pub struct HashTreeBuilder { /* private fields */ }Expand description
An incremental Blake3 hasher that also maintains an array representation of the full Blake3 tree, the generated array will be in the same stack ordering as Blake3.
The number is this tree are the index of each of these nodes in the array representation, and because of how Blake3 functions, the left subtree will always contain a power of 2 number of chunks.
8
/ \
/ \
6 7
/ \
/ \
/ \
2 5
/ \ / \
/ \ / \
0 1 3 4
Implementations§
Source§impl HashTreeBuilder
impl HashTreeBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new HashTreeBuilder with the default IV.
Sourcepub fn update(&mut self, input: &[u8])
pub fn update(&mut self, input: &[u8])
Input some more bytes to this hasher, this function is always single-threaded
use Self::update_rayon to achieve multi-threaded implementation with rayon.
Also for the best performance it is recommended that you feed full blocks to this function or at least powers of two.
Sourcepub fn update_rayon(&mut self, input: &[u8])
pub fn update_rayon(&mut self, input: &[u8])
Just like update but runs the hasher using rayon for work-stealing and parallelism.
pub fn update_with_join<J: Join>(&mut self, input: &[u8])
Trait Implementations§
Source§impl Clone for HashTreeBuilder
impl Clone for HashTreeBuilder
Source§fn clone(&self) -> HashTreeBuilder
fn clone(&self) -> HashTreeBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for HashTreeBuilder
impl RefUnwindSafe for HashTreeBuilder
impl Send for HashTreeBuilder
impl Sync for HashTreeBuilder
impl Unpin for HashTreeBuilder
impl UnwindSafe for HashTreeBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more