Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(service): change Service::call to take &self
change Service::call to take &self instead of &mut self. Because of this change, the trait bound in the service::util::service_fn and the trait bound in the impl for the ServiceFn struct were changed from FnMut to Fn. This change was decided on for the following reasons: - It prepares the way for async fn, since then the future only borrows &self, and thus a Service can concurrently handle multiple outstanding requests at once. - It's clearer that Services can likely be cloned - To share state across clones you generally need Arc<Mutex<_>> that means you're not really using the &mut self and could do with a &self This commit closses issue: hyperium#3040 BREAKING CHANGE: The Service::call function no longer takes a mutable reference to self. The FnMut trait bound on the service::util::service_fn function and the trait bound on the impl for the ServiceFn struct were changed from FnMut to Fn
- Loading branch information