Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
grumbles
  • Loading branch information
niklasad1 committed Dec 3, 2021
commit ec3c47f63aa5d0db0605d9585b361930a8da68b9
4 changes: 2 additions & 2 deletions types/src/v2/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub struct Request<'a> {
}

impl<'a> Request<'a> {
/// Create a new `Request`.
/// Create a new [`Request`].
pub fn new(method: Cow<'a, str>, params: Option<&'a RawValue>, id: Id<'a>) -> Self {
Self { jsonrpc: TwoPointZero, id, method, params }
}
Expand Down Expand Up @@ -79,7 +79,7 @@ pub struct Notification<'a, T> {
}

impl<'a, T> Notification<'a, T> {
/// Create a new `Notification`.
/// Create a new [`Notification`].
pub fn new(method: Cow<'a, str>, params: T) -> Self {
Self { jsonrpc: TwoPointZero, method, params }
}
Expand Down
2 changes: 1 addition & 1 deletion types/src/v2/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub struct Response<'a, T> {
}

impl<'a, T> Response<'a, T> {
/// Create a new `Response`.
/// Create a new [`Response`].
pub fn new(result: T, id: Id<'a>) -> Response<'a, T> {
Response { jsonrpc: TwoPointZero, result, id }
}
Expand Down
12 changes: 10 additions & 2 deletions utils/src/server/rpc_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,15 @@ impl Methods {
rx.next().await
}

/// Perform a method call and receive further subscriptions.
/// Perform a "in memory JSON-RPC method call" and receive further subscriptions.
/// This is useful if you want to support both `method calls` and `subscriptions`
/// in the same API.
///
/// There are better variants than this method if you only want
/// method calls or subscriptions.
///
/// See [`RpcModule::test_subscription`] and [`RpcModule::call_with`] for
/// for further documentation.
///
/// Returns a response to actual method call and a stream to process
/// futher subscriptions if a subcription was registered on the call.
Expand All @@ -386,7 +394,7 @@ impl Methods {
///
/// let mut module = RpcModule::new(());
/// module.register_subscription("hi", "hi", "goodbye", |_, mut sink, _| {
/// sink.send(&"one answer").unwrap();
/// sink.send(&"one answer").unwrap();
/// Ok(())
/// }).unwrap();
/// let (resp, mut stream) = module.call_and_subscribe("hi", EmptyParams::new()).await.unwrap();
Expand Down