aboutsummaryrefslogtreecommitdiff
path: root/src/traits.rs
diff options
context:
space:
mode:
authorJakub Kotur <qtr@google.com>2020-12-21 17:28:14 +0100
committerJakub Kotur <qtr@google.com>2021-03-05 15:07:06 +0100
commit835fea47b902cc9ae1f6283bc6e107f0cd83734e (patch)
treee0f621ccc416ebc1c69588afba361fef31b1ae2e /src/traits.rs
parent790fbb964d669b370a0017b6747f3b9f13a04af9 (diff)
downloadcriterion-plot-835fea47b902cc9ae1f6283bc6e107f0cd83734e.tar.gz
Initial import of criterion-plot-0.4.3.
Bug: 155309706 Change-Id: Ia9cfbc3f7d52994d45a3113e5bdfefa9733a80c8
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;
+}