rcore::inctx
				
					
				
			This commit is contained in:
		
							parent
							
								
									f6cc23ff5f
								
							
						
					
					
						commit
						e9e7ffb57d
					
				| @ -6,6 +6,7 @@ mod addresses; | |||||||
| mod context; | mod context; | ||||||
| mod diagnostic; | mod diagnostic; | ||||||
| mod hashing; | mod hashing; | ||||||
|  | mod inctx; | ||||||
| mod inlining; | mod inlining; | ||||||
| mod origin; | mod origin; | ||||||
| mod point; | mod point; | ||||||
| @ -24,6 +25,7 @@ pub use self::addresses::{Addresses, InliningAddresses}; | |||||||
| pub use self::context::Context; | pub use self::context::Context; | ||||||
| pub use self::diagnostic::Diagnostic; | pub use self::diagnostic::Diagnostic; | ||||||
| pub use self::hashing::{Hash, HASH_SIZE, HASH_ZEROS}; | pub use self::hashing::{Hash, HASH_SIZE, HASH_ZEROS}; | ||||||
|  | pub use self::inctx::InCtx; | ||||||
| pub use self::inlining::{Inlining, InliningExt}; | pub use self::inlining::{Inlining, InliningExt}; | ||||||
| pub use self::origin::{OFctr, Origin}; | pub use self::origin::{OFctr, Origin}; | ||||||
| pub use self::point::Point; | pub use self::point::Point; | ||||||
|  | |||||||
							
								
								
									
										19
									
								
								src/rcore/inctx.rs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								src/rcore/inctx.rs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,19 @@ | |||||||
|  | use super::*; | ||||||
|  | 
 | ||||||
|  | pub trait InCtx<'a, Ctx: Context<'a>>: Inlining { | ||||||
|  |     fn icnext_address<E>(self, err: impl FnOnce(&[u8]) -> E) -> Result<(Address, Self), E>; | ||||||
|  | 
 | ||||||
|  |     fn icnext_point<'b, A: Mentionable<'a, Ctx>, E>( | ||||||
|  |         self, | ||||||
|  |         factory: A::Fctr, | ||||||
|  |         err: impl FnOnce(&[u8]) -> E, | ||||||
|  |     ) -> Result<(Point<'a, Ctx, A>, Self), E> { | ||||||
|  |         let (point, inctx) = self.icnext_address(err)?; | ||||||
|  |         Ok(( | ||||||
|  |             Point::from_address(point, factory, inctx.iresolver()), | ||||||
|  |             inctx, | ||||||
|  |         )) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     fn iresolver(&self) -> Rc<dyn Resolver<'a, Ctx>>; | ||||||
|  | } | ||||||
| @ -34,24 +34,6 @@ impl<D: ?Sized + Deserializer> Inlining for &mut D { | |||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| pub trait InCtx<'a, Ctx: Context<'a>>: Inlining { |  | ||||||
|     fn icnext_address<E>(self, err: impl FnOnce(&[u8]) -> E) -> Result<(Address, Self), E>; |  | ||||||
| 
 |  | ||||||
|     fn icnext_point<'b, A: Mentionable<'a, Ctx>, E>( |  | ||||||
|         self, |  | ||||||
|         factory: A::Fctr, |  | ||||||
|         err: impl FnOnce(&[u8]) -> E, |  | ||||||
|     ) -> Result<(Point<'a, Ctx, A>, Self), E> { |  | ||||||
|         let (point, inctx) = self.icnext_address(err)?; |  | ||||||
|         Ok(( |  | ||||||
|             Point::from_address(point, factory, inctx.iresolver()), |  | ||||||
|             inctx, |  | ||||||
|         )) |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     fn iresolver(&self) -> Rc<dyn Resolver<'a, Ctx>>; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| impl<'a: 'c, 'c, Ctx: Context<'a>> Inlining for &'c mut dyn DeCtx<'a, Ctx> { | impl<'a: 'c, 'c, Ctx: Context<'a>> Inlining for &'c mut dyn DeCtx<'a, Ctx> { | ||||||
|     fn iread_n<A, E>( |     fn iread_n<A, E>( | ||||||
|         self, |         self, | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user