diff options
| author | Dario Nieuwenhuis <[email protected]> | 2021-05-19 22:31:09 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2021-05-19 23:20:26 +0200 |
| commit | dc67d2f4a49f4c9166fdefa4319a0e6dfab823e8 (patch) | |
| tree | a762c05590c708335c182d4a4f9d2a23c20c0018 /embassy-extras | |
| parent | 22e6a35598ec91b0ef56b2292f842c371ba85b1e (diff) | |
impl Unborrow for &'a mut T
This plays nicer with user code that's generic over peripheral traits like `Instance` or `Pin`.
Diffstat (limited to 'embassy-extras')
| -rw-r--r-- | embassy-extras/src/macros.rs | 16 |
1 files changed, 0 insertions, 16 deletions
diff --git a/embassy-extras/src/macros.rs b/embassy-extras/src/macros.rs index fba752619..351938c42 100644 --- a/embassy-extras/src/macros.rs +++ b/embassy-extras/src/macros.rs | |||
| @@ -24,14 +24,6 @@ macro_rules! peripherals { | |||
| 24 | } | 24 | } |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | $(#[$cfg])? | ||
| 28 | impl embassy::util::Unborrow for &mut $name { | ||
| 29 | type Target = $name; | ||
| 30 | #[inline] | ||
| 31 | unsafe fn unborrow(self) -> $name { | ||
| 32 | ::core::ptr::read(self) | ||
| 33 | } | ||
| 34 | } | ||
| 35 | )* | 27 | )* |
| 36 | } | 28 | } |
| 37 | 29 | ||
| @@ -95,14 +87,6 @@ macro_rules! impl_unborrow { | |||
| 95 | self | 87 | self |
| 96 | } | 88 | } |
| 97 | } | 89 | } |
| 98 | |||
| 99 | impl<'a> ::embassy::util::Unborrow for &'a mut $type { | ||
| 100 | type Target = $type; | ||
| 101 | #[inline] | ||
| 102 | unsafe fn unborrow(self) -> Self::Target { | ||
| 103 | unsafe { ::core::ptr::read(self) } | ||
| 104 | } | ||
| 105 | } | ||
| 106 | }; | 90 | }; |
| 107 | } | 91 | } |
| 108 | 92 | ||
