[−][src]Struct elrond_wasm::Queue
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]
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.
fn top_decode<I: Input>(input: &mut I) -> Result<Self, DecodeError>
[src]
fn dep_decode<I: Input>(input: &mut I) -> Result<Self, DecodeError>
[src]
fn top_decode_from_i64<I>(_input: I) -> Option<Result<Self, DecodeError>> where
I: FnOnce() -> i64,
[src]
I: FnOnce() -> i64,
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.
fn dep_encode_to<O: Output>(&self, dest: &mut O) -> Result<(), EncodeError>
[src]
fn using_top_encoded<F: FnOnce(&[u8])>(&self, f: F) -> Result<(), EncodeError>
[src]
fn top_encode(&self) -> Result<Vec<u8>, EncodeError>
[src]
fn top_encode_as_i64(&self) -> Option<Result<i64, EncodeError>>
[src]
Auto Trait Implementations
impl<T> Send for Queue<T> where
T: Send,
T: Send,
impl<T> Sync for Queue<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Queue<T> where
T: Unpin,
T: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T, D> ArgType<D> for T where
D: DynArgLoader<T>,
T: Decode,
[src]
D: DynArgLoader<T>,
T: Decode,
impl<T> AsyncCallArg for T where
T: Encode,
[src]
T: Encode,
fn push_async_arg(&Self, &mut CallDataSerializer) -> Result<(), SCError>
[src]
fn push_async_arg_exact(
&self,
_serializer: &mut CallDataSerializer,
_expected_len: usize
) -> Result<(), SCError>
[src]
&self,
_serializer: &mut CallDataSerializer,
_expected_len: usize
) -> Result<(), SCError>
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[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]
A: ContractHookApi<BigInt, BigUint> + ContractIOApi<BigInt, BigUint> + 'a,
BigInt: BigIntApi<BigUint> + 'static,
BigUint: BigUintApi + 'static,
T: Encode,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,