Expose Codec via an unstable flag (#49)
				
					
				
			Exposes `Codec` using an unstable flag. This is useful for testing.
This commit is contained in:
		| @@ -258,3 +258,14 @@ impl<T: AsyncRead, B> AsyncRead for FramedWrite<T, B> { | ||||
|         self.inner.prepare_uninitialized_buffer(buf) | ||||
|     } | ||||
| } | ||||
|  | ||||
| #[cfg(feature = "unstable")] | ||||
| mod unstable { | ||||
|     use super::*; | ||||
|  | ||||
|     impl<T, B> FramedWrite<T, B> { | ||||
|         pub fn get_ref(&self) -> &T { | ||||
|             &self.inner | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -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) | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user