pub trait Block: Clone {
type Identifier: Clone + Eq + Hash;
// Required methods
fn id(&self) -> Self::Identifier;
fn parent_id(&self) -> Option<Self::Identifier>;
}Expand description
A block contains a hash, and reference a parent block via parent hash.
Required Associated Types§
Sourcetype Identifier: Clone + Eq + Hash
type Identifier: Clone + Eq + Hash
Hash type of the block.
Required Methods§
Sourcefn id(&self) -> Self::Identifier
fn id(&self) -> Self::Identifier
Get the block hash.
Sourcefn parent_id(&self) -> Option<Self::Identifier>
fn parent_id(&self) -> Option<Self::Identifier>
Get the parent block hash. None if this block is genesis.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".