[][src]Struct elrond_wasm::Queue

pub struct Queue<T> { /* fields omitted */ }

A simple queue struct that is able to push and pop without moving elements. New items are pushed at the end, just like for a regular Vec. When popping, instead of performing a regular Vec remove that would shift items, a start index is moved up 1 position. When serializing, items before the start index are ignored.

Implementations

impl<T> Queue<T>[src]

pub fn new() -> Self[src]

impl<T> Queue<T>[src]

pub fn len(&self) -> usize[src]

pub fn is_empty(&self) -> bool[src]

pub fn as_slice(&self) -> &[T][src]

pub fn push(&mut self, value: T)[src]

pub fn peek(&self) -> Option<&T>[src]

Returns a referenece to the first item in the queue, without removing it. Returns None if the queue is empty.

pub fn peek_mut(&mut self) -> Option<&mut T>[src]

Returns a mutable referenece to the first item in the queue, without removing it. Returns None if the queue is empty.

pub fn pop(&mut self) -> Option<&T>[src]

Removes the first element from the queue and returns a reference to it. Does not physically extract the element from the underlying structure. Does nothing and returns None if the queue is empty.

Trait Implementations

impl<T: Decode> Decode for Queue<T>[src]

Deserializes like a Vec.

impl<T> Default for Queue<T>[src]

impl<T: Encode> Encode for Queue<T>[src]

Serializes identically to a Vec, entries before start index are ignored.

Auto Trait Implementations

impl<T> Send for Queue<T> where
    T: Send

impl<T> Sync for Queue<T> where
    T: Sync

impl<T> Unpin for Queue<T> where
    T: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T, D> ArgType<D> for T where
    D: DynArgLoader<T>,
    T: Decode
[src]

impl<T> AsyncCallArg for T where
    T: Encode
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<'a, A, BigInt, BigUint, T> EndpointResult<'a, A, BigInt, BigUint> for T where
    A: ContractHookApi<BigInt, BigUint> + ContractIOApi<BigInt, BigUint> + 'a,
    BigInt: BigIntApi<BigUint> + 'static,
    BigUint: BigUintApi + 'static,
    T: Encode
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.