pub trait Block: Clone {
type Hash: BlockHash;
// Required method
fn hash(&self) -> Self::Hash;
}Expand description
A view over the application layer’s block.
The [BorshSerialize] implementation MUST be infallible if the underlying writer is
infallible. The [BorshDeserialize] implementation MUST be infallible if it is deserializing a
value which was successfully serialized, from a well-formed reader.
Required Associated Types§
Sourcetype Hash: BlockHash
type Hash: BlockHash
The AsRef<[u8]> implementation MUST return a slice with a consistent length for any
value, meaning it’s constant.
The [BorshSerialize] implementation MUST be infallible if the underlying writer is
infallible. The [BorshDeserialize] implementation MUST be infallible if it is deserializing
a value which was successfully serialized, from a well-formed reader.
Required Methods§
Sourcefn hash(&self) -> Self::Hash
fn hash(&self) -> Self::Hash
The block’s hash.
This MUST be cryptographically binding to the entirety of the block.
For two blocks, b1 and b2, b1 == b2 MUST equal b1.hash() == b2.hash(), except with
negligible probability (per the binding property).
This MUST always return the same hash for a value upon each call.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".