builder: Add `into_inner` (#299)

When using a `ServiceBuilder`, it's not possible to obtain the
underlying `Layer` implementation.

Adding a `ServiceBuilder::into_inner` allows callers to retrieve this
field instead of only being able to build a `Service`.
This commit is contained in:
Oliver Gould 2019-07-09 11:43:59 -07:00 committed by GitHub
parent 18b30eb70e
commit b39a4881d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -212,6 +212,11 @@ impl<L> ServiceBuilder<L> {
self.layer(TimeoutLayer::new(timeout))
}
/// Obtains the underlying `Layer` implementation.
pub fn into_inner(self) -> L {
self.layer
}
/// Wrap the service `S` with the layers.
pub fn service<S>(self, service: S) -> L::Service
where