pub struct NetworkBlock { /* private fields */ }Expand description
A network block contains:
- An era tag identifying the Cardano era of the block, which determines its exact encoding.
- The block itself, encoded in CBOR format as per the Cardano network protocol.
From a NetworkBlock we can obtain:
- The raw CBOR bytes of the block, wrapped in a
RawBlock. - The decoded
Blockstructure, by decoding the inner CBOR bytes. - The decoded
BlockHeader, by decoding only the header part of the inner CBOR bytes.
Implementations§
Source§impl NetworkBlock
impl NetworkBlock
pub fn new( era_history: &EraHistory, block: &Block, ) -> Result<Self, EraHistoryError>
pub fn era_tag(&self) -> EraName
pub fn raw_block(&self) -> RawBlock
Sourcepub fn decode_block(&self) -> Result<Block, Error>
pub fn decode_block(&self) -> Result<Block, Error>
Decode the inner block from its raw CBOR representation.
Sourcepub fn decode_header(&self) -> Result<BlockHeader, Error>
pub fn decode_header(&self) -> Result<BlockHeader, Error>
Decode only the header from the raw CBOR representation of the block.
Trait Implementations§
Source§impl Clone for NetworkBlock
impl Clone for NetworkBlock
Source§fn clone(&self) -> NetworkBlock
fn clone(&self) -> NetworkBlock
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for NetworkBlock
impl Debug for NetworkBlock
Source§impl<'b> Decode<'b, ()> for NetworkBlock
impl<'b> Decode<'b, ()> for NetworkBlock
Source§impl<'de> Deserialize<'de> for NetworkBlock
impl<'de> Deserialize<'de> for NetworkBlock
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Encode<()> for NetworkBlock
impl Encode<()> for NetworkBlock
Source§impl Hash for NetworkBlock
impl Hash for NetworkBlock
Source§impl Ord for NetworkBlock
impl Ord for NetworkBlock
Source§fn cmp(&self, other: &NetworkBlock) -> Ordering
fn cmp(&self, other: &NetworkBlock) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for NetworkBlock
impl PartialEq for NetworkBlock
Source§impl PartialOrd for NetworkBlock
impl PartialOrd for NetworkBlock
Source§impl Serialize for NetworkBlock
impl Serialize for NetworkBlock
Source§impl TryFrom<RawBlock> for NetworkBlock
impl TryFrom<RawBlock> for NetworkBlock
impl Eq for NetworkBlock
impl StructuralPartialEq for NetworkBlock
Auto Trait Implementations§
impl Freeze for NetworkBlock
impl RefUnwindSafe for NetworkBlock
impl Send for NetworkBlock
impl Sync for NetworkBlock
impl Unpin for NetworkBlock
impl UnsafeUnpin for NetworkBlock
impl UnwindSafe for NetworkBlock
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more