pub struct Collection<T, M>where
T: Val,
M: Meta<T>,{
pub root: Location<T, M>,
pub stash: Stash<T, M>,
pub divisor: usize,
}
Expand description
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<T, M>
divisor: usize
The branching factor, currently hard-coded to 2, which means on average every fourth element will have weight > 0.
Implementations§
Source§impl<T, M> Collection<T, M>where
T: Val,
M: Meta<T>,
impl<T, M> Collection<T, M>where
T: Val,
M: Meta<T>,
Sourcepub fn new_from(root: Location<T, M>, stash: Stash<T, M>) -> Self
pub fn new_from(root: Location<T, M>, stash: Stash<T, M>) -> Self
Constructs a Collection given a root and a stash
Sourcepub fn _html(&self) -> Stringwhere
T: Debug,
pub fn _html(&self) -> Stringwhere
T: Debug,
Produces a html representation of this Collection. For debug use only.
Sourcepub fn union_using<F, E>(&mut self, b: &mut Self) -> Self
pub fn union_using<F, E>(&mut self, b: &mut Self) -> Self
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
.
Sourcepub fn mut_context<R: Relative>(
&mut self,
branch: Branch<T, M, R>,
) -> MutContext<'_, T, M, R>
pub fn mut_context<R: Relative>( &mut self, branch: Branch<T, M, R>, ) -> MutContext<'_, T, M, R>
Constructs a MutContext context, given a branch into the Collection.