Skip to main content

FutureFn

Trait FutureFn 

Source
pub trait FutureFn<T>:
    Fn() -> FutureBox<T>
    + Send
    + Sync { }
Expand description

A trait for thread-safe, reference-counted closures that produce a boxed future.

This trait is used for storing and executing asynchronous operations that need to be sendable across threads, such as in the server’s request processing pipeline.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T, O> FutureFn<O> for T
where T: Fn() -> FutureBox<O> + Send + Sync,

Blanket implementation of FutureFn for any type that satisfies the bounds.