1 | //! Traits |
2 | |
3 | /// Overloaded `configure` method |
4 | pub trait Configure<This> { |
5 | /// The properties of what's being configured |
6 | type Properties; |
7 | |
8 | /// Configure some set of properties |
9 | fn configure<F>(&mut self, this: This, function: F) -> &mut Self |
10 | where |
11 | F: FnOnce(&mut Self::Properties) -> &mut Self::Properties; |
12 | } |
13 | |
14 | /// Types that can be plotted |
15 | pub trait Data { |
16 | /// Convert the type into a double precision float |
17 | fn f64(self) -> f64; |
18 | } |
19 | |
20 | /// Overloaded `plot` method |
21 | pub trait Plot<This> { |
22 | /// The properties associated to the plot |
23 | type Properties; |
24 | |
25 | /// Plots some `data` with some `configuration` |
26 | fn plot<F>(&mut self, this: This, function: F) -> &mut Self |
27 | where |
28 | F: FnOnce(&mut Self::Properties) -> &mut Self::Properties; |
29 | } |
30 | |
31 | /// Overloaded `set` method |
32 | pub trait Set<T> { |
33 | /// Sets some property |
34 | fn set(&mut self, value: T) -> &mut Self; |
35 | } |
36 | |