pub trait Trie: Sized {
    type Item;
    type Cursor: Cursor<Self>;
    type MergeBuilder: MergeBuilder<Trie = Self>;
    type TupleBuilder: TupleBuilder<Trie = Self, Item = Self::Item>;

    // Required methods
    fn keys(&self) -> usize;
    fn tuples(&self) -> usize;
    fn cursor_from(&self, lower: usize, upper: usize) -> Self::Cursor;

    // Provided methods
    fn cursor(&self) -> Self::Cursor { ... }
    fn merge(&self, other: &Self) -> Self { ... }
}
Expand description

A collection of tuples, and types for building and enumerating them.

There are some implicit assumptions about the elements in trie-structured data, mostly that the items have some (key, val) structure. Perhaps we will nail these down better in the future and get a better name for the trait.

Required Associated Types§

source

type Item

The type of item from which the type is constructed.

source

type Cursor: Cursor<Self>

The type of cursor used to navigate the type.

source

type MergeBuilder: MergeBuilder<Trie = Self>

The type used to merge instances of the type together.

source

type TupleBuilder: TupleBuilder<Trie = Self, Item = Self::Item>

The type used to assemble instances of the type from its Items.

Required Methods§

source

fn keys(&self) -> usize

The number of distinct keys, as distinct from the total number of tuples.

source

fn tuples(&self) -> usize

The total number of tuples in the collection.

source

fn cursor_from(&self, lower: usize, upper: usize) -> Self::Cursor

Returns a cursor over a range of data, commonly used by others to restrict navigation to sub-collections.

Provided Methods§

source

fn cursor(&self) -> Self::Cursor

Returns a cursor capable of navigating the collection.

source

fn merge(&self, other: &Self) -> Self

Merges two collections into a third.

Collections are allowed their own semantics for merging. For example, unordered collections simply collect values, whereas weighted collections accumulate weights and discard elements whose weights are zero.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<K, L, O, C> Trie for OrderedLayer<K, L, O, C>where K: Ord + Clone, C: BatchContainer<Item = K>, L: Trie, O: OrdOffset,

§

type Item = (K, <L as Trie>::Item)

§

type Cursor = OrderedCursor<L>

§

type MergeBuilder = OrderedBuilder<K, <L as Trie>::MergeBuilder, O, C>

§

type TupleBuilder = OrderedBuilder<K, <L as Trie>::TupleBuilder, O, C>

source§

impl<K: Ord + Clone, R: Semigroup + Clone, C> Trie for OrderedLeaf<K, R, C>where C: BatchContainer<Item = (K, R)> + Deref<Target = [(K, R)]>,