referrerpolicy=no-referrer-when-downgrade
pallet_democracy

Type Alias BoundedCallOf

Source
pub type BoundedCallOf<T> = Bounded<CallOf<T>, <T as Config>::Hashing>;

Aliased Type§

enum BoundedCallOf<T> {
    Legacy {
        hash: <<T as Config>::Hashing as Hash>::Output,
        dummy: PhantomData<<T as Config>::RuntimeCall>,
    },
    Inline(BoundedVec<u8, ConstU32<128>>),
    Lookup {
        hash: <<T as Config>::Hashing as Hash>::Output,
        len: u32,
    },
}

Variants§

§

Legacy

A hash with no preimage length. We do not support creation of this except for transitioning from legacy state. In the future we will make this a pure Dummy item storing only the final dummy field.

Fields

§hash: <<T as Config>::Hashing as Hash>::Output
§dummy: PhantomData<<T as Config>::RuntimeCall>
§

Inline(BoundedVec<u8, ConstU32<128>>)

A bounded Call. Its encoding must be at most 128 bytes.

§

Lookup

A hash of the call together with an upper limit for its size.`

Fields

§hash: <<T as Config>::Hashing as Hash>::Output
§len: u32

Implementations

§

impl<T, H> Bounded<T, H>
where H: Hash,

pub fn transmute<S>(self) -> Bounded<S, H>
where S: Encode, T: Encode + EncodeLike<S>,

Casts the wrapped type into something that encodes alike.

§Examples
use frame_support::{traits::Bounded, sp_runtime::traits::BlakeTwo256};

// Transmute from `String` to `&str`.
let x: Bounded<String, BlakeTwo256> = Bounded::Inline(Default::default());
let _: Bounded<&str, BlakeTwo256> = x.transmute();

pub fn hash(&self) -> <H as Hash>::Output

Returns the hash of the preimage.

The hash is re-calculated every time if the preimage is inlined.

pub fn lookup_hash(&self) -> Option<<H as Hash>::Output>

Returns the hash to lookup the preimage.

If this is a Bounded::Inline, None is returned as no lookup is required.

pub fn len(&self) -> Option<u32>

Returns the length of the preimage or None if the length is unknown.

pub fn lookup_needed(&self) -> bool

Returns whether the image will require a lookup to be peeked.

pub fn lookup_len(&self) -> Option<u32>

The maximum length of the lookup that is needed to peek Self.

pub fn unrequested(hash: <H as Hash>::Output, len: u32) -> Bounded<T, H>

Constructs a Lookup bounded item.

pub fn from_legacy_hash(hash: impl Into<<H as Hash>::Output>) -> Bounded<T, H>

👎Deprecated: This API is only for transitioning to Scheduler v3 API

Constructs a Legacy bounded item.

Trait Implementations

§

impl<T, H> Clone for Bounded<T, H>
where T: Clone, H: Clone + Hash, <H as Hash>::Output: Clone,

§

fn clone(&self) -> Bounded<T, H>

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

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

Performs copy-assignment from source. Read more
§

impl<T, H> Debug for Bounded<T, H>
where H: Hash + Debug, T: Debug,

§

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

Formats the value using the given formatter. Read more
§

impl<T, H> Decode for Bounded<T, H>
where H: Hash, <H as Hash>::Output: Decode, PhantomData<T>: Decode,

§

fn decode<__CodecInputEdqy>( __codec_input_edqy: &mut __CodecInputEdqy, ) -> Result<Bounded<T, H>, Error>
where __CodecInputEdqy: Input,

Attempt to deserialise the value from input.
§

fn decode_into<I>( input: &mut I, dst: &mut MaybeUninit<Self>, ) -> Result<DecodeFinished, Error>
where I: Input,

Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
§

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

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

fn encoded_fixed_size() -> Option<usize>

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

impl<T, H> Encode for Bounded<T, H>
where H: Hash, <H as Hash>::Output: Encode, PhantomData<T>: Encode,

§

fn size_hint(&self) -> usize

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

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

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

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

Convert self to an owned vector.
§

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

fn encoded_size(&self) -> usize

Calculates the encoded size. Read more
§

impl<T, H> MaxEncodedLen for Bounded<T, H>
where H: Hash,

§

fn max_encoded_len() -> usize

Upper bound, in bytes, of the maximum encoded size of this item.
§

impl<T, H> PartialEq for Bounded<T, H>
where T: PartialEq, H: PartialEq + Hash, <H as Hash>::Output: PartialEq,

§

fn eq(&self, other: &Bounded<T, H>) -> 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.
§

impl<T, H> TypeInfo for Bounded<T, H>
where H: Hash + TypeInfo + 'static, <H as Hash>::Output: TypeInfo + 'static, PhantomData<T>: TypeInfo + 'static, T: TypeInfo + 'static,

§

type Identity = Bounded<T, H>

The type identifying for which type info is provided. Read more
§

fn type_info() -> Type

Returns the static type identifier for Self.
§

impl<T, H> DecodeWithMemTracking for Bounded<T, H>
where H: Hash, <H as Hash>::Output: DecodeWithMemTracking, PhantomData<T>: DecodeWithMemTracking,

§

impl<T, H> EncodeLike for Bounded<T, H>
where H: Hash, <H as Hash>::Output: Encode, PhantomData<T>: Encode,

§

impl<T, H> Eq for Bounded<T, H>
where T: Eq, H: Eq + Hash, <H as Hash>::Output: Eq,

§

impl<T, H> StructuralPartialEq for Bounded<T, H>
where H: Hash,