pub struct OneTime<T> { /* private fields */ }
Expand description
Encapsulation of a RwLock<Option
Implementations§
Source§impl<T> OneTime<T>where
T: Clone,
impl<T> OneTime<T>where
T: Clone,
Sourcepub fn init(&self, value: T)
pub fn init(&self, value: T)
Initializes the OneTime, should only be called once after construction. Will panic (via assert) if called more than once.
Sourcepub fn set(&self, value: T, is_override: bool)
pub fn set(&self, value: T, is_override: bool)
Allows the one time to be set again with an override.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for OneTime<T>
impl<T> !RefUnwindSafe for OneTime<T>
impl<T> Send for OneTime<T>
impl<T> Sync for OneTime<T>
impl<T> Unpin for OneTime<T>
impl<T> !UnwindSafe for OneTime<T>
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