Expand description
Solving in resolvo is a compute heavy operation. However, while computing the solver will
request additional information from the crate::DependencyProvider
and a dependency provider
might want to perform multiple requests concurrently. To that end the
crate::DependencyProvider
s methods are async. The implementer can implement the async
operations in any way they choose including with any runtime they choose.
However, the solver itself is completely single threaded, but it still has to await the calls to
the dependency provider. Using the AsyncRuntime
allows the caller of the solver to choose
how to await the futures.
By default, the solver uses the NowOrNeverRuntime
runtime which polls any future once. If
the future yields (thus requiring an additional poll) the runtime panics. If the methods of
crate::DependencyProvider
do not yield (e.g. do not .await
) this will suffice.
Only if the crate::DependencyProvider
implementation yields you will need to provide a
AsyncRuntime
to the solver.
§tokio
The AsyncRuntime
trait is implemented both for [tokio::runtime::Handle
] and for
[tokio::runtime::Runtime
].
§async-std
Use the [AsyncStdRuntime
] struct to block on async methods from the
crate::DependencyProvider
using the async-std
executor.
Structs§
- NowOr
Never Runtime - The simplest runtime possible evaluates and consumes the future, returning the resulting
output if the future is ready after the first call to
Future::poll
. If the future does yield the runtime panics.
Traits§
- Async
Runtime - A trait to wrap an async runtime.