aboutsummaryrefslogtreecommitdiff
path: root/src/traits.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/traits.rs')
-rwxr-xr-xsrc/traits.rs35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/traits.rs b/src/traits.rs
new file mode 100755
index 0000000..52d2233
--- /dev/null
+++ b/src/traits.rs
@@ -0,0 +1,35 @@
+//! Traits
+
+/// Overloaded `configure` method
+pub trait Configure<This> {
+ /// The properties of what's being configured
+ type Properties;
+
+ /// Configure some set of properties
+ fn configure<F>(&mut self, this: This, function: F) -> &mut Self
+ where
+ F: FnOnce(&mut Self::Properties) -> &mut Self::Properties;
+}
+
+/// Types that can be plotted
+pub trait Data {
+ /// Convert the type into a double precision float
+ fn f64(self) -> f64;
+}
+
+/// Overloaded `plot` method
+pub trait Plot<This> {
+ /// The properties associated to the plot
+ type Properties;
+
+ /// Plots some `data` with some `configuration`
+ fn plot<F>(&mut self, this: This, function: F) -> &mut Self
+ where
+ F: FnOnce(&mut Self::Properties) -> &mut Self::Properties;
+}
+
+/// Overloaded `set` method
+pub trait Set<T> {
+ /// Sets some property
+ fn set(&mut self, value: T) -> &mut Self;
+}