Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix docs for ProgressDrawTarget #523

Merged
merged 1 commit into from
Mar 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/draw_target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,29 @@ pub struct ProgressDrawTarget {
impl ProgressDrawTarget {
/// Draw to a buffered stdout terminal at a max of 20 times a second.
///
/// For more information see `ProgressDrawTarget::to_term`.
/// For more information see [`ProgressDrawTarget::term`].
pub fn stdout() -> Self {
Self::term(Term::buffered_stdout(), 20)
}

/// Draw to a buffered stderr terminal at a max of 20 times a second.
///
/// This is the default draw target for progress bars. For more
/// information see `ProgressDrawTarget::to_term`.
/// information see [`ProgressDrawTarget::term`].
pub fn stderr() -> Self {
Self::term(Term::buffered_stderr(), 20)
}

/// Draw to a buffered stdout terminal at a max of `refresh_rate` times a second.
///
/// For more information see `ProgressDrawTarget::to_term`.
/// For more information see [`ProgressDrawTarget::term`].
pub fn stdout_with_hz(refresh_rate: u8) -> Self {
Self::term(Term::buffered_stdout(), refresh_rate)
}

/// Draw to a buffered stderr terminal at a max of `refresh_rate` times a second.
///
/// For more information see `ProgressDrawTarget::to_term`.
/// For more information see [`ProgressDrawTarget::term`].
pub fn stderr_with_hz(refresh_rate: u8) -> Self {
Self::term(Term::buffered_stderr(), refresh_rate)
}
Expand All @@ -59,14 +59,14 @@ impl ProgressDrawTarget {
}
}

/// Draw to a terminal, optionally with a specific refresh rate.
/// Draw to a terminal, with a specific refresh rate.
///
/// Progress bars are by default drawn to terminals however if the
/// terminal is not user attended the entire progress bar will be
/// hidden. This is done so that piping to a file will not produce
/// useless escape codes in that file.
///
/// Will panic if refresh_rate is `Some(0)`. To disable rate limiting use `None` instead.
/// Will panic if refresh_rate is `0`.
pub fn term(term: Term, refresh_rate: u8) -> Self {
Self {
kind: TargetKind::Term {
Expand Down