Struct riot_wrappers::thread::InThread
source · pub struct InThread { /* private fields */ }
Expand description
Zero-size statement that the current code is not running in an interrupt
Implementations§
source§impl InThread
impl InThread
sourcepub fn new() -> Result<Self, InIsr>
pub fn new() -> Result<Self, InIsr>
Check that the code is running in thread mode
Note that this is actually running code; to avoid that, call TokenParts::in_thread()
,
which is a purely type-level procedure.
sourcepub fn promote<T>(self, value: T) -> ValueInThread<T>
pub fn promote<T>(self, value: T) -> ValueInThread<T>
Wrap a value
in a ValueInThread
. This makes it non-Send, but may make additional
(safe) methods on it, using the knowledge that it is still being used inside a thread.
source§impl InThread
impl InThread
sourcepub fn irq_is_enabled(self) -> bool
pub fn irq_is_enabled(self) -> bool
Trivial safe wrapper for
irq_is_enabled
Returns true if interrupts are currently enabled
Using this on an InThread
token is preferred over the global function, as the function
only returns reliable values when called from a thread context.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for InThread
impl !Send for InThread
impl !Sync for InThread
impl Unpin for InThread
impl UnwindSafe for InThread
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more