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 header(&self) -> BlockHeader<'_>
pub fn header(&self) -> BlockHeader<'_>
Get block header
Sourcepub fn from_block(block: Block<'_>) -> Result<Self, OwnedBlockError>
pub fn from_block(block: Block<'_>) -> Result<Self, OwnedBlockError>
Create owned block from a reference
Sourcepub fn from_buffers(
header: SharedAlignedBuffer,
body: SharedAlignedBuffer,
shard_kind: ShardKind,
) -> Option<Self>
pub fn from_buffers( header: SharedAlignedBuffer, body: SharedAlignedBuffer, shard_kind: ShardKind, ) -> Option<Self>
Create owned block from buffers
Trait Implementations§
Source§impl Clone for OwnedBlock
impl Clone for OwnedBlock
Source§fn clone(&self) -> OwnedBlock
fn clone(&self) -> OwnedBlock
Returns a copy 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 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
Converts to this type from the input type.
Source§impl From<OwnedIntermediateShardBlock> for OwnedBlock
impl From<OwnedIntermediateShardBlock> for OwnedBlock
Source§fn from(value: OwnedIntermediateShardBlock) -> Self
fn from(value: OwnedIntermediateShardBlock) -> Self
Converts to this type from the input type.
Source§impl From<OwnedLeafShardBlock> for OwnedBlock
impl From<OwnedLeafShardBlock> for OwnedBlock
Source§fn from(value: OwnedLeafShardBlock) -> Self
fn from(value: OwnedLeafShardBlock) -> Self
Converts to this type from the input type.
Source§impl GenericOwnedBlock for OwnedBlock
impl GenericOwnedBlock for OwnedBlock
Source§type Header = OwnedBlockHeader
type Header = OwnedBlockHeader
Block header type
Source§type Body = OwnedBlockBody
type Body = OwnedBlockBody
Block body type
Auto Trait Implementations§
impl Freeze for OwnedBlock
impl RefUnwindSafe for OwnedBlock
impl Send for OwnedBlock
impl Sync for OwnedBlock
impl Unpin for OwnedBlock
impl UnwindSafe for OwnedBlock
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