Skip to content

Commit

Permalink
Allow access a method handler (#15601)
Browse files Browse the repository at this point in the history
# 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
  • Loading branch information
notmd authored Oct 2, 2024
1 parent 7c6057b commit 453c016
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crates/bevy_remote/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,11 @@ impl RemoteMethods {
) -> Option<RemoteMethod> {
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,
Expand Down

0 comments on commit 453c016

Please sign in to comment.