make topology use points_vec

This commit is contained in:
AF 2023-04-22 21:56:25 +00:00
parent 0ebb088506
commit 8ebe30cd65

View File

@ -89,16 +89,14 @@ 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. /// Used for walking over object trees to ensure two objects with different references don't collide.
fn topology(&self) -> Hash { fn topology(&self) -> Hash {
let mut vec = Vec::new(); let mut vec = Vec::new();
let mut points = Vec::new(); for point in self.points_vec() {
self.points(&mut points);
for point in points {
vec.extend(point.point); vec.extend(point.point);
} }
Ctx::hash(&vec) Ctx::hash(&vec)
} }
/// References ([Point]s) to other objects. /// References ([Point]s) to other objects.
fn points(&self, points: &mut Vec<Point<'a, Ctx, TypelessMentionable<'a, Ctx>>>); fn points(&self, points: &mut Vec<Point<'a, Ctx, TypelessMentionable<'a, Ctx>>>);
/// [Vec] of [Point]s as used by [`Mentionable::topology`].
fn points_vec(&self) -> Vec<Point<'a, Ctx, TypelessMentionable<'a, Ctx>>> { fn points_vec(&self) -> Vec<Point<'a, Ctx, TypelessMentionable<'a, Ctx>>> {
let mut points = Vec::new(); let mut points = Vec::new();
self.points(&mut points); self.points(&mut points);