Trait former::HashMapLike

source ·
pub trait HashMapLike<K, E>
where K: Eq + Hash, Self: Sized + Default,
{ // Required method fn insert(&mut self, k: K, e: E) -> Option<E>; // Provided methods fn former( self ) -> HashMapSubformer<K, E, Self, Self, impl ToSuperFormer<Self, Self>> { ... } fn former_begin<Context, End>( self, context: Context, end: End ) -> HashMapSubformer<K, E, Self, Context, End> where End: ToSuperFormer<Self, Context> { ... } }
Expand description

A trait for types that behave like hash maps, supporting insertion and custom forming behaviors.

This trait allows for generic operations on hash map-like data structures, enabling the insertion of key-value pairs and the creation of formers for more complex construction patterns.

§Type Parameters

  • K: The type of keys stored in the hash map. Must implement Eq and Hash.
  • E: The type of elements (values) stored in the hash map.

Required Methods§

source

fn insert(&mut self, k: K, e: E) -> Option<E>

Inserts a key-value pair into the map.

Provided Methods§

source

fn former( self ) -> HashMapSubformer<K, E, Self, Self, impl ToSuperFormer<Self, Self>>

Return former.

source

fn former_begin<Context, End>( self, context: Context, end: End ) -> HashMapSubformer<K, E, Self, Context, End>
where End: ToSuperFormer<Self, Context>,

Return former with a custom context.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<K, E> HashMapLike<K, E> for HashMap<K, E>
where K: Eq + Hash, Self: Sized + Default,

source§

fn insert(&mut self, k: K, e: E) -> Option<E>

Implementors§