mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-22 14:53:03 +00:00
Reuse unsafe_impl_unborrow in other macros.
This commit is contained in:
parent
bff0ad9286
commit
715fa51468
@ -21,16 +21,7 @@ macro_rules! peripherals {
|
||||
}
|
||||
|
||||
$(#[$cfg])?
|
||||
unsafe impl $crate::Unborrow for $name {
|
||||
type Target = $name;
|
||||
#[inline]
|
||||
fn unborrow<'a>(self) -> $crate::Unborrowed<'a, Self::Target>
|
||||
where
|
||||
Self: 'a,
|
||||
{
|
||||
$crate::Unborrowed::new(self)
|
||||
}
|
||||
}
|
||||
$crate::unsafe_impl_unborrow!($name);
|
||||
)*
|
||||
}
|
||||
|
||||
|
@ -25,15 +25,7 @@ pub fn run(name: syn::Ident) -> Result<TokenStream, TokenStream> {
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl ::embassy_hal_common::Unborrow for #name_interrupt {
|
||||
type Target = #name_interrupt;
|
||||
fn unborrow<'a>(self) -> ::embassy_hal_common::Unborrowed<'a, #name_interrupt>
|
||||
where
|
||||
Self: 'a
|
||||
{
|
||||
::embassy_hal_common::Unborrowed::new(self)
|
||||
}
|
||||
}
|
||||
::embassy_hal_common::unsafe_impl_unborrow!(#name_interrupt);
|
||||
};
|
||||
Ok(result)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user