pub type MiddlewareReturnValue<C> = ReusableBoxFuture<MiddlewareResult<C>>;

Aliased Type§

struct MiddlewareReturnValue<C> { /* private fields */ }

Implementations§

source§

impl<T> ReusableBoxFuture<T>

source

pub fn new<F>(future: F) -> ReusableBoxFuture<T> where F: Future<Output = T> + Send + 'static,

Create a new ReusableBoxFuture<T> containing the provided future.

source

pub fn set<F>(&mut self, future: F)where F: Future<Output = T> + Send + 'static,

Replace the future currently stored in this box.

This reallocates if and only if the layout of the provided future is different from the layout of the currently stored future.

source

pub fn try_set<F>(&mut self, future: F) -> Result<(), F>where F: Future<Output = T> + Send + 'static,

Replace the future currently stored in this box.

This function never reallocates, but returns an error if the provided future has a different size or alignment from the currently stored future.

source

pub fn get_pin(&mut self) -> Pin<&mut (dyn Future<Output = T> + Send)>

Get a pinned reference to the underlying future.

source

pub fn poll(&mut self, cx: &mut Context<'_>) -> Poll<T>

Poll the future stored inside this box.

Trait Implementations§

source§

impl<T> Debug for ReusableBoxFuture<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<T> Drop for ReusableBoxFuture<T>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<T> Future for ReusableBoxFuture<T>

source§

fn poll(self: Pin<&mut ReusableBoxFuture<T>>, cx: &mut Context<'_>) -> Poll<T>

Poll the future stored inside this box.

§

type Output = T

The type of value produced on completion.
source§

impl<T> Send for ReusableBoxFuture<T>

source§

impl<T> Sync for ReusableBoxFuture<T>

source§

impl<T> Unpin for ReusableBoxFuture<T>