From 628e58020f5515a7a31267e3ed3e915b507a962f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Kr=C3=B6ger?= Date: Fri, 4 Jun 2021 23:42:25 +0200 Subject: [PATCH] Add `Unborrow` trait bound for `Interrupt` Allows the compiler to figure out bounds for wrapper code of owned peripherals and interrupts. Example: https://gist.github.com/timokroeger/f025ef590557f1cd6c2e9c7ab30442d2 --- embassy/src/interrupt.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/embassy/src/interrupt.rs b/embassy/src/interrupt.rs index 99d7af75..df3a79cc 100644 --- a/embassy/src/interrupt.rs +++ b/embassy/src/interrupt.rs @@ -30,7 +30,7 @@ unsafe impl cortex_m::interrupt::InterruptNumber for NrWrap { } } -pub unsafe trait Interrupt { +pub unsafe trait Interrupt: crate::util::Unborrow { type Priority: From + Into + Copy; fn number(&self) -> u16; unsafe fn steal() -> Self;