Remove h2-test-support crate (#119)
The h2-test-support caused the unstable flag to always be enabled.
This commit is contained in:
		
							
								
								
									
										52
									
								
								tests/support/raw.rs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								tests/support/raw.rs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,52 @@ | ||||
| // ===== Build a codec from raw bytes ===== | ||||
|  | ||||
| #[macro_export] | ||||
| macro_rules! raw_codec { | ||||
|     ( | ||||
|         $( | ||||
|             $fn:ident => [$($chunk:expr,)+]; | ||||
|         )* | ||||
|     ) => {{ | ||||
|         let mut b = $crate::support::mock_io::Builder::new(); | ||||
|  | ||||
|         $({ | ||||
|             let mut chunk = vec![]; | ||||
|  | ||||
|             $( | ||||
|                 $crate::support::raw::Chunk::push(&$chunk, &mut chunk); | ||||
|             )+ | ||||
|  | ||||
|             b.$fn(&chunk[..]); | ||||
|         })* | ||||
|  | ||||
|         $crate::support::Codec::new(b.build()) | ||||
|     }} | ||||
| } | ||||
|  | ||||
| pub trait Chunk { | ||||
|     fn push(&self, dst: &mut Vec<u8>); | ||||
| } | ||||
|  | ||||
| impl Chunk for u8 { | ||||
|     fn push(&self, dst: &mut Vec<u8>) { | ||||
|         dst.push(*self); | ||||
|     } | ||||
| } | ||||
|  | ||||
| impl<'a> Chunk for &'a [u8] { | ||||
|     fn push(&self, dst: &mut Vec<u8>) { | ||||
|         dst.extend(*self) | ||||
|     } | ||||
| } | ||||
|  | ||||
| impl<'a> Chunk for &'a str { | ||||
|     fn push(&self, dst: &mut Vec<u8>) { | ||||
|         dst.extend(self.as_bytes()) | ||||
|     } | ||||
| } | ||||
|  | ||||
| impl Chunk for Vec<u8> { | ||||
|     fn push(&self, dst: &mut Vec<u8>) { | ||||
|         dst.extend(self.iter()) | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user