pub struct IdentityManager { /* private fields */ }
Expand description

A simple structure to allocate Id identifiers.

Calling alloc returns a fresh, never-before-seen id. Calling free marks an id as dead; it will never be returned again by alloc.

Use IdentityManager::default to construct new instances.

IdentityManager returns Ids whose index values are suitable for use as indices into a Storage<T> that holds those ids’ referents:

  • Every live id has a distinct index value. Each live id’s index selects a distinct element in the vector.

  • IdentityManager prefers low index numbers. If you size your vector to accommodate the indices produced here, the vector’s length will reflect the highwater mark of actual occupancy.

  • IdentityManager reuses the index values of freed ids before returning ids with new index values. Freed vector entries get reused.

Implementations

Allocate a fresh, never-before-seen id with the given backend.

The backend is incorporated into the id, so that ids allocated with different backend values are always distinct.

Free id. It will never be returned from alloc again.

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

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 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.