Skip to content
Snippets Groups Projects
Commit eb802f4f authored by Andrew Paseltiner's avatar Andrew Paseltiner
Browse files

derive `Clone` impl

parent 871681f8
No related branches found
No related tags found
No related merge requests found
......@@ -59,6 +59,7 @@ use std::vec;
/// months.clear();
/// assert!(months.is_empty());
/// ```
#[derive(Clone)]
pub struct VecMap<V> {
v: Vec<Option<V>>,
}
......@@ -91,18 +92,6 @@ impl<V> Default for VecMap<V> {
fn default() -> VecMap<V> { VecMap::new() }
}
impl<V:Clone> Clone for VecMap<V> {
#[inline]
fn clone(&self) -> VecMap<V> {
VecMap { v: self.v.clone() }
}
#[inline]
fn clone_from(&mut self, source: &VecMap<V>) {
self.v.clone_from(&source.v);
}
}
impl<V: Hash> Hash for VecMap<V> {
fn hash<H: Hasher>(&self, state: &mut H) {
// In order to not traverse the `VecMap` twice, count the elements
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment