Struct droptest::DropGuard [−][src]
pub struct DropGuard<'a, T> { /* fields omitted */ }
Expand description
A guard object that reports to its registry when it gets dropped.
Implementations
Returns the id associated with the guard object.
Examples
use droptest::prelude::*;
let registry = DropRegistry::default();
let guard = registry.new_guard();
let id = guard.id();
assert_no_drop!(registry, id);
Returns the id associated with the guard object.
Examples
use droptest::prelude::*;
let registry = DropRegistry::default();
let guard = registry.new_guard_for(42);
let value = guard.value();
assert_eq!(value, &42);
Returns (self.id(), self)
.
Examples
use droptest::prelude::*;
let registry = DropRegistry::default();
let (id, guard) = registry.new_guard_for(42).by_id();
assert_no_drop!(registry, id);
Returns true
if the guard is registered with a given registry, otherwise false
.
Examples
use droptest::prelude::*;
let registry = DropRegistry::default();
let guard = registry.new_guard();
let id = guard.id();
assert!(guard.is_registered_to(®istry));
Trait Implementations
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl<'a, T> RefUnwindSafe for DropGuard<'a, T> where
T: RefUnwindSafe,
impl<'a, T> UnwindSafe for DropGuard<'a, T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more