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) -> <Block as Block>::Id
fn id(&self) -> <Block as Block>::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) -> <Block as Block>::ChainLength
fn chain_length(&self) -> <Block as Block>::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
source§impl<'a> HasFragments<'a> for &'a Block
impl<'a> HasFragments<'a> for &'a Block
source§impl Serialize for Block
impl Serialize for Block
source§fn serialized_size(&self) -> usize
fn serialized_size(&self) -> usize
Default implementation, not efficient, not recommended to use it
fn serialize<W>(&self, codec: &mut Codec<W>) -> Result<(), WriteError>where W: Write,
source§fn serialize_as_vec(&self) -> Result<Vec<u8, Global>, WriteError>
fn serialize_as_vec(&self) -> Result<Vec<u8, Global>, WriteError>
Convenience method to serialize into a byte vector.
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
source§impl<T> DeserializeFromSlice for Twhere
T: Deserialize,
impl<T> DeserializeFromSlice for Twhere T: Deserialize,
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request