Struct frame_support::weights::FunctionOf [−][src]
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.
Trait Implementations
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
impl<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,
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
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
impl<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,
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
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: 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
. Read more
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
pub 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. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
type Output = T
type Output = T
Should always be Self
The counterpart to unchecked_from
.
Consume self to return an equivalent value of T
.
pub fn vzip(self) -> V