re-implement topology via points_typed

This commit is contained in:
AF 2023-05-07 16:47:03 +00:00
parent 86b87306ef
commit ff4b4bb5b7
2 changed files with 8 additions and 3 deletions

View File

@ -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.

View File

@ -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)
}
}