pub struct ChunkWithProof { /* private fields */ }
Expand description
Represents a chunk of data with attached proof.
Implementations§
Source§impl ChunkWithProof
impl ChunkWithProof
Sourcepub const CHUNK_SIZE_BYTES: usize = 8_388_608usize
pub const CHUNK_SIZE_BYTES: usize = 8_388_608usize
8 MiB
Sourcepub fn new(data: &[u8], index: u64) -> Result<Self, MerkleConstructionError>
pub fn new(data: &[u8], index: u64) -> Result<Self, MerkleConstructionError>
Constructs the ChunkWithProof
that contains the chunk of data with the appropriate index
and the cryptographic proof.
Empty data is always represented as single, empty chunk and not as zero chunks.
Sourcepub fn into_chunk(self) -> Bytes
pub fn into_chunk(self) -> Bytes
Convert a chunk with proof into the underlying chunk.
Sourcepub fn proof(&self) -> &IndexedMerkleProof
pub fn proof(&self) -> &IndexedMerkleProof
Returns the IndexedMerkleProof
.
Sourcepub fn verify(&self) -> Result<(), ChunkWithProofVerificationError>
pub fn verify(&self) -> Result<(), ChunkWithProofVerificationError>
Verify the integrity of this chunk with indexed Merkle proof.
Trait Implementations§
Source§impl Clone for ChunkWithProof
impl Clone for ChunkWithProof
Source§fn clone(&self) -> ChunkWithProof
fn clone(&self) -> ChunkWithProof
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl DataSize for ChunkWithProof
impl DataSize for ChunkWithProof
Source§const IS_DYNAMIC: bool = true
const IS_DYNAMIC: bool = true
If
true
, the type has a heap size that can vary at runtime, depending on the actual value.Source§const STATIC_HEAP_SIZE: usize = 0usize
const STATIC_HEAP_SIZE: usize = 0usize
The amount of space a value of the type always occupies. If
IS_DYNAMIC
is false, this is
the total amount of heap memory occupied by the value. Otherwise this is a lower bound.Source§fn estimate_heap_size(&self) -> usize
fn estimate_heap_size(&self) -> usize
Estimates the size of heap memory taken up by this value. Read more
Source§impl Debug for ChunkWithProof
impl Debug for ChunkWithProof
Source§impl<'de> Deserialize<'de> for ChunkWithProof
impl<'de> Deserialize<'de> for ChunkWithProof
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl FromBytes for ChunkWithProof
impl FromBytes for ChunkWithProof
Source§impl JsonSchema for ChunkWithProof
impl JsonSchema for ChunkWithProof
Source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
Source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref
keyword. Read moreSource§impl PartialEq for ChunkWithProof
impl PartialEq for ChunkWithProof
Source§impl Serialize for ChunkWithProof
impl Serialize for ChunkWithProof
Source§impl ToBytes for ChunkWithProof
impl ToBytes for ChunkWithProof
Source§fn write_bytes(&self, buf: &mut Vec<u8>) -> Result<(), Error>
fn write_bytes(&self, buf: &mut Vec<u8>) -> Result<(), Error>
Writes
&self
into a mutable writer
.Source§fn serialized_length(&self) -> usize
fn serialized_length(&self) -> usize
Returns the length of the
Vec<u8>
which would be returned from a successful call to
to_bytes()
or into_bytes()
. The data is not actually serialized, so this call is
relatively cheap.impl Eq for ChunkWithProof
impl StructuralPartialEq for ChunkWithProof
Auto Trait Implementations§
impl !Freeze for ChunkWithProof
impl RefUnwindSafe for ChunkWithProof
impl Send for ChunkWithProof
impl Sync for ChunkWithProof
impl Unpin for ChunkWithProof
impl UnwindSafe for ChunkWithProof
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.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