[−][src]Struct act_zero::async_fn::Closure
Rust does not support async closures, and is incapable of inferring the correct lifetimes
for closures returning an async move { ... } block which captures a non-'static argument
to the closure.
To solve this problem, we introduce this explicit closure type, which takes a stand-alone
async fn expecting two arguments, and binds the second argument to a closure "upvar"
passed in at construction.
Implementations
impl<R, F, P> Closure<R, F, P>[src]
pub fn new(fun: F, upvar: P) -> Self[src]
Constructor.
fun should implement ClosureFn or ClosureFnMut for this to be useful.
Trait Implementations
impl<F, T, P, R> AsyncFnOnce<T> for Closure<R, F, P> where
F: for<'a> ClosureFn<'a, T, P, R>,
R: Send + 'static, [src]
F: for<'a> ClosureFn<'a, T, P, R>,
R: Send + 'static,
type Output = R
Output type of the returned future.
fn call(self, arg: &T) -> BoxFuture<'_, R>[src]
fn call_boxed(self: Box<Self>, arg: &T) -> BoxFuture<'_, Self::Output>[src]
fn map<G, R>(self, g: G) -> AsyncMap<Self, G> where
G: FnOnce(Self::Output, &T) -> R,
Self: Sized, [src]
G: FnOnce(Self::Output, &T) -> R,
Self: Sized,
fn bind_output(self, tx: Sender<Self::Output>) -> BindOutput<Self, Self::Output> where
Self: Sized, [src]
Self: Sized,
impl<F, P, T, R> AsyncMutFnOnce<T> for Closure<R, F, P> where
F: for<'a> ClosureFnMut<'a, T, P, R>,
R: Send + 'static, [src]
F: for<'a> ClosureFnMut<'a, T, P, R>,
R: Send + 'static,
type Output = R
Output type of the returned future.
fn call(self, arg: &mut T) -> BoxFuture<'_, R>[src]
fn call_boxed(self: Box<Self>, arg: &mut T) -> BoxFuture<'_, Self::Output>[src]
fn map<G, R>(self, g: G) -> AsyncMap<Self, G> where
G: FnOnce(Self::Output, &mut T) -> R,
Self: Sized, [src]
G: FnOnce(Self::Output, &mut T) -> R,
Self: Sized,
fn bind_output(self, tx: Sender<Self::Output>) -> BindOutput<Self, Self::Output> where
Self: Sized, [src]
Self: Sized,
Auto Trait Implementations
impl<R, F, P> RefUnwindSafe for Closure<R, F, P> where
F: RefUnwindSafe,
P: RefUnwindSafe,
F: RefUnwindSafe,
P: RefUnwindSafe,
impl<R, F, P> Send for Closure<R, F, P> where
F: Send,
P: Send,
F: Send,
P: Send,
impl<R, F, P> Sync for Closure<R, F, P> where
F: Sync,
P: Sync,
F: Sync,
P: Sync,
impl<R, F, P> Unpin for Closure<R, F, P> where
F: Unpin,
P: Unpin,
F: Unpin,
P: Unpin,
impl<R, F, P> UnwindSafe for Closure<R, F, P> where
F: UnwindSafe,
P: UnwindSafe,
F: UnwindSafe,
P: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, E> IntoResult<T, E> for T[src]
fn into_result(Self) -> Result<T, E>[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,