pub struct OwnedIntermediateShardBlock {
pub header: OwnedIntermediateShardHeader,
pub body: OwnedIntermediateShardBody,
}Expand description
An owned version of IntermediateShardBlock.
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: OwnedIntermediateShardHeaderBlock header
body: OwnedIntermediateShardBodyBlock body
Implementations§
Source§impl OwnedIntermediateShardBlock
impl OwnedIntermediateShardBlock
Sourcepub fn init<'a, OS, LSB>(
own_segments: OS,
leaf_shard_blocks: LSB,
) -> Result<OwnedIntermediateShardBlockBuilder, OwnedIntermediateShardBodyError>where
OS: TrustedLen<Item = (LocalSegmentIndex, SegmentRoot)>,
LSB: TrustedLen<Item = LeafShardBlockInfo<'a>> + 'a,
pub fn init<'a, OS, LSB>(
own_segments: OS,
leaf_shard_blocks: LSB,
) -> Result<OwnedIntermediateShardBlockBuilder, OwnedIntermediateShardBodyError>where
OS: TrustedLen<Item = (LocalSegmentIndex, SegmentRoot)>,
LSB: TrustedLen<Item = LeafShardBlockInfo<'a>> + 'a,
Initialize building of OwnedIntermediateShardBlock
Sourcepub fn from_parts(
header: OwnedIntermediateShardHeader,
body: OwnedIntermediateShardBody,
) -> Result<Self, (OwnedIntermediateShardHeader, OwnedIntermediateShardBody)>
pub fn from_parts( header: OwnedIntermediateShardHeader, body: OwnedIntermediateShardBody, ) -> Result<Self, (OwnedIntermediateShardHeader, OwnedIntermediateShardBody)>
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) -> IntermediateShardBlock<'_>
pub fn block(&self) -> IntermediateShardBlock<'_>
Trait Implementations§
Source§impl Clone for OwnedIntermediateShardBlock
impl Clone for OwnedIntermediateShardBlock
Source§impl Debug for OwnedIntermediateShardBlock
impl Debug for OwnedIntermediateShardBlock
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 GenericOwnedBlock for OwnedIntermediateShardBlock
impl GenericOwnedBlock for OwnedIntermediateShardBlock
Source§const SHARD_KIND: RealShardKind = RealShardKind::IntermediateShard
const SHARD_KIND: RealShardKind = RealShardKind::IntermediateShard
Shard kind
Source§type Header = OwnedIntermediateShardHeader
type Header = OwnedIntermediateShardHeader
Block header type
Source§type Body = OwnedIntermediateShardBody
type Body = OwnedIntermediateShardBody
Block body type
Source§type Block<'a> = IntermediateShardBlock<'a>
type Block<'a> = IntermediateShardBlock<'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 OwnedIntermediateShardBlock
impl Freeze for OwnedIntermediateShardBlockwhere
*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,
impl Move for OwnedIntermediateShardBlock
impl RefUnwindSafe for OwnedIntermediateShardBlock
impl Send for OwnedIntermediateShardBlockwhere
Arc<Yoke<IntermediateShardHeader<'static>, SharedAlignedBuffer>>: Send,
Arc<Yoke<IntermediateShardBody<'static>, SharedAlignedBuffer>>: Send,
impl Sync for OwnedIntermediateShardBlockwhere
Arc<Yoke<IntermediateShardHeader<'static>, SharedAlignedBuffer>>: Sync,
Arc<Yoke<IntermediateShardBody<'static>, SharedAlignedBuffer>>: Sync,
impl Unpin for OwnedIntermediateShardBlockwhere
*const ArcInner<Yoke<IntermediateShardHeader<'static>, SharedAlignedBuffer>> is !null: Unpin,
&'static BlockHeaderPrefix: Unpin,
&'static BlockHeaderResult: Unpin,
&'static BlockHeaderConsensusInfo: Unpin,
&'static BlockHeaderEd25519Seal: Unpin,
&'static BlockHeaderBeaconChainInfo: Unpin,
&'static Blake3Hash: Unpin,
&'static [u8]: Unpin,
Align4<u32>: Unpin,
*const u8 is !null: Unpin,
*const ArcInner<Yoke<IntermediateShardBody<'static>, SharedAlignedBuffer>> is !null: Unpin,
&'static [SegmentRoot]: Unpin,
impl UnsafeUnpin for OwnedIntermediateShardBlockwhere
*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,
impl UnwindSafe for OwnedIntermediateShardBlockwhere
Arc<Yoke<IntermediateShardHeader<'static>, SharedAlignedBuffer>>: UnwindSafe,
Arc<Yoke<IntermediateShardBody<'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