Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add RpcModule::remove #1416

Merged
merged 2 commits into from
Jun 26, 2024
Merged
Changes from all commits
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
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
Loading