pub enum DigestItem<Hash> {
ChangesTrieRoot(Hash),
PreRuntime(ConsensusEngineId, Vec<u8>),
Consensus(ConsensusEngineId, Vec<u8>),
Seal(ConsensusEngineId, Vec<u8>),
ChangesTrieSignal(ChangesTrieSignal),
Other(Vec<u8>),
}
Expand description
Digest item that is able to encode/decode ‘system’ digest items and provide opaque access to other items.
Variants§
ChangesTrieRoot(Hash)
System digest item that contains the root of changes trie at given block. It is created for every block iff runtime supports changes trie creation.
PreRuntime(ConsensusEngineId, Vec<u8>)
A pre-runtime digest.
These are messages from the consensus engine to the runtime, although the consensus engine can (and should) read them itself to avoid code and state duplication. It is erroneous for a runtime to produce these, but this is not (yet) checked.
NOTE: the runtime is not allowed to panic or fail in an on_initialize
call if an expected PreRuntime
digest is not present. It is the
responsibility of a external block verifier to check this. Runtime API calls
will initialize the block without pre-runtime digests, so initialization
cannot fail when they are missing.
Consensus(ConsensusEngineId, Vec<u8>)
A message from the runtime to the consensus engine. This should never be generated by the native code of any consensus engine, but this is not checked (yet).
Seal(ConsensusEngineId, Vec<u8>)
Put a Seal on it. This is only used by native code, and is never seen by runtimes.
ChangesTrieSignal(ChangesTrieSignal)
Digest item that contains signal from changes tries manager to the native code.
Other(Vec<u8>)
Some other thing. Unsupported and experimental.
Implementations§
Source§impl<Hash> DigestItem<Hash>
impl<Hash> DigestItem<Hash>
Sourcepub fn dref<'a>(&'a self) -> DigestItemRef<'a, Hash>
pub fn dref<'a>(&'a self) -> DigestItemRef<'a, Hash>
Returns a ‘referencing view’ for this digest item.
Sourcepub fn as_changes_trie_root(&self) -> Option<&Hash>
pub fn as_changes_trie_root(&self) -> Option<&Hash>
Returns Some
if the entry is the ChangesTrieRoot
entry.
Sourcepub fn as_pre_runtime(&self) -> Option<(ConsensusEngineId, &[u8])>
pub fn as_pre_runtime(&self) -> Option<(ConsensusEngineId, &[u8])>
Returns Some
if this entry is the PreRuntime
entry.
Sourcepub fn as_consensus(&self) -> Option<(ConsensusEngineId, &[u8])>
pub fn as_consensus(&self) -> Option<(ConsensusEngineId, &[u8])>
Returns Some
if this entry is the Consensus
entry.
Sourcepub fn as_seal(&self) -> Option<(ConsensusEngineId, &[u8])>
pub fn as_seal(&self) -> Option<(ConsensusEngineId, &[u8])>
Returns Some
if this entry is the Seal
entry.
Sourcepub fn as_changes_trie_signal(&self) -> Option<&ChangesTrieSignal>
pub fn as_changes_trie_signal(&self) -> Option<&ChangesTrieSignal>
Returns Some
if the entry is the ChangesTrieSignal
entry.
Sourcepub fn try_as_raw(&self, id: OpaqueDigestItemId<'_>) -> Option<&[u8]>
pub fn try_as_raw(&self, id: OpaqueDigestItemId<'_>) -> Option<&[u8]>
Returns the opaque data contained in the item if Some
if this entry has the id given.
Sourcepub fn try_to<T: Decode>(&self, id: OpaqueDigestItemId<'_>) -> Option<T>
pub fn try_to<T: Decode>(&self, id: OpaqueDigestItemId<'_>) -> Option<T>
Returns the data contained in the item if Some
if this entry has the id given, decoded
to the type provided T
.
Trait Implementations§
Source§impl<H> CheckEqual for DigestItem<H>
impl<H> CheckEqual for DigestItem<H>
Source§fn check_equal(&self, other: &Self)
fn check_equal(&self, other: &Self)
Source§impl<Hash: Clone> Clone for DigestItem<Hash>
impl<Hash: Clone> Clone for DigestItem<Hash>
Source§fn clone(&self) -> DigestItem<Hash>
fn clone(&self) -> DigestItem<Hash>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<Hash> Debug for DigestItem<Hash>where
Hash: Debug,
impl<Hash> Debug for DigestItem<Hash>where
Hash: Debug,
Source§impl<Hash: Decode> Decode for DigestItem<Hash>
impl<Hash: Decode> Decode for DigestItem<Hash>
Source§impl<'a, Hash: Decode> Deserialize<'a> for DigestItem<Hash>
impl<'a, Hash: Decode> Deserialize<'a> for DigestItem<Hash>
Source§fn deserialize<D>(de: D) -> Result<Self, D::Error>where
D: Deserializer<'a>,
fn deserialize<D>(de: D) -> Result<Self, D::Error>where
D: Deserializer<'a>,
Source§impl<Hash: Encode> Encode for DigestItem<Hash>
impl<Hash: Encode> Encode for DigestItem<Hash>
Source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
Source§fn encode_to<T>(&self, dest: &mut T)
fn encode_to<T>(&self, dest: &mut T)
Source§fn using_encoded<R, F>(&self, f: F) -> R
fn using_encoded<R, F>(&self, f: F) -> R
Source§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Source§impl<Hash> MallocSizeOf for DigestItem<Hash>where
Hash: MallocSizeOf,
impl<Hash> MallocSizeOf for DigestItem<Hash>where
Hash: MallocSizeOf,
Source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
T::size_of
is a constant, consider implementing constant_size
as well.Source§impl<Hash: PartialEq> PartialEq for DigestItem<Hash>
impl<Hash: PartialEq> PartialEq for DigestItem<Hash>
Source§impl<Hash: Encode> Serialize for DigestItem<Hash>
impl<Hash: Encode> Serialize for DigestItem<Hash>
impl<Hash: Encode> EncodeLike for DigestItem<Hash>
impl<Hash: Eq> Eq for DigestItem<Hash>
impl<Hash> StructuralPartialEq for DigestItem<Hash>
Auto Trait Implementations§
impl<Hash> Freeze for DigestItem<Hash>where
Hash: Freeze,
impl<Hash> RefUnwindSafe for DigestItem<Hash>where
Hash: RefUnwindSafe,
impl<Hash> Send for DigestItem<Hash>where
Hash: Send,
impl<Hash> Sync for DigestItem<Hash>where
Hash: Sync,
impl<Hash> Unpin for DigestItem<Hash>where
Hash: Unpin,
impl<Hash> UnwindSafe for DigestItem<Hash>where
Hash: UnwindSafe,
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
Source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DecodeLimit for Twhere
T: Decode,
impl<T> DecodeLimit for Twhere
T: Decode,
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<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, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
Source§impl<T> MallocSizeOfExt for Twhere
T: MallocSizeOf,
impl<T> MallocSizeOfExt for Twhere
T: MallocSizeOf,
Source§fn malloc_size_of(&self) -> usize
fn malloc_size_of(&self) -> usize
Source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
Source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
Source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
T
. Read moreSource§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
Source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from
.Source§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
Source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.