about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-07-17 15:15:34 -0700
committerPatrick Walton <pcwalton@mimiga.net>2013-07-17 15:15:34 -0700
commit3d13d4b58d5d871312537fabd736811c13ebcf4d (patch)
tree0dca4d7e74c03fdf863c263ed07102d3d1c6303f
parent3f8d548914fac1e7c32fcd9a903590d0fe21c64f (diff)
downloadrust-3d13d4b58d5d871312537fabd736811c13ebcf4d.tar.gz
rust-3d13d4b58d5d871312537fabd736811c13ebcf4d.zip
libextra: Add a stray deriving or two.
-rw-r--r--src/libextra/test.rs9
-rw-r--r--src/libextra/treemap.rs2
2 files changed, 10 insertions, 1 deletions
diff --git a/src/libextra/test.rs b/src/libextra/test.rs
index 6d2cb63ac14..c552ef2b8b6 100644
--- a/src/libextra/test.rs
+++ b/src/libextra/test.rs
@@ -27,6 +27,7 @@ use term;
 use time::precise_time_ns;
 use treemap::TreeMap;
 
+use std::clone::Clone;
 use std::comm::{stream, SharedChan};
 use std::either;
 use std::io;
@@ -93,7 +94,7 @@ pub struct TestDescAndFn {
     testfn: TestFn,
 }
 
-#[deriving(Encodable,Decodable,Eq)]
+#[deriving(Clone, Encodable, Decodable, Eq)]
 pub struct Metric {
     value: f64,
     noise: f64
@@ -102,6 +103,12 @@ pub struct Metric {
 #[deriving(Eq)]
 pub struct MetricMap(TreeMap<~str,Metric>);
 
+impl Clone for MetricMap {
+    pub fn clone(&self) -> MetricMap {
+        MetricMap((**self).clone())
+    }
+}
+
 /// Analysis of a single change in metric
 #[deriving(Eq)]
 pub enum MetricChange {
diff --git a/src/libextra/treemap.rs b/src/libextra/treemap.rs
index 223e17d0952..1e6d38b9a1f 100644
--- a/src/libextra/treemap.rs
+++ b/src/libextra/treemap.rs
@@ -34,6 +34,7 @@ use std::iterator::FromIterator;
 // These would be convenient since the methods work like `each`
 
 #[allow(missing_doc)]
+#[deriving(Clone)]
 pub struct TreeMap<K, V> {
     priv root: Option<~TreeNode<K, V>>,
     priv length: uint
@@ -506,6 +507,7 @@ pub struct TreeSetIterator<'self, T> {
 
 // Nodes keep track of their level in the tree, starting at 1 in the
 // leaves and with a red child sharing the level of the parent.
+#[deriving(Clone)]
 struct TreeNode<K, V> {
     key: K,
     value: V,