Struct collection::Collection
[−]
[src]
pub struct Collection<T, M> where T: Val, M: Meta<T> {
pub root: Location<T, M>,
pub stash: Stash<T, M>,
pub divisor: usize,
}
A collection of elements of type T, with metadata of type M.
This is the base type, that all the collection operations are implemented over.
Fields
root: Location<T, M>
The location on the stash that constitutes the root for this collection.
stash: Stash<T, M>
The store for values of type Node
divisor: usize
The branching factor, currently hard-coded to 2, which means on average every fourth element will have weight > 0.
Methods
impl<T, M> Collection<T, M> where T: Val, M: Meta<T>
[src]
fn new() -> Self
Returns a new, empty Collection.
fn new_from(root: Location<T, M>, stash: Stash<T, M>) -> Self
Constructs a Collection given a root and a stash
fn _html(&self) -> String where T: Debug
Produces a html representation of this Collection. For debug use only.
fn clone_mut(&mut self) -> Self
Clones the collection, mutating self
fn union_using<F, E>(&mut self, b: &mut Self) -> Self where F: Meta<T> + Select<T> + PartialEq + Ord,
E: Meta<T> + PartialEq,
M: SubMeta<F> + SubMeta<E>
E: Meta<T> + PartialEq,
M: SubMeta<F> + SubMeta<E>
Returns a new, cloned collection that is the result of a union operation
given two Meta implementations F
and E
F
is used to select which T goes first in the union.
E
is used to find overlapping common subtrees.
For Sets: F: Max<T>
, E: CheckSum<T>
, and for Maps:
F: Key<T::Key>
, E: KeySum<T>
.
When the equality testing succeeds, elements will be picked from
the Collection b
.
fn mut_context<R: Relative>(&mut self,
branch: Branch<T, M, R>)
-> MutContext<T, M, R>
branch: Branch<T, M, R>)
-> MutContext<T, M, R>
Constructs a MutContext context, given a branch into the Collection.
impl<T, M> Collection<T, M> where T: Val, M: Meta<T>
[src]
fn iter<'a>(&'a self) -> Iter<'a, T, M, Beginning>
Returns an iterator over Collection
fn iter_rev<'a>(&'a self) -> Iter<'a, T, M, End>
Returns a reverse iterator over Collection
Trait Implementations
impl<T, M> PartialEq for Collection<T, M> where T: Val, M: Meta<T> + SubMeta<CheckSum<u64>>
[src]
fn eq(&self, other: &Self) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl<T, M> SetOps<T> for Collection<T, M> where T: Val + Ord, M: Meta<T> + SubMeta<Max<T>>
[src]
fn member(&self, t: &T) -> bool
Is element a member of this set?
fn insert(&mut self, t: T)
Insert element into set
fn remove(&mut self, t: &T) -> Option<T>
Remove element from set
impl<T, M> SetOpsCheckSum<T> for Collection<T, M> where T: Val + Ord + Hash,
M: Meta<T> + SubMeta<Max<T>> + SubMeta<CheckSum<u64>>
[src]
M: Meta<T> + SubMeta<Max<T>> + SubMeta<CheckSum<u64>>
fn union(&mut self, b: &mut Self) -> Self where M: SubMeta<CheckSum<u64>> + SubMeta<Max<T>>
Return a new Collection, that is the union of self
and b
impl<T, M> VectorOps<T, M> for Collection<T, M> where T: Val, M: Meta<T> + SubMeta<Cardinality<usize>>
[src]
fn get(&self, i: usize) -> Option<&T>
Get a reference to element at index i
fn get_mut(&mut self, i: usize) -> Option<MutContext<T, M, Beginning>>
Get a mutable reference to element at index i
fn insert(&mut self, i: usize, t: T)
Insert element at index i
fn remove(&mut self, i: usize) -> Option<T>
Remove element from index i
fn push(&mut self, t: T)
Push element to end of vector
fn pop(&mut self) -> Option<T>
Pop from the end of the vector
fn split(&mut self, i: usize) -> (Self, Self) where Self: Sized
Split the vector in two at index i
fn concat(&mut self, b: &mut Self) -> Self
Concatenate two vectors
fn splice(&mut self, i: usize, from: &mut Self) -> Self
Splice in a vector at index i
impl<K, V, M> MapOps<K, V, M> for Collection<KV<K, V>, M> where M: Meta<KV<K, V>> + SubMeta<Key<K>>, K: Val + Ord, V: Clone
[src]
fn insert(&mut self, key: K, val: V)
Insert a value V
at key K
fn remove(&mut self, key: K) -> Option<V>
Remove value at key K
fn get(&self, key: K) -> Option<&V>
Get a reference to the value at key K
fn get_mut(&mut self, key: K) -> Option<ValContext<KV<K, V>, M, Beginning>>
Get a mutable reference to the value at key K
impl<K, V, M> MapOpsKeySum<K, V, M> for Collection<KV<K, V>, M> where M: Meta<KV<K, V>> + SubMeta<Key<K>> + SubMeta<KeySum<u64>>,
K: Val + Ord + Hash,
V: Clone
[src]
K: Val + Ord + Hash,
V: Clone
fn merge(&mut self, b: &mut Self) -> Self
Merge two maps, overwriting values from self
with b