Struct toolbelt::once::DoOnceSync
source · [−]pub struct DoOnceSync(_);
Expand description
A simple primitive for ensuring something is done exactly once. DoOnceSync is thread-safe
and uses internal mutability, so you can do_once
with an immutable reference.
e.g.
let once_task = DoOnceSync::new();
loop {
once_task.do_once(|| {
// this closure only runs once
});
//...
}
Implementations
Trait Implementations
impl Send for DoOnceSync
impl Sync for DoOnceSync
Auto Trait Implementations
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