diff options
author | 漂流 <driftluo@foxmail.com> | 2020-11-24 16:39:16 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-24 09:39:16 +0100 |
commit | 874fc3320bc000fee20d63b3ad865a1145122640 (patch) | |
tree | 53540b744f6a915cedc1099afe1b0639443b2436 | |
parent | ae67851f11b7cc1f577de8ce21767ce3e2c7aff9 (diff) |
codec: add read_buffer_mut to FramedRead (#3166)
-rw-r--r-- | tokio-util/src/codec/framed_read.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tokio-util/src/codec/framed_read.rs b/tokio-util/src/codec/framed_read.rs index a6844b73..2077fbce 100644 --- a/tokio-util/src/codec/framed_read.rs +++ b/tokio-util/src/codec/framed_read.rs @@ -100,6 +100,11 @@ impl<T, D> FramedRead<T, D> { pub fn read_buffer(&self) -> &BytesMut { &self.inner.state.buffer } + + /// Returns a mutable reference to the read buffer. + pub fn read_buffer_mut(&mut self) -> &mut BytesMut { + &mut self.inner.state.buffer + } } // This impl just defers to the underlying FramedImpl |