pub struct LimitedVec<T, E, const N: usize>(/* private fields */);
Expand description
Limited len vector.
T
is data type.
E
is overflow error type.
N
is max len which a vector can have.
Implementations§
Source§impl<T: Clone + Default, E: Default, const N: usize> LimitedVec<T, E, N>
impl<T: Clone + Default, E: Default, const N: usize> LimitedVec<T, E, N>
Sourcepub fn try_new_default(len: usize) -> Result<Self, E>
pub fn try_new_default(len: usize) -> Result<Self, E>
Tries to create new limited vector of length len
with default initialized elements.
Sourcepub fn new_default() -> Self
pub fn new_default() -> Self
Creates new limited vector with default initialized elements.
Sourcepub fn filled_with(value: T) -> Self
pub fn filled_with(value: T) -> Self
Creates limited vector filled with the specified value
.
Sourcepub fn extend_with(&mut self, value: T)
pub fn extend_with(&mut self, value: T)
Extends the array to its limit and fills with the specified value
.
Sourcepub fn try_extend_from_slice(&mut self, values: &[T]) -> Result<(), E>
pub fn try_extend_from_slice(&mut self, values: &[T]) -> Result<(), E>
Append values
to the end of vector.
Sourcepub fn try_prepend(&mut self, values: Self) -> Result<(), E>
pub fn try_prepend(&mut self, values: Self) -> Result<(), E>
Append values
to the begin of vector.
Source§impl LimitedVec<u8, PayloadSizeError, MAX_PAYLOAD_SIZE>
impl LimitedVec<u8, PayloadSizeError, MAX_PAYLOAD_SIZE>
Trait Implementations§
Source§impl<T: Clone, E: Clone, const N: usize> Clone for LimitedVec<T, E, N>
impl<T: Clone, E: Clone, const N: usize> Clone for LimitedVec<T, E, N>
Source§fn clone(&self) -> LimitedVec<T, E, N>
fn clone(&self) -> LimitedVec<T, E, N>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<T, E, const N: usize> Decode for LimitedVec<T, E, N>
impl<T, E, const N: usize> Decode for LimitedVec<T, E, N>
Source§fn decode<__CodecInputEdqy: Input>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<Self, Error>
fn decode<__CodecInputEdqy: Input>( __codec_input_edqy: &mut __CodecInputEdqy, ) -> Result<Self, Error>
Attempt to deserialise the value from input.
Source§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
Source§impl<T: Default, E: Default, const N: usize> Default for LimitedVec<T, E, N>
impl<T: Default, E: Default, const N: usize> Default for LimitedVec<T, E, N>
Source§fn default() -> LimitedVec<T, E, N>
fn default() -> LimitedVec<T, E, N>
Returns the “default value” for a type. Read more
Source§impl<T: Clone + Default, E: Default, const N: usize> Display for LimitedVec<T, E, N>
impl<T: Clone + Default, E: Default, const N: usize> Display for LimitedVec<T, E, N>
Formatter for LimitedVec
will print to precision of 8 by default, to print the whole data, use {:+}
.
Source§impl<T, E, const N: usize> Encode for LimitedVec<T, E, N>
impl<T, E, const N: usize> Encode for LimitedVec<T, E, N>
Source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
If possible give a hint of expected size of the encoding. Read more
Source§fn encode_to<__CodecOutputEdqy: Output + ?Sized>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy,
)
fn encode_to<__CodecOutputEdqy: Output + ?Sized>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy, )
Convert self to a slice and append it to the destination.
Source§fn using_encoded<R, F>(&self, f: F) -> R
fn using_encoded<R, F>(&self, f: F) -> R
Convert self to a slice and then invoke the given closure with it.
Source§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
Source§impl<T: Ord, E: Ord, const N: usize> Ord for LimitedVec<T, E, N>
impl<T: Ord, E: Ord, const N: usize> Ord for LimitedVec<T, E, N>
Source§fn cmp(&self, other: &LimitedVec<T, E, N>) -> Ordering
fn cmp(&self, other: &LimitedVec<T, E, N>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T: PartialOrd, E: PartialOrd, const N: usize> PartialOrd for LimitedVec<T, E, N>
impl<T: PartialOrd, E: PartialOrd, const N: usize> PartialOrd for LimitedVec<T, E, N>
Source§impl<T, E, const N: usize> TypeInfo for LimitedVec<T, E, N>
impl<T, E, const N: usize> TypeInfo for LimitedVec<T, E, N>
impl<T, E, const N: usize> EncodeLike for LimitedVec<T, E, N>
impl<T: Eq, E: Eq, const N: usize> Eq for LimitedVec<T, E, N>
impl<T, E, const N: usize> StructuralPartialEq for LimitedVec<T, E, N>
Auto Trait Implementations§
impl<T, E, const N: usize> Freeze for LimitedVec<T, E, N>
impl<T, E, const N: usize> RefUnwindSafe for LimitedVec<T, E, N>where
E: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, E, const N: usize> Send for LimitedVec<T, E, N>
impl<T, E, const N: usize> Sync for LimitedVec<T, E, N>
impl<T, E, const N: usize> Unpin for LimitedVec<T, E, N>
impl<T, E, const N: usize> UnwindSafe for LimitedVec<T, E, N>where
E: UnwindSafe,
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