Skip to main content

OwnedLeafShardBlock

Struct OwnedLeafShardBlock 

Source
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: OwnedLeafShardHeader

Block header

§body: OwnedLeafShardBody

Block body

Implementations§

Source§

impl OwnedLeafShardBlock

Source

pub fn init<OS>( own_segments: OS, ) -> Result<OwnedLeafShardBlockBuilder, OwnedLeafShardBodyError>

Initialize building of OwnedLeafShardBlock

Source

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.

Source

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.

Source

pub fn from_buffer( buffer: SharedAlignedBuffer, ) -> Result<Self, SharedAlignedBuffer>

Create owned block from a buffer with a whole block, see GenericOwnedBlock::from_buffer()

Source

pub fn block(&self) -> LeafShardBlock<'_>

Trait Implementations§

Source§

impl Clone for OwnedLeafShardBlock

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OwnedLeafShardBlock

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<OwnedLeafShardBlock> for OwnedBlock

Source§

fn from(value: OwnedLeafShardBlock) -> Self

Converts to this type from the input type.
Source§

impl GenericOwnedBlock for OwnedLeafShardBlock

Source§

const SHARD_KIND: RealShardKind = RealShardKind::LeafShard

Shard kind
Source§

type Header = OwnedLeafShardHeader

Block header type
Source§

type Body = OwnedLeafShardBody

Block body type
Source§

type Block<'a> = LeafShardBlock<'a>

Block
Source§

fn split(self) -> (Self::Header, Self::Body)

Split into header and body
Source§

fn header(&self) -> &Self::Header

Block header
Source§

fn body(&self) -> &Self::Body

Block body
Source§

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)>

Create owned block from buffers. Read more
Source§

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 more
Source§

fn block(&self) -> Self::Block<'_>

Get regular block out of the owned version

Auto Trait Implementations§

§

impl Forget for OwnedLeafShardBlock

§

impl Freeze for OwnedLeafShardBlock
where *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 OwnedLeafShardBlock
where Arc<Yoke<LeafShardHeader<'static>, SharedAlignedBuffer>>: Send, Arc<Yoke<LeafShardBody<'static>, SharedAlignedBuffer>>: Send,

§

impl Sync for OwnedLeafShardBlock
where Arc<Yoke<LeafShardHeader<'static>, SharedAlignedBuffer>>: Sync, Arc<Yoke<LeafShardBody<'static>, SharedAlignedBuffer>>: Sync,

§

impl Unpin for OwnedLeafShardBlock
where *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 OwnedLeafShardBlock

§

impl UnwindSafe for OwnedLeafShardBlock

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.