pub trait Version {
type NodeData: Debug;
// Required methods
fn consensus_branch_id(data: &Self::NodeData) -> u32;
fn start_height(data: &Self::NodeData) -> u64;
fn end_height(data: &Self::NodeData) -> u64;
fn combine_inner(
subtree_commitment: [u8; 32],
left: &Self::NodeData,
right: &Self::NodeData,
) -> Self::NodeData;
fn read<R: Read>(
consensus_branch_id: u32,
r: &mut R,
) -> Result<Self::NodeData>;
fn write<W: Write>(data: &Self::NodeData, w: &mut W) -> Result<()>;
// Provided methods
fn combine(left: &Self::NodeData, right: &Self::NodeData) -> Self::NodeData { ... }
fn to_bytes(data: &Self::NodeData) -> Vec<u8> ⓘ { ... }
fn from_bytes<T: AsRef<[u8]>>(
consensus_branch_id: u32,
buf: T,
) -> Result<Self::NodeData> { ... }
fn hash(data: &Self::NodeData) -> [u8; 32] { ... }
}Expand description
A version of the chain history tree.
Required Associated Types§
Required Methods§
Sourcefn consensus_branch_id(data: &Self::NodeData) -> u32
fn consensus_branch_id(data: &Self::NodeData) -> u32
Returns the consensus branch ID for the given node data.
Sourcefn start_height(data: &Self::NodeData) -> u64
fn start_height(data: &Self::NodeData) -> u64
Returns the start height for the given node data.
Sourcefn end_height(data: &Self::NodeData) -> u64
fn end_height(data: &Self::NodeData) -> u64
Returns the end height for the given node data.
Sourcefn combine_inner(
subtree_commitment: [u8; 32],
left: &Self::NodeData,
right: &Self::NodeData,
) -> Self::NodeData
fn combine_inner( subtree_commitment: [u8; 32], left: &Self::NodeData, right: &Self::NodeData, ) -> Self::NodeData
Combines two nodes metadata.
For internal use.
Provided Methods§
Sourcefn combine(left: &Self::NodeData, right: &Self::NodeData) -> Self::NodeData
fn combine(left: &Self::NodeData, right: &Self::NodeData) -> Self::NodeData
Combines two nodes’ metadata.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".