diff options
| author | huntc <[email protected]> | 2021-12-01 09:14:24 +1100 |
|---|---|---|
| committer | huntc <[email protected]> | 2021-12-01 09:14:24 +1100 |
| commit | 469852c667cd7105d5eba7b197e1e2b5b9528d15 (patch) | |
| tree | c3a7b3e1d294ae129b38d11127dd88229fa0ed6e /embassy-nrf/src/uarte.rs | |
| parent | e36e36dab6b19ae90c6f78b1cdd2233e295bd171 (diff) | |
Removed unsafe from uarte
The constructors themselves are not strictly unsafe. Interactions with DMA can be generally unsafe if a future is dropped, but that's a separate issue. It is important that we use the `unsafe` keyword diligently as it can lead to confusion otherwise.
Diffstat (limited to 'embassy-nrf/src/uarte.rs')
| -rw-r--r-- | embassy-nrf/src/uarte.rs | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/embassy-nrf/src/uarte.rs b/embassy-nrf/src/uarte.rs index 459bc8436..543f7fb73 100644 --- a/embassy-nrf/src/uarte.rs +++ b/embassy-nrf/src/uarte.rs | |||
| @@ -48,14 +48,7 @@ pub struct Uarte<'d, T: Instance> { | |||
| 48 | impl<'d, T: Instance> Uarte<'d, T> { | 48 | impl<'d, T: Instance> Uarte<'d, T> { |
| 49 | /// Creates the interface to a UARTE instance. | 49 | /// Creates the interface to a UARTE instance. |
| 50 | /// Sets the baud rate, parity and assigns the pins to the UARTE peripheral. | 50 | /// Sets the baud rate, parity and assigns the pins to the UARTE peripheral. |
| 51 | /// | 51 | pub fn new( |
| 52 | /// # Safety | ||
| 53 | /// | ||
| 54 | /// The returned API is safe unless you use `mem::forget` (or similar safe mechanisms) | ||
| 55 | /// on stack allocated buffers which which have been passed to [`send()`](Uarte::send) | ||
| 56 | /// or [`receive`](Uarte::receive). | ||
| 57 | #[allow(unused_unsafe)] | ||
| 58 | pub unsafe fn new( | ||
| 59 | _uarte: impl Unborrow<Target = T> + 'd, | 52 | _uarte: impl Unborrow<Target = T> + 'd, |
| 60 | irq: impl Unborrow<Target = T::Interrupt> + 'd, | 53 | irq: impl Unborrow<Target = T::Interrupt> + 'd, |
| 61 | rxd: impl Unborrow<Target = impl GpioPin> + 'd, | 54 | rxd: impl Unborrow<Target = impl GpioPin> + 'd, |
