#[repr(C)]pub struct InnerPiece {
pub header: PieceHeader,
pub record: Record,
}Expand description
A piece of archival history.
This version is allocated on the stack, for a heap-allocated piece that can be moved around
efficiently, see Piece.
Internally, a piece contains a record, supplementary record chunk root, and a proof proving this piece belongs to can be used to verify that a piece belongs to the actual archival history of the blockchain.
Fields§
§header: PieceHeaderPiece header
record: RecordRecord contained within a piece
Implementations§
Source§impl InnerPiece
impl InnerPiece
Sourcepub fn is_valid(
&self,
super_segment_root: &SuperSegmentRoot,
num_segments: u32,
position: PiecePosition,
) -> bool
pub fn is_valid( &self, super_segment_root: &SuperSegmentRoot, num_segments: u32, position: PiecePosition, ) -> bool
Check whether the piece is valid against the matching super segment root
Sourcepub fn record_root(&self) -> RecordRoot
pub fn record_root(&self) -> RecordRoot
Root of the record contained within a piece.
It is re-derived on every call of this function.
Sourcepub fn slice_to_repr(value: &[Self]) -> &[[u8; 1049560]]
pub fn slice_to_repr(value: &[Self]) -> &[[u8; 1049560]]
Convenient conversion from slice of pieces to underlying representation for efficiency purposes.
Sourcepub fn slice_from_repr(value: &[[u8; 1049560]]) -> &[Self]
pub fn slice_from_repr(value: &[[u8; 1049560]]) -> &[Self]
Convenient conversion from slice of underlying representation to pieces for efficiency purposes.
Sourcepub fn slice_mut_to_repr(value: &mut [Self]) -> &mut [[u8; 1049560]]
pub fn slice_mut_to_repr(value: &mut [Self]) -> &mut [[u8; 1049560]]
Convenient conversion from mutable slice of pieces to underlying representation for efficiency purposes.
Sourcepub fn slice_mut_from_repr(value: &mut [[u8; 1049560]]) -> &mut [Self]
pub fn slice_mut_from_repr(value: &mut [[u8; 1049560]]) -> &mut [Self]
Convenient conversion from mutable slice of underlying representation to pieces for efficiency purposes.
Trait Implementations§
impl AnyBitPatternMarker for InnerPiecewhere
for<'__ab_io_type> PieceHeader: AnyBitPatternMarker,
for<'__ab_io_type> Record: AnyBitPatternMarker,
Source§impl Clone for InnerPiece
impl Clone for InnerPiece
impl Copy for InnerPiece
Source§impl Debug for InnerPiece
impl Debug for InnerPiece
impl Eq for InnerPiece
Source§impl From<&InnerPiece> for Piece
impl From<&InnerPiece> for Piece
Source§fn from(value: &InnerPiece) -> Self
fn from(value: &InnerPiece) -> Self
Source§impl PartialEq for InnerPiece
impl PartialEq for InnerPiece
impl StructuralPartialEq for InnerPiece
Source§impl TrivialType for InnerPiece
impl TrivialType for InnerPiece
Source§const METADATA: &[u8]
const METADATA: &[u8]
IoTypeMetadataKind for encoding details.const SIZE: u32
Source§final fn try_from_bytes(bytes: &[u8]) -> Option<(&Self, &[u8])>
final fn try_from_bytes(bytes: &[u8]) -> Option<(&Self, &[u8])>
bytes, returns the value and the remaining bytes. Read moreSource§final fn try_from_bytes_exact(bytes: &[u8]) -> Option<&Self>
final fn try_from_bytes_exact(bytes: &[u8]) -> Option<&Self>
Self::try_from_bytes(), but returns None if there are more bytes than the valueSource§final fn try_from_bytes_mut(bytes: &mut [u8]) -> Option<(&mut Self, &mut [u8])>
final fn try_from_bytes_mut(bytes: &mut [u8]) -> Option<(&mut Self, &mut [u8])>
Self::try_from_bytes(), but returns an exclusive reference. Read moreSource§final fn try_from_bytes_mut_exact(bytes: &mut [u8]) -> Option<&mut Self>
final fn try_from_bytes_mut_exact(bytes: &mut [u8]) -> Option<&mut Self>
Self::try_from_bytes_mut(), but returns None if there are more bytes than the
valueSource§final fn from_bytes(bytes: &[u8]) -> Option<(&Self, &[u8])>where
Self: AnyBitPattern,
final fn from_bytes(bytes: &[u8]) -> Option<(&Self, &[u8])>where
Self: AnyBitPattern,
bytes, returns the value and
the remaining bytes. Read moreSource§final fn from_bytes_exact(bytes: &[u8]) -> Option<&Self>where
Self: AnyBitPattern,
final fn from_bytes_exact(bytes: &[u8]) -> Option<&Self>where
Self: AnyBitPattern,
Self::from_bytes(), but returns None if there are more bytes than the valueSource§final unsafe fn from_bytes_unchecked(bytes: &[u8]) -> &Self
final unsafe fn from_bytes_unchecked(bytes: &[u8]) -> &Self
Self::from_bytes(), but for any type and without any checks Read moreSource§final fn from_bytes_mut(bytes: &mut [u8]) -> Option<(&mut Self, &mut [u8])>where
Self: AnyBitPattern,
final fn from_bytes_mut(bytes: &mut [u8]) -> Option<(&mut Self, &mut [u8])>where
Self: AnyBitPattern,
Self::from_bytes(), but returns an exclusive referenceSource§final fn from_bytes_mut_exact(bytes: &mut [u8]) -> Option<&mut Self>where
Self: AnyBitPattern,
final fn from_bytes_mut_exact(bytes: &mut [u8]) -> Option<&mut Self>where
Self: AnyBitPattern,
Self::from_bytes_mut(), but returns None if there are more bytes than the valueSource§final unsafe fn from_bytes_mut_unchecked(bytes: &mut [u8]) -> &mut Self
final unsafe fn from_bytes_mut_unchecked(bytes: &mut [u8]) -> &mut Self
Self::from_bytes_mut(), but for any type and without any checks Read moreSource§final fn slice_from_bytes(
bytes: &[u8],
count: usize,
) -> Option<(&[Self], &[u8])>where
Self: AnyBitPattern,
final fn slice_from_bytes(
bytes: &[u8],
count: usize,
) -> Option<(&[Self], &[u8])>where
Self: AnyBitPattern,
count values at the beginning of aligned bytes, returns the values and
the remaining bytes. Read moreSource§final fn slice_from_bytes_mut(
bytes: &mut [u8],
count: usize,
) -> Option<(&mut [Self], &mut [u8])>where
Self: AnyBitPattern,
final fn slice_from_bytes_mut(
bytes: &mut [u8],
count: usize,
) -> Option<(&mut [Self], &mut [u8])>where
Self: AnyBitPattern,
Self::slice_from_bytes(), but returns an exclusive referenceSource§final fn as_bytes(&self) -> &[u8; ab_io_type::trivial_type::SIZE_OF::<Self>]
final fn as_bytes(&self) -> &[u8; ab_io_type::trivial_type::SIZE_OF::<Self>]
Source§final fn slice_as_bytes(values: &[Self]) -> &[u8] ⓘ
final fn slice_as_bytes(values: &[Self]) -> &[u8] ⓘ
Source§final fn as_bytes_mut(
&mut self,
) -> &mut [u8; ab_io_type::trivial_type::SIZE_OF::<Self>]where
Self: AnyBitPattern,
final fn as_bytes_mut(
&mut self,
) -> &mut [u8; ab_io_type::trivial_type::SIZE_OF::<Self>]where
Self: AnyBitPattern,
Source§final unsafe fn as_bytes_mut_unchecked(
&mut self,
) -> &mut [u8; ab_io_type::trivial_type::SIZE_OF::<Self>]
final unsafe fn as_bytes_mut_unchecked( &mut self, ) -> &mut [u8; ab_io_type::trivial_type::SIZE_OF::<Self>]
Self::as_bytes_mut(), but for any type. Read moreAuto Trait Implementations§
impl Forget for InnerPiece
impl Freeze for InnerPiece
impl RefUnwindSafe for InnerPiece
impl Send for InnerPiece
impl Sync for InnerPiece
impl Unpin for InnerPiece
impl UnsafeUnpin for InnerPiece
impl UnwindSafe for InnerPiece
Blanket Implementations§
impl<T> AnyBitPattern for Twhere
T: TrivialType + AnyBitPatternMarker,
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 moreSource§impl<T> IoType for Twhere
T: TrivialType,
impl<T> IoType for Twhere
T: TrivialType,
Source§const METADATA: &'static [u8] = T::METADATA
const METADATA: &'static [u8] = T::METADATA
IoTypeMetadataKind for encoding detailsSource§type PointerType = T
type PointerType = T
IoType representsSource§type WithLifetime<'b> = T
type WithLifetime<'b> = T
'b. Read moreSource§type Reborrowed<'b> = &'b mut T
type Reborrowed<'b> = &'b mut T
Source§unsafe fn from_ptr<'a>(
ptr: &'a NonNull<<T as IoType>::PointerType>,
size: &'a u32,
capacity: u32,
) -> impl Deref<Target = <T as IoType>::WithLifetime<'a>> + 'a
unsafe fn from_ptr<'a>( ptr: &'a NonNull<<T as IoType>::PointerType>, size: &'a u32, capacity: u32, ) -> impl Deref<Target = <T as IoType>::WithLifetime<'a>> + 'a
Source§unsafe fn from_mut_ptr<'a>(
ptr: &'a mut NonNull<<T as IoType>::PointerType>,
_size: &'a mut u32,
capacity: u32,
) -> impl DerefMut + 'a
unsafe fn from_mut_ptr<'a>( ptr: &'a mut NonNull<<T as IoType>::PointerType>, _size: &'a mut u32, capacity: u32, ) -> impl DerefMut + 'a
Source§unsafe fn try_from_ptr<'a>(
ptr: &'a NonNull<<T as IoType>::PointerType>,
size: &'a u32,
capacity: u32,
) -> Option<impl Deref<Target = <T as IoType>::WithLifetime<'a>> + 'a>
unsafe fn try_from_ptr<'a>( ptr: &'a NonNull<<T as IoType>::PointerType>, size: &'a u32, capacity: u32, ) -> Option<impl Deref<Target = <T as IoType>::WithLifetime<'a>> + 'a>
Source§unsafe fn try_from_mut_ptr<'a>(
ptr: &'a mut NonNull<<T as IoType>::PointerType>,
size: &'a mut u32,
capacity: u32,
) -> Option<impl DerefMut + 'a>
unsafe fn try_from_mut_ptr<'a>( ptr: &'a mut NonNull<<T as IoType>::PointerType>, size: &'a mut u32, capacity: u32, ) -> Option<impl DerefMut + 'a>
Self::try_from_ptr(), but returns an exclusive reference. Read more