Commit Graph

6 Commits

Author SHA1 Message Date
Sean McArthur
01c03db7ea chore(lib): add dyn keyword to trait objects (#1820)
Requires Rust 1.27.
2019-06-03 13:08:13 -07:00
Michal 'vorner' Vaner
2114950cda docs(service): change the make_service_fn example to a full snippet
Include the creation of server too. Previously, the parameter type of
the closure had a different type than the default server provided, which
wasn't obvious to the user.
2019-03-01 13:57:34 -08:00
Yusuke Sasaki
0bf30ccc68 feat(service): add poll_ready to Service and MakeService (#1767) 2019-02-27 09:30:52 -08:00
Sean McArthur
877606d5c8 feat(service): allow FnMut with service_fn 2019-02-14 11:55:22 -08:00
Sean McArthur
a522c3151a feat(service): export hyper::service::MakeServiceRef
It's sealed, and has a blanket implementation, and so should only be
used as bounds. Even still, its hidden from the docs.
2018-12-03 09:32:05 -08:00
Sean McArthur
30870029b9 feat(server): change NewService to MakeService with connection context
This adjusts the way `Service`s are created for a `hyper::Server`. The
`MakeService` trait allows receiving an argument when creating a
`Service`. The implementation for `hyper::Server` expects to pass a
reference to the accepted transport (so, `&Incoming::Item`). The user
can inspect the transport before making a `Service`.

In practice, this allows for things like getting the remote socket
address, or the TLS certification, or similar.

To prevent a breaking change, there is a blanket implementation of
`MakeService` for any `NewService`. Besides implementing `MakeService`
directly, there is also added `hyper::service::make_service_fn`.

Closes #1650
2018-11-16 13:18:09 -08:00