Skip to content

Commit

Permalink
add RpcModule::remove (#1416)
Browse files Browse the repository at this point in the history
* rpc: remove method

* remove internal remove method

---------

Co-authored-by: Niklas Adolfsson <[email protected]>
  • Loading branch information
polachok and niklasad1 authored Jun 26, 2024
1 parent 5ac7047 commit 9ebc4c1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions core/src/server/rpc_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,14 @@ impl<Context: Send + Sync + 'static> RpcModule<Context> {
)
}

/// Removes the method if it exists.
///
/// Be aware that a subscription consist of two methods, `subscribe` and `unsubscribe` and
/// it's the caller responsibility to remove both `subscribe` and `unsubscribe` methods for subscriptions.
pub fn remove_method(&mut self, method_name: &'static str) -> Option<MethodCallback> {
self.methods.mut_callbacks().remove(method_name)
}

/// Register a new asynchronous RPC method, which computes the response with the given callback.
///
/// ## Examples
Expand Down

0 comments on commit 9ebc4c1

Please sign in to comment.