pub struct Sha2_256Node(_);
Expand description

A struct for storing SHA2 256 hashes in a MerkleTree.

Trait Implementations§

source§

impl Default for Sha2_256Node

source§

fn default() -> Sha2_256Node

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for Sha2_256Node

source§

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

source§

const KIND: HashKind = HashKind::Sha2_256

The kind of hash algorithm that this HashData uses.
source§

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<()>

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<()>

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<()>

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<()>

Returns Ok(()) if the result of combining left and right is contained in self.
source§

fn try_as_slice(&self) -> Result<&[u8]>

Attempts to borrow the data in this node as a slice.
source§

fn digest<'a, I: Iterator<Item = &'a [u8]>>( dest: &mut [u8], parts: I ) -> Result<()>

Computes the hash of the data produced by the given iterator and writes it to the given slice.
source§

impl Serialize for Sha2_256Node

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Free for T

§

unsafe default fn free(ptr_ref: NonNull<T>)

Drops the content pointed by this pointer and frees it. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,