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.`
Implementations
§impl<T, H> Bounded<T, H>where
H: Hash,
impl<T, H> Bounded<T, H>where
H: Hash,
pub fn transmute<S>(self) -> Bounded<S, H>where
S: Encode,
T: Encode + EncodeLike<S>,
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
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>
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>
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
pub fn lookup_needed(&self) -> bool
Returns whether the image will require a lookup to be peeked.
pub fn lookup_len(&self) -> Option<u32>
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>
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
pub fn from_legacy_hash(hash: impl Into<<H as Hash>::Output>) -> Bounded<T, H>
Constructs a Legacy
bounded item.