Expand description
Situwaition
This library makes it easy to wait for a situation (cutely named “situWAITion”) to complete.
Situwaition can be used in contexts with or without async runtimes, and generally does what you’d expect (tm):
use situwaition::wait_for;
fn main() -> Result<(), Box<dyn Error>> {
let value = 0;
let result: Result<&str> = wait_for(|| match value == 5 {
true => Ok("done!"),
false => {
value += 1; // NOTE: incrementing like this only works in a single threaded context!
Err("not yet")
},
});
}The example above demonstrates the synchronous usage, but tokio and async-std and corresponding modules are available as well.
Re-exports§
pub use sync::wait_for;
Modules§
Structs§
- Situwaition
Opts - Options for a given situwaition
- Situwaition
Opts Builder - Builder for
SituwaitionOpts.
Enums§
- Situwaition
Error - The type of error that is thrown when
- Situwaition
Opts Builder Error - Error type for SituwaitionOptsBuilder
- Waiter
Creation Error - Errors that are thrown during waiter creation
Traits§
- Async
StdAsync Situwaition - This trait represents a “situwaition” that can be a“waited“, with async-std. note that how the waiting is done can differ by platform
- Situwaition
Base - The basic requirements of any situwaition
- Sync
Situwaition - Synchronously executed situwaitions
- Tokio
Async Situwaition - This trait represents a “situwaition” that can be a“waited“, with tokio. note that how the waiting is done can differ by platform