Better interrupt handling

This commit is contained in:
Thales Fragoso
2021-05-09 17:36:13 -03:00
parent 72fb3a7520
commit 490152d028
407 changed files with 15639 additions and 1318 deletions

View File

@ -27,3 +27,44 @@ pub trait Unborrow {
pub trait Steal {
unsafe fn steal() -> Self;
}
macro_rules! impl_unborrow_tuples {
($($t:ident),+) => {
impl<$($t),+> Unborrow for ($($t),+)
where
$(
$t: Unborrow<Target = $t>
),+
{
type Target = ($($t),+);
unsafe fn unborrow(self) -> Self::Target {
self
}
}
impl<'a, $($t),+> Unborrow for &'a mut($($t),+)
where
$(
$t: Unborrow<Target = $t>
),+
{
type Target = ($($t),+);
unsafe fn unborrow(self) -> Self::Target {
::core::ptr::read(self)
}
}
};
}
impl_unborrow_tuples!(A, B);
impl_unborrow_tuples!(A, B, C);
impl_unborrow_tuples!(A, B, C, D);
impl_unborrow_tuples!(A, B, C, D, E);
impl_unborrow_tuples!(A, B, C, D, E, F);
impl_unborrow_tuples!(A, B, C, D, E, F, G);
impl_unborrow_tuples!(A, B, C, D, E, F, G, H);
impl_unborrow_tuples!(A, B, C, D, E, F, G, H, I);
impl_unborrow_tuples!(A, B, C, D, E, F, G, H, I, J);
impl_unborrow_tuples!(A, B, C, D, E, F, G, H, I, J, K);
impl_unborrow_tuples!(A, B, C, D, E, F, G, H, I, J, K, L);