pub struct RandomFileContents {
pub file_hash: MerkleHash,
pub data: Bytes,
pub xorbs: MerkleHashMap<RawXorbData>,
pub terms: Vec<FileTermReference>,
}Expand description
Complete information about a randomly generated file for testing purposes.
Contains all the metadata needed to verify that reconstruction and fetching operations return correct data.
Fields§
§file_hash: MerkleHashThe file hash (used for reconstruction queries).
data: BytesThe complete file data.
xorbs: MerkleHashMap<RawXorbData>The RawXorbData for each XORB that was created, keyed by XORB hash.
terms: Vec<FileTermReference>Information about each term in file order.
Implementations§
Source§impl RandomFileContents
impl RandomFileContents
Sourcepub fn term_matches(&self, term_index: usize, data: &[u8]) -> bool
pub fn term_matches(&self, term_index: usize, data: &[u8]) -> bool
Verifies that the given data matches the expected data for a specific term.
This checks that the hash of the provided data matches the expected XORB data for the term at the given index.
§Arguments
term_index- The index of the term (0-based) in the terms listdata- The data to verify against the expected term data
§Returns
true if the data matches the expected term data, false otherwise.
Sourcepub fn term_data(&self, term_index: usize) -> Option<&Bytes>
pub fn term_data(&self, term_index: usize) -> Option<&Bytes>
Returns the expected data for a specific term.
Sourcepub fn term_xorb_hash(&self, term_index: usize) -> Option<MerkleHash>
pub fn term_xorb_hash(&self, term_index: usize) -> Option<MerkleHash>
Returns the XORB hash for a specific term.
Trait Implementations§
Source§impl Clone for RandomFileContents
impl Clone for RandomFileContents
Source§fn clone(&self) -> RandomFileContents
fn clone(&self) -> RandomFileContents
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !Freeze for RandomFileContents
impl RefUnwindSafe for RandomFileContents
impl Send for RandomFileContents
impl Sync for RandomFileContents
impl Unpin for RandomFileContents
impl UnsafeUnpin for RandomFileContents
impl UnwindSafe for RandomFileContents
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> DropFlavorWrapper<T> for T
impl<T> DropFlavorWrapper<T> for T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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