pub struct Record(/* private fields */);
Expand description
Record contained within a piece.
NOTE: This is a stack-allocated data structure and can cause stack overflow!
Implementations§
Source§impl Record
impl Record
Sourcepub const NUM_CHUNKS: usize = 32_768usize
pub const NUM_CHUNKS: usize = 32_768usize
Number of chunks (scalars) within one record.
Sourcepub const NUM_S_BUCKETS: usize = 65_536usize
pub const NUM_S_BUCKETS: usize = 65_536usize
Number of s-buckets contained within one record (and by extension sector).
Essentially we chunk records into scalars and erasure code them.
Sourcepub const SIZE: usize = 1_048_576usize
pub const SIZE: usize = 1_048_576usize
Size of a segment record given the global piece size (in bytes) after erasure coding
RawRecord
, is guaranteed to be a multiple of ScalarBytes::FULL_BYTES
.
Sourcepub fn new_zero_vec(length: usize) -> Vec<Self>
pub fn new_zero_vec(length: usize) -> Vec<Self>
Create vector filled with zeroe records without hitting stack overflow
Sourcepub fn slice_to_repr(value: &[Self]) -> &[[[u8; 32]; 32768]]
pub fn slice_to_repr(value: &[Self]) -> &[[[u8; 32]; 32768]]
Convenient conversion from slice of record to underlying representation for efficiency purposes.
Sourcepub fn slice_from_repr(value: &[[[u8; 32]; 32768]]) -> &[Self]
pub fn slice_from_repr(value: &[[[u8; 32]; 32768]]) -> &[Self]
Convenient conversion from slice of underlying representation to record for efficiency purposes.
Sourcepub fn slice_mut_to_repr(value: &mut [Self]) -> &mut [[[u8; 32]; 32768]]
pub fn slice_mut_to_repr(value: &mut [Self]) -> &mut [[[u8; 32]; 32768]]
Convenient conversion from mutable slice of record to underlying representation for efficiency purposes.
Sourcepub fn slice_mut_from_repr(value: &mut [[[u8; 32]; 32768]]) -> &mut [Self]
pub fn slice_mut_from_repr(value: &mut [[[u8; 32]; 32768]]) -> &mut [Self]
Convenient conversion from mutable slice of underlying representation to record for efficiency purposes.
Sourcepub fn to_raw_record_chunks(
&self,
) -> impl DoubleEndedIterator<Item = &[u8; 31]> + '_
pub fn to_raw_record_chunks( &self, ) -> impl DoubleEndedIterator<Item = &[u8; 31]> + '_
Convert from a record to its raw bytes, assumes dealing with source record that only stores safe bytes in its chunks.
Sourcepub fn to_mut_raw_record_chunks(
&mut self,
) -> impl DoubleEndedIterator<Item = &mut [u8; 31]> + '_
pub fn to_mut_raw_record_chunks( &mut self, ) -> impl DoubleEndedIterator<Item = &mut [u8; 31]> + '_
Convert from a record to mutable raw bytes, assumes dealing with source record that only stores safe bytes in its chunks.
Trait Implementations§
impl Copy for Record
impl Eq for Record
impl StructuralPartialEq for Record
Auto Trait Implementations§
impl Freeze for Record
impl RefUnwindSafe for Record
impl Send for Record
impl Sync for Record
impl Unpin for Record
impl UnwindSafe for Record
Blanket Implementations§
§impl<T, U> AsByteSlice<T> for U
impl<T, U> AsByteSlice<T> for U
fn as_byte_slice(&self) -> &[u8] ⓘ
§impl<T, U> AsMutByteSlice<T> for U
impl<T, U> AsMutByteSlice<T> for U
fn as_mut_byte_slice(&mut self) -> &mut [u8] ⓘ
§impl<U> AsMutSliceOf for U
impl<U> AsMutSliceOf for U
fn as_mut_slice_of<T>(&mut self) -> Result<&mut [T], Error>where
T: FromByteSlice,
§impl<U> AsSliceOf for U
impl<U> AsSliceOf for U
fn as_slice_of<T>(&self) -> Result<&[T], Error>where
T: FromByteSlice,
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> Pointable for T
impl<T> Pointable for T
Source§impl<T> ToHex for T
impl<T> ToHex for T
Source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
self
into the result. Lower case
letters are used (e.g. f9b4ca
)Source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
self
into the result. Upper case
letters are used (e.g. F9B4CA
)