Skip to main content

OwnedBlock

Enum OwnedBlock 

Source
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

Source

pub fn split(self) -> (OwnedBlockHeader, OwnedBlockBody)

Split into header and body

Source

pub fn header(&self) -> BlockHeader<'_>

Block header

Source

pub fn body(&self) -> BlockBody<'_>

Block body

Source

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.

Source

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

Source

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

Get block

Trait Implementations§

Source§

impl Clone for OwnedBlock

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 OwnedBlock

Source§

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

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

impl From<OwnedBeaconChainBlock> for OwnedBlock

Source§

fn from(value: OwnedBeaconChainBlock) -> Self

Converts to this type from the input type.
Source§

impl From<OwnedIntermediateShardBlock> for OwnedBlock

Source§

fn from(value: OwnedIntermediateShardBlock) -> Self

Converts to this type from the input type.
Source§

impl From<OwnedLeafShardBlock> for OwnedBlock

Source§

fn from(value: OwnedLeafShardBlock) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl Forget for OwnedBlock

§

impl Freeze for OwnedBlock

§

impl Move for OwnedBlock

§

impl RefUnwindSafe for OwnedBlock

§

impl Send for OwnedBlock

§

impl Sync for OwnedBlock

§

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

§

impl UnwindSafe for OwnedBlock

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.