pub struct TrackedObject<T> { /* private fields */ }
Expand description

Your tracked object.

A tracked object contains reference counting logic and an Arc to your object. It is cloneable but calling clone will not clone your internal object.

Your object cannot be mutated. You can borrow it using the Deref interface.

Implementations

Creates a new object from an existing one.

The new object will be registered in your original object’s inventory.

use census::{Inventory, TrackedObject};

let inventory = Inventory::new();

let seven = inventory.track(7);
let fourteen = seven.map(|i| i * 2);
assert_eq!(*fourteen, 14);

let living_instances = inventory.list();
assert_eq!(living_instances.len(), 2);

Trait Implementations

Converts this type into a shared reference of the (usually inferred) input type.
Immutably borrows from an owned value. Read more
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
The resulting type after dereferencing.
Dereferences the value.

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
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.