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
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
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>ⓘimpl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>ⓘimpl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
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
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
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
The counterpart to unchecked_from
.
Consume self to return an equivalent value of T
.
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more