re-implement topology via points_typed
				
					
				
			This commit is contained in:
		
							parent
							
								
									86b87306ef
								
							
						
					
					
						commit
						ff4b4bb5b7
					
				@ -67,9 +67,7 @@ pub trait Mentionable<'a, Ctx: 'a + Context>: 'a + Serializable {
 | 
			
		||||
    /// Used for walking over object trees to ensure two objects with different references don't collide.
 | 
			
		||||
    fn topology(&self) -> Hash {
 | 
			
		||||
        let mut vec = Vec::new();
 | 
			
		||||
        for point in self.points_vec() {
 | 
			
		||||
            vec.extend(point.point);
 | 
			
		||||
        }
 | 
			
		||||
        self.points_typed(&mut vec);
 | 
			
		||||
        Ctx::hash(&vec)
 | 
			
		||||
    }
 | 
			
		||||
    /// References ([Point]s) to other objects. Typed.
 | 
			
		||||
 | 
			
		||||
@ -3,3 +3,10 @@ use super::*;
 | 
			
		||||
pub trait TakesPoints<'a, Ctx: 'a + Context> {
 | 
			
		||||
    fn take<A: Mentionable<'a, Ctx>>(&mut self, point: &Point<'a, Ctx, A>);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, Ctx: 'a + Context> TakesPoints<'a, Ctx> for Vec<u8> {
 | 
			
		||||
    /// The only natural implementation, as used in [`Mentionable::topology`].
 | 
			
		||||
    fn take<A: Mentionable<'a, Ctx>>(&mut self, point: &Point<'a, Ctx, A>) {
 | 
			
		||||
        self.extend(point.point)
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user