pub trait Entry<'a> {
type Key;
type Value;
// Required methods
fn key(&self) -> &Self::Key;
fn or_insert(self, default: Self::Value) -> &'a mut Self::Value;
fn or_insert_with<F>(self, f: F) -> &'a mut Self::Value
where F: FnOnce() -> Self::Value;
}Expand description
The Entry trait seeks to establish a common interface for all elements within a
so-called keyed container; i.e. on in which elements can be accessed by any type of key.
Required Associated Types§
Required Methods§
Sourcefn or_insert(self, default: Self::Value) -> &'a mut Self::Value
fn or_insert(self, default: Self::Value) -> &'a mut Self::Value
if the entry does not exist, insert the provided value and return a mutable reference to it
Sourcefn or_insert_with<F>(self, f: F) -> &'a mut Self::Value
fn or_insert_with<F>(self, f: F) -> &'a mut Self::Value
if the entry does not exist, insert the value returned by the provided function and return a mutable reference to it.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.