• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
configure<F>(&mut self, this: This, function: F) -> &mut Self where F: FnOnce(&mut Self::Properties) -> &mut Self::Properties9     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
f64(self) -> f6417     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`
plot<F>(&mut self, this: This, function: F) -> &mut Self where F: FnOnce(&mut Self::Properties) -> &mut Self::Properties26     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
set(&mut self, value: T) -> &mut Self34     fn set(&mut self, value: T) -> &mut Self;
35 }
36