diff --git a/src/bencher.rs b/src/bencher.rs index a508fd3e..98b91084 100644 --- a/src/bencher.rs +++ b/src/bencher.rs @@ -25,7 +25,7 @@ use crate::async_executor::AsyncExecutor; /// * If your routine requires no per-iteration setup and returns a value with an expensive `drop` /// method, use `iter_with_large_drop`. /// * If your routine requires some per-iteration setup that shouldn't be timed, use `iter_batched` -/// or `iter_batched_ref`. See [`BatchSize`](enum.BatchSize.html) for a discussion of batch sizes. +/// or `iter_batched_ref`. See [`BatchSize`] for a discussion of batch sizes. /// If the setup value implements `Drop` and you don't want to include the `drop` time in the /// measurement, use `iter_batched_ref`, otherwise use `iter_batched`. These methods are also /// suitable for benchmarking routines which return a value with an expensive `drop` method, @@ -189,7 +189,7 @@ impl<'a, M: Measurement> Bencher<'a, M> { } /// Times a `routine` that requires some input by generating a batch of input, then timing the - /// iteration of the benchmark over the input. See [`BatchSize`](enum.BatchSize.html) for + /// iteration of the benchmark over the input. See [`BatchSize`] for /// details on choosing the batch size. Use this when the routine must consume its input. /// /// For example, use this loop to benchmark sorting algorithms, because they require unsorted @@ -278,7 +278,7 @@ impl<'a, M: Measurement> Bencher<'a, M> { } /// Times a `routine` that requires some input by generating a batch of input, then timing the - /// iteration of the benchmark over the input. See [`BatchSize`](enum.BatchSize.html) for + /// iteration of the benchmark over the input. See [`BatchSize`] for /// details on choosing the batch size. Use this when the routine should accept the input by /// mutable reference. /// @@ -384,7 +384,7 @@ impl<'a, M: Measurement> Bencher<'a, M> { } } -/// Async/await variant of the Bencher struct. +/// Async/await variant of [`Bencher`]. #[cfg(feature = "async")] pub struct AsyncBencher<'a, 'b, A: AsyncExecutor, M: Measurement = WallTime> { b: &'b mut Bencher<'a, M>, @@ -567,7 +567,7 @@ impl<'a, 'b, A: AsyncExecutor, M: Measurement> AsyncBencher<'a, 'b, A, M> { } /// Times a `routine` that requires some input by generating a batch of input, then timing the - /// iteration of the benchmark over the input. See [`BatchSize`](enum.BatchSize.html) for + /// iteration of the benchmark over the input. See [`BatchSize`] for /// details on choosing the batch size. Use this when the routine must consume its input. /// /// For example, use this loop to benchmark sorting algorithms, because they require unsorted @@ -664,7 +664,7 @@ impl<'a, 'b, A: AsyncExecutor, M: Measurement> AsyncBencher<'a, 'b, A, M> { } /// Times a `routine` that requires some input by generating a batch of input, then timing the - /// iteration of the benchmark over the input. See [`BatchSize`](enum.BatchSize.html) for + /// iteration of the benchmark over the input. See [`BatchSize`] for /// details on choosing the batch size. Use this when the routine should accept the input by /// mutable reference. /// diff --git a/src/lib.rs b/src/lib.rs index 59c973d1..9b633dc4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -267,12 +267,14 @@ pub enum Baseline { } /// Enum used to select the plotting backend. +/// +/// See [`Criterion::plotting_backend`]. #[derive(Debug, Clone, Copy)] pub enum PlottingBackend { /// Plotting backend which uses the external `gnuplot` command to render plots. This is the /// default if the `gnuplot` command is installed. Gnuplot, - /// Plotting backend which uses the rust 'Plotters' library. This is the default if `gnuplot` + /// Plotting backend which uses the Rust 'Plotters' library. This is the default if `gnuplot` /// is not installed. Plotters, /// Null plotting backend which outputs nothing, @@ -455,7 +457,7 @@ impl Default for Criterion { impl Criterion { /// Changes the measurement for the benchmarks run with this runner. See the - /// Measurement trait for more details + /// [`Measurement`] trait for more details pub fn with_measurement(self, m: M2) -> Criterion { // Can't use struct update syntax here because they're technically different types. Criterion { @@ -477,7 +479,7 @@ impl Criterion { #[must_use] /// Changes the internal profiler for benchmarks run with this runner. See - /// the Profiler trait for more details. + /// the [`Profiler`] trait for more details. pub fn with_profiler(self, p: P) -> Criterion { Criterion { profiler: Box::new(RefCell::new(p)), @@ -486,10 +488,12 @@ impl Criterion { } #[must_use] - /// Set the plotting backend. By default, Criterion will use gnuplot if available, or plotters - /// if not. + /// Set the [plotting backend]. By default, Criterion will use `gnuplot` if available, + /// or `plotters` if not. + /// + /// Panics if `backend` is [`PlottingBackend::Gnuplot`] and `gnuplot` is not available. /// - /// Panics if `backend` is `PlottingBackend::Gnuplot` and gnuplot is not available. + /// [plotting backend]: PlottingBackend pub fn plotting_backend(mut self, backend: PlottingBackend) -> Criterion { if let PlottingBackend::Gnuplot = backend { assert!( diff --git a/src/macros.rs b/src/macros.rs index df7a44d9..1b10051d 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -3,14 +3,15 @@ //! Criterion.rs benchmarks with `cargo bench`. /// Macro used to define a function group for the benchmark harness; see the -/// `criterion_main!` macro for more details. +/// [`criterion_main!`](crate::criterion_main) macro for more details. /// /// This is used to define a function group; a collection of functions to call with a common /// Criterion configuration. Accepts two forms which can be seen below. /// -/// Note that the group name given here is not important, it must simply -/// be unique. Note also that this macro is not related to the `Criterion::benchmark_group` function -/// or the `BenchmarkGroup` type. +/// Note that the group name given here is not important, it must simply be +/// unique. Note also that this macro is not related to the +/// [`Criterion::benchmark_group`](crate::Criterion::benchmark_group) function +/// or the [`BenchmarkGroup`](crate::BenchmarkGroup) type. /// /// # Examples: /// @@ -36,9 +37,9 @@ /// ``` /// /// In this form, all of the options are clearly spelled out. This expands to -/// a function named benches, which uses the given config expression to create -/// an instance of the Criterion struct. This is then passed by mutable -/// reference to the targets. +/// a function named `benches`, which uses the given config expression to create +/// an instance of the [`Criterion`](crate::Criterion) struct. This is then +/// passed by mutable reference to the targets. /// /// Compact Form: /// diff --git a/src/profiler.rs b/src/profiler.rs index 906af5f0..b812be9b 100644 --- a/src/profiler.rs +++ b/src/profiler.rs @@ -14,7 +14,7 @@ pub trait Profiler { /// This function is called after Criterion.rs stops profiling a particular /// benchmark. The benchmark ID and directory are the same as in the call - /// to `start`, provided for convenience. + /// to [`start_profiling`](Self::start_profiling), provided for convenience. fn stop_profiling(&mut self, benchmark_id: &str, benchmark_dir: &Path); }