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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
use super::edit::ElementId;
use canvas::*;
mod properties;
mod element;
mod brush_element;
mod brush_properties_element;
mod brush_definition_element;
pub use self::properties::*;
pub use self::element::*;
pub use self::brush_element::*;
pub use self::brush_properties_element::*;
pub use self::brush_definition_element::*;
use std::ops::Deref;
#[derive(Clone)]
pub enum Vector {
BrushDefinition(BrushDefinitionElement),
BrushProperties(BrushPropertiesElement),
BrushStroke(BrushElement)
}
impl Vector {
#[inline]
pub fn new<IntoVec: Into<Vector>>(from: IntoVec) -> Vector {
from.into()
}
#[inline]
pub fn id(&self) -> ElementId {
self.deref().id()
}
}
impl Deref for Vector {
type Target = VectorElement;
#[inline]
fn deref(&self) -> &VectorElement {
use Vector::*;
match self {
&BrushDefinition(ref defn) => defn,
&BrushProperties(ref props) => props,
&BrushStroke(ref elem) => elem
}
}
}