pub struct OwnedLeafShardBlock {
pub header: OwnedLeafShardHeader,
pub body: OwnedLeafShardBody,
}Expand description
An owned version of LeafShardBlock.
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: OwnedLeafShardHeaderBlock header
body: OwnedLeafShardBodyBlock body
Implementations§
Source§impl OwnedLeafShardBlock
impl OwnedLeafShardBlock
Sourcepub fn init<OS>(
own_segments: OS,
) -> Result<OwnedLeafShardBlockBuilder, OwnedLeafShardBodyError>
pub fn init<OS>( own_segments: OS, ) -> Result<OwnedLeafShardBlockBuilder, OwnedLeafShardBodyError>
Initialize building of OwnedLeafShardBlock
Sourcepub fn from_parts(
header: OwnedLeafShardHeader,
body: OwnedLeafShardBody,
) -> Result<Self, (OwnedLeafShardHeader, OwnedLeafShardBody)>
pub fn from_parts( header: OwnedLeafShardHeader, body: OwnedLeafShardBody, ) -> Result<Self, (OwnedLeafShardHeader, OwnedLeafShardBody)>
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) -> LeafShardBlock<'_>
pub fn block(&self) -> LeafShardBlock<'_>
Get LeafShardBlock out of OwnedLeafShardBlock
Trait Implementations§
Source§impl Clone for OwnedLeafShardBlock
impl Clone for OwnedLeafShardBlock
Source§impl Debug for OwnedLeafShardBlock
impl Debug for OwnedLeafShardBlock
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 OwnedLeafShardBlock
impl GenericOwnedBlock for OwnedLeafShardBlock
Source§const SHARD_KIND: RealShardKind = RealShardKind::LeafShard
const SHARD_KIND: RealShardKind = RealShardKind::LeafShard
Shard kind
Source§type Header = OwnedLeafShardHeader
type Header = OwnedLeafShardHeader
Block header type
Source§type Body = OwnedLeafShardBody
type Body = OwnedLeafShardBody
Block body type
Source§type Block<'a> = LeafShardBlock<'a>
type Block<'a> = LeafShardBlock<'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 OwnedLeafShardBlock
impl Freeze for OwnedLeafShardBlockwhere
*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 OwnedLeafShardBlock
impl RefUnwindSafe for OwnedLeafShardBlock
impl Send for OwnedLeafShardBlockwhere
Arc<Yoke<LeafShardHeader<'static>, SharedAlignedBuffer>>: Send,
Arc<Yoke<LeafShardBody<'static>, SharedAlignedBuffer>>: Send,
impl Sync for OwnedLeafShardBlockwhere
Arc<Yoke<LeafShardHeader<'static>, SharedAlignedBuffer>>: Sync,
Arc<Yoke<LeafShardBody<'static>, SharedAlignedBuffer>>: Sync,
impl Unpin for OwnedLeafShardBlockwhere
*const ArcInner<Yoke<LeafShardHeader<'static>, SharedAlignedBuffer>> is !null: Unpin,
&'static BlockHeaderPrefix: Unpin,
&'static BlockHeaderResult: Unpin,
&'static BlockHeaderConsensusInfo: Unpin,
&'static BlockHeaderEd25519Seal: Unpin,
&'static BlockHeaderBeaconChainInfo: Unpin,
&'static [u8]: Unpin,
Align4<u32>: Unpin,
*const u8 is !null: Unpin,
*const ArcInner<Yoke<LeafShardBody<'static>, SharedAlignedBuffer>> is !null: Unpin,
&'static [SegmentRoot]: Unpin,
impl UnsafeUnpin for OwnedLeafShardBlockwhere
*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 OwnedLeafShardBlockwhere
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
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