Struct ReusableBoxFuture
struct ReusableBoxFuture<'a, T> { ... }
A reusable Pin<Box<dyn Future<Output = T> + Send + 'a>>.
This type lets you replace the future stored in the box without reallocating when the size and alignment permits this.
Implementations
impl<'a, T> ReusableBoxFuture<'a, T>
fn new<F>(future: F) -> Self where F: Future<Output = T> + Send + 'aCreate a new
ReusableBoxFuture<T>containing the provided future.fn set<F>(self: &mut Self, future: F) where F: Future<Output = T> + Send + 'aReplace 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.
fn try_set<F>(self: &mut Self, future: F) -> Result<(), F> where F: Future<Output = T> + Send + 'aReplace 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.
fn get_pin(self: &mut Self) -> Pin<&mut dyn Future<Output = T> + Send>Get a pinned reference to the underlying future.
fn poll(self: &mut Self, cx: &mut Context<'_>) -> Poll<T>Poll the future stored inside this box.
impl<'a, T> Freeze for ReusableBoxFuture<'a, T>
impl<'a, T> RefUnwindSafe for ReusableBoxFuture<'a, T>
impl<'a, T> Send for ReusableBoxFuture<'a, T>
impl<'a, T> Unpin for ReusableBoxFuture<'a, T>
impl<'a, T> UnsafeUnpin for ReusableBoxFuture<'a, T>
impl<'a, T> UnwindSafe for ReusableBoxFuture<'a, T>
impl<F> IntoFuture for ReusableBoxFuture<'a, T>
fn into_future(self: Self) -> <F as IntoFuture>::IntoFuture
impl<F, T, E> TryFuture for ReusableBoxFuture<'a, T>
fn try_poll(self: Pin<&mut F>, cx: &mut Context<'_>) -> Poll<<F as Future>::Output>
impl<T> Any for ReusableBoxFuture<'a, T>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for ReusableBoxFuture<'a, T>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for ReusableBoxFuture<'a, T>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> Debug for ReusableBoxFuture<'_, T>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<T> From for ReusableBoxFuture<'a, T>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Future for ReusableBoxFuture<'_, T>
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<T>Poll the future stored inside this box.
impl<T> Sync for ReusableBoxFuture<'_, T>
impl<T, U> Into for ReusableBoxFuture<'a, T>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for ReusableBoxFuture<'a, T>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for ReusableBoxFuture<'a, T>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>