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.
2 parents 5cc1bf8 + 3804ea8 commit 99a0f4dCopy full SHA for 99a0f4d
src/timer.rs
@@ -79,3 +79,17 @@ pub trait CountDown {
79
80
/// Marker trait that indicates that a timer is periodic
81
pub trait Periodic {}
82
+
83
+/// Trait for cancelable countdowns.
84
+pub trait Cancel : CountDown {
85
+ /// Error returned when a countdown can't be canceled.
86
+ type Error;
87
88
+ /// Tries to cancel this countdown.
89
+ ///
90
+ /// # Errors
91
92
+ /// An error will be returned if the countdown has already been canceled or was never started.
93
+ /// An error is also returned if the countdown is not `Periodic` and has already expired.
94
+ fn cancel(&mut self) -> Result<(), Self::Error>;
95
+}
0 commit comments