pub struct LocalStatic<T> { /* private fields */ }Expand description
A struct for storing local variables in static storage.
LocalStatic provides a way to store local variables in static storage,
allowing them to be initialized and accessed at runtime.
This type is useful when you need to store mutable state in a static context,
such as in embedded systems.
Implementations§
Source§impl<T> LocalStatic<T>
impl<T> LocalStatic<T>
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Creates a new LocalStatic instance, with the memory being filled with 0 bytes.
§Returns
A new LocalStatic instance containing an uninitialized value of type T.
Sourcepub fn get(&'static self) -> &'static T
pub fn get(&'static self) -> &'static T
Gets an immutable reference to the value stored in LocalStatic.
§Returns
An immutable reference to the value stored in LocalStatic.
Sourcepub fn get_mut(&'static self) -> &'static mut T
pub fn get_mut(&'static self) -> &'static mut T
Gets a mutable reference to the value stored in LocalStatic.
§Returns
A mutable reference to the value stored in LocalStatic.
Trait Implementations§
impl<T> Send for LocalStatic<T>
impl<T> Sync for LocalStatic<T>
Auto Trait Implementations§
impl<T> !Freeze for LocalStatic<T>
impl<T> !RefUnwindSafe for LocalStatic<T>
impl<T> Unpin for LocalStatic<T>where
T: Unpin,
impl<T> UnwindSafe for LocalStatic<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