Struct embedded_threadsafe::safecells::interrupt::InterruptCell   
source · pub struct InterruptCell<T> { /* private fields */ }Expand description
A fast, thread-local cell that can be safely shared accross interrupt contexts
Warning
This cell must not be accessed from another thread; doing so will raise a panic.
Implementations§
source§impl<T> InterruptCell<T>
 
impl<T> InterruptCell<T>
sourcepub const fn new_with_threadid(value: T, thread_id: usize) -> Self
 
pub const fn new_with_threadid(value: T, thread_id: usize) -> Self
Creates a new thread-local cell
sourcepub fn scope<F, FR>(&self, scope: F) -> FRwhere
    F: FnOnce(&mut T) -> FR,
 
pub fn scope<F, FR>(&self, scope: F) -> FRwhere F: FnOnce(&mut T) -> FR,
Provides scoped access to the underlying value
Panic
This function will panic if called from another thread or interrupt context
sourcepub unsafe fn raw<F, FR>(&self, scope: F) -> FRwhere
    F: FnOnce(&mut T) -> FR,
 
pub unsafe fn raw<F, FR>(&self, scope: F) -> FRwhere F: FnOnce(&mut T) -> FR,
Provides an unsafe raw scoped access to the underlying value
Safety
This function provides unchecked, mutable access to the underlying value, so incorrect use of this function may lead to race conditions or undefined behavior.
source§impl<T> InterruptCell<LazyCell<T>>
 
impl<T> InterruptCell<LazyCell<T>>
sourcepub fn lazy_scope<F, FR>(&self, scope: F) -> FRwhere
    F: FnOnce(&mut T) -> FR,
 
pub fn lazy_scope<F, FR>(&self, scope: F) -> FRwhere F: FnOnce(&mut T) -> FR,
Provides scoped access to the underlying lazy cell
Panic
This function will panic if called from another thread or interrupt context
Trait Implementations§
source§impl<T> Debug for InterruptCell<T>where
    T: Debug,
 
impl<T> Debug for InterruptCell<T>where T: Debug,
impl<T> Sync for InterruptCell<T>where T: Send,
Auto Trait Implementations§
impl<T> !RefUnwindSafe for InterruptCell<T>
impl<T> Send for InterruptCell<T>where T: Send,
impl<T> Unpin for InterruptCell<T>where T: Unpin,
impl<T> UnwindSafe for InterruptCell<T>where T: UnwindSafe,
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