AnyMapContext

Type Alias AnyMapContext 

Source
pub type AnyMapContext<K, KB> = MapContext<AnyMapEntry<K, KB>, BoxConverter>;
Expand description

A context whose entries are AnyMapEntry<K, KB>.

Aliased Type§

pub struct AnyMapContext<K, KB> { /* private fields */ }

Trait Implementations§

Source§

impl<K, KB> AnyContext for AnyMapContext<K, KB>
where K: Borrow<KB> + Debug + Send + Sync + 'static, KB: Debug + Display + Eq + Hash + ?Sized + Send + Sync,

Source§

fn value_as<T, Q>(&self, key: &Q) -> Option<&T>
where <Self::Entry as Entry>::KeyBorrowed: Borrow<Q>, Q: Debug + Eq + Hash + ?Sized, T: Any,

Returns the value corresponding to the given key and tries to cast it to the type T. Returns None if the entry doesn’t exist or the downcasting fails.