Skip to content

Commit

Permalink
Improve documentation addind intradoc links
Browse files Browse the repository at this point in the history
  • Loading branch information
Gianmarco Garrisi committed Feb 1, 2025
1 parent cd75a60 commit 9fee5c4
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/core_iterators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ impl<I, P> FusedIterator for Iter<'_, I, P> {}
/// An iterator in arbitrary order over the couples
/// `(item, priority)` that consumes the queue.
///
/// It can be obtained calling the `into_iter` method from the `IntoIterator` trait.
/// It can be obtained calling the `into_iter` method from the [`IntoIterator`] trait.
pub struct IntoIter<I, P> {
pub(crate) iter: ::indexmap::map::IntoIter<I, P>,
}
Expand Down
4 changes: 2 additions & 2 deletions src/double_priority_queue/iterators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ use crate::DoublePriorityQueue;
/// A mutable iterator over the couples `(item, priority)` of the `DoublePriorityQueue`
/// in arbitrary order.
///
/// It can be obtained calling the `iter_mut` method.
/// It can be obtained calling the [`iter_mut`](DoublePriorityQueue::iter_mut) method.
///
/// It can be used to update the priorities of the elements in the queue.
/// When the iterator goes out of scope, the heap is rebuilt to restore the
Expand Down Expand Up @@ -146,7 +146,7 @@ where
/// A consuming iterator over the couples `(item, priority)` of the `PriorityQueue`
/// ordered by priority, from the lowest to the highest.
///
/// It can be obtained calling the `into_sorted_iter` method.
/// It can be obtained calling the [`into_sorted_iter`](DoublePriorityQueue::into_sorted_iter) method.
///
/// Since it implements [`DoubleEndedIterator`], this iterator can be reversed at any time
/// calling `rev`, at which point, elements will be extracted from the one with maximum priority
Expand Down
19 changes: 11 additions & 8 deletions src/double_priority_queue/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,9 @@ where
/// in a way that change the result of `Hash` or `Eq`.
///
/// The priority cannot be modified with a call to this function.
/// To modify the priority use `push`, `change_priority` or
/// `change_priority_by`.
/// To modify the priority use [`push`](DoublePriorityQueue::push),
/// [`change_priority`](DoublePriorityQueue::change_priority) or
/// [`change_priority_by`](DoublePriorityQueue::change_priority_by).
///
/// Computes in **O(1)** time
pub fn peek_min_mut(&mut self) -> Option<(&mut I, &P)> {
Expand Down Expand Up @@ -397,8 +398,9 @@ where
/// in a way that change the result of `Hash` or `Eq`.
///
/// The priority cannot be modified with a call to this function.
/// To modify the priority use `push`, `change_priority` or
/// `change_priority_by`.
/// To modify the priority use [`push`](DoublePriorityQueue::push),
/// [`change_priority`](DoublePriorityQueue::change_priority) or
/// [`change_priority_by`](DoublePriorityQueue::change_priority_by).
///
/// Computes in **O(1)** time
pub fn peek_max_mut(&mut self) -> Option<(&mut I, &P)> {
Expand Down Expand Up @@ -569,8 +571,9 @@ where
/// in a way that change the result of `Hash` or `Eq`.
///
/// The priority cannot be modified with a call to this function.
/// To modify the priority use `push`, `change_priority` or
/// `change_priority_by`.
/// To modify the priority use use [`push`](DoublePriorityQueue::push),
/// [`change_priority`](DoublePriorityQueue::change_priority) or
/// [`change_priority_by`](DoublePriorityQueue::change_priority_by).
pub fn get_mut<Q: ?Sized>(&mut self, item: &Q) -> Option<(&mut I, &P)>
where
I: Borrow<Q>,
Expand Down Expand Up @@ -613,8 +616,8 @@ where
/// At the end, `other` will be empty.
///
/// **Note** that at the end, the priority of the duplicated elements
/// inside self may be the one of the elements in other,
/// if other is longer than self
/// inside `self` may be the one of the elements in `other`,
/// if `other` is longer than `self`
pub fn append(&mut self, other: &mut Self) {
self.store.append(&mut other.store);
self.heap_build();
Expand Down
4 changes: 2 additions & 2 deletions src/priority_queue/iterators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ use crate::PriorityQueue;
/// A mutable iterator over the couples `(item, priority)` of the `PriorityQueue`
/// in arbitrary order.
///
/// It can be obtained calling the `iter_mut` method.
/// It can be obtained calling the [`iter_mut`](PriorityQueue::iter_mut) method.
///
/// It can be used to update the priorities of the elements in the queue.
/// When the iterator goes out of scope, the heap is rebuilt to restore the
Expand Down Expand Up @@ -111,7 +111,7 @@ where
/// A consuming iterator over the couples `(item, priority)` of the `PriorityQueue`
/// ordered by priority, from the highest to the lowest.
///
/// It can be obtained calling the `into_sorted_iter` method.
/// It can be obtained calling the [`into_sorted_iter`](PriorityQueue::into_sorted_iter) method.
#[cfg(feature = "std")]
pub struct IntoSortedIter<I, P, H = RandomState> {
pub(crate) pq: PriorityQueue<I, P, H>,
Expand Down
10 changes: 6 additions & 4 deletions src/priority_queue/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -535,8 +535,9 @@ where
/// in a way that change the result of `Hash` or `Eq`.
///
/// The priority cannot be modified with a call to this function.
/// To modify the priority use `push`, `change_priority` or
/// `change_priority_by`.
/// To modify the priority use [`push`](PriorityQueue::push),
/// [`change_priority`](PriorityQueue::change_priority) or
/// [`change_priority_by`](PriorityQueue::change_priority_by).
pub fn get_mut<Q: ?Sized>(&mut self, item: &Q) -> Option<(&mut I, &P)>
where
I: Borrow<Q>,
Expand All @@ -552,8 +553,9 @@ where
/// in a way that change the result of `Hash` or `Eq`.
///
/// The priority cannot be modified with a call to this function.
/// To modify the priority use `push`, `change_priority` or
/// `change_priority_by`.
/// To modify the priority use[`push`](PriorityQueue::push),
/// [`change_priority`](PriorityQueue::change_priority) or
/// [`change_priority_by`](PriorityQueue::change_priority_by).
///
/// Computes in **O(1)** time
pub fn peek_mut(&mut self) -> Option<(&mut I, &P)> {
Expand Down

0 comments on commit 9fee5c4

Please sign in to comment.