Skip to main content

Struct tauri::api::assets::phf::OrderedMap

pub struct OrderedMap<K, V> where
    V: 'static,
    K: 'static,  { /* fields omitted */ }

An order-preserving immutable map constructed at compile time.

Unlike a Map, iteration order is guaranteed to match the definition order.

Note#

The fields of this struct are public so that they may be initialized by the phf_ordered_map! macro and code generation. They are subject to change at any time and should never be accessed directly.

Implementations#

OrderedMap#

impl<K, V> OrderedMap<K, V>

Defined in: ordered_map.rs:53-166

len#

pub fn len(&self) -> usize

Returns the number of entries in the Map.

Defined in: ordered_map.rs:55

is_empty#

pub fn is_empty(&self) -> bool

Returns true if the Map is empty.

Defined in: ordered_map.rs:60

get#

pub fn get<T>(&self, key: &T) -> Option<&V> where
    T: Eq + PhfHash + ?Sized,
    K: PhfBorrow<T>, 

Returns a reference to the value that key maps to.

Defined in: ordered_map.rs:65-68

get_key#

pub fn get_key<T>(&self, key: &T) -> Option<&K> where
    T: Eq + PhfHash + ?Sized,
    K: PhfBorrow<T>, 

Returns a reference to the map’s internal static instance of the given key.

This can be useful for interning schemes.

Defined in: ordered_map.rs:77-80

contains_key#

pub fn contains_key<T>(&self, key: &T) -> bool where
    T: Eq + PhfHash + ?Sized,
    K: PhfBorrow<T>, 

Determines if key is in the Map.

Defined in: ordered_map.rs:86-89

get_index#

pub fn get_index<T>(&self, key: &T) -> Option<usize> where
    T: Eq + PhfHash + ?Sized,
    K: PhfBorrow<T>, 

Returns the index of the key within the list used to initialize the ordered map.

Defined in: ordered_map.rs:96-99

index#

pub fn index(&self, index: usize) -> Option<(&K, &V)>

Returns references to both the key and values at an index within the list used to initialize the ordered map. See .get_index(key).

Defined in: ordered_map.rs:106

get_entry#

pub fn get_entry<T>(&self, key: &T) -> Option<(&K, &V)> where
    T: Eq + PhfHash + ?Sized,
    K: PhfBorrow<T>, 

Like get, but returns both the key and the value.

Defined in: ordered_map.rs:111-114

entries#

pub fn entries(&self) -> Entries<'_, K, V>ⓘ
Notable traits for Entries<'a, K, V>
impl<'a, K, V> Iterator for Entries<'a, K, V>
    type Item = (&'a K, &'a V);

Returns an iterator over the key/value pairs in the map.

Entries are returned in the same order in which they were defined.

Defined in: ordered_map.rs:143

keys#

pub fn keys(&self) -> Keys<'_, K, V>ⓘ
Notable traits for Keys<'a, K, V>
impl<'a, K, V> Iterator for Keys<'a, K, V>
    type Item = &'a K;

Returns an iterator over the keys in the map.

Keys are returned in the same order in which they were defined.

Defined in: ordered_map.rs:152

values#

pub fn values(&self) -> Values<'_, K, V>ⓘ
Notable traits for Values<'a, K, V>
impl<'a, K, V> Iterator for Values<'a, K, V>
    type Item = &'a V;

Returns an iterator over the values in the map.

Values are returned in the same order in which they were defined.

Defined in: ordered_map.rs:161

Trait Implementations#

Debug#

impl<K, V> Debug for OrderedMap<K, V> where
    V: Debug,
    K: Debug, 

Defined in: ordered_map.rs:31-39

fmt#

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

Formats the value using the given formatter. Read more

Defined in: ordered_map.rs:36

Index#

impl<'a, K, V, T> Index<&'a T> for OrderedMap<K, V> where
    T: Eq + PhfHash + ?Sized,
    K: PhfBorrow<T>, 

Defined in: ordered_map.rs:41-51

type Output = V#

The returned type after indexing.

index#

pub fn index(&self, k: &'a T) -> &V

Performs the indexing (container[index]) operation.

Defined in: ordered_map.rs:48

IntoIterator#

impl<'a, K, V> IntoIterator for &'a OrderedMap<K, V>

Defined in: ordered_map.rs:168-175

type Item = (&'aK, &'aV)#

The type of the elements being iterated over.

type IntoIter = Entries<'a, K, V>#

Which kind of iterator are we turning this into?

into_iter#

pub fn into_iter(self) -> Entries<'a, K, V>ⓘ
Notable traits for Entries<'a, K, V>
impl<'a, K, V> Iterator for Entries<'a, K, V>
    type Item = (&'a K, &'a V);

Creates an iterator from a value. Read more

Defined in: ordered_map.rs:172

Auto Trait Implementations#

impl<K, V> RefUnwindSafe for OrderedMap<K, V> where K: RefUnwindSafe, V: RefUnwindSafe,#

impl<K, V> Send for OrderedMap<K, V> where K: Send + Sync, V: Send + Sync,#

impl<K, V> Sync for OrderedMap<K, V> where K: Sync, V: Sync,#

impl<K, V> Unpin for OrderedMap<K, V> where K: Unpin, V: Unpin,#

impl<K, V> UnwindSafe for OrderedMap<K, V> where K: RefUnwindSafe + UnwindSafe, V: RefUnwindSafe + UnwindSafe,#

Blanket Implementations#

Any#

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

Defined in: any.rs:131-135

type_id#

pub fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

Defined in: any.rs:132

Borrow#

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

Defined in: borrow.rs:208-213

borrow#

pub fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

Defined in: borrow.rs:210

BorrowMut#

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

Defined in: borrow.rs:216-220

borrow_mut#

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

Mutably borrows from an owned value. Read more

Defined in: borrow.rs:217

From#

impl<T> From<T> for T

Defined in: mod.rs:544-548

from#

pub fn from(t: T) -> T

Performs the conversion.

Defined in: mod.rs:545

Into#

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

Defined in: mod.rs:533-540

into#

pub fn into(self) -> U

Performs the conversion.

Defined in: mod.rs:537

TryFrom#

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

Defined in: mod.rs:581-590

type Error = Infallible#

The type returned in the event of a conversion error.

try_from#

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

Performs the conversion.

Defined in: mod.rs:587

TryInto#

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

Defined in: mod.rs:567-576

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

The type returned in the event of a conversion error.

try_into#

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

Performs the conversion.

Defined in: mod.rs:573

impl<V, T> VZip<V> for T where V: MultiLane<T>,#

pub fn vzip(self) -> V#