Skip to content

Commit

Permalink
Add links in iter.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
dominik-korsa committed Nov 27, 2023
1 parent 7893787 commit f22cf9c
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ pub trait ProgressIterator
where
Self: Sized + Iterator,
{
/// Wrap an iterator with default styling. Uses `Iterator::size_hint` to get length.
/// Returns `Some(..)` only if `size_hint.1` is `Some`. If you want to create a progress bar
/// even if `size_hint.1` returns `None` use `progress_count` or `progress_with` instead.
/// Wrap an iterator with default styling. Uses [`Iterator::size_hint()`] to get length.
/// Returns `Some(..)` only if `size_hint.1` is [`Some`]. If you want to create a progress bar
/// even if `size_hint.1` returns [`None`] use [`progress_count()`](ProgressIterator::progress_count)
/// or [`progress_with()`](ProgressIterator::progress_with) instead.
fn try_progress(self) -> Option<ProgressBarIter<Self>> {
self.size_hint()
.1
Expand Down Expand Up @@ -66,47 +67,47 @@ pub struct ProgressBarIter<T> {
impl<T> ProgressBarIter<T> {
/// Builder-like function for setting underlying progress bar's style.
///
/// See [`ProgressBar::with_style`].
/// See [`ProgressBar::with_style()`].
pub fn with_style(mut self, style: ProgressStyle) -> Self {
self.progress = self.progress.with_style(style);
self
}

/// Builder-like function for setting underlying progress bar's prefix.
///
/// See [`ProgressBar::with_prefix`].
/// See [`ProgressBar::with_prefix()`].
pub fn with_prefix(mut self, prefix: impl Into<Cow<'static, str>>) -> Self {
self.progress = self.progress.with_prefix(prefix);
self
}

/// Builder-like function for setting underlying progress bar's message.
///
/// See [`ProgressBar::with_message`].
/// See [`ProgressBar::with_message()`].
pub fn with_message(mut self, message: impl Into<Cow<'static, str>>) -> Self {
self.progress = self.progress.with_message(message);
self
}

/// Builder-like function for setting underlying progress bar's position.
///
/// See [`ProgressBar::with_position`].
/// See [`ProgressBar::with_position()`].
pub fn with_position(mut self, position: u64) -> Self {
self.progress = self.progress.with_position(position);
self
}

/// Builder-like function for setting underlying progress bar's elapsed time.
///
/// See [`ProgressBar::with_elapsed`].
/// See [`ProgressBar::with_elapsed()`].
pub fn with_elapsed(mut self, elapsed: Duration) -> Self {
self.progress = self.progress.with_elapsed(elapsed);
self
}

/// Builder-like function for setting underlying progress bar's finish behavior.
///
/// See [`ProgressBar::with_finish`].
/// See [`ProgressBar::with_finish()`].
pub fn with_finish(mut self, finish: ProgressFinish) -> Self {
self.progress = self.progress.with_finish(finish);
self
Expand Down

0 comments on commit f22cf9c

Please sign in to comment.