Struct jsonrpsee_core::server::rpc_module::Subscription
source · pub struct Subscription { /* private fields */ }
Expand description
Wrapper struct that maintains a subscription “mainly” for testing.
Implementations§
source§impl Subscription
impl Subscription
sourcepub fn subscription_id(&self) -> &RpcSubscriptionId<'_>
pub fn subscription_id(&self) -> &RpcSubscriptionId<'_>
Get the subscription ID
sourcepub async fn next<T: DeserializeOwned>(
&mut self
) -> Option<Result<(T, RpcSubscriptionId<'static>), Error>>
pub async fn next<T: DeserializeOwned>(
&mut self
) -> Option<Result<(T, RpcSubscriptionId<'static>), Error>>
Returns Some((val, sub_id))
for the next element of type T from the underlying stream,
otherwise None
if the subscription was closed.
Panics
If the decoding the value as T
fails.