Trait GhtGet

Source
pub trait GhtGet: GeneralizedHashTrieNode {
    type Get: GeneralizedHashTrieNode<Schema = Self::Schema>;

    // Required methods
    fn get<'a>(&'a self, head: &Self::Head) -> Option<&'a Self::Get>;
    fn get_mut<'a>(&'a mut self, head: &Self::Head) -> Option<&'a mut Self::Get>;
    fn iter(&self) -> impl Iterator<Item = Self::Head>;
    fn iter_tuples(
        &self,
    ) -> impl Iterator<Item = <Self::Schema as VariadicExt>::AsRefVar<'_>>;
}
Expand description

A trait for the get and iter methods from Wang/Willsey/Suciu, which work differently on leaves than internal nodes

Required Associated Types§

Source

type Get: GeneralizedHashTrieNode<Schema = Self::Schema>

Type returned by Self::get.

Required Methods§

Source

fn get<'a>(&'a self, head: &Self::Head) -> Option<&'a Self::Get>

On an Inner node, retrieves the value (child) associated with the given “head” key. returns an Option containing a reference to the value if found, or None if not found. On a Leaf node, returns None.

Source

fn get_mut<'a>(&'a mut self, head: &Self::Head) -> Option<&'a mut Self::Get>

get, but mutable output

Source

fn iter(&self) -> impl Iterator<Item = Self::Head>

Iterator for the “head” keys (from inner nodes) or nothing (from leaf nodes).

Source

fn iter_tuples( &self, ) -> impl Iterator<Item = <Self::Schema as VariadicExt>::AsRefVar<'_>>

Iterator for the tuples (from leaf nodes) or nothing (from inner nodes).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<Head, Node> GhtGet for GhtInner<Head, Node>
where Head: 'static + Eq + Hash + Clone, Node: 'static + GeneralizedHashTrieNode, Node::Schema: SplitBySuffix<(Head, Node::SuffixSchema)>,

Source§

type Get = Node

Source§

impl<Schema, ValType, Storage> GhtGet for GhtLeaf<Schema, ValType, Storage>
where Schema: 'static + Eq + Hash + Clone + PartialEqVariadic + SplitBySuffix<ValType>, ValType: Eq + Hash + Clone + PartialEqVariadic, <Schema as SplitBySuffix<ValType>>::Prefix: Eq + Hash + Clone, GhtLeaf<Schema, ValType, Storage>: GeneralizedHashTrieNode<Schema = Schema>, Storage: VariadicCollection<Schema = Schema>,

Source§

type Get = GhtLeaf<Schema, ValType, Storage>