pub enum Block<'a> {
BeaconChain(BeaconChainBlock<'a>),
IntermediateShard(IntermediateShardBlock<'a>),
LeafShard(LeafShardBlock<'a>),
}Expand description
Block that contains BlockHeader and BlockBody
Variants§
BeaconChain(BeaconChainBlock<'a>)
Block corresponds to the beacon chain
IntermediateShard(IntermediateShardBlock<'a>)
Block corresponds to an intermediate shard
LeafShard(LeafShardBlock<'a>)
Block corresponds to a leaf shard
Implementations§
Source§impl<'a> Block<'a>
impl<'a> Block<'a>
Sourcepub fn try_from_bytes(
bytes: &'a [u8],
shard_kind: RealShardKind,
) -> Option<(Self, &'a [u8])>
pub fn try_from_bytes( bytes: &'a [u8], shard_kind: RealShardKind, ) -> Option<(Self, &'a [u8])>
Try to create a new instance from provided bytes.
bytes should be 16-byte aligned.
Checks internal consistency of header, body, and block, but no consensus verification is done.
Returns an instance and remaining bytes on success, None if too few bytes were given,
bytes are not properly aligned or input is otherwise invalid.
Sourcepub fn to_owned(self) -> OwnedBlock
pub fn to_owned(self) -> OwnedBlock
Create an owned version of this block
Trait Implementations§
Source§impl<'a> From<BeaconChainBlock<'a>> for Block<'a>
impl<'a> From<BeaconChainBlock<'a>> for Block<'a>
Source§fn from(value: BeaconChainBlock<'a>) -> Self
fn from(value: BeaconChainBlock<'a>) -> Self
Converts to this type from the input type.
Source§impl<'a> From<IntermediateShardBlock<'a>> for Block<'a>
impl<'a> From<IntermediateShardBlock<'a>> for Block<'a>
Source§fn from(value: IntermediateShardBlock<'a>) -> Self
fn from(value: IntermediateShardBlock<'a>) -> Self
Converts to this type from the input type.
Source§impl<'a> From<LeafShardBlock<'a>> for Block<'a>
impl<'a> From<LeafShardBlock<'a>> for Block<'a>
Source§fn from(value: LeafShardBlock<'a>) -> Self
fn from(value: LeafShardBlock<'a>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<'a> !Freeze for Block<'a>
impl<'a> Forget for Block<'a>
impl<'a> RefUnwindSafe for Block<'a>
impl<'a> Send for Block<'a>
impl<'a> Sync for Block<'a>
impl<'a> Unpin for Block<'a>
impl<'a> UnsafeUnpin for Block<'a>
impl<'a> UnwindSafe for Block<'a>
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