pub struct LastCv { /* private fields */ }Expand description
The chaining value of a message’s last subtree, with its place and length: the right child at some level of the tree’s right edge. It may be shorter than its left sibling, and is never a left child: no call takes one on the left, so a tree with a short subtree inside it does not compile.
ⓘ
use blake3_servil_core::{Mode, throughput::TreeHasher};
let tree = TreeHasher::new(Mode::Plain);
let end = tree.last_cv(1, &[7u8; 100]);
let next = tree.subtree_cv(0, 2, &[7u8; 1024]);
let _ = tree.parent_cv(&end, &next); // a short subtree on the leftA whole subtree that ends the message becomes one by LastCv::from:
the program says that the message ends there.
Equality and Debug are as Cv’s.
§Trait implementations
Clonereproduces the value, starting chunk and length.Copycopies those coordinates along with the chaining bytes.Debugshows the starting chunk and length without exposing chaining bytes.Eqidentifies values with equal coordinates and bytes.From(of aCv) keeps a whole subtree’s bytes and records its first chunk and full length, on the caller’s word that the message ends there; it panics on aCvthat was never set.PartialEqcompares both coordinates and compares the chaining bytes in constant time.
Implementations§
Source§impl LastCv
impl LastCv
Sourcepub const fn at(first_chunk: u64, len: u64, bytes: [u8; 32]) -> Self
pub const fn at(first_chunk: u64, len: u64, bytes: [u8; 32]) -> Self
A chaining value a program stored or received, for the last
subtree: the message’s last len bytes, which begin at its chunk
first_chunk.
Requires what TreeHasher::last_cv does of the place and the
length.
Sourcepub const fn first_chunk(&self) -> u64
pub const fn first_chunk(&self) -> u64
The message’s chunk the subtree begins at.
Trait Implementations§
impl Copy for LastCv
impl Eq for LastCv
Auto Trait Implementations§
impl Freeze for LastCv
impl RefUnwindSafe for LastCv
impl Send for LastCv
impl Sync for LastCv
impl Unpin for LastCv
impl UnsafeUnpin for LastCv
impl UnwindSafe for LastCv
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
Mutably borrows from an owned value. Read more