pub struct DoOnce(_);
Expand description
A simple primitive for ensuring something is done exactly once. Not thread-safe.
e.g.
let mut once_task = DoOnce::new();
loop {
once_task.do_once(|| {
// this closure only runs once
});
//...
}
Implementations
Auto Trait Implementations
impl RefUnwindSafe for DoOnce
impl Send for DoOnce
impl Sync for DoOnce
impl Unpin for DoOnce
impl UnwindSafe for DoOnce
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more