diff --git a/docs/en/src/subscription.md b/docs/en/src/subscription.md index b72d1b50..8f60f6cf 100644 --- a/docs/en/src/subscription.md +++ b/docs/en/src/subscription.md @@ -11,12 +11,13 @@ struct Subscription; #[Subscription] impl Subscription { - async fn integers(&self, #[graphql(default = "1")] step: i32) -> impl Stream { + async fn integers(&self, #[graphql(default = 1)] step: i32) -> impl Stream { let mut value = 0; - tokio::time::interval(Duration::from_secs(1)).map(move |_| { - value += step; - value - }) + tokio_stream::wrappers::IntervalStream::new(tokio::time::interval(Duration::from_secs(1))) + .map(move |_| { + value += step; + value + }) } } ``` diff --git a/docs/zh-CN/src/subscription.md b/docs/zh-CN/src/subscription.md index 60c012bd..1dc8348f 100644 --- a/docs/zh-CN/src/subscription.md +++ b/docs/zh-CN/src/subscription.md @@ -11,12 +11,13 @@ struct Subscription; #[Subscription] impl Subscription { - async fn integers(&self, #[graphql(default = "1")] step: i32) -> impl Stream { + async fn integers(&self, #[graphql(default = 1)] step: i32) -> impl Stream { let mut value = 0; - tokio::time::interval(Duration::from_secs(1)).map(move |_| { - value += step; - value - }) + tokio_stream::wrappers::IntervalStream::new(tokio::time::interval(Duration::from_secs(1))) + .map(move |_| { + value += step; + value + }) } } ```