util: add mutable reference getters for codecs to pinned Framed (#4372)

This commit is contained in:
Tom Dohrmann
2022-01-03 22:21:43 +01:00
committed by GitHub
parent 12dd06336d
commit 4a12163d7c
3 changed files with 19 additions and 0 deletions
+5
View File
@@ -108,6 +108,11 @@ impl<T, D> FramedRead<T, D> {
&mut self.inner.codec
}
/// Returns a mutable reference to the underlying decoder.
pub fn decoder_pin_mut(self: Pin<&mut Self>) -> &mut D {
self.project().inner.project().codec
}
/// Returns a reference to the read buffer.
pub fn read_buffer(&self) -> &BytesMut {
&self.inner.state.buffer