mirror of
https://github.com/actix/actix-web.git
synced 2025-02-01 03:42:21 +00:00
allow to change framed codec
This commit is contained in:
parent
f8efabdce7
commit
b1899e2bb1
1 changed files with 13 additions and 0 deletions
|
@ -120,6 +120,19 @@ impl<T, U> Framed<T, U> {
|
||||||
self.inner.into_inner().into_inner().0
|
self.inner.into_inner().into_inner().0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Consume the `Frame`, returning `Frame` with different codec.
|
||||||
|
pub fn into_framed<U2>(self, codec: U2) -> Framed<T, U2> {
|
||||||
|
let (inner, read_buf) = self.inner.into_parts();
|
||||||
|
let (inner, write_buf) = inner.into_parts();
|
||||||
|
|
||||||
|
Framed {
|
||||||
|
inner: framed_read2_with_buffer(
|
||||||
|
framed_write2_with_buffer(Fuse(inner.0, codec), write_buf),
|
||||||
|
read_buf,
|
||||||
|
),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Consumes the `Frame`, returning its underlying I/O stream, the buffer
|
/// Consumes the `Frame`, returning its underlying I/O stream, the buffer
|
||||||
/// with unprocessed data, and the codec.
|
/// with unprocessed data, and the codec.
|
||||||
///
|
///
|
||||||
|
|
Loading…
Reference in a new issue