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
63
64
65
66
67
68
69
70
71
72
73
74
75
use super::tool_action::*;
use super::tool_input::*;
use super::super::model::*;
use ui::*;
use animation::*;
use futures::*;
use futures::stream;
use std::sync::*;
pub trait Tool<Anim: Animation> : Send+Sync {
type ToolData: Send+'static;
type Model: Send+Sync+'static;
fn tool_name(&self) -> String;
fn image_name(&self) -> String;
fn create_model(&self, flo_model: Arc<FloModel<Anim>>) -> Self::Model;
fn create_menu_controller(&self, _flo_model: Arc<FloModel<Anim>>, _tool_model: &Self::Model) -> Option<Arc<Controller>> {
None
}
fn actions_for_model(&self, _flo_model: Arc<FloModel<Anim>>, _tool_model: &Self::Model) -> Box<Stream<Item=ToolAction<Self::ToolData>, Error=()>+Send> {
Box::new(stream::empty())
}
fn actions_for_input<'a>(&'a self, data: Option<Arc<Self::ToolData>>, input: Box<'a+Iterator<Item=ToolInput<Self::ToolData>>>) -> Box<'a+Iterator<Item=ToolAction<Self::ToolData>>>;
}
impl<ToolData: Send+'static, Model: Send+Sync+'static, Anim: Animation> PartialEq for Tool<Anim, ToolData=ToolData, Model=Model> {
fn eq(&self, other: &Tool<Anim, ToolData=ToolData, Model=Model>) -> bool {
self.tool_name() == other.tool_name()
}
}