}
}
+impl<K: TotalOrd, V: TotalEq> Eq for BTree<K, V> {
+ fn eq(&self, other: &BTree<K, V>) -> bool {
+ self.equals(other)
+ }
+}
impl<K: TotalOrd, V: TotalEq> TotalEq for BTree<K, V> {
///Testing equality on BTrees by comparing the root.
}
}
+impl<K: TotalOrd, V: TotalEq> Ord for BTree<K, V> {
+ fn lt(&self, other: &BTree<K, V>) -> bool {
+ self.cmp(other) == Less
+ }
+}
+
impl<K: TotalOrd, V: TotalEq> TotalOrd for BTree<K, V> {
///Returns an ordering based on the root nodes of each BTree.
fn cmp(&self, other: &BTree<K, V>) -> Ordering {
}
}
+impl<K: TotalOrd, V: TotalEq> Eq for Node<K, V> {
+ fn eq(&self, other: &Node<K, V>) -> bool {
+ self.equals(other)
+ }
+}
+
impl<K: TotalOrd, V: TotalEq> TotalEq for Node<K, V> {
///Returns whether two nodes are equal based on the keys of each element.
///Two nodes are equal if all of their keys are the same.
}
}
+impl<K: TotalOrd, V: TotalEq> Ord for Node<K, V> {
+ fn lt(&self, other: &Node<K, V>) -> bool {
+ self.cmp(other) == Less
+ }
+}
+
impl<K: TotalOrd, V: TotalEq> TotalOrd for Node<K, V> {
///Implementation of TotalOrd for Nodes.
fn cmp(&self, other: &Node<K, V>) -> Ordering {
}
}
+impl<K: TotalOrd, V: TotalEq> Eq for Leaf<K, V> {
+ fn eq(&self, other: &Leaf<K, V>) -> bool {
+ self.equals(other)
+ }
+}
+
impl<K: TotalOrd, V: TotalEq> TotalEq for Leaf<K, V> {
///Implementation of equals function for leaves that compares LeafElts.
fn equals(&self, other: &Leaf<K, V>) -> bool {
}
}
+impl<K: TotalOrd, V: TotalEq> Ord for Leaf<K, V> {
+ fn lt(&self, other: &Leaf<K, V>) -> bool {
+ self.cmp(other) == Less
+ }
+}
+
impl<K: TotalOrd, V: TotalEq> TotalOrd for Leaf<K, V> {
///Returns an ordering based on the first element of each Leaf.
fn cmp(&self, other: &Leaf<K, V>) -> Ordering {
}
}
+impl<K: TotalOrd, V: TotalEq> Eq for Branch<K, V> {
+ fn eq(&self, other: &Branch<K, V>) -> bool {
+ self.equals(other)
+ }
+}
+
impl<K: TotalOrd, V: TotalEq> TotalEq for Branch<K, V> {
///Equals function for Branches--compares all the elements in each branch
fn equals(&self, other: &Branch<K, V>) -> bool {
}
}
+impl<K: TotalOrd, V: TotalEq> Ord for Branch<K, V> {
+ fn lt(&self, other: &Branch<K, V>) -> bool {
+ self.cmp(other) == Less
+ }
+}
+
impl<K: TotalOrd, V: TotalEq> TotalOrd for Branch<K, V> {
///Compares the first elements of two branches to determine an ordering
fn cmp(&self, other: &Branch<K, V>) -> Ordering {
}
}
+impl<K: TotalOrd, V: TotalEq> Eq for LeafElt<K, V> {
+ fn eq(&self, other: &LeafElt<K, V>) -> bool {
+ self.equals(other)
+ }
+}
+
impl<K: TotalOrd, V: TotalEq> TotalEq for LeafElt<K, V> {
///TotalEq for LeafElts
fn equals(&self, other: &LeafElt<K, V>) -> bool {
}
}
+impl<K: TotalOrd, V: TotalEq> Ord for LeafElt<K, V> {
+ fn lt(&self, other: &LeafElt<K, V>) -> bool {
+ self.cmp(other) == Less
+ }
+}
+
impl<K: TotalOrd, V: TotalEq> TotalOrd for LeafElt<K, V> {
///Returns an ordering based on the keys of the LeafElts.
fn cmp(&self, other: &LeafElt<K, V>) -> Ordering {
}
}
+impl<K: TotalOrd, V: TotalEq> Eq for BranchElt<K, V>{
+ fn eq(&self, other: &BranchElt<K, V>) -> bool {
+ self.equals(other)
+ }
+}
+
impl<K: TotalOrd, V: TotalEq> TotalEq for BranchElt<K, V>{
///TotalEq for BranchElts
fn equals(&self, other: &BranchElt<K, V>) -> bool {
}
}
+impl<K: TotalOrd, V: TotalEq> Ord for BranchElt<K, V> {
+ fn lt(&self, other: &BranchElt<K, V>) -> bool {
+ self.cmp(other) == Less
+ }
+}
+
impl<K: TotalOrd, V: TotalEq> TotalOrd for BranchElt<K, V> {
///Fulfills TotalOrd for BranchElts
fn cmp(&self, other: &BranchElt<K, V>) -> Ordering {