From 453c0167b25a55d09a38705d35e473de17cd0c2a Mon Sep 17 00:00:00 2001 From: notmd <33456881+notmd@users.noreply.github.com> Date: Thu, 3 Oct 2024 02:45:18 +0700 Subject: [PATCH] Allow access a method handler (#15601) # Objective - I'm building a streaming plugin for `bevy_remote` and accessing to builtin method will be very valuable ## Solution - Add a method to allow access a handler by method name. ## Testing - CI should pass --- crates/bevy_remote/src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/bevy_remote/src/lib.rs b/crates/bevy_remote/src/lib.rs index cff0d39d1df7a..57bc05035346b 100644 --- a/crates/bevy_remote/src/lib.rs +++ b/crates/bevy_remote/src/lib.rs @@ -399,6 +399,11 @@ impl RemoteMethods { ) -> Option { self.0.insert(method_name.into(), handler) } + + /// Retrieves a handler by method name. + pub fn get(&self, method_name: &str) -> Option<&RemoteMethod> { + self.0.get(method_name) + } } /// A single request from a Bevy Remote Protocol client to the server,