| Crates.io | waiter-trait |
| lib.rs | waiter-trait |
| version | 0.9.2 |
| created_at | 2025-09-09 23:54:59.12616+00 |
| updated_at | 2025-12-12 03:44:38.033347+00 |
| description | Traits used to wait and timeout. |
| homepage | |
| repository | https://github.com/mcu-rust/waiter-trait |
| max_upload_size | |
| id | 1831738 |
| size | 23,109 |
This crate has been refactored into crate timeout-trait, so I'm no longer maintaining it. If you’d like to take over the crate name, feel free to contact me on GitHub. I'm happy to transfer ownership to you.
Traits used to wait and timeout in a no-std embedded system.
std: Disabled by default.cargo add waiter-trait
See crate
Waiter or TimedWaiter implementation.start() to get a WaiterStatus implementation.timeout() to check if the time limit expires.
Interval::interval is usually called in timeout()
before the time limit expires. It also depends on your implementation.restart() to reset the timeout condition if necessary.use waiter_trait::prelude::*;
fn foo(waiter: impl Waiter) {
let mut t = waiter.start();
loop {
// Wait for something.
// Reset if it's necessary.
t.restart();
if t.timeout() {
break;
}
}
}
StdWaiter and StdInterval: Need the std feature enabled.NonInterval: implements Interval that does nothing.TickDelay: implements DelayNsFor developers, you can choose one of the following options.
Waiter or TimedWaiter, and WaiterStatus then use them.TickInstant then use TickWaiter or TimedTickWaiter.
NonInterval to Waiter, If you don't need interval.
In this way, you can also use DelayNs or sleep separately.Interval and use it.Counter, if you don't have any tick source.