pub struct Scope { /* private fields */ }Expand description
Hierarchical resource scope: parent close cascades to children; supports finalizers and awaitable close.
Implementations§
Source§impl Scope
impl Scope
Sourcepub fn fork(&self) -> Self
pub fn fork(&self) -> Self
Child scope linked under self; inherits close if the parent is already closed.
Sourcepub fn extend(&self, other: &Scope) -> bool
pub fn extend(&self, other: &Scope) -> bool
Reparents other under self if both are open; returns false if either is closed.
Sourcepub fn close(&self) -> bool
pub fn close(&self) -> bool
Closes with Exit::succeed; returns true on the first successful close.
Sourcepub fn close_with_exit(&self, exit: Exit<(), Never>) -> bool
pub fn close_with_exit(&self, exit: Exit<(), Never>) -> bool
Closes this scope and descendants, runs finalizers (LIFO) with exit, then opens the close latch.
Sourcepub fn add_finalizer(&self, finalizer: Finalizer) -> bool
pub fn add_finalizer(&self, finalizer: Finalizer) -> bool
Registers finalizer to run on close; returns false if already closed.
Sourcepub fn wait_closed(&self) -> Effect<(), Never, ()>
pub fn wait_closed(&self) -> Effect<(), Never, ()>
Wait until this scope has completed a successful close (including this scope’s finalizers).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Scope
impl RefUnwindSafe for Scope
impl Send for Scope
impl Sync for Scope
impl Unpin for Scope
impl UnsafeUnpin for Scope
impl UnwindSafe for Scope
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