pub trait MapEntry {
type Key;
type Value;
// Required methods
fn into_parts(self) -> (Self::Key, Self::Value);
fn from_parts(key: Self::Key, value: Self::Value) -> Self;
}Expand description
An entry that splits into a key and a value.
This is what lets the derive talk about the K and the V of a
HashMap<K, V> when all it can name is the collection’s
Item. It is implemented for (K, V), which is what
every std map iterates as; implement it yourself only if you have a map
whose entry type is not a tuple.
Required Associated Types§
Required Methods§
Sourcefn into_parts(self) -> (Self::Key, Self::Value)
fn into_parts(self) -> (Self::Key, Self::Value)
Splits the entry into its parts.
Sourcefn from_parts(key: Self::Key, value: Self::Value) -> Self
fn from_parts(key: Self::Key, value: Self::Value) -> Self
Reassembles an entry from parts, so it can be put back into a collection.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".