1
0
mirror of https://github.com/fafhrd91/actix-net synced 2024-11-30 16:34:36 +01:00

add FramedParts::with_read_buf method

This commit is contained in:
Nikolay Kim 2019-03-06 22:53:55 -08:00
parent 51bd7d2721
commit b407c65f4c
3 changed files with 19 additions and 1 deletions

View File

@ -1,5 +1,10 @@
# Changes
## [0.1.0] - 2019-03-06
* Added `FramedParts::with_read_buffer()` method.
## [0.1.0] - 2018-12-09
* Move codec to separate crate

View File

@ -1,6 +1,6 @@
[package]
name = "actix-codec"
version = "0.1.0"
version = "0.1.1"
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
description = "Utilities for encoding and decoding frames"
keywords = ["network", "framework", "async", "futures"]

View File

@ -349,4 +349,17 @@ impl<T, U> FramedParts<T, U> {
_priv: (),
}
}
/// Create a new `FramedParts` with read buffer
pub fn with_read_buf(io: T, codec: U, read_buf: BytesMut) -> FramedParts<T, U> {
FramedParts {
io,
codec,
read_buf,
write_buf: BytesMut::new(),
write_buf_lw: LW,
write_buf_hw: HW,
_priv: (),
}
}
}