detached std::{typeless,cast} from points
				
					
				
			This commit is contained in:
		
							parent
							
								
									43ae010a93
								
							
						
					
					
						commit
						8410d6ad7f
					
				| @ -87,7 +87,7 @@ where | ||||
|             |resolved| match resolved { | ||||
|                 Ok(mentionable) => { | ||||
|                     let resolver: Rc<dyn Resolver<'a, Ctx>> = Rc::new(CastResolver { | ||||
|                         points: mentionable.points_vec(), | ||||
|                         points: mentionable.points_vec_2(), | ||||
|                     }); | ||||
|                     Ok((mentionable.bytes(), resolver)) | ||||
|                 } | ||||
| @ -117,7 +117,7 @@ where | ||||
|         factory.parse_slice( | ||||
|             &self.bytes(), | ||||
|             map_resolver(Rc::new(CastResolver { | ||||
|                 points: self.points_vec(), | ||||
|                 points: self.points_vec_2(), | ||||
|             })), | ||||
|         ) | ||||
|     } | ||||
|  | ||||
| @ -101,3 +101,30 @@ impl<'a, Ctx: 'a + Context, A: Mentionable<'a, Ctx>> Point<'a, Ctx, A> { | ||||
|         } | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| pub trait MentionableExt2<'a, Ctx: 'a + Context>: Mentionable<'a, Ctx> { | ||||
|     /// References ([Point]s) to other objects. Typeless.
 | ||||
|     fn points_typeless(&self, points: &mut Vec<Point<'a, Ctx, TypelessMentionable<'a, Ctx>>>); | ||||
|     /// [Vec] of [Point]s as used by [`Mentionable::topology`].
 | ||||
|     fn points_vec_2(&self) -> Vec<Point<'a, Ctx, TypelessMentionable<'a, Ctx>>>; | ||||
| } | ||||
| 
 | ||||
| impl<'a, Ctx: 'a + Context, A: Mentionable<'a, Ctx>> MentionableExt2<'a, Ctx> for A { | ||||
|     fn points_typeless(&self, points: &mut Vec<Point<'a, Ctx, TypelessMentionable<'a, Ctx>>>) { | ||||
|         self.points_typed(points) | ||||
|     } | ||||
| 
 | ||||
|     fn points_vec_2(&self) -> Vec<Point<'a, Ctx, TypelessMentionable<'a, Ctx>>> { | ||||
|         let mut points = Vec::new(); | ||||
|         self.points_typeless(&mut points); | ||||
|         points | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| impl<'a, Ctx: 'a + Context> TakesPoints<'a, Ctx> | ||||
|     for Vec<Point<'a, Ctx, TypelessMentionable<'a, Ctx>>> | ||||
| { | ||||
|     fn take<A: Mentionable<'a, Ctx>>(&mut self, point: &Point<'a, Ctx, A>) { | ||||
|         self.push(point.typeless()); | ||||
|     } | ||||
| } | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user