Struct modalkit::editing::completion::CompletionMap
source · pub struct CompletionMap<K, V>{ /* private fields */ }
Expand description
Maps keys onto values with support for listing keys by prefix.
Implementations§
source§impl<K, V> CompletionMap<K, V>
impl<K, V> CompletionMap<K, V>
sourcepub fn remove<Q>(&mut self, k: &Q) -> Option<V>
pub fn remove<Q>(&mut self, k: &Q) -> Option<V>
Unmap the given key, returning its previous value if one existed.
sourcepub fn get<Q>(&self, k: &Q) -> Option<&V>
pub fn get<Q>(&self, k: &Q) -> Option<&V>
Get an immutable reference to a value if the key exists.
sourcepub fn get_mut<Q>(&mut self, k: &Q) -> Option<&mut V>
pub fn get_mut<Q>(&mut self, k: &Q) -> Option<&mut V>
Get a mutable reference to a value if the key exists.
sourcepub fn get_or_default(&mut self, k: K) -> &mut Vwhere
V: Default,
pub fn get_or_default(&mut self, k: K) -> &mut Vwhere
V: Default,
Get a mutable reference to a value for the given key.
If the key is unmapped, then this will insert a Default value first.
Trait Implementations§
Auto Trait Implementations§
impl<K, V> Freeze for CompletionMap<K, V>
impl<K, V> RefUnwindSafe for CompletionMap<K, V>where
V: RefUnwindSafe,
K: RefUnwindSafe,
impl<K, V> Send for CompletionMap<K, V>
impl<K, V> Sync for CompletionMap<K, V>
impl<K, V> Unpin for CompletionMap<K, V>
impl<K, V> UnwindSafe for CompletionMap<K, V>where
V: UnwindSafe,
K: UnwindSafe,
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§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
.source§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
.source§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.source§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.