pub struct Vec<T: BoundedStorable, M: Memory> { /* private fields */ }
Expand description

An implementation of growable arrays in stable memory.

Implementations§

Creates a new empty vector in the specified memory, overwriting any data structures the memory might have contained previously.

Complexity: O(1)

Initializes a vector in the specified memory.

Complexity: O(1)

PRECONDITION: the memory is either empty or contains a valid stable vector.

Returns the underlying memory instance.

Returns true if the vector is empty.

Complexity: O(1)

Returns the number of items in the vector.

Complexity: O(1)

Sets the item at the specified index to the specified value.

Complexity: O(T::MAX_SIZE)

PRECONDITION: index < self.len()

Returns the item at the specified index.

Complexity: O(T::MAX_SIZE)

Adds a new item at the end of the vector.

Complexity: O(T::MAX_SIZE)

Removes the item at the end of the vector.

Complexity: O(T::MAX_SIZE)

Trait Implementations§

Formats the value using the given formatter. 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.