Fix tests.

This commit is contained in:
Sunli 2021-01-20 10:37:31 +08:00
parent adb0c4ef3c
commit b9fb1dab24
2 changed files with 8 additions and 1 deletions

View File

@ -20,3 +20,4 @@ serde_json = "1.0.59"
[dev-dependencies]
tokio = { version = "1.0", default-features = false, features = ["macros", "rt-multi-thread", "time"] }
async-stream = "0.3.0"

View File

@ -31,7 +31,13 @@ use warp::{Filter, Rejection, Reply};
/// #[Subscription]
/// impl SubscriptionRoot {
/// async fn tick(&self) -> impl Stream<Item = String> {
/// tokio::time::interval(Duration::from_secs(1)).map(|n| format!("{}", n.elapsed().as_secs_f32()))
/// async_stream::stream! {
/// let mut interval = tokio::time::interval(Duration::from_secs(1));
/// loop {
/// let n = interval.tick().await;
/// yield format!("{}", n.elapsed().as_secs_f32());
/// }
/// }
/// }
/// }
///