pub struct DequeStoreMut<'a, T, S, Ser = Bincode2> where
    T: Serialize + DeserializeOwned,
    S: Storage,
    Ser: Serde
{ /* private fields */ }
Expand description

A type allowing both reads from and writes to the deque store at a given storage location.

Implementations

Try to use the provided storage as an DequeStore. If it doesn’t seem to be one, then initialize it as one.

Returns Err if the contents of the storage can not be parsed.

Try to use the provided storage as an DequeStore.

Returns None if the provided storage doesn’t seem like an DequeStore. Returns Err if the contents of the storage can not be parsed.

Try to use the provided storage as an DequeStore. If it doesn’t seem to be one, then initialize it as one. This method allows choosing the serialization format you want to use.

Returns Err if the contents of the storage can not be parsed.

Try to use the provided storage as an DequeStore. This method allows choosing the serialization format you want to use.

Returns None if the provided storage doesn’t seem like an DequeStore. Returns Err if the contents of the storage can not be parsed.

Return an iterator over the items in the collection

Get the value stored at a given position.

Errors

Will return an error if pos is out of bounds or if an item is not found.

Set the value of the item stored at a given position.

Errors

Will return an error if the position is out of bounds

Append an item to the end of the collection.

This operation has a constant cost.

Add an item to the begining of the collection.

This operation has a constant cost.

Pop the last item off the collection

This operation has a constant cost.

Pop the first item off the collection

This operation has a constant cost.

Remove an element from the collection at the specified position.

Removing an element from the head (first) or tail (last) has a constant cost. The cost of removing from the middle will depend on the proximity to the head or tail. In that case, all the elements between the closest tip of the collection (head or tail) and the specified position will be shifted in storage.

Removing an element from the middle of the collection has the worst runtime and gas cost.

Clear the collection

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.