pub struct LangMap<V> { /* private fields */ }Expand description
Represents a map of Lang keys that can be partially matched.
Implementations§
Source§impl<V> LangMap<V>
impl<V> LangMap<V>
Sourcepub fn with_capacity(capacity: usize) -> LangMap<V>
pub fn with_capacity(capacity: usize) -> LangMap<V>
New empty with pre-allocated capacity.
Sourcepub fn best_match(&self, lang: &Lang) -> Option<&Lang>
pub fn best_match(&self, lang: &Lang) -> Option<&Lang>
Returns the best match to lang currently in the map.
Sourcepub fn get_exact_mut(&mut self, lang: &Lang) -> Option<&mut V>
pub fn get_exact_mut(&mut self, lang: &Lang) -> Option<&mut V>
Returns the exact match for lang.
Sourcepub fn get_exact_or_insert(
&mut self,
lang: Lang,
new: impl FnOnce() -> V,
) -> &mut V
pub fn get_exact_or_insert( &mut self, lang: Lang, new: impl FnOnce() -> V, ) -> &mut V
Returns the current value or insert new and return a reference to it.
Sourcepub fn insert(&mut self, lang: Lang, value: V) -> Option<V>
pub fn insert(&mut self, lang: Lang, value: V) -> Option<V>
Insert the value with the exact match of lang.
Returns the previous exact match.
Sourcepub fn remove_all(&mut self, lang: &Lang) -> usize
pub fn remove_all(&mut self, lang: &Lang) -> usize
Remove all exact and partial matches of lang.
Returns a count of items removed.
Sourcepub fn keys(&self) -> impl ExactSizeIterator
pub fn keys(&self) -> impl ExactSizeIterator
Iterator over lang keys.
Sourcepub fn values(&self) -> impl ExactSizeIterator
pub fn values(&self) -> impl ExactSizeIterator
Iterator over values.
Sourcepub fn values_mut(&mut self) -> impl ExactSizeIterator
pub fn values_mut(&mut self) -> impl ExactSizeIterator
Iterator over values.
Sourcepub fn into_values(self) -> impl ExactSizeIterator
pub fn into_values(self) -> impl ExactSizeIterator
Into iterator of values.
Sourcepub fn iter(&self) -> impl ExactSizeIterator
pub fn iter(&self) -> impl ExactSizeIterator
Iterate over key-value pairs.
Sourcepub fn iter_mut(&mut self) -> impl ExactSizeIterator
pub fn iter_mut(&mut self) -> impl ExactSizeIterator
Iterate over key-value pairs with mutable values.
Source§impl<V> LangMap<HashMap<LangFilePath, V>>
impl<V> LangMap<HashMap<LangFilePath, V>>
Sourcepub fn get_file(&self, lang: &Lang, file: &LangFilePath) -> Option<&V>
pub fn get_file(&self, lang: &Lang, file: &LangFilePath) -> Option<&V>
Returns the match for lang and file.
Sourcepub fn best_file_match(
&self,
lang: &Lang,
file: &LangFilePath,
) -> Option<&LangFilePath>
pub fn best_file_match( &self, lang: &Lang, file: &LangFilePath, ) -> Option<&LangFilePath>
Returns the best match to lang and file currently in the map.
Trait Implementations§
Source§impl<'de, V> Deserialize<'de> for LangMap<V>where
V: Deserialize<'de>,
impl<'de, V> Deserialize<'de> for LangMap<V>where
V: Deserialize<'de>,
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<LangMap<V>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<LangMap<V>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<V> IntoIterator for LangMap<V>
impl<V> IntoIterator for LangMap<V>
Source§impl<V> Serialize for LangMap<V>where
V: Serialize,
impl<V> Serialize for LangMap<V>where
V: Serialize,
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<V> Eq for LangMap<V>where
V: Eq,
Auto Trait Implementations§
impl<V> Freeze for LangMap<V>
impl<V> RefUnwindSafe for LangMap<V>where
V: RefUnwindSafe,
impl<V> Send for LangMap<V>where
V: Send,
impl<V> Sync for LangMap<V>where
V: Sync,
impl<V> Unpin for LangMap<V>where
V: Unpin,
impl<V> UnwindSafe for LangMap<V>where
V: UnwindSafe,
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
Source§impl<T> AnyVarValue for T
impl<T> AnyVarValue for T
Source§fn clone_boxed(&self) -> BoxAnyVarValue
fn clone_boxed(&self) -> BoxAnyVarValue
Clone the value.
Source§fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
Gets if
self and other are equal.Source§fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> bool
fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> bool
Swap value with
other if both are of the same type.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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
Source§impl<T> FsChangeNote for T
impl<T> FsChangeNote for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 more§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
The none-equivalent value.
§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().