From 874fc3320bc000fee20d63b3ad865a1145122640 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BC=82=E6=B5=81?= Date: Tue, 24 Nov 2020 16:39:16 +0800 Subject: [PATCH] codec: add read_buffer_mut to FramedRead (#3166) --- tokio-util/src/codec/framed_read.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tokio-util/src/codec/framed_read.rs b/tokio-util/src/codec/framed_read.rs index a6844b735..2077fbcee 100644 --- a/tokio-util/src/codec/framed_read.rs +++ b/tokio-util/src/codec/framed_read.rs @@ -100,6 +100,11 @@ impl FramedRead { 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