Struct near_sdk::collections::Vector [−][src]
pub struct Vector<T> { /* fields omitted */ }
Expand description
An iterable implementation of vector that stores its content on the trie. Uses the following map: index -> element.
Implementations
Returns the number of elements in the vector, also referred to as its size.
Create new vector with zero elements. Use id
as a unique identifier on the trie.
Returns the serialized element by index or None
if it is not present.
Removes an element from the vector and returns it in serialized form.
The removed element is replaced by the last element of the vector.
Does not preserve ordering, but is O(1)
.
Panics
Panics if index
is out of bounds.
Appends a serialized element to the back of the collection.
Removes the last element from a vector and returns it without deserializing, or None
if it is empty.
Inserts a serialized element at index
, returns a serialized evicted element.
Panics
If index
is out of bounds.
Iterate over raw serialized elements.
Extends vector from the given collection of serialized elements.
Returns the element by index or None
if it is not present.
Removes an element from the vector and returns it.
The removed element is replaced by the last element of the vector.
Does not preserve ordering, but is O(1)
.
Panics
Panics if index
is out of bounds.
Removes the last element from a vector and returns it, or None
if it is empty.
Trait Implementations
Deserializes this instance from a given slice of bytes. Updates the buffer to point at the remaining bytes. Read more
Deserialize this instance from a slice of bytes.
Whether Self is u8.
NOTE: Vec<u8>
is the most common use-case for serialization and deserialization, it’s
worth handling it as a special case to improve performance.
It’s a workaround for specific Vec<u8>
implementation versus generic Vec<T>
implementation. See https://github.com/rust-lang/rfcs/pull/1210 for details. Read more
Serialize this instance into a vector of bytes.
Whether Self is u8.
NOTE: Vec<u8>
is the most common use-case for serialization and deserialization, it’s
worth handling it as a special case to improve performance.
It’s a workaround for specific Vec<u8>
implementation versus generic Vec<T>
implementation. See https://github.com/rust-lang/rfcs/pull/1210 for details. Read more