#[non_exhaustive]pub struct IntermediateShardBlock<'a> { /* private fields */ }
Expand description
Block that corresponds to an intermediate shard
Implementations§
Source§impl<'a> IntermediateShardBlock<'a>
impl<'a> IntermediateShardBlock<'a>
Sourcepub fn try_from_bytes(bytes: &'a [u8]) -> Option<(Self, &'a [u8])>
pub fn try_from_bytes(bytes: &'a [u8]) -> Option<(Self, &'a [u8])>
Try to create a new instance from provided bytes for provided shard index.
bytes
should be 8-bytes aligned.
Checks internal consistency of header, body, and block, but no consensus verification is
done. For unchecked version use Self::try_from_bytes_unchecked()
.
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 is_internally_consistent(&self) -> bool
pub fn is_internally_consistent(&self) -> bool
Check block’s internal consistency.
This is usually not necessary to be called explicitly since full internal consistency is
checked by Self::try_from_bytes()
internally.
NOTE: This only checks block-level internal consistency, header and block level internal consistency is checked separately.
Sourcepub fn try_from_bytes_unchecked(bytes: &'a [u8]) -> Option<(Self, &'a [u8])>
pub fn try_from_bytes_unchecked(bytes: &'a [u8]) -> Option<(Self, &'a [u8])>
The same as Self::try_from_bytes()
, but for trusted input that skips some consistency
checks
Sourcepub fn to_owned(self) -> OwnedIntermediateShardBlock
pub fn to_owned(self) -> OwnedIntermediateShardBlock
Create an owned version of this block
Trait Implementations§
Source§impl<'a> Clone for IntermediateShardBlock<'a>
impl<'a> Clone for IntermediateShardBlock<'a>
Source§fn clone(&self) -> IntermediateShardBlock<'a>
fn clone(&self) -> IntermediateShardBlock<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<'a> Debug for IntermediateShardBlock<'a>
impl<'a> Debug for IntermediateShardBlock<'a>
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
Source§impl<'a> GenericBlock<'a> for IntermediateShardBlock<'a>
impl<'a> GenericBlock<'a> for IntermediateShardBlock<'a>
Source§const SHARD_KIND: ShardKind = ShardKind::IntermediateShard
const SHARD_KIND: ShardKind = ShardKind::IntermediateShard
Source§type Header = IntermediateShardHeader<'a>
type Header = IntermediateShardHeader<'a>
Source§type Body = IntermediateShardBody<'a>
type Body = IntermediateShardBody<'a>
Source§type Owned = OwnedIntermediateShardBlock
type Owned = OwnedIntermediateShardBlock
Auto Trait Implementations§
impl<'a> Freeze for IntermediateShardBlock<'a>
impl<'a> !RefUnwindSafe for IntermediateShardBlock<'a>
impl<'a> Send for IntermediateShardBlock<'a>
impl<'a> Sync for IntermediateShardBlock<'a>
impl<'a> Unpin for IntermediateShardBlock<'a>
impl<'a> !UnwindSafe for IntermediateShardBlock<'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
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>
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>
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