Skip to content

Commit

Permalink
BTreeMap: fix internal comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ssomers committed Feb 9, 2021
1 parent f4008fe commit f7edf5c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions library/alloc/src/collections/btree/navigate.rs
Expand Up @@ -103,7 +103,8 @@ where
}
}

/// Equivalent to `range_search(k, v, ..)` but without the `Ord` bound.
/// Equivalent to `range_search(root1, root2, ..)` but without the `Ord` bound.
/// Equivalent to `(root1.first_leaf_edge(), root2.last_leaf_edge())` but more efficient.
fn full_range<BorrowType: marker::BorrowType, K, V>(
root1: NodeRef<BorrowType, K, V, marker::LeafOrInternal>,
root2: NodeRef<BorrowType, K, V, marker::LeafOrInternal>,
Expand All @@ -130,7 +131,7 @@ fn full_range<BorrowType: marker::BorrowType, K, V>(
}

impl<'a, K: 'a, V: 'a> NodeRef<marker::Immut<'a>, K, V, marker::LeafOrInternal> {
/// Creates a pair of leaf edges delimiting a specified range in or underneath a node.
/// Finds the pair of leaf edges delimiting a specific range in a tree.
///
/// The result is meaningful only if the tree is ordered by key, like the tree
/// in a `BTreeMap` is.
Expand All @@ -149,7 +150,7 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::Immut<'a>, K, V, marker::LeafOrInternal>
range_search(self, self, range)
}

/// Returns (self.first_leaf_edge(), self.last_leaf_edge()), but more efficiently.
/// Finds the pair of leaf edges delimiting an entire tree.
pub fn full_range(
self,
) -> (
Expand Down
2 changes: 1 addition & 1 deletion library/alloc/src/collections/btree/node.rs
Expand Up @@ -169,7 +169,7 @@ impl<K, V, Type> NodeRef<marker::Owned, K, V, Type> {
NodeRef { height: self.height, node: self.node, _marker: PhantomData }
}

/// Irreversibly transistions to a reference that offers traversal,
/// Irreversibly transitions to a reference that permits traversal and offers
/// destructive methods and little else.
pub fn into_dying(self) -> NodeRef<marker::Dying, K, V, Type> {
NodeRef { height: self.height, node: self.node, _marker: PhantomData }
Expand Down

0 comments on commit f7edf5c

Please sign in to comment.