InliningDyn
				
					
				
			This commit is contained in:
		
							parent
							
								
									ca48aba4fb
								
							
						
					
					
						commit
						8cf8680353
					
				| @ -88,6 +88,28 @@ impl<'a: 'c, 'c, Ctx: Context<'a>> InCtx<'a, Ctx> for &'c mut dyn DeCtx<'a, Ctx> | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| pub trait InliningDyn: Sized { | ||||
|     fn idread_n(self, n: usize) -> Result<(Vec<u8>, Self), Vec<u8>>; | ||||
| 
 | ||||
|     fn idread_all(self) -> Vec<u8>; | ||||
| 
 | ||||
|     fn idtell(&self) -> usize; | ||||
| } | ||||
| 
 | ||||
| impl<I: Inlining> InliningDyn for I { | ||||
|     fn idread_n(self, n: usize) -> Result<(Vec<u8>, Self), Vec<u8>> { | ||||
|         self.iread_n(n, |slice| Vec::from(slice), |slice| Vec::from(slice)) | ||||
|     } | ||||
| 
 | ||||
|     fn idread_all(self) -> Vec<u8> { | ||||
|         self.iread_all(|slice| Vec::from(slice)) | ||||
|     } | ||||
| 
 | ||||
|     fn idtell(&self) -> usize { | ||||
|         self.itell() | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| pub type IParseResult<'a, Ctx, F, I> = | ||||
|     Result<(Mtbl<'a, Ctx, F>, I), <F as Factory<'a, Ctx>>::ParseError>; | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user