pub enum ValueOrChunk<V> {
Value(V),
ChunkWithProof(ChunkWithProof),
}
Expand description
Represents a value or a chunk of data with attached proof.
Chunk with attached proof is used when the requested value is larger than ChunkWithProof::CHUNK_SIZE_BYTES.
Variants§
Value(V)
Represents a value.
ChunkWithProof(ChunkWithProof)
Represents a chunk of data with attached proof.
Implementations§
Source§impl<V> ValueOrChunk<V>
impl<V> ValueOrChunk<V>
Sourcepub fn new(data: V, chunk_index: u64) -> Result<Self, ChunkingError>where
V: Chunkable,
pub fn new(data: V, chunk_index: u64) -> Result<Self, ChunkingError>where
V: Chunkable,
Creates an instance of ValueOrChunk::Value
if data size is less than or equal to
ChunkWithProof::CHUNK_SIZE_BYTES
or a ValueOrChunk::ChunkWithProof
if it is greater.
In the latter case it will return only the chunk_index
-th chunk of the value’s byte
representation.
NOTE: The Chunkable
instance used here needs to match the one used when calling
Digest::hash_into_chunks_if_necessary
. This is to ensure that type is turned into
bytes consistently before chunking and hashing. If not then the Merkle proofs for chunks
won’t match.
Trait Implementations§
Source§impl<V: Clone> Clone for ValueOrChunk<V>
impl<V: Clone> Clone for ValueOrChunk<V>
Source§fn clone(&self) -> ValueOrChunk<V>
fn clone(&self) -> ValueOrChunk<V>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<V> DataSize for ValueOrChunk<V>
impl<V> DataSize for ValueOrChunk<V>
Source§const IS_DYNAMIC: bool = true
const IS_DYNAMIC: bool = true
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
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
Source§fn estimate_detailed_heap_size(&self) -> MemUsageNode
fn estimate_detailed_heap_size(&self) -> MemUsageNode
Source§impl<V: Debug> Debug for ValueOrChunk<V>
impl<V: Debug> Debug for ValueOrChunk<V>
Source§impl<'de, V> Deserialize<'de> for ValueOrChunk<V>where
V: Deserialize<'de>,
impl<'de, V> Deserialize<'de> for ValueOrChunk<V>where
V: Deserialize<'de>,
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>,
Source§impl Display for ValueOrChunk<HashingTrieRaw>
impl Display for ValueOrChunk<HashingTrieRaw>
Source§impl Display for ValueOrChunk<Vec<ExecutionResult>>
impl Display for ValueOrChunk<Vec<ExecutionResult>>
Source§impl<V: PartialEq> PartialEq for ValueOrChunk<V>
impl<V: PartialEq> PartialEq for ValueOrChunk<V>
Source§impl<V> Serialize for ValueOrChunk<V>where
V: Serialize,
impl<V> Serialize for ValueOrChunk<V>where
V: Serialize,
impl<V: Eq> Eq for ValueOrChunk<V>
impl<V> StructuralPartialEq for ValueOrChunk<V>
Auto Trait Implementations§
impl<V> !Freeze for ValueOrChunk<V>
impl<V> RefUnwindSafe for ValueOrChunk<V>where
V: RefUnwindSafe,
impl<V> Send for ValueOrChunk<V>where
V: Send,
impl<V> Sync for ValueOrChunk<V>where
V: Sync,
impl<V> Unpin for ValueOrChunk<V>where
V: Unpin,
impl<V> UnwindSafe for ValueOrChunk<V>where
V: UnwindSafe,
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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
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
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<From, To> FallibleInto<To> for Fromwhere
To: TryFrom<From>,
impl<From, To> FallibleInto<To> for Fromwhere
To: TryFrom<From>,
fn try_into_wrapped(self) -> Result<To, VMError>
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>
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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out
indicating that a T
is niched.