Skip to content

Commit 2ee82a7

Browse files
committed
feat: add downcast on Sleep trait
This commit adds `as_any` downcast method for the `Sleep` trait. BREAKING CHANGE: `Sleep` trait now needs `as_any` implementation
1 parent 5bf1640 commit 2ee82a7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/rt.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use std::{
99
future::Future,
1010
pin::Pin,
1111
time::{Duration, Instant},
12+
any::Any,
1213
};
1314

1415
/// An executor of futures.
@@ -32,4 +33,7 @@ pub trait Timer {
3233
}
3334

3435
/// A future returned by a `Timer`.
35-
pub trait Sleep: Send + Sync + Future<Output = ()> {}
36+
pub trait Sleep: Send + Sync + Future<Output = ()> {
37+
/// Downcast API
38+
fn as_any(&self) -> &dyn Any;
39+
}

0 commit comments

Comments
 (0)