Trait rusty_pool::Task [−][src]
pub trait Task<R: Send>: Send { fn run(self) -> R; fn as_fn(self) -> Option<Box<dyn FnOnce() -> R + Send + 'static>>; fn is_fn(&self) -> bool; }
Trait to implement for all items that may be executed by the ThreadPool
.
Required methods
fn run(self) -> R
[src]
Execute this task and return its result.
fn as_fn(self) -> Option<Box<dyn FnOnce() -> R + Send + 'static>>
[src]
Transform this Task
into a heap allocated FnOnce
if possible.
Used by ThreadPool::execute
to turn this Task
into a Job
directly without having to create an additional Job
that calls this Task
.
fn is_fn(&self) -> bool
[src]
Return true
if calling as_fn()
on this Task
returns Some
.
Implementations on Foreign Types
impl Task<()> for Arc<AsyncTask>
[src]
impl Task<()> for Arc<AsyncTask>
[src]Implement the Task
trait for AsyncTask
in order to make it executable for the pool by
creating a waker and polling the future.
Implementors
Loading content...