Struct cw_storage_plus::Deque
source · pub struct Deque<'a, 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
sourceimpl<'a, T: Serialize + DeserializeOwned> Deque<'a, T>
impl<'a, T: Serialize + DeserializeOwned> Deque<'a, 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 first element of the deque without removing it
Auto Trait Implementations
impl<'a, T> RefUnwindSafe for Deque<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for Deque<'a, T>where
T: Send,
impl<'a, T> Sync for Deque<'a, T>where
T: Sync,
impl<'a, T> Unpin for Deque<'a, T>where
T: Unpin,
impl<'a, T> UnwindSafe for Deque<'a, T>where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more