pub struct OwnedBeaconChainBlock {
pub header: OwnedBeaconChainHeader,
pub body: OwnedBeaconChainBody,
}Expand description
An owned version of BeaconChainBlock.
It is correctly aligned in memory and well suited for sending and receiving over the network efficiently or storing in memory or on disk.
Fields can’t be modified after creation, so that the header always corresponds to the body, which constructors ensure.
Fields§
§header: OwnedBeaconChainHeaderBlock header
body: OwnedBeaconChainBodyBlock body
Implementations§
Source§impl OwnedBeaconChainBlock
impl OwnedBeaconChainBlock
Sourcepub fn init<'a, OS, ISB>(
own_segments: OS,
intermediate_shard_blocks: ISB,
pot_checkpoints: &[PotCheckpoints],
) -> Result<OwnedBeaconChainBlockBuilder, OwnedBeaconChainBodyError>where
OS: TrustedLen<Item = (LocalSegmentIndex, SegmentRoot)>,
ISB: TrustedLen<Item = IntermediateShardBlockInfo<'a>> + 'a,
pub fn init<'a, OS, ISB>(
own_segments: OS,
intermediate_shard_blocks: ISB,
pot_checkpoints: &[PotCheckpoints],
) -> Result<OwnedBeaconChainBlockBuilder, OwnedBeaconChainBodyError>where
OS: TrustedLen<Item = (LocalSegmentIndex, SegmentRoot)>,
ISB: TrustedLen<Item = IntermediateShardBlockInfo<'a>> + 'a,
Initialize building of OwnedBeaconChainBlock
Sourcepub fn from_parts(
header: OwnedBeaconChainHeader,
body: OwnedBeaconChainBody,
) -> Result<Self, (OwnedBeaconChainHeader, OwnedBeaconChainBody)>
pub fn from_parts( header: OwnedBeaconChainHeader, body: OwnedBeaconChainBody, ) -> Result<Self, (OwnedBeaconChainHeader, OwnedBeaconChainBody)>
Create owned block from a header and a body.
Returns them back if the header doesn’t correspond to the body.
Sourcepub fn from_buffers(
header: SharedAlignedBuffer,
body: SharedAlignedBuffer,
) -> Result<Self, (SharedAlignedBuffer, SharedAlignedBuffer)>
pub fn from_buffers( header: SharedAlignedBuffer, body: SharedAlignedBuffer, ) -> Result<Self, (SharedAlignedBuffer, SharedAlignedBuffer)>
Create owned block from buffers.
Returns them back if they don’t contain a header and a body of a block.
Sourcepub fn from_buffer(
buffer: SharedAlignedBuffer,
) -> Result<Self, SharedAlignedBuffer>
pub fn from_buffer( buffer: SharedAlignedBuffer, ) -> Result<Self, SharedAlignedBuffer>
Create owned block from a buffer with a whole block, see
GenericOwnedBlock::from_buffer()
Sourcepub fn block(&self) -> BeaconChainBlock<'_>
pub fn block(&self) -> BeaconChainBlock<'_>
Get BeaconChainBlock out of OwnedBeaconChainBlock
Trait Implementations§
Source§impl Clone for OwnedBeaconChainBlock
impl Clone for OwnedBeaconChainBlock
Source§impl Debug for OwnedBeaconChainBlock
impl Debug for OwnedBeaconChainBlock
Source§impl From<OwnedBeaconChainBlock> for OwnedBlock
impl From<OwnedBeaconChainBlock> for OwnedBlock
Source§fn from(value: OwnedBeaconChainBlock) -> Self
fn from(value: OwnedBeaconChainBlock) -> Self
Converts to this type from the input type.
Source§impl GenericOwnedBlock for OwnedBeaconChainBlock
impl GenericOwnedBlock for OwnedBeaconChainBlock
Source§const SHARD_KIND: RealShardKind = RealShardKind::BeaconChain
const SHARD_KIND: RealShardKind = RealShardKind::BeaconChain
Shard kind
Source§type Header = OwnedBeaconChainHeader
type Header = OwnedBeaconChainHeader
Block header type
Source§type Body = OwnedBeaconChainBody
type Body = OwnedBeaconChainBody
Block body type
Source§type Block<'a> = BeaconChainBlock<'a>
type Block<'a> = BeaconChainBlock<'a>
Block
Source§fn from_parts(
header: Self::Header,
body: Self::Body,
) -> Result<Self, (Self::Header, Self::Body)>
fn from_parts( header: Self::Header, body: Self::Body, ) -> Result<Self, (Self::Header, Self::Body)>
Create owned block from a header and a body. Read more
Source§fn from_buffers(
header: SharedAlignedBuffer,
body: SharedAlignedBuffer,
) -> Result<Self, (SharedAlignedBuffer, SharedAlignedBuffer)>
fn from_buffers( header: SharedAlignedBuffer, body: SharedAlignedBuffer, ) -> Result<Self, (SharedAlignedBuffer, SharedAlignedBuffer)>
Create owned block from buffers. Read more
Source§fn from_buffer(buffer: SharedAlignedBuffer) -> Result<Self, SharedAlignedBuffer>
fn from_buffer(buffer: SharedAlignedBuffer) -> Result<Self, SharedAlignedBuffer>
Create owned block from a buffer with a whole block, see
Block::try_from_bytes() for the
layout. Read moreAuto Trait Implementations§
impl Forget for OwnedBeaconChainBlock
impl Freeze for OwnedBeaconChainBlockwhere
*const ArcInner<Yoke<BeaconChainHeader<'static>, SharedAlignedBuffer>> is !null: Freeze,
PhantomData<Yoke<BeaconChainHeader<'static>, SharedAlignedBuffer>>: Freeze,
*const ArcInner<Yoke<BeaconChainBody<'static>, SharedAlignedBuffer>> is !null: Freeze,
PhantomData<Yoke<BeaconChainBody<'static>, SharedAlignedBuffer>>: Freeze,
impl Move for OwnedBeaconChainBlock
impl RefUnwindSafe for OwnedBeaconChainBlockwhere
Atomic<usize>: RefUnwindSafe,
NonZero<u32>: RefUnwindSafe,
NonZero<u16>: RefUnwindSafe,
OnceLock<BlockRoot>: RefUnwindSafe,
impl Send for OwnedBeaconChainBlockwhere
Arc<Yoke<BeaconChainHeader<'static>, SharedAlignedBuffer>>: Send,
Arc<Yoke<BeaconChainBody<'static>, SharedAlignedBuffer>>: Send,
impl Sync for OwnedBeaconChainBlockwhere
Arc<Yoke<BeaconChainHeader<'static>, SharedAlignedBuffer>>: Sync,
Arc<Yoke<BeaconChainBody<'static>, SharedAlignedBuffer>>: Sync,
impl Unpin for OwnedBeaconChainBlockwhere
*const ArcInner<Yoke<BeaconChainHeader<'static>, SharedAlignedBuffer>> is !null: Unpin,
&'static BlockHeaderPrefix: Unpin,
&'static BlockHeaderResult: Unpin,
&'static BlockHeaderConsensusInfo: Unpin,
&'static BlockHeaderEd25519Seal: Unpin,
&'static Blake3Hash: Unpin,
NonZero<u32>: Unpin,
NonZero<u16>: Unpin,
&'static SuperSegmentRoot: Unpin,
&'static BlockHeaderPotParametersChange: Unpin,
&'static [u8]: Unpin,
Align4<u32>: Unpin,
*const u8 is !null: Unpin,
*const ArcInner<Yoke<BeaconChainBody<'static>, SharedAlignedBuffer>> is !null: Unpin,
&'static [SegmentRoot]: Unpin,
&'static [PotCheckpoints]: Unpin,
impl UnsafeUnpin for OwnedBeaconChainBlockwhere
*const ArcInner<Yoke<BeaconChainHeader<'static>, SharedAlignedBuffer>> is !null: UnsafeUnpin,
PhantomData<Yoke<BeaconChainHeader<'static>, SharedAlignedBuffer>>: UnsafeUnpin,
*const ArcInner<Yoke<BeaconChainBody<'static>, SharedAlignedBuffer>> is !null: UnsafeUnpin,
PhantomData<Yoke<BeaconChainBody<'static>, SharedAlignedBuffer>>: UnsafeUnpin,
impl UnwindSafe for OwnedBeaconChainBlockwhere
Arc<Yoke<BeaconChainHeader<'static>, SharedAlignedBuffer>>: UnwindSafe,
Arc<Yoke<BeaconChainBody<'static>, SharedAlignedBuffer>>: UnwindSafe,
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