Struct frame_support::weights::FunctionOf
source · [−]pub struct FunctionOf<WD, CD, PF>(pub WD, pub CD, pub PF);
Function arguments are available directly inside the annotation now.
Expand description
A struct to represent a weight which is a function of the input arguments. The given items have the following types:
WD
: a rawWeight
value or a closure that returns aWeight
with the same argument list as the dispatched, wrapped in a tuple.CD
: a rawDispatchClass
value or a closure that returns aDispatchClass
with the same argument list as the dispatched, wrapped in a tuple.PF
: aPays
variant for whether this dispatch pays fee or not or a closure that returns aPays
variant with the same argument list as the dispatched, wrapped in a tuple.
Tuple Fields
0: WD
Function arguments are available directly inside the annotation now.
1: CD
Function arguments are available directly inside the annotation now.
2: PF
Function arguments are available directly inside the annotation now.
Trait Implementations
sourceimpl<Args, WD, PF> ClassifyDispatch<Args> for FunctionOf<WD, DispatchClass, PF>
impl<Args, WD, PF> ClassifyDispatch<Args> for FunctionOf<WD, DispatchClass, PF>
sourcefn classify_dispatch(&self, _: Args) -> DispatchClass
fn classify_dispatch(&self, _: Args) -> DispatchClass
Classify the dispatch function based on input data target
of type T
. When implementing
this for a dispatchable, T
will be a tuple of all arguments given to the function (except
origin). Read more
sourceimpl<Args, WD, CD, PF> ClassifyDispatch<Args> for FunctionOf<WD, CD, PF> where
CD: Fn(Args) -> DispatchClass,
impl<Args, WD, CD, PF> ClassifyDispatch<Args> for FunctionOf<WD, CD, PF> where
CD: Fn(Args) -> DispatchClass,
sourcefn classify_dispatch(&self, args: Args) -> DispatchClass
fn classify_dispatch(&self, args: Args) -> DispatchClass
Classify the dispatch function based on input data target
of type T
. When implementing
this for a dispatchable, T
will be a tuple of all arguments given to the function (except
origin). Read more
sourceimpl<Args, WD, CD> PaysFee<Args> for FunctionOf<WD, CD, Pays>
impl<Args, WD, CD> PaysFee<Args> for FunctionOf<WD, CD, Pays>
sourceimpl<Args, WD, CD, PF> PaysFee<Args> for FunctionOf<WD, CD, PF> where
PF: Fn(Args) -> Pays,
impl<Args, WD, CD, PF> PaysFee<Args> for FunctionOf<WD, CD, PF> where
PF: Fn(Args) -> Pays,
sourceimpl<Args, CD, PF> WeighData<Args> for FunctionOf<Weight, CD, PF>
impl<Args, CD, PF> WeighData<Args> for FunctionOf<Weight, CD, PF>
sourcefn weigh_data(&self, _: Args) -> Weight
fn weigh_data(&self, _: Args) -> Weight
Weigh the data T
given by target
. When implementing this for a dispatchable, T
will be
a tuple of all arguments given to the function (except origin). Read more
sourceimpl<Args, WD, CD, PF> WeighData<Args> for FunctionOf<WD, CD, PF> where
WD: Fn(Args) -> Weight,
impl<Args, WD, CD, PF> WeighData<Args> for FunctionOf<WD, CD, PF> where
WD: Fn(Args) -> Weight,
sourcefn weigh_data(&self, args: Args) -> Weight
fn weigh_data(&self, args: Args) -> Weight
Weigh the data T
given by target
. When implementing this for a dispatchable, T
will be
a tuple of all arguments given to the function (except origin). Read more
Auto Trait Implementations
impl<WD, CD, PF> RefUnwindSafe for FunctionOf<WD, CD, PF> where
CD: RefUnwindSafe,
PF: RefUnwindSafe,
WD: RefUnwindSafe,
impl<WD, CD, PF> Send for FunctionOf<WD, CD, PF> where
CD: Send,
PF: Send,
WD: Send,
impl<WD, CD, PF> Sync for FunctionOf<WD, CD, PF> where
CD: Sync,
PF: Sync,
WD: Sync,
impl<WD, CD, PF> Unpin for FunctionOf<WD, CD, PF> where
CD: Unpin,
PF: Unpin,
WD: Unpin,
impl<WD, CD, PF> UnwindSafe for FunctionOf<WD, CD, PF> where
CD: UnwindSafe,
PF: UnwindSafe,
WD: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> CheckedConversion for T
impl<T> CheckedConversion for T
sourcefn checked_from<T>(t: T) -> Option<Self> where
Self: TryFrom<T>,
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
sourcefn checked_into<T>(self) -> Option<T> where
Self: TryInto<T>,
fn checked_into<T>(self) -> Option<T> where
Self: TryInto<T>,
Consume self to return Some
equivalent value of Option<T>
. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T, Outer> IsWrappedBy<Outer> for T where
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
impl<T, Outer> IsWrappedBy<Outer> for T where
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
sourceimpl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
sourcefn saturated_from<T>(t: T) -> Self where
Self: UniqueSaturatedFrom<T>,
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
sourcefn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
Consume self to return an equivalent value of T
. Read more
sourceimpl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
sourcepub fn unchecked_into(self) -> T
pub fn unchecked_into(self) -> T
The counterpart to unchecked_from
.
sourceimpl<T, S> UniqueSaturatedInto<T> for S where
T: Bounded,
S: TryInto<T>,
impl<T, S> UniqueSaturatedInto<T> for S where
T: Bounded,
S: TryInto<T>,
sourcepub fn unique_saturated_into(self) -> T
pub fn unique_saturated_into(self) -> T
Consume self to return an equivalent value of T
.