move points_vec
out of Mentionable
This commit is contained in:
parent
ff4b4bb5b7
commit
83f9296a4f
@ -74,7 +74,14 @@ pub trait Mentionable<'a, Ctx: 'a + Context>: 'a + Serializable {
|
|||||||
fn points_typed(&self, points: &mut impl TakesPoints<'a, Ctx>);
|
fn points_typed(&self, points: &mut impl TakesPoints<'a, Ctx>);
|
||||||
/// References ([Point]s) to other objects. Typeless.
|
/// References ([Point]s) to other objects. Typeless.
|
||||||
fn points(&self, points: &mut Vec<Point<'a, Ctx, TypelessMentionable<'a, Ctx>>>);
|
fn points(&self, points: &mut Vec<Point<'a, Ctx, TypelessMentionable<'a, Ctx>>>);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub trait MentionableExt<'a, Ctx: 'a + Context>: Mentionable<'a, Ctx> {
|
||||||
/// [Vec] of [Point]s as used by [`Mentionable::topology`].
|
/// [Vec] of [Point]s as used by [`Mentionable::topology`].
|
||||||
|
fn points_vec(&self) -> Vec<Point<'a, Ctx, TypelessMentionable<'a, Ctx>>>;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a, Ctx: 'a + Context, A: Mentionable<'a, Ctx>> MentionableExt<'a, Ctx> for A {
|
||||||
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);
|
||||||
|
@ -65,10 +65,6 @@ impl<'a, Ctx: 'a + Context> Mentionable<'a, Ctx> for TypelessMentionable<'a, Ctx
|
|||||||
fn points(&self, points: &mut Vec<Point<'a, Ctx, TypelessMentionable<'a, Ctx>>>) {
|
fn points(&self, points: &mut Vec<Point<'a, Ctx, TypelessMentionable<'a, Ctx>>>) {
|
||||||
points.extend(self.t_points.iter().map(Clone::clone));
|
points.extend(self.t_points.iter().map(Clone::clone));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn points_vec(&self) -> Vec<Point<'a, Ctx, TypelessMentionable<'a, Ctx>>> {
|
|
||||||
self.t_points.clone()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, Ctx: 'a + Context> Clone for TypelessFactory<'a, Ctx> {
|
impl<'a, Ctx: 'a + Context> Clone for TypelessFactory<'a, Ctx> {
|
||||||
|
Loading…
Reference in New Issue
Block a user