pub struct LookUpTable<const ENTRIES: usize> {
    pub by_id: FnvIndexMap<i32, Entry, ENTRIES>,
    pub by_name: FnvIndexMap<String<32>, Entry, ENTRIES>,
}
Expand description

A LookUpTable allows finding the Entry associated with either an ID or a name.

§Note

Both the IDs and the name MUST be unique in the look up table.

Fields§

§by_id: FnvIndexMap<i32, Entry, ENTRIES>

Unique IDs of each item in the

§by_name: FnvIndexMap<String<32>, Entry, ENTRIES>

Corresponding index for each hash

Implementations§

source§

impl<const ENTRIES: usize> LookUpTable<ENTRIES>

source

pub fn append( &mut self, id: i32, name: &str, entry: Entry ) -> Result<(), LutError>

source

pub fn append_id(&mut self, id: i32, entry: Entry) -> Result<(), LutError>

source

pub fn append_name(&mut self, name: &str, entry: Entry) -> Result<(), LutError>

source

pub fn entries( &self ) -> FnvIndexMap<Entry, (Option<i32>, Option<String<32>>), ENTRIES>

Returns the list of entries of this LUT

Trait Implementations§

source§

impl<const ENTRIES: usize> Clone for LookUpTable<ENTRIES>

source§

fn clone(&self) -> LookUpTable<ENTRIES>

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<const ENTRIES: usize> Debug for LookUpTable<ENTRIES>

source§

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

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

impl<'a, const ENTRIES: usize> Decode<'a> for LookUpTable<ENTRIES>

source§

fn decode<R: Reader<'a>>(decoder: &mut R) -> Result<Self>

Attempt to decode this message using the provided decoder.
source§

fn from_der(bytes: &'a [u8]) -> Result<Self, Error>

Parse Self from the provided DER-encoded byte slice.
source§

impl<const ENTRIES: usize> Default for LookUpTable<ENTRIES>

source§

fn default() -> LookUpTable<ENTRIES>

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

impl<const ENTRIES: usize> Encode for LookUpTable<ENTRIES>

source§

fn encoded_len(&self) -> Result<Length>

Compute the length of this value in bytes when encoded as ASN.1 DER.
source§

fn encode(&self, encoder: &mut impl Writer) -> Result<()>

Encode this value as ASN.1 DER using the provided Writer.
source§

fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8], Error>

Encode this value to the provided byte slice, returning a sub-slice containing the encoded message.
source§

fn encode_to_vec(&self, buf: &mut Vec<u8>) -> Result<Length, Error>

Encode this message as ASN.1 DER, appending it to the provided byte vector.
source§

fn to_der(&self) -> Result<Vec<u8>, Error>

Encode this type as DER, returning a byte vector.
source§

impl<const ENTRIES: usize> PartialEq for LookUpTable<ENTRIES>

source§

fn eq(&self, other: &LookUpTable<ENTRIES>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<const ENTRIES: usize> Eq for LookUpTable<ENTRIES>

source§

impl<const ENTRIES: usize> StructuralPartialEq for LookUpTable<ENTRIES>

Auto Trait Implementations§

§

impl<const ENTRIES: usize> Freeze for LookUpTable<ENTRIES>

§

impl<const ENTRIES: usize> RefUnwindSafe for LookUpTable<ENTRIES>

§

impl<const ENTRIES: usize> Send for LookUpTable<ENTRIES>

§

impl<const ENTRIES: usize> Sync for LookUpTable<ENTRIES>

§

impl<const ENTRIES: usize> Unpin for LookUpTable<ENTRIES>

§

impl<const ENTRIES: usize> UnwindSafe for LookUpTable<ENTRIES>

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> 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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

§

type Output = T

Should always be Self
source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

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

§

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, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DecodeOwned for T
where T: for<'a> Decode<'a>,

source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,