pub struct PhaseGuard { /* private fields */ }Expand description
RAII guard for an arena phase. Calls begin_phase() on construction and
end_phase() on drop — including during panic unwinding. Use this in
place of paired begin_phase()/end_phase() calls when the phase body
can panic, to avoid leaving the arena active across the unwind.
ⓘ
loop {
let _guard = zk_alloc::PhaseGuard::new();
heavy_work_that_might_panic();
// _guard drops here on normal return AND on unwind
}Implementations§
Source§impl PhaseGuard
impl PhaseGuard
Trait Implementations§
Source§impl Default for PhaseGuard
impl Default for PhaseGuard
Source§impl Drop for PhaseGuard
impl Drop for PhaseGuard
Auto Trait Implementations§
impl Freeze for PhaseGuard
impl RefUnwindSafe for PhaseGuard
impl Send for PhaseGuard
impl Sync for PhaseGuard
impl Unpin for PhaseGuard
impl UnsafeUnpin for PhaseGuard
impl UnwindSafe for PhaseGuard
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more