diff --git a/CHANGES.md b/CHANGES.md index 58e68379..8c16169c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,11 @@ # Changes +## [0.2.3] - 2018-11-17 + +### Added + +* Framed::is_write_buf_empty() checks if write buffer is flushed + ## [0.2.2] - 2018-11-14 ### Added diff --git a/Cargo.toml b/Cargo.toml index b7f1c1e0..3ebfdaf1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "actix-net" -version = "0.2.2" +version = "0.2.3" authors = ["Nikolay Kim "] description = "Actix net - framework for the compisible network services for Rust (experimental)" readme = "README.md" diff --git a/src/codec/framed.rs b/src/codec/framed.rs index fcf5d2da..3c92ee54 100644 --- a/src/codec/framed.rs +++ b/src/codec/framed.rs @@ -135,6 +135,11 @@ impl Framed { &mut self.inner.get_mut().get_mut().0 } + /// Check if write buffer is empty. + pub fn is_write_buf_empty(&self) -> bool { + self.inner.get_ref().is_empty() + } + /// Check if write buffer is full. pub fn is_write_buf_full(&self) -> bool { self.inner.get_ref().is_full() diff --git a/src/codec/framed_write.rs b/src/codec/framed_write.rs index 02ea5738..8d4fe15f 100644 --- a/src/codec/framed_write.rs +++ b/src/codec/framed_write.rs @@ -77,6 +77,11 @@ impl FramedWrite { pub fn is_full(&self) -> bool { self.inner.is_full() } + + /// Check if write buffer is empty. + pub fn is_empty(&self) -> bool { + self.inner.is_empty() + } } impl FramedWrite @@ -194,6 +199,10 @@ impl FramedWrite2 { pub fn is_full(&self) -> bool { self.buffer.len() >= self.high_watermark } + + pub fn is_empty(&self) -> bool { + self.buffer.is_empty() + } } impl FramedWrite2 diff --git a/src/server/mod.rs b/src/server/mod.rs index d84f87dd..24d20b15 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -45,4 +45,4 @@ impl Token { self.0 += 1; token } -} \ No newline at end of file +}