pub struct OwnedLeafShardHeader { /* private fields */ }Expand description
An owned version of LeafShardHeader.
It is correctly aligned in memory and well suited for sending and receiving over the network efficiently or storing in memory or on disk.
Implementations§
Source§impl OwnedLeafShardHeader
impl OwnedLeafShardHeader
Sourcepub const MAX_ALLOCATION: u32
pub const MAX_ALLOCATION: u32
Max allocation needed by this header
Sourcepub fn from_parts(
prefix: &BlockHeaderPrefix,
result: &BlockHeaderResult,
consensus_info: &BlockHeaderConsensusInfo,
beacon_chain_info: &BlockHeaderBeaconChainInfo,
) -> Result<OwnedLeafShardHeaderUnsealed, BlockHeaderConsistencyError>
pub fn from_parts( prefix: &BlockHeaderPrefix, result: &BlockHeaderResult, consensus_info: &BlockHeaderConsensusInfo, beacon_chain_info: &BlockHeaderBeaconChainInfo, ) -> Result<OwnedLeafShardHeaderUnsealed, BlockHeaderConsistencyError>
Create a new OwnedLeafShardHeader from its parts.
Returns an error if the parts are not consistent with each other or with the shard kind.
Sourcepub fn from_parts_into<'a>(
prefix: &BlockHeaderPrefix,
result: &BlockHeaderResult,
consensus_info: &BlockHeaderConsensusInfo,
beacon_chain_info: &BlockHeaderBeaconChainInfo,
buffer: &'a mut OwnedAlignedBuffer,
) -> Result<OwnedLeafShardHeaderUnsealedRef<'a>, OwnedLeafShardHeaderError>
pub fn from_parts_into<'a>( prefix: &BlockHeaderPrefix, result: &BlockHeaderResult, consensus_info: &BlockHeaderConsensusInfo, beacon_chain_info: &BlockHeaderBeaconChainInfo, buffer: &'a mut OwnedAlignedBuffer, ) -> Result<OwnedLeafShardHeaderUnsealedRef<'a>, OwnedLeafShardHeaderError>
Write a header from its parts into the provided buffer, after the bytes already there.
The length of the buffer must be a multiple of 8 for the header to parse.
Returns an error if the parts are not consistent with each other or with the shard kind.
The seal is not attached, the header in the buffer is complete only after
OwnedLeafShardHeaderUnsealedRef::with_seal() attaches it. Nothing is written when an
error is returned, otherwise the seal is guaranteed to fit.
Sourcepub fn from_buffer(
buffer: SharedAlignedBuffer,
) -> Result<Self, SharedAlignedBuffer>
pub fn from_buffer( buffer: SharedAlignedBuffer, ) -> Result<Self, SharedAlignedBuffer>
Create an owned header from a buffer
Sourcepub fn header(&self) -> &LeafShardHeader<'_>
pub fn header(&self) -> &LeafShardHeader<'_>
Get LeafShardHeader out of OwnedLeafShardHeader
Trait Implementations§
Source§impl Clone for OwnedLeafShardHeader
impl Clone for OwnedLeafShardHeader
Source§impl Debug for OwnedLeafShardHeader
impl Debug for OwnedLeafShardHeader
Source§impl From<OwnedLeafShardHeader> for OwnedBlockHeader
impl From<OwnedLeafShardHeader> for OwnedBlockHeader
Source§fn from(value: OwnedLeafShardHeader) -> Self
fn from(value: OwnedLeafShardHeader) -> Self
Source§impl GenericOwnedBlockHeader for OwnedLeafShardHeader
impl GenericOwnedBlockHeader for OwnedLeafShardHeader
Source§const SHARD_KIND: RealShardKind = RealShardKind::LeafShard
const SHARD_KIND: RealShardKind = RealShardKind::LeafShard
Source§type Header<'a> = LeafShardHeader<'a>
type Header<'a> = LeafShardHeader<'a>
Source§fn from_buffer(buffer: SharedAlignedBuffer) -> Result<Self, SharedAlignedBuffer>
fn from_buffer(buffer: SharedAlignedBuffer) -> Result<Self, SharedAlignedBuffer>
Auto Trait Implementations§
impl Forget for OwnedLeafShardHeader
impl Freeze for OwnedLeafShardHeader
impl RefUnwindSafe for OwnedLeafShardHeader
impl Send for OwnedLeafShardHeader
impl Sync for OwnedLeafShardHeader
impl Unpin for OwnedLeafShardHeader
impl UnsafeUnpin for OwnedLeafShardHeader
impl UnwindSafe for OwnedLeafShardHeader
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
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> ⓘ
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> ⓘ
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