File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8
8
# Unreleased
9
9
10
10
- ** builder** : Implement ` Layer ` for ` ServiceBuilder ` .
11
+ - ** builder** : Add ` ServiceBuilder::and_then ` analogous to
12
+ ` ServiceExt::and_then `
11
13
12
14
# 0.4.8 (May 28, 2021)
13
15
Original file line number Diff line number Diff line change @@ -453,6 +453,28 @@ impl<L> ServiceBuilder<L> {
453
453
self . layer ( crate :: util:: ThenLayer :: new ( f) )
454
454
}
455
455
456
+ /// Executes a new future after this service's future resolves. This does
457
+ /// not alter the behaviour of the [`poll_ready`] method.
458
+ ///
459
+ /// This method can be used to change the [`Response`] type of the service
460
+ /// into a different type. You can use this method to chain along a computation once the
461
+ /// service's response has been resolved.
462
+ ///
463
+ /// This wraps the inner service with an instance of the [`AndThen`]
464
+ /// middleware.
465
+ ///
466
+ /// See the documentation for the [`and_then` combinator] for details.
467
+ ///
468
+ /// [`Response`]: crate::Service::Response
469
+ /// [`poll_ready`]: crate::Service::poll_ready
470
+ /// [`and_then` combinator]: crate::util::ServiceExt::and_then
471
+ /// [`AndThen`]: crate::util::AndThen
472
+ #[ cfg( feature = "util" ) ]
473
+ #[ cfg_attr( docsrs, doc( cfg( feature = "util" ) ) ) ]
474
+ pub fn and_then < F > ( self , f : F ) -> ServiceBuilder < Stack < crate :: util:: AndThenLayer < F > , L > > {
475
+ self . layer ( crate :: util:: AndThenLayer :: new ( f) )
476
+ }
477
+
456
478
/// Maps this service's result type (`Result<Self::Response, Self::Error>`)
457
479
/// to a different value, regardless of whether the future succeeds or
458
480
/// fails.
You can’t perform that action at this time.
0 commit comments