Struct btlib::crypto::merkle_stream::Sha2_256Node
source · pub struct Sha2_256Node(_);
Expand description
A struct for storing SHA2 256 hashes in a MerkleTree
.
Trait Implementations§
source§impl Default for Sha2_256Node
impl Default for Sha2_256Node
source§fn default() -> Sha2_256Node
fn default() -> Sha2_256Node
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for Sha2_256Node
impl<'de> Deserialize<'de> for Sha2_256Node
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl MerkleNode for Sha2_256Node
impl MerkleNode for Sha2_256Node
source§fn new<'a, I: Iterator<Item = &'a [u8]>>(parts: I) -> Result<Self>
fn new<'a, I: Iterator<Item = &'a [u8]>>(parts: I) -> Result<Self>
Creates a new
HashData
instance by hashing the data produced by the given iterator and
storing it in self.source§fn combine<'a, I: Iterator<Item = &'a [u8]>>(
&mut self,
prefix: I,
left: Option<&'a Self>,
right: Option<&'a Self>
) -> Result<()>
fn combine<'a, I: Iterator<Item = &'a [u8]>>( &mut self, prefix: I, left: Option<&'a Self>, right: Option<&'a Self> ) -> Result<()>
Combines the hash data from the given children and prefix and stores it in self. It is
an error for no children to be provided (though one or the other may be
None
).source§fn assert_contains(&self, hash_data: Option<&[u8]>) -> Result<()>
fn assert_contains(&self, hash_data: Option<&[u8]>) -> Result<()>
Returns
Ok(())
if self contains the given hash data, and Err(Error::HashCmpFailure)
otherwise.source§fn assert_contains_hash_of<'a, I: Iterator<Item = &'a [u8]>>(
&self,
parts: I
) -> Result<()>
fn assert_contains_hash_of<'a, I: Iterator<Item = &'a [u8]>>( &self, parts: I ) -> Result<()>
Returns
Ok(())
if self contains the hash of the given data. Otherwise,
Err(Error::HashCmpFailure)
is returned.source§fn assert_parent_of<'a, I: Iterator<Item = &'a [u8]>>(
&self,
prefix: I,
left: Option<&'a Self>,
right: Option<&'a Self>
) -> Result<()>
fn assert_parent_of<'a, I: Iterator<Item = &'a [u8]>>( &self, prefix: I, left: Option<&'a Self>, right: Option<&'a Self> ) -> Result<()>
Returns
Ok(())
if the result of combining left and right is contained in self.source§fn try_as_slice(&self) -> Result<&[u8]>
fn try_as_slice(&self) -> Result<&[u8]>
Attempts to borrow the data in this node as a slice.
Auto Trait Implementations§
impl RefUnwindSafe for Sha2_256Node
impl Send for Sha2_256Node
impl Sync for Sha2_256Node
impl Unpin for Sha2_256Node
impl UnwindSafe for Sha2_256Node
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