Expose Codec via an unstable flag (#49)
				
					
				
			Exposes `Codec` using an unstable flag. This is useful for testing.
This commit is contained in:
		| @@ -3,6 +3,7 @@ use bytes::{BufMut, Bytes, Buf}; | ||||
|  | ||||
| use std::fmt; | ||||
|  | ||||
| #[derive(Eq, PartialEq)] | ||||
| pub struct Data<T = Bytes> { | ||||
|     stream_id: StreamId, | ||||
|     data: T, | ||||
|   | ||||
| @@ -2,7 +2,7 @@ use frame::{self, Head, Error, Kind, StreamId, Reason}; | ||||
|  | ||||
| use bytes::{BufMut, BigEndian}; | ||||
|  | ||||
| #[derive(Debug, Clone, Copy)] | ||||
| #[derive(Debug, Clone, Copy, Eq, PartialEq)] | ||||
| pub struct GoAway { | ||||
|     last_stream_id: StreamId, | ||||
|     error_code: u32, | ||||
|   | ||||
| @@ -15,6 +15,7 @@ use std::io::Cursor; | ||||
| /// Header frame | ||||
| /// | ||||
| /// This could be either a request or a response. | ||||
| #[derive(Eq, PartialEq)] | ||||
| pub struct Headers { | ||||
|     /// The ID of the stream with which this frame is associated. | ||||
|     stream_id: StreamId, | ||||
| @@ -36,7 +37,7 @@ pub struct Headers { | ||||
| #[derive(Copy, Clone, Eq, PartialEq)] | ||||
| pub struct HeadersFlag(u8); | ||||
|  | ||||
| #[derive(Debug)] | ||||
| #[derive(Debug, Eq, PartialEq)] | ||||
| pub struct PushPromise { | ||||
|     /// The ID of the stream with which this frame is associated. | ||||
|     stream_id: StreamId, | ||||
| @@ -63,7 +64,7 @@ pub struct Continuation { | ||||
|     headers: Iter, | ||||
| } | ||||
|  | ||||
| #[derive(Debug, Default)] | ||||
| #[derive(Debug, Default, Eq, PartialEq)] | ||||
| pub struct Pseudo { | ||||
|     // Request | ||||
|     pub method: Option<Method>, | ||||
|   | ||||
| @@ -61,6 +61,7 @@ pub type FrameSize = u32; | ||||
|  | ||||
| pub const HEADER_LEN: usize = 9; | ||||
|  | ||||
| #[derive(Eq, PartialEq)] | ||||
| pub enum Frame<T = Bytes> { | ||||
|     Data(Data<T>), | ||||
|     Headers(Headers), | ||||
|   | ||||
| @@ -5,7 +5,7 @@ const ACK_FLAG: u8 = 0x1; | ||||
|  | ||||
| pub type Payload = [u8; 8]; | ||||
|  | ||||
| #[derive(Debug)] | ||||
| #[derive(Debug, Eq, PartialEq)] | ||||
| pub struct Ping { | ||||
|     ack: bool, | ||||
|     payload: Payload, | ||||
|   | ||||
| @@ -1,12 +1,12 @@ | ||||
| use frame::*; | ||||
|  | ||||
| #[derive(Debug)] | ||||
| #[derive(Debug, Eq, PartialEq)] | ||||
| pub struct Priority { | ||||
|     stream_id: StreamId, | ||||
|     dependency: StreamDependency, | ||||
| } | ||||
|  | ||||
| #[derive(Debug)] | ||||
| #[derive(Debug, Eq, PartialEq)] | ||||
| pub struct StreamDependency { | ||||
|     /// The ID of the stream dependency target | ||||
|     dependency_id: StreamId, | ||||
|   | ||||
| @@ -2,7 +2,7 @@ use frame::{self, Head, Error, Kind, StreamId, Reason}; | ||||
|  | ||||
| use bytes::{BufMut, BigEndian}; | ||||
|  | ||||
| #[derive(Debug)] | ||||
| #[derive(Debug, Eq, PartialEq)] | ||||
| pub struct Reset { | ||||
|     stream_id: StreamId, | ||||
|     error_code: u32, | ||||
|   | ||||
| @@ -29,8 +29,8 @@ pub fn strip_padding(payload: &mut Bytes) -> Result<u8, Error> { | ||||
|         return Err(Error::TooMuchPadding); | ||||
|     } | ||||
|  | ||||
|     let _ = payload.split_off(pad_len); | ||||
|     let _ = payload.split_to(1); | ||||
|     let _ = payload.split_off(pad_len); | ||||
|  | ||||
|     Ok(pad_len as u8) | ||||
| } | ||||
|   | ||||
| @@ -4,7 +4,7 @@ use bytes::{BufMut, BigEndian}; | ||||
|  | ||||
| const SIZE_INCREMENT_MASK: u32 = 1 << 31; | ||||
|  | ||||
| #[derive(Copy, Clone, Debug)] | ||||
| #[derive(Debug, Copy, Clone, Eq, PartialEq)] | ||||
| pub struct WindowUpdate { | ||||
|     stream_id: StreamId, | ||||
|     size_increment: u32, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user