Struct chain_impl_mockchain::block::Block
source · pub struct Block {
header: Header,
contents: Contents,
}
Expand description
Block
is an element of the blockchain it contains multiple
transaction and a reference to the parent block. Alongside
with the position of that block in the chain.
Fields§
§header: Header
§contents: Contents
Implementations§
Trait Implementations§
source§impl Block for Block
impl Block for Block
source§fn id(&self) -> Self::Id
fn id(&self) -> Self::Id
Identifier of the block, currently the hash of the serialized transaction.
§type Id = Hash
type Id = Hash
the Block identifier. It must be unique. This mean that
2 different blocks have 2 different identifiers. Read more
§type Date = BlockDate
type Date = BlockDate
the block date (also known as a block number) represents the
absolute position of the block in the chain. This can be used
for random access (if the storage algorithm allows it) or for
identifying the position of a block in a given epoch or era.
§type Version = BlockVersion
type Version = BlockVersion
the type associated to the version of a block
§type ChainLength = ChainLength
type ChainLength = ChainLength
the length of the blockchain (number of blocks)
source§fn chain_length(&self) -> Self::ChainLength
fn chain_length(&self) -> Self::ChainLength
get the block’s chain length. The number of block
created following this thread of blocks on the blockchain
(including Self).
source§impl Deserialize for Block
impl Deserialize for Block
fn deserialize<R: Read>(codec: &mut Codec<R>) -> Result<Self, ReadError>
fn deserialize_validate<R>(codec: &mut Codec<R>) -> Result<(), ReadError>where R: Read,
source§impl Serialize for Block
impl Serialize for Block
impl Eq for Block
Auto Trait Implementations§
impl RefUnwindSafe for Block
impl Send for Block
impl Sync for Block
impl Unpin for Block
impl UnwindSafe for Block
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more