Struct jsonrpsee_core::server::rpc_module::Subscription
source · pub struct Subscription { /* private fields */ }
Available on crate feature
server
only.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.
Trait Implementations§
source§impl Debug for Subscription
impl Debug for Subscription
Auto Trait Implementations§
impl !RefUnwindSafe for Subscription
impl Send for Subscription
impl Sync for Subscription
impl Unpin for Subscription
impl !UnwindSafe for Subscription
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more