future_queue::traits

Trait WeightedFuture

Source
pub trait WeightedFuture: Sealed {
    type F: FnOnce(FutureQueueContext) -> Self::Future;
    type Future: Future;

    // Required methods
    fn weight(&self) -> usize;
    fn into_components(self) -> (usize, Self::F);
}
Expand description

A trait for types which can be converted into a Future and a weight.

Provided in case it’s necessary. This trait is only implemented for (usize, impl Future).

Required Associated Types§

Source

type F: FnOnce(FutureQueueContext) -> Self::Future

The function to obtain the future from

Source

type Future: Future

The associated Future type.

Required Methods§

Source

fn weight(&self) -> usize

The weight of the future.

Source

fn into_components(self) -> (usize, Self::F)

Turns self into its components.

Implementations on Foreign Types§

Source§

impl<F, Fut> WeightedFuture for (usize, F)
where F: FnOnce(FutureQueueContext) -> Fut, Fut: Future,

Source§

type F = F

Source§

type Future = Fut

Source§

fn weight(&self) -> usize

Source§

fn into_components(self) -> (usize, Self::F)

Implementors§