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 Twhere
T: VarValue,
impl<T> AnyVarValue for Twhere
T: VarValue,
source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Access to mut
dyn Any
methods.source§fn clone_boxed(&self) -> Box<dyn AnyVarValue>
fn clone_boxed(&self) -> Box<dyn AnyVarValue>
Clone the value.
source§fn clone_boxed_var(&self) -> Box<dyn AnyVar>
fn clone_boxed_var(&self) -> Box<dyn AnyVar>
Clone the value into a new boxed
LocalVar<Self>
.source§fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
Gets if
self
equals other
.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,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§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.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> 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()
.