Struct anise::structure::lookuptable::LookUpTable
source · pub struct LookUpTable<const ENTRIES: usize> {
pub by_id: FnvIndexMap<i32, Entry, ENTRIES>,
pub by_name: FnvIndexMap<String<32>, Entry, ENTRIES>,
}
Expand description
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>
impl<const ENTRIES: usize> LookUpTable<ENTRIES>
pub fn append( &mut self, id: i32, name: &str, entry: Entry ) -> Result<(), LutError>
pub fn append_id(&mut self, id: i32, entry: Entry) -> Result<(), LutError>
pub fn append_name(&mut self, name: &str, entry: Entry) -> Result<(), LutError>
sourcepub fn entries(
&self
) -> FnvIndexMap<Entry, (Option<i32>, Option<String<32>>), ENTRIES>
pub fn entries( &self ) -> FnvIndexMap<Entry, (Option<i32>, Option<String<32>>), ENTRIES>
Returns the list of entries of this LUT
sourcepub fn reid(&mut self, current_id: i32, new_id: i32) -> Result<(), LutError>
pub fn reid(&mut self, current_id: i32, new_id: i32) -> Result<(), LutError>
Change the ID of a given entry to the new ID
This will return an error if the current ID is not in the LUT, or if the new ID is already in the LUT.
sourcepub fn rmid(&mut self, id: i32) -> Result<(), LutError>
pub fn rmid(&mut self, id: i32) -> Result<(), LutError>
Removes this ID from the LUT if it’s present.
If this item was inserted with a name, it will rename accessible by the name.
Trait Implementations§
source§impl<const ENTRIES: usize> Clone for LookUpTable<ENTRIES>
impl<const ENTRIES: usize> Clone for LookUpTable<ENTRIES>
source§fn clone(&self) -> LookUpTable<ENTRIES>
fn clone(&self) -> LookUpTable<ENTRIES>
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<const ENTRIES: usize> Debug for LookUpTable<ENTRIES>
impl<const ENTRIES: usize> Debug for LookUpTable<ENTRIES>
source§impl<'a, const ENTRIES: usize> Decode<'a> for LookUpTable<ENTRIES>
impl<'a, const ENTRIES: usize> Decode<'a> for LookUpTable<ENTRIES>
source§impl<const ENTRIES: usize> Default for LookUpTable<ENTRIES>
impl<const ENTRIES: usize> Default for LookUpTable<ENTRIES>
source§fn default() -> LookUpTable<ENTRIES>
fn default() -> LookUpTable<ENTRIES>
Returns the “default value” for a type. Read more
source§impl<const ENTRIES: usize> Encode for LookUpTable<ENTRIES>
impl<const ENTRIES: usize> Encode for LookUpTable<ENTRIES>
source§fn encoded_len(&self) -> Result<Length>
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<()>
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>
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§impl<const ENTRIES: usize> PartialEq for LookUpTable<ENTRIES>
impl<const ENTRIES: usize> PartialEq for LookUpTable<ENTRIES>
source§fn eq(&self, other: &LookUpTable<ENTRIES>) -> bool
fn eq(&self, other: &LookUpTable<ENTRIES>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl<const ENTRIES: usize> Eq for LookUpTable<ENTRIES>
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> 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
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moresource§fn is_in_subset(&self) -> bool
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
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
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.