Struct embedded_threadsafe::safecells::local::LocalCell   
source · pub struct LocalCell<T> { /* private fields */ }Expand description
A fast, thread-local cell
Warning
This cell must not be accessed from another thread or an interrupt context; doing so will raise a panic.
Implementations§
source§impl<T> LocalCell<T>
 
impl<T> LocalCell<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.
Trait Implementations§
impl<T> Sync for LocalCell<T>where T: Send,
Auto Trait Implementations§
impl<T> !RefUnwindSafe for LocalCell<T>
impl<T> Send for LocalCell<T>where T: Send,
impl<T> Unpin for LocalCell<T>where T: Unpin,
impl<T> UnwindSafe for LocalCell<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