pub struct InThread {
_not_send: PhantomData<*const ()>,
}
Expand description
Zero-size statement that the current code is not running in an interrupt
Fields§
§_not_send: PhantomData<*const ()>
Implementations§
Source§impl InThread
impl InThread
unsafe fn new_unchecked() -> Self
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 Freeze for InThread
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)Source§impl<T> IntoSwitch for T
impl<T> IntoSwitch for T
Source§fn into_switch<ActiveLevel>(self) -> Switch<T, ActiveLevel>
fn into_switch<ActiveLevel>(self) -> Switch<T, ActiveLevel>
Source§fn into_active_high_switch(self) -> Switch<Self, ActiveHigh>where
Self: Sized,
fn into_active_high_switch(self) -> Switch<Self, ActiveHigh>where
Self: Sized,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 0 bytes