1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-08-31 10:46:58 +02:00

allow to check if Framed's write buffer is full

This commit is contained in:
Nikolay Kim
2018-11-13 21:33:10 -08:00
parent f13a0925f7
commit 9a3321b153
2 changed files with 37 additions and 4 deletions

View File

@@ -85,7 +85,12 @@ impl<T, U> Framed<T, U> {
pub fn from_parts(parts: FramedParts<T, U>) -> Framed<T, U> {
Framed {
inner: framed_read2_with_buffer(
framed_write2_with_buffer(Fuse(parts.io, parts.codec), parts.write_buf, parts.write_buf_lw, parts.write_buf_hw),
framed_write2_with_buffer(
Fuse(parts.io, parts.codec),
parts.write_buf,
parts.write_buf_lw,
parts.write_buf_hw,
),
parts.read_buf,
),
}
@@ -121,6 +126,11 @@ impl<T, U> Framed<T, U> {
&mut self.inner.get_mut().get_mut().0
}
/// Check if write buffer is full.
pub fn is_full(&self) -> bool {
self.inner.get_ref().is_full()
}
/// Consumes the `Frame`, returning its underlying I/O stream.
///
/// Note that care should be taken to not tamper with the underlying stream