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
76
77
78
// Todo: Make a Constructor trait ?
/*
pub trait Has<'a,T>
{
fn retrieve(&'a self) -> T;
}
impl<'a,T> Has<'a,T> for T where T:Copy
{
fn retrieve(&'a self) -> T { *self }
}
*/
/*
pub trait Setter<T>
{
fn set(&mut self, val: T) -> &mut Self;
}
impl<T> Setter<T> for T
{
fn set(&mut self, val: T) -> &mut Self {
*self = val;
self
}
}
*/
/*
pub trait With<T>
{
fn with(self, value: T);
}
*/
//pub trait GetterSetter<T> : Has<T> + Setter<T>{}
//impl<S,T> GetterSetter<T> for S where S:Has<T> +Setter<T>{}
// Based on [GGEZ Has trait](https://docs.rs/ggez/latest/ggez/context/trait.Has.html)
// Based on [GGEZ HasMut trait](https://docs.rs/ggez/latest/ggez/context/trait.HasMut.html)
//pub trait Has<T> : HasRef<T> + HasMut<T>{}
//impl<S,T> Has<T> for S where S:HasRef<T> +HasMut<T>{}
/*
pub trait HasReadGuard<'a,T>
{
fn retrive_guard_ref(&'a self) -> T;
}
impl<'a,T> HasReadGuard<'a,&'a T> for &'a T { fn retrive_guard_ref(&'a self) -> &'a T { self } }
*/