pub trait TrieStream {
// Required methods
fn new() -> Self;
fn append_empty_data(&mut self);
fn begin_branch(
&mut self,
maybe_key: Option<&[u8]>,
maybe_value: Option<Value<'_>>,
has_children: impl Iterator<Item = bool>,
);
fn append_leaf(&mut self, key: &[u8], value: Value<'_>);
fn append_extension(&mut self, key: &[u8]);
fn append_substream<H: Hasher>(&mut self, other: Self);
fn out(self) -> Vec<u8> ⓘ;
// Provided methods
fn append_empty_child(&mut self) { ... }
fn end_branch(&mut self, _value: Option<Value<'_>>) { ... }
}
Expand description
Byte-stream oriented trait for constructing closed-form tries.
Required Methods§
Sourcefn append_empty_data(&mut self)
fn append_empty_data(&mut self)
Append an Empty node
Sourcefn begin_branch(
&mut self,
maybe_key: Option<&[u8]>,
maybe_value: Option<Value<'_>>,
has_children: impl Iterator<Item = bool>,
)
fn begin_branch( &mut self, maybe_key: Option<&[u8]>, maybe_value: Option<Value<'_>>, has_children: impl Iterator<Item = bool>, )
Start a new Branch node, possibly with a value; takes a list indicating which slots in the Branch node has further child nodes.
Sourcefn append_leaf(&mut self, key: &[u8], value: Value<'_>)
fn append_leaf(&mut self, key: &[u8], value: Value<'_>)
Append a Leaf node
Sourcefn append_extension(&mut self, key: &[u8])
fn append_extension(&mut self, key: &[u8])
Append an Extension node
Sourcefn append_substream<H: Hasher>(&mut self, other: Self)
fn append_substream<H: Hasher>(&mut self, other: Self)
Append a Branch of Extension substream
Provided Methods§
Sourcefn append_empty_child(&mut self)
fn append_empty_child(&mut self)
Append an empty child node. Optional.
Sourcefn end_branch(&mut self, _value: Option<Value<'_>>)
fn end_branch(&mut self, _value: Option<Value<'_>>)
Wrap up a Branch node portion of a TrieStream
and append the value
stored on the Branch (if any).
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.