Skip to main content

Hash

Trait Hash 

Source
pub trait Hash {
    // Required method
    fn hash(&self) -> SHA256Hash;
}
Expand description

SHA-256 of a value’s CXS encoding.

The blanket impl covers every WriteXDR type: it encodes the value into the shared scratch buffer and hashes the bytes. Under the alloc feature the scratch grows to fit, so there is no size limit. In the no-alloc guest the scratch is a fixed SCRATCH_MAX (4 KiB) buffer; a value whose encoding exceeds it throws HandlingError::EncodingException (a non-returning library exception), matching how terminal returns and aborts handle the same overflow.

Required Methods§

Source

fn hash(&self) -> SHA256Hash

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T> Hash for T
where T: WriteXDR,