Skip to content

Commit

Permalink
Explicitly implement Clone for Antichain (#419)
Browse files Browse the repository at this point in the history
  • Loading branch information
frankmcsherry committed Sep 10, 2021
1 parent c5195eb commit 4c2886b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion timely/src/progress/frontier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::order::PartialOrder;
/// Two antichains are equal if the contain the same set of elements, even if in different orders.
/// This can make equality testing quadratic, though linear in the common case that the sequences
/// are identical.
#[derive(Clone, Debug, Default, Abomonation, Serialize, Deserialize)]
#[derive(Debug, Default, Abomonation, Serialize, Deserialize)]
pub struct Antichain<T> {
elements: Vec<T>
}
Expand Down Expand Up @@ -218,6 +218,15 @@ impl<T: PartialOrder> PartialOrder for Antichain<T> {
}
}

impl<T: Clone> Clone for Antichain<T> {
fn clone(&self) -> Self {
Antichain { elements: self.elements.clone() }
}
fn clone_from(&mut self, source: &Self) {
self.elements.clone_from(&source.elements)
}
}

impl<T: PartialOrder> From<Vec<T>> for Antichain<T> {
fn from(vec: Vec<T>) -> Self {
// TODO: We could reuse `vec` with some care.
Expand Down

0 comments on commit 4c2886b

Please sign in to comment.