We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ae5ad91 commit ec5f283Copy full SHA for ec5f283
embassy-time/src/timer.rs
@@ -200,6 +200,10 @@ impl Future for Timer {
200
/// }
201
202
/// ```
203
+///
204
+/// ## Cancel safety
205
+/// It is safe to cancel waiting for the next tick,
206
+/// meaning no tick is lost if the Future is dropped.
207
pub struct Ticker {
208
expires_at: Instant,
209
duration: Duration,
@@ -231,6 +235,9 @@ impl Ticker {
231
235
}
232
236
233
237
/// Waits for the next tick.
238
+ ///
239
+ /// ## Cancel safety
240
+ /// The produced Future is cancel safe, meaning no tick is lost if the Future is dropped.
234
241
pub fn next(&mut self) -> impl Future<Output = ()> + Send + Sync + '_ {
242
poll_fn(|cx| {
243
if self.expires_at <= Instant::now() {
0 commit comments