pub struct SharedOnceCell<T: Copy + 'static> { /* private fields */ }Implementations§
pub fn create(path: impl AsRef<Path>) -> Result<Self, SharedOnceError>
pub fn open(path: impl AsRef<Path>) -> Result<Self, SharedOnceError>
Sourcepub fn is_initialized(&self) -> bool
pub fn is_initialized(&self) -> bool
True when the cell has been initialised.
Sourcepub fn get(&self) -> Option<T>
pub fn get(&self) -> Option<T>
Get the value if initialised; otherwise return None. Non-blocking; never invokes the initialiser.
Sourcepub fn set(&self, value: T) -> bool
pub fn set(&self, value: T) -> bool
Try to write the value. Returns true if this caller won
the init race, false if the cell was already initialised
or another init is in progress.
Sourcepub fn get_or_init<F: FnOnce() -> T>(&self, init: F) -> T
pub fn get_or_init<F: FnOnce() -> T>(&self, init: F) -> T
Get the cached value, or run init to produce it. The first
caller across all processes runs init; subsequent callers
spin until the value is published and return that value.
Sourcepub fn flush_async(&self) -> Result<(), SharedOnceError>
pub fn flush_async(&self) -> Result<(), SharedOnceError>
Non-blocking flush: schedules a writeback via the OS. Note: Windows is only partially async (sync to page cache, not to disk).
pub fn flush(&self) -> Result<(), SharedOnceError>
Trait Implementations§
fn header(&self) -> &HandshakeHeader
fn ring(&self) -> &ObservationRing
fn make_policy(&self) -> Box<dyn Policy>
Source§fn apply_migration(&self, new_tag: u32)
fn apply_migration(&self, new_tag: u32)
Called by the sidecar when the policy returns a new strategy
tag. Default implementation: just set the tag on the header.
Primitives that need heavier migration (data-layout swap)
override this to perform the swap before (or after) updating
the tag.
Auto Trait Implementations§
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