Struct pallet_mmr_primitives::Compact [−][src]
pub struct Compact<H, T> { pub tuple: T, // some fields omitted }
Expand description
A composition of multiple leaf elements with compact form representation.
When composing together multiple LeafDataProviders you will end up with
a tuple of LeafData
that each element provides.
However this will cause the leaves to have significant size, while for some use cases it will be enough to prove only one element of the tuple. That’s the rationale for Compact struct. We wrap each element of the tuple into DataOrHash and each tuple element is hashed first before constructing the final hash of the entire tuple. This allows you to replace tuple elements you don’t care about with their hashes.
Fields
tuple: T
Internal tuple representation.
Implementations
Trait Implementations
Attempt to deserialise the value from input.
Attempt to skip the encoded value from input. Read more
fn encoded_fixed_size() -> Option<usize>
fn encoded_fixed_size() -> Option<usize>
Returns the fixed encoded size of the type. Read more
FullLeaf implementation for Compact<H, (DataOrHash<H, Tuple>, ...)>
impl<H, A, B> FullLeaf for Compact<H, (DataOrHash<H, A>, DataOrHash<H, B>)> where
H: Hash,
A: FullLeaf,
B: FullLeaf,
impl<H, A, B> FullLeaf for Compact<H, (DataOrHash<H, A>, DataOrHash<H, B>)> where
H: Hash,
A: FullLeaf,
B: FullLeaf,
FullLeaf implementation for Compact<H, (DataOrHash<H, Tuple>, ...)>
impl<H, A, B, C> FullLeaf for Compact<H, (DataOrHash<H, A>, DataOrHash<H, B>, DataOrHash<H, C>)> where
H: Hash,
A: FullLeaf,
B: FullLeaf,
C: FullLeaf,
impl<H, A, B, C> FullLeaf for Compact<H, (DataOrHash<H, A>, DataOrHash<H, B>, DataOrHash<H, C>)> where
H: Hash,
A: FullLeaf,
B: FullLeaf,
C: FullLeaf,
FullLeaf implementation for Compact<H, (DataOrHash<H, Tuple>, ...)>
impl<H, A, B, C, D> FullLeaf for Compact<H, (DataOrHash<H, A>, DataOrHash<H, B>, DataOrHash<H, C>, DataOrHash<H, D>)> where
H: Hash,
A: FullLeaf,
B: FullLeaf,
C: FullLeaf,
D: FullLeaf,
impl<H, A, B, C, D> FullLeaf for Compact<H, (DataOrHash<H, A>, DataOrHash<H, B>, DataOrHash<H, C>, DataOrHash<H, D>)> where
H: Hash,
A: FullLeaf,
B: FullLeaf,
C: FullLeaf,
D: FullLeaf,
FullLeaf implementation for Compact<H, (DataOrHash<H, Tuple>, ...)>
impl<H, A, B, C, D, E> FullLeaf for Compact<H, (DataOrHash<H, A>, DataOrHash<H, B>, DataOrHash<H, C>, DataOrHash<H, D>, DataOrHash<H, E>)> where
H: Hash,
A: FullLeaf,
B: FullLeaf,
C: FullLeaf,
D: FullLeaf,
E: FullLeaf,
impl<H, A, B, C, D, E> FullLeaf for Compact<H, (DataOrHash<H, A>, DataOrHash<H, B>, DataOrHash<H, C>, DataOrHash<H, D>, DataOrHash<H, E>)> where
H: Hash,
A: FullLeaf,
B: FullLeaf,
C: FullLeaf,
D: FullLeaf,
E: FullLeaf,
FullLeaf implementation for Compact<H, (DataOrHash<H, Tuple>, ...)>
LeafDataProvider implementation for Compact<H, (DataOrHash<H, Tuple>, ...)>
This provides a compact-form encoding for tuples wrapped in Compact.
impl<H, A, B> LeafDataProvider for Compact<H, (A, B)> where
H: Hash,
A: LeafDataProvider,
B: LeafDataProvider,
impl<H, A, B> LeafDataProvider for Compact<H, (A, B)> where
H: Hash,
A: LeafDataProvider,
B: LeafDataProvider,
LeafDataProvider implementation for Compact<H, (DataOrHash<H, Tuple>, ...)>
This provides a compact-form encoding for tuples wrapped in Compact.
impl<H, A, B, C> LeafDataProvider for Compact<H, (A, B, C)> where
H: Hash,
A: LeafDataProvider,
B: LeafDataProvider,
C: LeafDataProvider,
impl<H, A, B, C> LeafDataProvider for Compact<H, (A, B, C)> where
H: Hash,
A: LeafDataProvider,
B: LeafDataProvider,
C: LeafDataProvider,
LeafDataProvider implementation for Compact<H, (DataOrHash<H, Tuple>, ...)>
This provides a compact-form encoding for tuples wrapped in Compact.
type LeafData = Compact<H, (DataOrHash<H, A::LeafData>, DataOrHash<H, B::LeafData>, DataOrHash<H, C::LeafData>)>
type LeafData = Compact<H, (DataOrHash<H, A::LeafData>, DataOrHash<H, B::LeafData>, DataOrHash<H, C::LeafData>)>
A type that should end up in the leaf of MMR.
impl<H, A, B, C, D> LeafDataProvider for Compact<H, (A, B, C, D)> where
H: Hash,
A: LeafDataProvider,
B: LeafDataProvider,
C: LeafDataProvider,
D: LeafDataProvider,
impl<H, A, B, C, D> LeafDataProvider for Compact<H, (A, B, C, D)> where
H: Hash,
A: LeafDataProvider,
B: LeafDataProvider,
C: LeafDataProvider,
D: LeafDataProvider,
LeafDataProvider implementation for Compact<H, (DataOrHash<H, Tuple>, ...)>
This provides a compact-form encoding for tuples wrapped in Compact.
type LeafData = Compact<H, (DataOrHash<H, A::LeafData>, DataOrHash<H, B::LeafData>, DataOrHash<H, C::LeafData>, DataOrHash<H, D::LeafData>)>
type LeafData = Compact<H, (DataOrHash<H, A::LeafData>, DataOrHash<H, B::LeafData>, DataOrHash<H, C::LeafData>, DataOrHash<H, D::LeafData>)>
A type that should end up in the leaf of MMR.
impl<H, A, B, C, D, E> LeafDataProvider for Compact<H, (A, B, C, D, E)> where
H: Hash,
A: LeafDataProvider,
B: LeafDataProvider,
C: LeafDataProvider,
D: LeafDataProvider,
E: LeafDataProvider,
impl<H, A, B, C, D, E> LeafDataProvider for Compact<H, (A, B, C, D, E)> where
H: Hash,
A: LeafDataProvider,
B: LeafDataProvider,
C: LeafDataProvider,
D: LeafDataProvider,
E: LeafDataProvider,
LeafDataProvider implementation for Compact<H, (DataOrHash<H, Tuple>, ...)>
This provides a compact-form encoding for tuples wrapped in Compact.
type LeafData = Compact<H, (DataOrHash<H, A::LeafData>, DataOrHash<H, B::LeafData>, DataOrHash<H, C::LeafData>, DataOrHash<H, D::LeafData>, DataOrHash<H, E::LeafData>)>
type LeafData = Compact<H, (DataOrHash<H, A::LeafData>, DataOrHash<H, B::LeafData>, DataOrHash<H, C::LeafData>, DataOrHash<H, D::LeafData>, DataOrHash<H, E::LeafData>)>
A type that should end up in the leaf of MMR.
Auto Trait Implementations
impl<H, T> RefUnwindSafe for Compact<H, T> where
H: RefUnwindSafe,
T: RefUnwindSafe,
impl<H, T> UnwindSafe for Compact<H, T> where
H: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
Convert 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
. Read more
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
type Output = T
type Output = T
Should always be Self
The counterpart to unchecked_from
.
Consume self to return an equivalent value of T
.
pub fn vzip(self) -> V
impl<T> MaybeDebug for T where
T: Debug,
impl<T> MaybeDebug for T where
T: Debug,