Struct froggy::Storage [] [src]

pub struct Storage<T> { /* fields omitted */ }

Component storage type. Manages the components and allows for efficient processing. See also: Pointer

Examples

let mut storage = Storage::new();
// add component to storage
let pointer = storage.create(1u32);
// change component by pointer
storage[&pointer] = 30;

Methods

impl<T> Storage<T>
[src]

[src]

Create a new empty storage.

[src]

Create a new empty storage with specified capacity.

[src]

Synchronize for all the pending updates. It will update all reference counters in Storage, so iter_alive and iter_alive_mut will return actual information.

Use this function only if necessary, because it needs to block Storage.

[src]

Iterate all components in this storage that are still referenced from outside.

Attention

Information about live components is updated not for all changes, but only when you explicitly call sync_pending. It means, you can get wrong results when calling this function before updating pending.

[src]

Iterate all components that are stored, even if not referenced. This can be faster than the regular iter for the lack of refcount checks.

[src]

Iterate all components in this storage that are still referenced from outside, mutably.

Attention

Information about live components is updated not for all changes, but only when you explicitly call sync_pending. It means, you can get wrong results when calling this function before updating pending.

[src]

Iterate all components that are stored, even if not referenced, mutably. This can be faster than the regular iter_mut for the lack of refcount checks.

[src]

Pin an iterated item with a newly created Pointer.

[src]

Split the storage according to the provided pointer, returning the (left slice, pointed data, right slice) triple, where: left slice contains all the elements that would be iterated prior to the given one, right slice contains all the elements that would be iterated after the given one

[src]

Produce a streaming mutable iterator over components that are still referenced.

Attention

Information about live components is updated not for all changes, but only when you explicitly call sync_pending. It means, you can get wrong results when calling this function before updating pending.

[src]

Returns a cursor to the end of the storage, for backwards streaming iteration.

[src]

Add a new component to the storage, returning the Pointer to it.

Trait Implementations

impl<T: Debug> Debug for Storage<T>
[src]

[src]

Formats the value using the given formatter.

impl<'a, T> Index<&'a Pointer<T>> for Storage<T>
[src]

The returned type after indexing.

[src]

Performs the indexing (container[index]) operation.

impl<'a, T> IndexMut<&'a Pointer<T>> for Storage<T>
[src]

[src]

Performs the mutable indexing (container[index]) operation.

impl<T> FromIterator<T> for Storage<T>
[src]

[src]

Creates a value from an iterator. Read more

impl<'a, T> IntoIterator for &'a Storage<T>
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

[src]

Creates an iterator from a value. Read more

impl<'a, T> IntoIterator for &'a mut Storage<T>
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

[src]

Creates an iterator from a value. Read more

impl<T> Default for Storage<T>
[src]

[src]

Returns the "default value" for a type. Read more