pub enum OwnedBlock {
BeaconChain(OwnedBeaconChainBlock),
IntermediateShard(OwnedIntermediateShardBlock),
LeafShard(OwnedLeafShardBlock),
}Expand description
An owned version of Block.
It is correctly aligned in memory and well suited for sending and receiving over the network efficiently or storing in memory or on disk.
Variants§
BeaconChain(OwnedBeaconChainBlock)
Block corresponds to the beacon chain
IntermediateShard(OwnedIntermediateShardBlock)
Block corresponds to an intermediate shard
LeafShard(OwnedLeafShardBlock)
Block corresponds to a leaf shard
Implementations§
Source§impl OwnedBlock
impl OwnedBlock
Sourcepub fn split(self) -> (OwnedBlockHeader, OwnedBlockBody)
pub fn split(self) -> (OwnedBlockHeader, OwnedBlockBody)
Split into header and body
Sourcepub fn header(&self) -> BlockHeader<'_>
pub fn header(&self) -> BlockHeader<'_>
Block header
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.
The shard kind of the block is that of the shard index in the prefix of its header, see
BlockHeader::shard_kind_from_bytes(). Returns buffers 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().
The shard kind of the block is that of the shard index in the prefix of its header, see
BlockHeader::shard_kind_from_bytes().
Trait Implementations§
Source§impl Clone for OwnedBlock
impl Clone for OwnedBlock
Source§impl Debug for OwnedBlock
impl Debug for OwnedBlock
Source§impl From<OwnedBeaconChainBlock> for OwnedBlock
impl From<OwnedBeaconChainBlock> for OwnedBlock
Source§fn from(value: OwnedBeaconChainBlock) -> Self
fn from(value: OwnedBeaconChainBlock) -> Self
Source§impl From<OwnedIntermediateShardBlock> for OwnedBlock
impl From<OwnedIntermediateShardBlock> for OwnedBlock
Source§fn from(value: OwnedIntermediateShardBlock) -> Self
fn from(value: OwnedIntermediateShardBlock) -> Self
Source§impl From<OwnedLeafShardBlock> for OwnedBlock
impl From<OwnedLeafShardBlock> for OwnedBlock
Source§fn from(value: OwnedLeafShardBlock) -> Self
fn from(value: OwnedLeafShardBlock) -> Self
Auto Trait Implementations§
impl Forget for OwnedBlock
impl Freeze for OwnedBlockwhere
*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,
*const ArcInner<Yoke<IntermediateShardHeader<'static>, SharedAlignedBuffer>> is !null: Freeze,
PhantomData<Yoke<IntermediateShardHeader<'static>, SharedAlignedBuffer>>: Freeze,
*const ArcInner<Yoke<IntermediateShardBody<'static>, SharedAlignedBuffer>> is !null: Freeze,
PhantomData<Yoke<IntermediateShardBody<'static>, SharedAlignedBuffer>>: Freeze,
*const ArcInner<Yoke<LeafShardHeader<'static>, SharedAlignedBuffer>> is !null: Freeze,
PhantomData<Yoke<LeafShardHeader<'static>, SharedAlignedBuffer>>: Freeze,
*const ArcInner<Yoke<LeafShardBody<'static>, SharedAlignedBuffer>> is !null: Freeze,
PhantomData<Yoke<LeafShardBody<'static>, SharedAlignedBuffer>>: Freeze,
impl Move for OwnedBlock
impl RefUnwindSafe for OwnedBlockwhere
Atomic<usize>: RefUnwindSafe,
NonZero<u32>: RefUnwindSafe,
NonZero<u16>: RefUnwindSafe,
OnceLock<BlockRoot>: RefUnwindSafe,
impl Send for OwnedBlockwhere
Arc<Yoke<BeaconChainHeader<'static>, SharedAlignedBuffer>>: Send,
Arc<Yoke<BeaconChainBody<'static>, SharedAlignedBuffer>>: Send,
Arc<Yoke<IntermediateShardHeader<'static>, SharedAlignedBuffer>>: Send,
Arc<Yoke<IntermediateShardBody<'static>, SharedAlignedBuffer>>: Send,
Arc<Yoke<LeafShardHeader<'static>, SharedAlignedBuffer>>: Send,
Arc<Yoke<LeafShardBody<'static>, SharedAlignedBuffer>>: Send,
impl Sync for OwnedBlockwhere
Arc<Yoke<BeaconChainHeader<'static>, SharedAlignedBuffer>>: Sync,
Arc<Yoke<BeaconChainBody<'static>, SharedAlignedBuffer>>: Sync,
Arc<Yoke<IntermediateShardHeader<'static>, SharedAlignedBuffer>>: Sync,
Arc<Yoke<IntermediateShardBody<'static>, SharedAlignedBuffer>>: Sync,
Arc<Yoke<LeafShardHeader<'static>, SharedAlignedBuffer>>: Sync,
Arc<Yoke<LeafShardBody<'static>, SharedAlignedBuffer>>: Sync,
impl Unpin for OwnedBlockwhere
*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,
*const ArcInner<Yoke<IntermediateShardHeader<'static>, SharedAlignedBuffer>> is !null: Unpin,
&'static BlockHeaderBeaconChainInfo: Unpin,
*const ArcInner<Yoke<IntermediateShardBody<'static>, SharedAlignedBuffer>> is !null: Unpin,
*const ArcInner<Yoke<LeafShardHeader<'static>, SharedAlignedBuffer>> is !null: Unpin,
*const ArcInner<Yoke<LeafShardBody<'static>, SharedAlignedBuffer>> is !null: Unpin,
impl UnsafeUnpin for OwnedBlockwhere
*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,
*const ArcInner<Yoke<IntermediateShardHeader<'static>, SharedAlignedBuffer>> is !null: UnsafeUnpin,
PhantomData<Yoke<IntermediateShardHeader<'static>, SharedAlignedBuffer>>: UnsafeUnpin,
*const ArcInner<Yoke<IntermediateShardBody<'static>, SharedAlignedBuffer>> is !null: UnsafeUnpin,
PhantomData<Yoke<IntermediateShardBody<'static>, SharedAlignedBuffer>>: UnsafeUnpin,
*const ArcInner<Yoke<LeafShardHeader<'static>, SharedAlignedBuffer>> is !null: UnsafeUnpin,
PhantomData<Yoke<LeafShardHeader<'static>, SharedAlignedBuffer>>: UnsafeUnpin,
*const ArcInner<Yoke<LeafShardBody<'static>, SharedAlignedBuffer>> is !null: UnsafeUnpin,
PhantomData<Yoke<LeafShardBody<'static>, SharedAlignedBuffer>>: UnsafeUnpin,
impl UnwindSafe for OwnedBlockwhere
Arc<Yoke<BeaconChainHeader<'static>, SharedAlignedBuffer>>: UnwindSafe,
Arc<Yoke<BeaconChainBody<'static>, SharedAlignedBuffer>>: UnwindSafe,
Arc<Yoke<IntermediateShardHeader<'static>, SharedAlignedBuffer>>: UnwindSafe,
Arc<Yoke<IntermediateShardBody<'static>, SharedAlignedBuffer>>: UnwindSafe,
Arc<Yoke<LeafShardHeader<'static>, SharedAlignedBuffer>>: UnwindSafe,
Arc<Yoke<LeafShardBody<'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
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