Skip to content

Commit a7456f6

Browse files
waywardmonkeysdjc
authored andcommitted
docs: Improve formatting and linking.
1 parent 889084f commit a7456f6

4 files changed

Lines changed: 22 additions & 10 deletions

File tree

src/draw_target.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl ProgressDrawTarget {
6666
/// hidden. This is done so that piping to a file will not produce
6767
/// useless escape codes in that file.
6868
///
69-
/// Will panic if refresh_rate is `0`.
69+
/// Will panic if `refresh_rate` is `0`.
7070
pub fn term(term: Term, refresh_rate: u8) -> Self {
7171
Self {
7272
kind: TargetKind::Term {

src/iter.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,47 +66,47 @@ pub struct ProgressBarIter<T> {
6666
impl<T> ProgressBarIter<T> {
6767
/// Builder-like function for setting underlying progress bar's style.
6868
///
69-
/// See [ProgressBar::with_style].
69+
/// See [`ProgressBar::with_style`].
7070
pub fn with_style(mut self, style: ProgressStyle) -> Self {
7171
self.progress = self.progress.with_style(style);
7272
self
7373
}
7474

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

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

9191
/// Builder-like function for setting underlying progress bar's position.
9292
///
93-
/// See [ProgressBar::with_position].
93+
/// See [`ProgressBar::with_position`].
9494
pub fn with_position(mut self, position: u64) -> Self {
9595
self.progress = self.progress.with_position(position);
9696
self
9797
}
9898

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

107107
/// Builder-like function for setting underlying progress bar's finish behavior.
108108
///
109-
/// See [ProgressBar::with_finish].
109+
/// See [`ProgressBar::with_finish`].
110110
pub fn with_finish(mut self, finish: ProgressFinish) -> Self {
111111
self.progress = self.progress.with_finish(finish);
112112
self

src/multi.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,11 @@ impl MultiProgress {
2626
/// Creates a new multi progress object.
2727
///
2828
/// Progress bars added to this object by default draw directly to stderr, and refresh
29-
/// a maximum of 15 times a second. To change the refresh rate set the draw target to
29+
/// a maximum of 15 times a second. To change the refresh rate [set] the [draw target] to
3030
/// one with a different refresh rate.
31+
///
32+
/// [set]: MultiProgress::set_draw_target
33+
/// [draw target]: ProgressDrawTarget
3134
pub fn new() -> Self {
3235
Self::default()
3336
}
@@ -40,6 +43,8 @@ impl MultiProgress {
4043
}
4144

4245
/// Sets a different draw target for the multiprogress bar.
46+
///
47+
/// Use [`MultiProgress::with_draw_target`] to set the draw target during creation.
4348
pub fn set_draw_target(&self, target: ProgressDrawTarget) {
4449
let mut state = self.state.write().unwrap();
4550
state.draw_target.disconnect(Instant::now());

src/progress_bar.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,11 @@ impl ProgressBar {
3838
/// Creates a new progress bar with a given length
3939
///
4040
/// This progress bar by default draws directly to stderr, and refreshes a maximum of 15 times
41-
/// a second. To change the refresh rate, set the draw target to one with a different refresh
41+
/// a second. To change the refresh rate, [set] the [draw target] to one with a different refresh
4242
/// rate.
43+
///
44+
/// [set]: ProgressBar::set_draw_target
45+
/// [draw target]: ProgressDrawTarget
4346
pub fn new(len: u64) -> Self {
4447
Self::with_draw_target(Some(len), ProgressDrawTarget::stderr())
4548
}
@@ -378,6 +381,8 @@ impl ProgressBar {
378381
/// running [`MultiProgress::add`]) will unlink this progress bar. If you don't want this
379382
/// behavior, call [`MultiProgress::set_draw_target`] instead.
380383
///
384+
/// Use [`ProgressBar::with_draw_target`] to set the draw target during creation.
385+
///
381386
/// [`MultiProgress`]: crate::MultiProgress
382387
/// [`MultiProgress::add`]: crate::MultiProgress::add
383388
/// [`MultiProgress::set_draw_target`]: crate::MultiProgress::set_draw_target
@@ -391,7 +396,7 @@ impl ProgressBar {
391396
///
392397
/// Useful for external code that writes to the standard output.
393398
///
394-
/// If the progress bar was added to a MultiProgress, it will suspend the entire MultiProgress
399+
/// If the progress bar was added to a [`MultiProgress`], it will suspend the entire `MultiProgress`].
395400
///
396401
/// **Note:** The internal lock is held while `f` is executed. Other threads trying to print
397402
/// anything on the progress bar will be blocked until `f` finishes.
@@ -404,6 +409,8 @@ impl ProgressBar {
404409
/// println!("Log message");
405410
/// })
406411
/// ```
412+
///
413+
/// [`MultiProgress`]: crate::MultiProgress
407414
pub fn suspend<F: FnOnce() -> R, R>(&self, f: F) -> R {
408415
self.state().suspend(Instant::now(), f)
409416
}

0 commit comments

Comments
 (0)