Expose Codec via an unstable flag (#49)

Exposes `Codec` using an unstable flag. This is useful for testing.
This commit is contained in:
Carl Lerche
2017-09-03 16:17:05 -07:00
committed by GitHub
parent c122e97127
commit 88d1de2da0
33 changed files with 222 additions and 85 deletions

View File

@@ -65,6 +65,11 @@ impl<T, B> Codec<T, B> {
self.inner.get_ref().max_frame_size()
}
#[cfg(feature = "unstable")]
pub fn get_ref(&self) -> &T {
self.inner.get_ref().get_ref()
}
pub fn get_mut(&mut self) -> &mut T {
self.inner.get_mut().get_mut()
}
@@ -146,3 +151,12 @@ impl<T, B> Sink for Codec<T, B>
Ok(Async::Ready(()))
}
}
// TODO: remove (or improve) this
impl<T> From<T> for Codec<T, ::std::io::Cursor<::bytes::Bytes>>
where T: AsyncRead + AsyncWrite,
{
fn from(src: T) -> Self {
Self::new(src)
}
}