Struct cw_storage_plus::Deque
source · pub struct Deque<T> { /* private fields */ }
Expand description
A deque stores multiple items at the given key. It provides efficient FIFO and LIFO access, as well as direct index access.
It has a maximum capacity of u32::MAX - 1
. Make sure to never exceed that number when using this type.
If you do, the methods won’t work as intended anymore.
Implementations§
source§impl<T> Deque<T>
impl<T> Deque<T>
source§impl<T: Serialize + DeserializeOwned> Deque<T>
impl<T: Serialize + DeserializeOwned> Deque<T>
sourcepub fn push_back(&self, storage: &mut dyn Storage, value: &T) -> StdResult<()>
pub fn push_back(&self, storage: &mut dyn Storage, value: &T) -> StdResult<()>
Adds the given value to the end of the deque
sourcepub fn push_front(&self, storage: &mut dyn Storage, value: &T) -> StdResult<()>
pub fn push_front(&self, storage: &mut dyn Storage, value: &T) -> StdResult<()>
Adds the given value to the front of the deque
sourcepub fn pop_back(&self, storage: &mut dyn Storage) -> StdResult<Option<T>>
pub fn pop_back(&self, storage: &mut dyn Storage) -> StdResult<Option<T>>
Removes the last element of the deque and returns it
sourcepub fn pop_front(&self, storage: &mut dyn Storage) -> StdResult<Option<T>>
pub fn pop_front(&self, storage: &mut dyn Storage) -> StdResult<Option<T>>
Removes the first element of the deque and returns it
sourcepub fn front(&self, storage: &dyn Storage) -> StdResult<Option<T>>
pub fn front(&self, storage: &dyn Storage) -> StdResult<Option<T>>
Returns the first element of the deque without removing it
sourcepub fn back(&self, storage: &dyn Storage) -> StdResult<Option<T>>
pub fn back(&self, storage: &dyn Storage) -> StdResult<Option<T>>
Returns the last element of the deque without removing it
Auto Trait Implementations§
impl<T> Freeze for Deque<T>
impl<T> RefUnwindSafe for Deque<T>where
T: RefUnwindSafe,
impl<T> Send for Deque<T>where
T: Send,
impl<T> Sync for Deque<T>where
T: Sync,
impl<T> Unpin for Deque<T>where
T: Unpin,
impl<T> UnwindSafe for Deque<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more