mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 12:11:09 +00:00
examples: Adjust example to return subscription ID
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
@@ -16,6 +16,7 @@ use subxt::{
|
|||||||
RpcClientT,
|
RpcClientT,
|
||||||
RpcFuture,
|
RpcFuture,
|
||||||
RpcSubscription,
|
RpcSubscription,
|
||||||
|
RpcSubscriptionId,
|
||||||
},
|
},
|
||||||
OnlineClient,
|
OnlineClient,
|
||||||
PolkadotConfig,
|
PolkadotConfig,
|
||||||
@@ -54,7 +55,7 @@ impl RpcClientT for MyLoggingClient {
|
|||||||
sub: &'a str,
|
sub: &'a str,
|
||||||
params: Option<Box<RawValue>>,
|
params: Option<Box<RawValue>>,
|
||||||
unsub: &'a str,
|
unsub: &'a str,
|
||||||
) -> RpcFuture<'a, RpcSubscription> {
|
) -> RpcFuture<'a, (RpcSubscription, Option<RpcSubscriptionId>)> {
|
||||||
writeln!(
|
writeln!(
|
||||||
self.log.lock().unwrap(),
|
self.log.lock().unwrap(),
|
||||||
"{sub}({}) (unsub: {unsub})",
|
"{sub}({}) (unsub: {unsub})",
|
||||||
@@ -68,7 +69,8 @@ impl RpcClientT for MyLoggingClient {
|
|||||||
let res = RawValue::from_string("[]".to_string()).unwrap();
|
let res = RawValue::from_string("[]".to_string()).unwrap();
|
||||||
let stream = futures::stream::once(async move { Ok(res) });
|
let stream = futures::stream::once(async move { Ok(res) });
|
||||||
let stream: Pin<Box<dyn futures::Stream<Item = _> + Send>> = Box::pin(stream);
|
let stream: Pin<Box<dyn futures::Stream<Item = _> + Send>> = Box::pin(stream);
|
||||||
Box::pin(std::future::ready(Ok(stream)))
|
// This subscription does not provide an ID.
|
||||||
|
Box::pin(std::future::ready(Ok((stream, None))))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user