1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use envelope_lib as env;
pub use envelope_lib::Envelope as Trait;
use std::iter::FromIterator;
pub type Point = env::BezierPoint<f64, f64>;
#[derive(Clone, Debug, RustcDecodable, RustcEncodable)]
pub struct Envelope {
pub points: Vec<Point>,
}
impl FromIterator<Point> for Envelope {
fn from_iter<T>(iter: T) -> Self where T: IntoIterator<Item=Point> {
Envelope { points: iter.into_iter().collect(), }
}
}
impl ::std::convert::From<Vec<Point>> for Envelope {
fn from(points: Vec<Point>) -> Self {
Envelope { points: points }
}
}
impl<'a> Trait<'a, Point> for Envelope {
type Points = ::std::slice::Iter<'a, Point>;
#[inline]
fn points(&'a self) -> Self::Points { self.points.iter() }
}