2024-01-30 16:41:11 +01:00
|
|
|
use std::{future, pin::Pin};
|
2021-08-11 17:41:49 +03:00
|
|
|
|
2024-01-30 16:41:11 +01:00
|
|
|
use futures::{stream, Stream};
|
2021-08-11 17:41:49 +03:00
|
|
|
use juniper::graphql_subscription;
|
|
|
|
|
2024-01-30 16:41:11 +01:00
|
|
|
type BoxStream<'a, I> = Pin<Box<dyn Stream<Item = I> + Send + 'a>>;
|
2021-08-11 17:41:49 +03:00
|
|
|
|
|
|
|
struct ObjA;
|
|
|
|
|
|
|
|
#[graphql_subscription]
|
|
|
|
impl ObjA {
|
2024-01-30 16:41:11 +01:00
|
|
|
async fn id(&self) -> BoxStream<'static, &'static str> {
|
2021-08-11 17:41:49 +03:00
|
|
|
Box::pin(stream::once(future::ready("funA")))
|
|
|
|
}
|
|
|
|
|
|
|
|
#[graphql(name = "id")]
|
2024-01-30 16:41:11 +01:00
|
|
|
async fn id2(&self) -> BoxStream<'static, &'static str> {
|
2021-08-11 17:41:49 +03:00
|
|
|
Box::pin(stream::once(future::ready("funB")))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|