pub struct Teardown<Cx: ?Sized> { /* private fields */ }Expand description
2026-09-25: Releases a set of resources in reverse registration order, the inverse of how they were built, which is the only safe order when later resources borrow earlier ones.
One failure does not abandon the rest: every resource’s release is attempted, and one error naming every failure is returned afterwards.
Implementations§
Source§impl<Cx: ?Sized> Teardown<Cx>
impl<Cx: ?Sized> Teardown<Cx>
pub fn new() -> Self
Sourcepub fn push(&mut self, resource: Box<dyn ModelResource<Cx>>)
pub fn push(&mut self, resource: Box<dyn ModelResource<Cx>>)
2026-09-25: Register a resource. Callers register in construction order.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn release_all(&mut self, cx: &Cx) -> Result<()>
pub fn release_all(&mut self, cx: &Cx) -> Result<()>
2026-09-25: Release everything, newest first. After attempting them all, returns one error that lists every failure with its resource’s label.
Trait Implementations§
Auto Trait Implementations§
impl<Cx> Freeze for Teardown<Cx>where
Cx: ?Sized,
impl<Cx> !RefUnwindSafe for Teardown<Cx>
impl<Cx> Send for Teardown<Cx>where
Cx: ?Sized,
impl<Cx> Sync for Teardown<Cx>where
Cx: ?Sized,
impl<Cx> Unpin for Teardown<Cx>where
Cx: ?Sized,
impl<Cx> !UnwindSafe for Teardown<Cx>
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