pub trait TreapMapConfig: Sized {
    type SearchKey;
    type SortKey;
    type Value: Clone;
    type ExtMap: KeyMngTrait<Self>;
    type Weight: ConsoliableWeight;

    // Required method
    fn next_node_dir(
        me: (&Self::SortKey, &Self::SearchKey),
        other: (&Self::SortKey, &Self::SearchKey)
    ) -> Option<Direction>;
}
Expand description

TreapMap is a struct which implements a treap which can be indexed by a different key (type SearchKey). The associate type SortKey and SearchKey defines how to order node in treap collaborately.

As the user only needs to provider the SearchKey in searching an element, but the underlying treap is ordered by both SortKey and SearchKey. TreapMap also maintains KeyMng to recover SortKey from SearchKey. It could be a HashMap.

If TreapMap is indexed in the same key as the inside treap. The SortKey can be deprecated to () and the KeyMng can be deprecated to a unit type. Since it is compiled through static dispatch, unnecessary operations will be optimized away.

Required Associated Types§

source

type SearchKey

The search key type in the TreapMap, supporting query/remove a node by key.

source

type SortKey

The sort key in the treap.

source

type Value: Clone

The stored value.

source

type ExtMap: KeyMngTrait<Self>

The external map which can computing SortKey from SearchKey. If not needed, it could be a unit type.

source

type Weight: ConsoliableWeight

The consolidable weight.

Required Methods§

source

fn next_node_dir( me: (&Self::SortKey, &Self::SearchKey), other: (&Self::SortKey, &Self::SearchKey) ) -> Option<Direction>

Compare the key.

Object Safety§

This trait is not object safe.

Implementors§