Skip to main content

ACMapBase

Trait ACMapBase 

Source
pub trait ACMapBase {
    // Required methods
    fn with_capacity(capacity: usize) -> Self;
    fn len(&self) -> usize;
    fn clear(&mut self);

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

Minimal interface for any “associative coefficient map” backing a PauliSum — construction, length, and clear.

Implementations exist for HashMap, IndexMap, and DashMap; pick one via a Config.

Required Methods§

Source

fn with_capacity(capacity: usize) -> Self

Construct an empty map with at least capacity slots reserved.

Source

fn len(&self) -> usize

Number of stored (key, value) pairs.

Source

fn clear(&mut self)

Remove every entry, retaining allocated capacity.

Provided Methods§

Source

fn is_empty(&self) -> bool

true if the map is empty.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<'a, V, Hasher, W> ACMapBase for HashMap<W, V, Hasher>
where V: Coefficient, Hasher: Clone + BuildHasher + Default,

Source§

fn with_capacity(capacity: usize) -> HashMap<W, V, Hasher>

Source§

fn len(&self) -> usize

Source§

fn clear(&mut self)

Source§

impl<'a, V, Hasher, W> ACMapBase for IndexMap<W, V, Hasher>
where V: Coefficient, Hasher: Clone + BuildHasher + Default,

Source§

fn with_capacity(capacity: usize) -> IndexMap<W, V, Hasher>

Source§

fn len(&self) -> usize

Source§

fn clear(&mut self)

Source§

impl<V, H, W> ACMapBase for AHashMap<W, V, H>

Source§

fn with_capacity(capacity: usize) -> AHashMap<W, V, H>

Source§

fn len(&self) -> usize

Source§

fn clear(&mut self)

Source§

impl<V, Hasher, T> ACMapBase for DashMap<T, V, Hasher>
where T: Hash + Eq, V: Coefficient, Hasher: Clone + BuildHasher + Default,

Source§

fn with_capacity(capacity: usize) -> DashMap<T, V, Hasher>

Source§

fn len(&self) -> usize

Source§

fn clear(&mut self)

Implementors§