pub struct Arena<C: Component + 'static> { /* private fields */ }
Expand description

Unordered container with random access.

Implementations

Creates an arena instance.

Creates an arena instance with the specified initial capacity.

Creates an arena instance.

Creates an arena instance with the specified initial capacity.

Returns contained items packed in a special container. While arena itself is unique (i.e. non-clonable) object, this special container could be cloned.

Returns reference to contained items packed in a special container. While arena itself is unique (i.e. non-clonable) object, this special container could be cloned.

Returns mutable reference to contained items packed in a (mostly read-only) special container. While arena itself is unique (i.e. non-clonable) object, this special container could be cloned.

Place new component into the arena.

Examples
let mut arena = Arena::new();
let new_component_id = arena.insert(|id| (MyComponent { /* ... */ }, id));

Removes component with provided id.

The arena tries to detect invalid provided id (i.e. foreign, or previously dropped), and panics if such detection hits. But it is important to pay respect to the fact there is small probability that invalid id will not be intercepted.

Trait Implementations

Formats the value using the given formatter. Read more

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

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

Performs the mutable indexing (container[index]) operation. 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.