Merge pull request #439 from taiki-e/docs-subscription
Update subscription.md
This commit is contained in:
commit
26a55146da
|
@ -11,9 +11,10 @@ struct Subscription;
|
||||||
|
|
||||||
#[Subscription]
|
#[Subscription]
|
||||||
impl Subscription {
|
impl Subscription {
|
||||||
async fn integers(&self, #[graphql(default = "1")] step: i32) -> impl Stream<Item = i32> {
|
async fn integers(&self, #[graphql(default = 1)] step: i32) -> impl Stream<Item = i32> {
|
||||||
let mut value = 0;
|
let mut value = 0;
|
||||||
tokio::time::interval(Duration::from_secs(1)).map(move |_| {
|
tokio_stream::wrappers::IntervalStream::new(tokio::time::interval(Duration::from_secs(1)))
|
||||||
|
.map(move |_| {
|
||||||
value += step;
|
value += step;
|
||||||
value
|
value
|
||||||
})
|
})
|
||||||
|
|
|
@ -11,9 +11,10 @@ struct Subscription;
|
||||||
|
|
||||||
#[Subscription]
|
#[Subscription]
|
||||||
impl Subscription {
|
impl Subscription {
|
||||||
async fn integers(&self, #[graphql(default = "1")] step: i32) -> impl Stream<Item = i32> {
|
async fn integers(&self, #[graphql(default = 1)] step: i32) -> impl Stream<Item = i32> {
|
||||||
let mut value = 0;
|
let mut value = 0;
|
||||||
tokio::time::interval(Duration::from_secs(1)).map(move |_| {
|
tokio_stream::wrappers::IntervalStream::new(tokio::time::interval(Duration::from_secs(1)))
|
||||||
|
.map(move |_| {
|
||||||
value += step;
|
value += step;
|
||||||
value
|
value
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue
Block a user