[][src]Trait sharded::Collection

pub trait Collection<K, Value>: IntoIterator<Item = Value> + Clone where
    K: Hash,
    Value: ExtractShardKey<K>, 
{ fn with_capacity(capacity: usize) -> Self;
fn insert(&mut self, v: Value) -> Option<Value>;
fn get(&self, k: &K) -> Option<Value>;
fn len(&self) -> usize;
fn capacity(&self) -> usize; }

Basic methods needing implemented for shard construction

Required methods

fn with_capacity(capacity: usize) -> Self

Creates an empty collection with specified capacity. Usually this means the collection should avoid resizing until that threshold is reached

fn insert(&mut self, v: Value) -> Option<Value>

Insert a (possibly) key value pair into the collection

fn get(&self, k: &K) -> Option<Value>

fn len(&self) -> usize

Returns the count of values stored in the collection

fn capacity(&self) -> usize

Returns the current specified capacity

Loading content...

Implementations on Foreign Types

impl<K, V, S> Collection<K, (K, V)> for HashMap<K, V, S> where
    K: Hash + Clone + Eq,
    V: Clone,
    S: BuildHasher + Clone + Default
[src]

impl<K, S> Collection<K, K> for HashSet<K, S> where
    K: Hash + Clone + Eq,
    S: BuildHasher + Clone + Default
[src]

Loading content...

Implementors

Loading content...