Expand description
Provides a way to manager asynchronous tasks.
See examples/counter
for more information.
§TaskManager
The TaskManager
is a core type that you must save in your app’s state. Call TaskManager::add_collection
to register a new collection. And then call TaskManager::push_task
when you want to add a new task.
§TasksCollection
and CollectionData
TasksCollection
can be implemented for a type and then this type might be used as a type parameter
for several methods.
CollectionData
is a “dynamic” version of a type that implements TasksCollection
although
not totally. It holds collection’s name and executor. And in addition to this holds currently
running tasks and channel that receives data that tasks yield.
§Task
and Caller
Task
has name and Caller
. Caller
can be either Standard
or
Progressing
.
Caller::standard
expects a future.
Caller::progressing
expects a closure with an argument of type TaskProgressShared
.
This type provides functionality for progress tracking and functions such TaskProgressShared::set_total
and TaskProgressShared::update
. Which allows you to track your progress.
For more information about progress see TaskProgressShared
.
§TaskExecutor
A trait that determines task’s execution.
Modules§
- executors
- Executors that can be used in the
TasksCollection
. - setup
- Provides several functions and a macro to setup the runtime.
Macros§
- setup
- Creates a tokio runtime and executes it in its own thread.
Structs§
- Collection
Data - Collection holds the tasks in the queue and the data of currently executing ones.
- Handler
- Handler that is used to handle task’s result.
- Task
- A task that can be executed.
- Task
Data - The data of a task that is currently running.
- Task
Manager - It holds all collections.
- Task
Progress - Execution progress of a task.
- Task
Progress Shared - Shared version of
TaskProgress
which does not provide any mutable access to it’s fields.
Enums§
- Caller
- The task’s body itself.
- Execution
Poll - Indicates whether a task available to be executed or not.
Traits§
- Progress
- It is used to handle to execution progress.
- Task
Executor - A trait that determines task’s execution.
- Tasks
Collection - Describes the collection of tasks.
Type Aliases§
- AnyHandler
- Handler that has
Box<dyn Any + Send>
as a type parameter. - AnyTask
- Task that has
Box<dyn Any + Send>
as a return type.