Struct rustpython_common::atomic::OncePtr
source · pub struct OncePtr<T> { /* private fields */ }
Implementations§
source§impl<T> OncePtr<T>
impl<T> OncePtr<T>
pub fn new() -> Self
pub fn get(&self) -> Option<NonNull<T>>
pub fn set(&self, value: NonNull<T>) -> Result<(), NonNull<T>>
pub fn get_or_init<F>(&self, f: F) -> NonNull<T>where F: FnOnce() -> Box<T>,
pub fn get_or_try_init<F, E>(&self, f: F) -> Result<NonNull<T>, E>where F: FnOnce() -> Result<Box<T>, E>,
Trait Implementations§
Auto Trait Implementations§
impl<T> !RefUnwindSafe for OncePtr<T>
impl<T> !Send for OncePtr<T>
impl<T> !Sync for OncePtr<T>
impl<T> Unpin for OncePtr<T>
impl<T> UnwindSafe for OncePtr<T>where T: RefUnwindSafe,
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