pub trait OnceExt {
type T;
// Required methods
fn try_borrow_with<F, E>(&self, f: F) -> Result<&Self::T, E>
where F: FnOnce() -> Result<Self::T, E>;
fn replace(&mut self, new_value: Self::T) -> Option<Self::T>;
fn filled(&self) -> bool;
}
Required Associated Types§
Required Methods§
Sourcefn try_borrow_with<F, E>(&self, f: F) -> Result<&Self::T, E>
fn try_borrow_with<F, E>(&self, f: F) -> Result<&Self::T, E>
This might run f
multiple times if different threads start initializing at once.
fn replace(&mut self, new_value: Self::T) -> Option<Self::T>
fn filled(&self) -> bool
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.