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 { priv root: Option<~TreeNode>, 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 { key: K, value: V,