async_codec_util/decoder/mod.rs
1//! Utilities for working with decores.
2
3use async_codec::AsyncDecode;
4
5mod and_then;
6pub use self::and_then::AndThen;
7mod decode_exact;
8pub use self::decode_exact::{DecodeExact, DecodeExactError};
9mod map;
10pub use self::map::Map;
11mod chain;
12pub use self::chain::Chain;
13
14/// Chain a compution on the result of a decoder.
15pub fn map<D, F>(decoder: D, f: F) -> Map<D, F> {
16 Map::new(decoder, f)
17}
18
19/// Create new `Chain` which first decodes via the given `S` and then decodes via the given `T`.
20pub fn chain<S, T>(first: S, second: T) -> Chain<S, T>
21 where S: AsyncDecode
22{
23 Chain::new(first, second)
24}