Skip to content

Commit 3d13d4b

Browse files
committed
libextra: Add a stray deriving or two.
1 parent 3f8d548 commit 3d13d4b

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/libextra/test.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ use term;
2727
use time::precise_time_ns;
2828
use treemap::TreeMap;
2929

30+
use std::clone::Clone;
3031
use std::comm::{stream, SharedChan};
3132
use std::either;
3233
use std::io;
@@ -93,7 +94,7 @@ pub struct TestDescAndFn {
9394
testfn: TestFn,
9495
}
9596

96-
#[deriving(Encodable,Decodable,Eq)]
97+
#[deriving(Clone, Encodable, Decodable, Eq)]
9798
pub struct Metric {
9899
value: f64,
99100
noise: f64
@@ -102,6 +103,12 @@ pub struct Metric {
102103
#[deriving(Eq)]
103104
pub struct MetricMap(TreeMap<~str,Metric>);
104105

106+
impl Clone for MetricMap {
107+
pub fn clone(&self) -> MetricMap {
108+
MetricMap((**self).clone())
109+
}
110+
}
111+
105112
/// Analysis of a single change in metric
106113
#[deriving(Eq)]
107114
pub enum MetricChange {

src/libextra/treemap.rs

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ use std::iterator::FromIterator;
3434
// These would be convenient since the methods work like `each`
3535

3636
#[allow(missing_doc)]
37+
#[deriving(Clone)]
3738
pub struct TreeMap<K, V> {
3839
priv root: Option<~TreeNode<K, V>>,
3940
priv length: uint
@@ -506,6 +507,7 @@ pub struct TreeSetIterator<'self, T> {
506507

507508
// Nodes keep track of their level in the tree, starting at 1 in the
508509
// leaves and with a red child sharing the level of the parent.
510+
#[deriving(Clone)]
509511
struct TreeNode<K, V> {
510512
key: K,
511513
value: V,

0 commit comments

Comments
 (0)