mirror of
https://github.com/fafhrd91/actix-net
synced 2025-02-24 23:33:21 +01:00
Added Framed::map_io() method
This commit is contained in:
parent
e0d3581239
commit
95d02659d5
@ -1,6 +1,11 @@
|
|||||||
# Changes
|
# Changes
|
||||||
|
|
||||||
## [0.1.0] - 2019-03-06
|
## [0.1.2] - 2019-03-27
|
||||||
|
|
||||||
|
* Added `Framed::map_io()` method.
|
||||||
|
|
||||||
|
|
||||||
|
## [0.1.1] - 2019-03-06
|
||||||
|
|
||||||
* Added `FramedParts::with_read_buffer()` method.
|
* Added `FramedParts::with_read_buffer()` method.
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "actix-codec"
|
name = "actix-codec"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
||||||
description = "Utilities for encoding and decoding frames"
|
description = "Utilities for encoding and decoding frames"
|
||||||
keywords = ["network", "framework", "async", "futures"]
|
keywords = ["network", "framework", "async", "futures"]
|
||||||
@ -11,15 +11,15 @@ categories = ["network-programming", "asynchronous"]
|
|||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
exclude = [".gitignore", ".travis.yml", ".cargo/config", "appveyor.yml"]
|
exclude = [".gitignore", ".travis.yml", ".cargo/config", "appveyor.yml"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
workspace = "../"
|
workspace = ".."
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "actix_codec"
|
name = "actix_codec"
|
||||||
path = "src/lib.rs"
|
path = "src/lib.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bytes = "0.4"
|
bytes = "0.4.12"
|
||||||
futures = "0.1.24"
|
futures = "0.1.24"
|
||||||
tokio-io = "0.1"
|
tokio-io = "0.1.12"
|
||||||
tokio-codec = "0.1"
|
tokio-codec = "0.1.1"
|
||||||
log = "0.4"
|
log = "0.4"
|
@ -167,6 +167,22 @@ impl<T, U> Framed<T, U> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Consume the `Frame`, returning `Frame` with different io.
|
||||||
|
pub fn map_io<F, T2>(self, f: F) -> Framed<T2, U>
|
||||||
|
where
|
||||||
|
F: Fn(T) -> T2,
|
||||||
|
{
|
||||||
|
let (inner, read_buf) = self.inner.into_parts();
|
||||||
|
let (inner, write_buf, lw, hw) = inner.into_parts();
|
||||||
|
|
||||||
|
Framed {
|
||||||
|
inner: framed_read2_with_buffer(
|
||||||
|
framed_write2_with_buffer(Fuse(f(inner.0), inner.1), write_buf, lw, hw),
|
||||||
|
read_buf,
|
||||||
|
),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Consume the `Frame`, returning `Frame` with different codec.
|
/// Consume the `Frame`, returning `Frame` with different codec.
|
||||||
pub fn map_codec<F, U2>(self, f: F) -> Framed<T, U2>
|
pub fn map_codec<F, U2>(self, f: F) -> Framed<T, U2>
|
||||||
where
|
where
|
||||||
|
Loading…
x
Reference in New Issue
Block a user