jam_types::vec_map

Struct VecMap

Source
pub struct VecMap<K, V>(/* private fields */);

Implementations§

Source§

impl<K: Eq + PartialEq + Ord + PartialOrd, V> VecMap<K, V>

Source

pub fn new() -> Self

Source

pub fn from_sorted(v: Vec<(K, V)>) -> Result<Self, ()>

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn iter(&self) -> Iter<'_, (K, V)>

Source

pub fn iter_mut(&mut self) -> IterMut<'_, (K, V)>

Source

pub fn keys(&self) -> impl Iterator<Item = &K>

Source

pub fn values(&self) -> impl Iterator<Item = &V>

Source

pub fn get(&self, k: &K) -> Option<&V>

Source

pub fn get_mut(&mut self, k: &K) -> Option<&mut V>

Source

pub fn map<U>(self, f: impl FnMut(K, V) -> U) -> Vec<U>

Source

pub fn map_ref<U>(&self, f: impl FnMut(&K, &V) -> U) -> Vec<U>

Source

pub fn to_vec(&self) -> Vec<(K, V)>
where K: Clone, V: Clone,

Source

pub fn into_vec(self) -> Vec<(K, V)>

Source

pub fn insert(&mut self, k: K, v: V) -> Option<(K, V)>

Source

pub fn extend(&mut self, iter: impl IntoIterator<Item = (K, V)>)

Source

pub fn contains_key(&self, k: &K) -> bool

Source

pub fn remove(&mut self, k: &K) -> Option<(K, V)>

Source

pub fn retain(&mut self, f: impl FnMut(&K, &V) -> bool)

Trait Implementations§

Source§

impl<K, V> AsMut<[(K, V)]> for VecMap<K, V>

Source§

fn as_mut(&mut self) -> &mut [(K, V)]

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<K, V> AsRef<[(K, V)]> for VecMap<K, V>

Source§

fn as_ref(&self) -> &[(K, V)]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<K: Clone, V: Clone> Clone for VecMap<K, V>

Source§

fn clone(&self) -> VecMap<K, V>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<K: Debug, V: Debug> Debug for VecMap<K, V>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<K: Decode + Eq + PartialEq + Ord + PartialOrd, V: Decode> Decode for VecMap<K, V>

Source§

fn decode<I: Input>(input: &mut I) -> Result<Self, DecodeError>

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,

Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
Source§

fn skip<I>(input: &mut I) -> Result<(), Error>
where I: Input,

Attempt to skip the encoded value from input. Read more
Source§

fn encoded_fixed_size() -> Option<usize>

Returns the fixed encoded size of the type. Read more
Source§

impl<K, V> Default for VecMap<K, V>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<K: Display, V: Display> Display for VecMap<K, V>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<K, V> Encode for VecMap<K, V>
where Vec<(K, V)>: Encode,

Source§

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, )

Convert self to a slice and append it to the destination.
Source§

fn encode(&self) -> Vec<u8>

Convert self to an owned vector.
Source§

fn using_encoded<__CodecOutputReturn, __CodecUsingEncodedCallback: FnOnce(&[u8]) -> __CodecOutputReturn>( &self, f: __CodecUsingEncodedCallback, ) -> __CodecOutputReturn

Convert self to a slice and then invoke the given closure with it.
Source§

fn encoded_size(&self) -> usize

Calculates the encoded size. Read more
Source§

impl<K: Eq + PartialEq + Ord + PartialOrd, V> Extend<(K, V)> for VecMap<K, V>

Source§

fn extend<I: IntoIterator<Item = (K, V)>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<K: Eq + PartialEq + Ord + PartialOrd, V> From<Vec<(K, V)>> for VecMap<K, V>

Source§

fn from(v: Vec<(K, V)>) -> Self

Converts to this type from the input type.
Source§

impl<K, V> From<VecMap<K, V>> for Vec<(K, V)>

Source§

fn from(s: VecMap<K, V>) -> Vec<(K, V)>

Converts to this type from the input type.
Source§

impl<K: Eq + PartialEq + Ord + PartialOrd, V> FromIterator<(K, V)> for VecMap<K, V>

Source§

fn from_iter<I: IntoIterator<Item = (K, V)>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<K: Eq + PartialEq + Ord + PartialOrd, V> IntoIterator for VecMap<K, V>

