nash_native_client/ws_client/
stream.rs

1use std::{pin::Pin, task::Context, task::Poll};
2
3use futures::stream::Stream;
4
5use nash_protocol::errors::Result;
6use nash_protocol::protocol::subscriptions::SubscriptionResponse;
7use nash_protocol::protocol::ResponseOrError;
8
9use crate::Client;
10
11impl Stream for Client {
12    type Item = Result<ResponseOrError<SubscriptionResponse>>;
13
14    fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
15        self.global_subscription_receiver.poll_recv(cx)
16    }
17}