Struct spirt::spv::spec::indexed::NamedIdxMap

source ·
pub struct NamedIdxMap<I, T, S: StorageShape<I, (&'static str, T)>> {
    pub(super) idx_by_name: FxHashMap<&'static str, I>,
    pub(super) storage: S::Storage,
}

Fields§

§idx_by_name: FxHashMap<&'static str, I>§storage: S::Storage

Implementations§

source§

impl<I, T, S: StorageShape<I, (&'static str, T)>> NamedIdxMap<I, T, S>

source

pub fn lookup(&self, name: &str) -> Option<I>
where I: Copy,

Get an index from a name.

source

pub fn get_named(&self, idx: I) -> Option<(&'static str, &T)>

source

pub fn get(&self, idx: I) -> Option<&T>

Trait Implementations§

source§

impl<I, T, S: StorageShape<I, (&'static str, T)>> Index<I> for NamedIdxMap<I, T, S>

§

type Output = T

The returned type after indexing.
source§

fn index(&self, idx: I) -> &T

Performs the indexing (container[index]) operation. Read more

Auto Trait Implementations§

§

impl<I, T, S> RefUnwindSafe for NamedIdxMap<I, T, S>
where I: RefUnwindSafe, <S as StorageShape<I, (&'static str, T)>>::Storage: RefUnwindSafe,

§

impl<I, T, S> Send for NamedIdxMap<I, T, S>
where I: Send, <S as StorageShape<I, (&'static str, T)>>::Storage: Send,

§

impl<I, T, S> Sync for NamedIdxMap<I, T, S>
where I: Sync, <S as StorageShape<I, (&'static str, T)>>::Storage: Sync,

§

impl<I, T, S> Unpin for NamedIdxMap<I, T, S>
where I: Unpin, <S as StorageShape<I, (&'static str, T)>>::Storage: Unpin,

§

impl<I, T, S> UnwindSafe for NamedIdxMap<I, T, S>
where I: UnwindSafe, <S as StorageShape<I, (&'static str, T)>>::Storage: 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> 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> 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, 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.