move MentionableExt
to core::typeless
This commit is contained in:
parent
83f9296a4f
commit
43ae010a93
13
src/core.rs
13
src/core.rs
@ -76,19 +76,6 @@ pub trait Mentionable<'a, Ctx: 'a + Context>: 'a + Serializable {
|
|||||||
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`].
|
|
||||||
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>>> {
|
|
||||||
let mut points = Vec::new();
|
|
||||||
self.points(&mut points);
|
|
||||||
points
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Shorthand for the type of vaalues returned by [`Factory::deserialize`].
|
/// Shorthand for the type of vaalues returned by [`Factory::deserialize`].
|
||||||
pub type ParseResult<'a, Ctx, F> =
|
pub type ParseResult<'a, Ctx, F> =
|
||||||
Result<<F as Factory<'a, Ctx>>::Mtbl, <F as Factory<'a, Ctx>>::ParseError>;
|
Result<<F as Factory<'a, Ctx>>::Mtbl, <F as Factory<'a, Ctx>>::ParseError>;
|
||||||
|
@ -169,3 +169,16 @@ impl<'a> TypelessError<'a> {
|
|||||||
TypelessError(Box::new(error))
|
TypelessError(Box::new(error))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub trait MentionableExt<'a, Ctx: 'a + Context>: Mentionable<'a, Ctx> {
|
||||||
|
/// [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>>> {
|
||||||
|
let mut points = Vec::new();
|
||||||
|
self.points(&mut points);
|
||||||
|
points
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user