Struct droptest::DropRegistry[][src]

pub struct DropRegistry { /* fields omitted */ }
Expand description

A registry for tracking a guard’s liveness state (i.e. alive vs. dropped).

Implementations

Returns a registered wrapper for a provided value.

Examples
use droptest::prelude::*;

let registry = DropRegistry::default();
let guard = registry.new_guard_for(42);
let value = guard.value();

assert_eq!(value, &42);

Returns a registered wrapper for a () value.

Examples
use droptest::prelude::*;

let registry = DropRegistry::default();
let guard = registry.new_guard();
let value = guard.value();

assert_eq!(value, &());

Returns the statistics snapshot for the registry at the current time.

Examples
use droptest::prelude::*;

let registry = DropRegistry::default();
let guard = registry.new_guard();
let stats = registry.stats();

assert_eq!(stats, DropStatistics {
    created: 1,
    dropped: 0
});

Returns true if the guard associated with id has been dropped, otherwise `false.

Examples
use droptest::prelude::*;

let registry = DropRegistry::default();
let guard = registry.new_guard();
let guard_id = guard.id();

assert!(!registry.is_dropped(guard_id));

std::mem::drop(guard);

assert!(registry.is_dropped(guard_id));

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.