io: expose underlying codec (#686)

This commit is contained in:
Nikolay Kim
2018-10-06 19:23:05 -04:00
committed by Toby Lawrence
parent 1879bc49ce
commit a2f457fa48
+18
View File
@@ -97,6 +97,24 @@ impl<T, U> Framed<T, U> {
&mut self.inner.get_mut().get_mut().0
}
/// Returns a reference to the underlying codec wrapped by
/// `Frame`.
///
/// Note that care should be taken to not tamper with the underlying codec
/// as it may corrupt the stream of frames otherwise being worked with.
pub fn codec(&self) -> &U {
&self.inner.get_ref().get_ref().1
}
/// Returns a mutable reference to the underlying codec wrapped by
/// `Frame`.
///
/// Note that care should be taken to not tamper with the underlying codec
/// as it may corrupt the stream of frames otherwise being worked with.
pub fn codec_mut(&mut self) -> &mut U {
&mut self.inner.get_mut().get_mut().1
}
/// Consumes the `Frame`, returning its underlying I/O stream.
///
/// Note that care should be taken to not tamper with the underlying stream