diff --git a/lib/cretonne/src/bforest/map.rs b/lib/cretonne/src/bforest/map.rs index 23cac5600d..601e9febe6 100644 --- a/lib/cretonne/src/bforest/map.rs +++ b/lib/cretonne/src/bforest/map.rs @@ -61,6 +61,11 @@ where /// /// This is not a general-purpose replacement for `BTreeMap`. See the [module /// documentation](index.html) for more information about design tradeoffs. +/// +/// Maps can be cloned, but that operation should only be used as part of cloning the whole forest +/// they belong to. *Cloning a map does not allocate new memory for the clone*. It creates an alias +/// of the same memory. +#[derive(Clone)] pub struct Map where K: Copy, @@ -145,6 +150,17 @@ where } } +impl Default for Map +where + K: Copy, + V: Copy, + C: Comparator, +{ + fn default() -> Self { + Self::new() + } +} + #[cfg(test)] impl Map where diff --git a/lib/cretonne/src/bforest/set.rs b/lib/cretonne/src/bforest/set.rs index 4956a26147..025efc0225 100644 --- a/lib/cretonne/src/bforest/set.rs +++ b/lib/cretonne/src/bforest/set.rs @@ -58,6 +58,11 @@ where /// /// This is not a general-purpose replacement for `BTreeSet`. See the [module /// documentation](index.html) for more information about design tradeoffs. +/// +/// Sets can be cloned, but that operation should only be used as part of cloning the whole forest +/// they belong to. *Cloning a set does not allocate new memory for the clone*. It creates an alias +/// of the same memory. +#[derive(Clone)] pub struct Set where K: Copy, @@ -142,6 +147,16 @@ where } } +impl Default for Set +where + K: Copy, + C: Comparator, +{ + fn default() -> Self { + Self::new() + } +} + /// A position in a `Set` used to navigate and modify the ordered set. /// /// A cursor always points at an element in the set, or "off the end" which is a position after the