Enum DigestItem

Source
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>

Source

pub fn dref<'a>(&'a self) -> DigestItemRef<'a, Hash>

Returns a ‘referencing view’ for this digest item.

Source

pub fn as_changes_trie_root(&self) -> Option<&Hash>

Returns Some if the entry is the ChangesTrieRoot entry.

Source

pub fn as_pre_runtime(&self) -> Option<(ConsensusEngineId, &[u8])>

Returns Some if this entry is the PreRuntime entry.

Source

pub fn as_consensus(&self) -> Option<(ConsensusEngineId, &[u8])>

Returns Some if this entry is the Consensus entry.

Source

pub fn as_seal(&self) -> Option<(ConsensusEngineId, &[u8])>

Returns Some if this entry is the Seal entry.

Source

pub fn as_changes_trie_signal(&self) -> Option<&ChangesTrieSignal>

Returns Some if the entry is the ChangesTrieSignal entry.

Source

pub fn as_other(&self) -> Option<&[u8]>

Returns Some if self is a DigestItem::Other.

Source

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.

Source

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>
where H: Encode + PartialEq + Eq + Debug,

Source§

fn check_equal(&self, other: &Self)

Perform the equality check.
Source§

impl<Hash: Clone> Clone for DigestItem<Hash>

Source§

fn clone(&self) -> DigestItem<Hash>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Hash> Debug for DigestItem<Hash>
where Hash: Debug,

Source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Hash: Decode> Decode for DigestItem<Hash>

Source§

fn decode<I: Input>(input: &mut I) -> Result<Self, Error>

Attempt to deserialise the value from input.
Source§

fn skip<I>(input: &mut I) -> Result<(), Error>
where I: Input,

Attempt to skip the encoded value from input. Read more
Source§

fn encoded_fixed_size() -> Option<usize>

Returns the fixed encoded size of the type. Read more
Source§

impl<'a, Hash: Decode> Deserialize<'a> for DigestItem<Hash>

Source§

fn deserialize<D>(de: D) -> Result<Self, D::Error>
where D: Deserializer<'a>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<Hash: Encode> Encode for DigestItem<Hash>

Source§

fn encode(&self) -> Vec<u8>

Convert self to an owned vector.
Source§

fn size_hint(&self) -> usize

If possible give a hint of expected size of the encoding. Read more
Source§

fn encode_to<T>(&self, dest: &mut T)
where T: Output + ?Sized,

Convert self to a slice and append it to the destination.
Source§

fn using_encoded<R, F>(&self, f: F) -> R
where F: FnOnce(&[u8]) -> R,

Convert self to a slice and then invoke the given closure with it.
Source§

fn encoded_size(&self) -> usize

Calculates the encoded size. Read more
Source§

impl<Hash> MallocSizeOf for DigestItem<Hash>
where Hash: MallocSizeOf,

Source§

fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize

Measure the heap usage of all descendant heap-allocated structures, but not the space taken up by the value itself. If T::size_of is a constant, consider implementing constant_size as well.
Source§

fn constant_size() -> Option<usize>
where Self: Sized,

Used to optimize MallocSizeOf implementation for collections like Vec and HashMap to avoid iterating over them unnecessarily. The Self: Sized bound is for object safety.
Source§

impl<Hash: PartialEq> PartialEq for DigestItem<Hash>

Source§

fn eq(&self, other: &DigestItem<Hash>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<Hash: Encode> Serialize for DigestItem<Hash>

Source§

fn serialize<S>(&self, seq: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<Hash: Encode> EncodeLike for DigestItem<Hash>

Source§

impl<Hash: Eq> Eq for DigestItem<Hash>

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CheckedConversion for T

Source§

fn checked_from<T>(t: T) -> Option<Self>
where Self: TryFrom<T>,

Convert from a value of T into an equivalent instance of Option<Self>. Read more
Source§

fn checked_into<T>(self) -> Option<T>
where Self: TryInto<T>,

Consume self to return Some equivalent value of Option<T>. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DecodeAll for T
where T: Decode,

Source§

fn decode_all(input: &[u8]) -> Result<T, Error>

Decode Self and consume all of the given input data. Read more
Source§

impl<T> DecodeLimit for T
where T: Decode,

Source§

fn decode_all_with_depth_limit(limit: u32, input: &[u8]) -> Result<T, Error>

Decode Self and consume all of the given input data. Read more
Source§

fn decode_with_depth_limit(limit: u32, input: &[u8]) -> Result<T, Error>

Decode Self with the given maximum recursion depth. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn 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.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert 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)

Convert &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)

Convert &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
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T, Outer> IsWrappedBy<Outer> for T
where Outer: AsRef<T> + AsMut<T> + From<T>, T: From<Outer>,

Source§

fn from_ref(outer: &Outer) -> &T

Get a reference to the inner from the outer.

Source§

fn from_mut(outer: &mut Outer) -> &mut T

Get a mutable reference to the inner from the outer.

Source§

impl<T> KeyedVec for T
where T: Codec,

Source§

fn to_keyed_vec(&self, prepend_key: &[u8]) -> Vec<u8>

Return an encoding of Self prepended by given slice.
Source§

impl<T> MallocSizeOfExt for T
where T: MallocSizeOf,

Source§

fn malloc_size_of(&self) -> usize

Method to launch a heapsize measurement with a fresh state.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SaturatedConversion for T

Source§

fn saturated_from<T>(t: T) -> Self
where Self: UniqueSaturatedFrom<T>,

Convert from a value of T into an equivalent instance of Self. Read more
Source§

fn saturated_into<T>(self) -> T
where Self: UniqueSaturatedInto<T>,

Consume self to return an equivalent value of T. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> UncheckedInto<T> for S
where T: UncheckedFrom<S>,

Source§

fn unchecked_into(self) -> T

The counterpart to unchecked_from.
Source§

impl<T, S> UniqueSaturatedInto<T> for S
where T: Bounded, S: TryInto<T>,

Source§

fn unique_saturated_into(self) -> T

Consume self to return an equivalent value of T.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<S> Codec for S
where S: Decode + Encode,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> EncodeLike<&&T> for T
where T: Encode,

Source§

impl<T> EncodeLike<&T> for T
where T: Encode,

Source§

impl<T> EncodeLike<&mut T> for T
where T: Encode,

Source§

impl<T> EncodeLike<Arc<T>> for T
where T: Encode,

Source§

impl<T> EncodeLike<Box<T>> for T
where T: Encode,

Source§

impl<'a, T> EncodeLike<Cow<'a, T>> for T
where T: ToOwned + Encode,

Source§

impl<T> EncodeLike<Rc<T>> for T
where T: Encode,

Source§

impl<S> FullCodec for S
where S: Decode + FullEncode,

Source§

impl<S> FullEncode for S
where S: Encode + EncodeLike,

Source§

impl<T> MaybeDebug for T
where T: Debug,

Source§

impl<T> MaybeDebug for T
where T: Debug,

Source§

impl<T> MaybeMallocSizeOf for T
where T: MallocSizeOf,

Source§

impl<T> MaybeRefUnwindSafe for T
where T: RefUnwindSafe,

Source§

impl<T> MaybeSerialize for T
where T: Serialize,

Source§

impl<T> MaybeSerializeDeserialize for T

Source§

impl<T> Member for T
where T: Send + Sync + Debug + Eq + PartialEq + Clone + 'static,