A [Tower] [Service
] combinator that "pipelines" two services.
A [Pipeline
] is a [Service
] consisting of two other [Service
]s where the response of the
first is the request of the second. This is analagous to [function composition] but for
services.
```rust use towerpipeline::PipelineExt; use tower::{servicefn, BoxError, ServiceExt};
// service that returns the length of a string let lengthsvc = servicefn(|input: &'static str| async move { Ok::<_, BoxError>(input.len()) });
// service that doubles its input let doublesvc = servicefn(|input: usize| async move { Ok::<_, BoxError>(input * 2) });
// combine our two services let combined = lengthsvc.pipeline(doublesvc);
// call the service let result = combined.oneshot("rust").await.unwrap();
assert_eq!(result, 8); ```
License: MIT