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