Skip to content

Commit

Permalink
Distinguish between 'handler' and 'callback'
Browse files Browse the repository at this point in the history
In this case, we take "callback" to refer to some function or method
passed as an argument to be executed by the `Router<S>`, while "handler"
refers to the object wrapping said callback that gets executed on every
`<Router<S> as Service<Request>>::call`.
  • Loading branch information
ebkalderon committed Mar 11, 2022
1 parent 3779de1 commit 1af51d3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,14 @@ impl<S: LanguageServer> LspServiceBuilder<S> {
/// .method("custom/notificationParams", Mock::notification_params)
/// .finish();
/// ```
pub fn method<P, R, F>(mut self, name: &'static str, handler: F) -> Self
pub fn method<P, R, F>(mut self, name: &'static str, callback: F) -> Self
where
P: FromParams,
R: IntoResponse,
F: for<'a> Method<&'a S, P, R> + Clone + Send + Sync + 'static,
{
let layer = layers::Normal::new(self.state.clone(), self.pending.clone());
self.inner.method(name, handler, layer);
self.inner.method(name, callback, layer);
self
}

Expand Down

0 comments on commit 1af51d3

Please sign in to comment.