util: expose FramedWrite/Framed::write_buffer/write_buffer_mut

This commit is contained in:
David Raifaizen
2021-01-08 23:20:07 +01:00
committed by GitHub
parent e42317b072
commit 2fe2f0401b
2 changed files with 21 additions and 0 deletions
+10
View File
@@ -208,6 +208,16 @@ impl<T, U> Framed<T, U> {
&mut self.inner.state.read.buffer
}
/// Returns a reference to the write buffer.
pub fn write_buffer(&self) -> &BytesMut {
&self.inner.state.write.buffer
}
/// Returns a mutable reference to the write buffer.
pub fn write_buffer_mut(&mut self) -> &mut BytesMut {
&mut self.inner.state.write.buffer
}
/// Consumes the `Framed`, returning its underlying I/O stream.
///
/// Note that care should be taken to not tamper with the underlying stream