#[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 piece array 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 piece array 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 piece array 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 piece array for efficiency purposes.
Trait Implementations§
Source§impl Clone for InnerPiece
impl Clone for InnerPiece
Source§fn clone(&self) -> InnerPiece
fn clone(&self) -> InnerPiece
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for InnerPiece
impl Debug 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
Source§impl TrivialType for InnerPiecewhere
PieceHeader: TrivialType,
Record: TrivialType,
impl TrivialType for InnerPiecewhere
PieceHeader: TrivialType,
Record: TrivialType,
Source§const METADATA: &[u8]
const METADATA: &[u8]
IoTypeMetadataKind] for encoding details.const SIZE: u32 = _
§unsafe fn read_unaligned(bytes: &[u8]) -> Option<Self>
unsafe fn read_unaligned(bytes: &[u8]) -> Option<Self>
§unsafe fn read_unaligned_unchecked(bytes: &[u8]) -> Self
unsafe fn read_unaligned_unchecked(bytes: &[u8]) -> Self
Self::read_unaligned()], but doesn’t do any checks at all. Read more§unsafe fn from_bytes(bytes: &[u8]) -> Option<&Self>
unsafe fn from_bytes(bytes: &[u8]) -> Option<&Self>
§unsafe fn from_bytes_unchecked(bytes: &[u8]) -> &Self
unsafe fn from_bytes_unchecked(bytes: &[u8]) -> &Self
Self::from_bytes()], but doesn’t do any checks at all. Read more§unsafe fn from_bytes_mut(bytes: &mut [u8]) -> Option<&mut Self>
unsafe fn from_bytes_mut(bytes: &mut [u8]) -> Option<&mut Self>
§unsafe fn from_bytes_mut_unchecked(bytes: &mut [u8]) -> &mut Self
unsafe fn from_bytes_mut_unchecked(bytes: &mut [u8]) -> &mut Self
Self::from_bytes_mut()], but doesn’t do any checks at all. Read more§unsafe fn as_bytes_mut(&mut self) -> &mut [u8; { _ }]
unsafe fn as_bytes_mut(&mut self) -> &mut [u8; { _ }]
impl Copy for InnerPiece
impl Eq for InnerPiece
impl StructuralPartialEq for InnerPiece
Auto Trait Implementations§
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§
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§impl<T> IoType for Twhere
T: TrivialType,
impl<T> IoType for Twhere
T: TrivialType,
§const METADATA: &'static [u8] = T::METADATA
const METADATA: &'static [u8] = T::METADATA
IoTypeMetadataKind for encoding details§type PointerType = T
type PointerType = T
IoType represents