pub trait RunnableWith<T, E> {
// Required method
fn run_with(&mut self, input: &mut T) -> Result<(), E>;
// Provided methods
fn into_box(self) -> BoxRunnableWith<T, E>
where Self: Sized + 'static { ... }
fn into_rc(self) -> RcRunnableWith<T, E>
where Self: Sized + 'static { ... }
fn into_arc(self) -> ArcRunnableWith<T, E>
where Self: Sized + Send + 'static { ... }
fn into_fn(self) -> impl FnMut(&mut T) -> Result<(), E>
where Self: Sized + 'static { ... }
fn to_box(&self) -> BoxRunnableWith<T, E>
where Self: Clone + Sized + 'static { ... }
fn to_rc(&self) -> RcRunnableWith<T, E>
where Self: Clone + Sized + 'static { ... }
fn to_arc(&self) -> ArcRunnableWith<T, E>
where Self: Clone + Send + Sized + 'static { ... }
fn to_fn(&self) -> impl FnMut(&mut T) -> Result<(), E>
where Self: Clone + Sized + 'static { ... }
fn into_callable_with(self) -> BoxCallableWith<T, (), E>
where Self: Sized + 'static { ... }
}Expand description
A fallible, reusable action that receives mutable input.
Conceptually this is FnMut(&mut T) -> Result<(), E> with task-oriented
naming. It is useful for executor-style APIs that run an action with access
to protected state, such as a value held under a lock.
§Type Parameters
T- The mutable input type.E- The error value returned when the action fails.
§Author
Haixing Hu
Required Methods§
Provided Methods§
Sourcefn into_box(self) -> BoxRunnableWith<T, E>where
Self: Sized + 'static,
fn into_box(self) -> BoxRunnableWith<T, E>where
Self: Sized + 'static,
Sourcefn into_rc(self) -> RcRunnableWith<T, E>where
Self: Sized + 'static,
fn into_rc(self) -> RcRunnableWith<T, E>where
Self: Sized + 'static,
Sourcefn into_arc(self) -> ArcRunnableWith<T, E>
fn into_arc(self) -> ArcRunnableWith<T, E>
Sourcefn into_fn(self) -> impl FnMut(&mut T) -> Result<(), E>where
Self: Sized + 'static,
fn into_fn(self) -> impl FnMut(&mut T) -> Result<(), E>where
Self: Sized + 'static,
Converts this runnable into a mutable closure.
§Returns
A closure implementing FnMut(&mut T) -> Result<(), E>.
Sourcefn to_box(&self) -> BoxRunnableWith<T, E>
fn to_box(&self) -> BoxRunnableWith<T, E>
Converts this runnable into a boxed runnable without consuming self.
§Returns
A BoxRunnableWith<T, E> built from a clone of this runnable.
Sourcefn to_rc(&self) -> RcRunnableWith<T, E>
fn to_rc(&self) -> RcRunnableWith<T, E>
Converts this runnable into an Rc runnable without consuming self.
§Returns
A RcRunnableWith<T, E> built from a clone of this runnable.
Sourcefn to_arc(&self) -> ArcRunnableWith<T, E>
fn to_arc(&self) -> ArcRunnableWith<T, E>
Converts this runnable into an Arc runnable without consuming self.
§Returns
An ArcRunnableWith<T, E> built from a clone of this runnable.
Sourcefn to_fn(&self) -> impl FnMut(&mut T) -> Result<(), E>
fn to_fn(&self) -> impl FnMut(&mut T) -> Result<(), E>
Converts this runnable into a mutable closure without consuming self.
§Returns
A closure implementing FnMut(&mut T) -> Result<(), E>.
Sourcefn into_callable_with(self) -> BoxCallableWith<T, (), E>where
Self: Sized + 'static,
fn into_callable_with(self) -> BoxCallableWith<T, (), E>where
Self: Sized + 'static,
Converts this runnable into a callable returning unit.
§Returns
A BoxCallableWith<T, (), E> that runs this task and returns unit on
success.