tokio_util::sync::mpsc

Type Alias InnerFuture

Source
type InnerFuture<'a, T> = ReusableBoxFuture<'a, Result<OwnedPermit<T>, PollSendError<T>>>;

Aliased Type§

struct InnerFuture<'a, T> {
    boxed: Pin<Box<dyn Future<Output = Result<OwnedPermit<T>, PollSendError<T>>> + Send + 'a>>,
}

Fields§

§boxed: Pin<Box<dyn Future<Output = Result<OwnedPermit<T>, PollSendError<T>>> + Send + 'a>>

Implementations

Source§

impl<'a, T> ReusableBoxFuture<'a, T>

Source

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

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

Source

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

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 + 'a,

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

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

impl<T> Future for ReusableBoxFuture<'_, T>

Source§

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

Poll the future stored inside this box.

Source§

type Output = T

The type of value produced on completion.
Source§

impl<T> Sync for ReusableBoxFuture<'_, T>