pub struct OwnedBeaconChainHeader { /* private fields */ }Expand description
An owned version of BeaconChainHeader.
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 OwnedBeaconChainHeader
impl OwnedBeaconChainHeader
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,
intermediate_shard_blocks_root: &Blake3Hash,
consensus_parameters: &BlockHeaderConsensusParameters<'_>,
) -> Result<OwnedBeaconChainHeaderUnsealed, BlockHeaderConsistencyError>
pub fn from_parts( prefix: &BlockHeaderPrefix, result: &BlockHeaderResult, consensus_info: &BlockHeaderConsensusInfo, intermediate_shard_blocks_root: &Blake3Hash, consensus_parameters: &BlockHeaderConsensusParameters<'_>, ) -> Result<OwnedBeaconChainHeaderUnsealed, BlockHeaderConsistencyError>
Create a new OwnedBeaconChainHeader 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,
intermediate_shard_blocks_root: &Blake3Hash,
consensus_parameters: &BlockHeaderConsensusParameters<'_>,
buffer: &'a mut OwnedAlignedBuffer,
) -> Result<OwnedBeaconChainHeaderUnsealedRef<'a>, OwnedBeaconChainHeaderError>
pub fn from_parts_into<'a>( prefix: &BlockHeaderPrefix, result: &BlockHeaderResult, consensus_info: &BlockHeaderConsensusInfo, intermediate_shard_blocks_root: &Blake3Hash, consensus_parameters: &BlockHeaderConsensusParameters<'_>, buffer: &'a mut OwnedAlignedBuffer, ) -> Result<OwnedBeaconChainHeaderUnsealedRef<'a>, OwnedBeaconChainHeaderError>
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
OwnedBeaconChainHeaderUnsealedRef::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) -> &BeaconChainHeader<'_>
pub fn header(&self) -> &BeaconChainHeader<'_>
Get BeaconChainHeader out of OwnedBeaconChainHeader
Trait Implementations§
Source§impl Clone for OwnedBeaconChainHeader
impl Clone for OwnedBeaconChainHeader
Source§impl Debug for OwnedBeaconChainHeader
impl Debug for OwnedBeaconChainHeader
Source§impl From<OwnedBeaconChainHeader> for OwnedBlockHeader
impl From<OwnedBeaconChainHeader> for OwnedBlockHeader
Source§fn from(value: OwnedBeaconChainHeader) -> Self
fn from(value: OwnedBeaconChainHeader) -> Self
Source§impl GenericOwnedBlockHeader for OwnedBeaconChainHeader
impl GenericOwnedBlockHeader for OwnedBeaconChainHeader
Source§const SHARD_KIND: RealShardKind = RealShardKind::BeaconChain
const SHARD_KIND: RealShardKind = RealShardKind::BeaconChain
Source§type Header<'a> = BeaconChainHeader<'a>
type Header<'a> = BeaconChainHeader<'a>
Source§fn from_buffer(buffer: SharedAlignedBuffer) -> Result<Self, SharedAlignedBuffer>
fn from_buffer(buffer: SharedAlignedBuffer) -> Result<Self, SharedAlignedBuffer>
Auto Trait Implementations§
impl Forget for OwnedBeaconChainHeader
impl Freeze for OwnedBeaconChainHeader
impl RefUnwindSafe for OwnedBeaconChainHeader
impl Send for OwnedBeaconChainHeader
impl Sync for OwnedBeaconChainHeader
impl Unpin for OwnedBeaconChainHeader
impl UnsafeUnpin for OwnedBeaconChainHeader
impl UnwindSafe for OwnedBeaconChainHeader
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