Source§

type Item = (K, V)

The type of the elements being iterated over.
Source§

type IntoIter = <Vec<(K, V)> as IntoIterator>::IntoIter

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<K: Eq + PartialEq + Ord + PartialOrd, V> MapLike<K, V> for VecMap<K, V>

Source§

fn insert(&mut self, k: K, v: V) -> Option<V>

Source§

fn extend(&mut self, iter: impl Iterator<Item = (K, V)>)

Source§

fn contains_key(&self, k: &K) -> bool

Source§

fn remove(&mut self, k: &K) -> Option<V>

Source§

fn get(&self, k: &K) -> Option<&V>

Source§

fn get_mut(&mut self, k: &K) -> Option<&mut V>

Source§

fn keys<'a>(&'a self) -> impl Iterator<Item = &'a K>
where K: 'a,

Source§

impl<K: Ord, V: Ord> Ord for VecMap<K, V>

Source§

fn cmp(&self, other: &VecMap<K, V>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<K: PartialEq, V: PartialEq> PartialEq for VecMap<K, V>

Source§

fn eq(&self, other: &VecMap<K, V>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<K: PartialOrd, V: PartialOrd> PartialOrd for VecMap<K, V>

Source§

fn partial_cmp(&self, other: &VecMap<K, V>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<K, V> EncodeLike for VecMap<K, V>
where Vec<(K, V)>: Encode,

Source§

impl<K: Eq, V: Eq> Eq for VecMap<K, V>

Source§

impl<K, V> StructuralPartialEq for VecMap<K, V>

Auto Trait Implementations§

§

impl<K, V> Freeze for VecMap<K, V>

§

impl<K, V> RefUnwindSafe for VecMap<K, V>

§

impl<K, V> Send for VecMap<K, V>
where K: Send, V: Send,

§

impl<K, V> Sync for VecMap<K, V>
where K: Sync, V: Sync,

§

impl<K, V> Unpin for VecMap<K, V>
where K: Unpin, V: Unpin,

§

impl<K, V> UnwindSafe for VecMap<K, V>
where K: UnwindSafe, V: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T, U> AsByteSlice<T> for U
where T: ToByteSlice, U: AsRef<[T]> + ?Sized,

Source§

fn as_byte_slice(&self) -> &[u8]

Source§

impl<T, U> AsMutByteSlice<T> for U
where T: ToMutByteSlice, U: AsMut<[T]> + ?Sized,

Source§

fn as_mut_byte_slice(&mut self) -> &mut [u8]

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> DecodeAll for T
where T: Decode,

Source§

fn decode_all(input: &mut &[u8]) -> Result<T, Error>

Decode Self and consume all of the given input data. Read more
Source§

impl<T> DecodeLimit for T
where T: Decode,

Source§

fn decode_all_with_depth_limit( limit: u32, input: &mut &[u8], ) -> Result<T, Error>

Decode Self and consume all of the given input data. Read more
Source§

fn decode_with_depth_limit<I>(limit: u32, input: &mut I) -> Result<T, Error>
where I: Input,

Decode Self with the given maximum recursion depth and advance input by the number of bytes consumed. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> KeyedVec for T
where T: Codec,

Source§

fn to_keyed_vec(&self, prepend_key: &[u8]) -> Vec<u8>

Return an encoding of Self prepended by given slice.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S> Codec for S
where S: Decode + Encode,

Source§

impl<T> EncodeLike<&&T> for T
where T: Encode,

Source§

impl<T> EncodeLike<&T> for T
where T: Encode,

Source§

impl<T> EncodeLike<&mut T> for T
where T: Encode,

Source§

impl<T> EncodeLike<Arc<T>> for T
where T: Encode,

Source§

impl<T> EncodeLike<Box<T>> for T
where T: Encode,

Source§

impl<'a, T> EncodeLike<Cow<'a, T>> for T
where T: ToOwned + Encode,

Source§

impl<T> EncodeLike<Rc<T>> for T
where T: Encode,

Source§

impl<S> FullCodec for S
where S: Decode + FullEncode,

Source§

impl<S> FullEncode for S
where S: Encode + EncodeLike,

Source§

impl<T> JsonSchemaMaybe for T