1
0
mirror of https://github.com/BurntSushi/ripgrep.git synced 2025-06-14 22:15:13 +02:00

crates: remove hard-coded links

And use rustdoc's native intra-crate links. So much nicer.
This commit is contained in:
Andrew Gallant
2023-09-25 18:24:08 -04:00
parent 82d3183a04
commit 3ad7a0d95e
14 changed files with 147 additions and 206 deletions

View File

@ -83,7 +83,7 @@ impl std::fmt::Display for ColorError {
/// This set of color specifications represents the various color types that
/// are supported by the printers in this crate. A set of color specifications
/// can be created from a sequence of
/// [`UserColorSpec`s](struct.UserColorSpec.html).
/// [`UserColorSpec`]s.
#[derive(Clone, Debug, Default, Eq, PartialEq)]
pub struct ColorSpecs {
path: ColorSpec,

View File

@ -549,14 +549,13 @@ impl<W> JSON<W> {
/// This type is generic over a few type parameters:
///
/// * `'p` refers to the lifetime of the file path, if one is provided. When
/// no file path is given, then this is `'static`.
/// * `'s` refers to the lifetime of the
/// [`JSON`](struct.JSON.html)
/// printer that this type borrows.
/// no file path is given, then this is `'static`.
/// * `'s` refers to the lifetime of the [`JSON`] printer that this type
/// borrows.
/// * `M` refers to the type of matcher used by
/// `grep_searcher::Searcher` that is reporting results to this sink.
/// `grep_searcher::Searcher` that is reporting results to this sink.
/// * `W` refers to the underlying writer that this printer is writing its
/// output to.
/// output to.
#[derive(Debug)]
pub struct JSONSink<'p, 's, M: Matcher, W> {
matcher: M,

View File

@ -5,22 +5,20 @@ crate.
# Brief overview
The [`Standard`](struct.Standard.html) printer shows results in a human
readable format, and is modeled after the formats used by standard grep-like
tools. Features include, but are not limited to, cross platform terminal
coloring, search & replace, multi-line result handling and reporting summary
statistics.
The [`Standard`] printer shows results in a human readable format, and is
modeled after the formats used by standard grep-like tools. Features include,
but are not limited to, cross platform terminal coloring, search & replace,
multi-line result handling and reporting summary statistics.
The [`JSON`](struct.JSON.html) printer shows results in a machine readable
format. To facilitate a stream of search results, the format uses
[JSON Lines](https://jsonlines.org/)
by emitting a series of messages as search results are found.
The [`JSON`] printer shows results in a machine readable format.
To facilitate a stream of search results, the format uses [JSON
Lines](https://jsonlines.org/) by emitting a series of messages as search
results are found.
The [`Summary`](struct.Summary.html) printer shows *aggregate* results for a
single search in a human readable format, and is modeled after similar formats
found in standard grep-like tools. This printer is useful for showing the total
number of matches and/or printing file paths that either contain or don't
contain matches.
The [`Summary`] printer shows *aggregate* results for a single search in a
human readable format, and is modeled after similar formats found in standard
grep-like tools. This printer is useful for showing the total number of matches
and/or printing file paths that either contain or don't contain matches.
# Example

View File

@ -149,11 +149,11 @@ impl StandardBuilder {
/// Set the user color specifications to use for coloring in this printer.
///
/// A [`UserColorSpec`](struct.UserColorSpec.html) can be constructed from
/// a string in accordance with the color specification format. See the
/// `UserColorSpec` type documentation for more details on the format.
/// A [`ColorSpecs`](struct.ColorSpecs.html) can then be generated from
/// zero or more `UserColorSpec`s.
/// A [`UserColorSpec`](crate::UserColorSpec) can be constructed from
/// a string in accordance with the color specification format. See
/// the `UserColorSpec` type documentation for more details on the
/// format. A [`ColorSpecs`] can then be generated from zero or more
/// `UserColorSpec`s.
///
/// Regardless of the color specifications provided here, whether color
/// is actually used or not is determined by the implementation of
@ -196,15 +196,13 @@ impl StandardBuilder {
/// number of bytes searched and the total number of bytes printed.
///
/// Aggregate statistics can be accessed via the sink's
/// [`StandardSink::stats`](struct.StandardSink.html#method.stats)
/// method.
/// [`StandardSink::stats`] method.
///
/// When this is enabled, this printer may need to do extra work in order
/// to compute certain statistics, which could cause the search to take
/// longer.
///
/// For a complete description of available statistics, see
/// [`Stats`](struct.Stats.html).
/// For a complete description of available statistics, see [`Stats`].
pub fn stats(&mut self, yes: bool) -> &mut StandardBuilder {
self.config.stats = yes;
self
@ -484,7 +482,7 @@ impl StandardBuilder {
/// A default printer can be created with either of the `Standard::new` or
/// `Standard::new_no_color` constructors. However, there are a considerable
/// number of options that configure this printer's output. Those options can
/// be configured using [`StandardBuilder`](struct.StandardBuilder.html).
/// be configured using [`StandardBuilder`].
///
/// This type is generic over `W`, which represents any implementation
/// of the `termcolor::WriteColor` trait. If colors are not desired,
@ -633,12 +631,9 @@ impl<W> Standard<W> {
/// An implementation of `Sink` associated with a matcher and an optional file
/// path for the standard printer.
///
/// A `Sink` can be created via the
/// [`Standard::sink`](struct.Standard.html#method.sink)
/// or
/// [`Standard::sink_with_path`](struct.Standard.html#method.sink_with_path)
/// methods, depending on whether you want to include a file path in the
/// printer's output.
/// A `Sink` can be created via the [`Standard::sink`] or
/// [`Standard::sink_with_path`] methods, depending on whether you want to
/// include a file path in the printer's output.
///
/// Building a `StandardSink` is cheap, and callers should create a new one
/// for each thing that is searched. After a search has completed, callers may
@ -648,14 +643,13 @@ impl<W> Standard<W> {
/// This type is generic over a few type parameters:
///
/// * `'p` refers to the lifetime of the file path, if one is provided. When
/// no file path is given, then this is `'static`.
/// * `'s` refers to the lifetime of the
/// [`Standard`](struct.Standard.html)
/// printer that this type borrows.
/// no file path is given, then this is `'static`.
/// * `'s` refers to the lifetime of the [`Standard`] printer that this type
/// borrows.
/// * `M` refers to the type of matcher used by
/// `grep_searcher::Searcher` that is reporting results to this sink.
/// `grep_searcher::Searcher` that is reporting results to this sink.
/// * `W` refers to the underlying writer that this printer is writing its
/// output to.
/// output to.
#[derive(Debug)]
pub struct StandardSink<'p, 's, M: Matcher, W> {
matcher: M,
@ -710,8 +704,7 @@ impl<'p, 's, M: Matcher, W: WriteColor> StandardSink<'p, 's, M, W> {
/// searches executed on this sink.
///
/// This only returns stats if they were requested via the
/// [`StandardBuilder`](struct.StandardBuilder.html)
/// configuration.
/// [`StandardBuilder`] configuration.
pub fn stats(&self) -> Option<&Stats> {
self.stats.as_ref()
}

View File

@ -193,11 +193,11 @@ impl SummaryBuilder {
/// Set the user color specifications to use for coloring in this printer.
///
/// A [`UserColorSpec`](struct.UserColorSpec.html) can be constructed from
/// a string in accordance with the color specification format. See the
/// `UserColorSpec` type documentation for more details on the format.
/// A [`ColorSpecs`](struct.ColorSpecs.html) can then be generated from
/// zero or more `UserColorSpec`s.
/// A [`UserColorSpec`](crate::UserColorSpec) can be constructed from
/// a string in accordance with the color specification format. See
/// the `UserColorSpec` type documentation for more details on the
/// format. A [`ColorSpecs`] can then be generated from zero or more
/// `UserColorSpec`s.
///
/// Regardless of the color specifications provided here, whether color
/// is actually used or not is determined by the implementation of
@ -242,8 +242,7 @@ impl SummaryBuilder {
/// number of bytes searched and the total number of bytes printed.
///
/// Aggregate statistics can be accessed via the sink's
/// [`SummarySink::stats`](struct.SummarySink.html#method.stats)
/// method.
/// [`SummarySink::stats`] method.
///
/// When this is enabled, this printer may need to do extra work in order
/// to compute certain statistics, which could cause the search to take
@ -251,8 +250,7 @@ impl SummaryBuilder {
/// the first match, but if `stats` is enabled, then the search will
/// continue after the first match in order to compute statistics.
///
/// For a complete description of available statistics, see
/// [`Stats`](struct.Stats.html).
/// For a complete description of available statistics, see [`Stats`].
///
/// Note that some output modes, such as `CountMatches`, automatically
/// enable this option even if it has been explicitly disabled.
@ -348,7 +346,7 @@ impl SummaryBuilder {
/// A default printer can be created with either of the `Summary::new` or
/// `Summary::new_no_color` constructors. However, there are a number of
/// options that configure this printer's output. Those options can be
/// configured using [`SummaryBuilder`](struct.SummaryBuilder.html).
/// configured using [`SummaryBuilder`].
///
/// This type is generic over `W`, which represents any implementation of
/// the `termcolor::WriteColor` trait.
@ -480,14 +478,13 @@ impl<W> Summary<W> {
/// This type is generic over a few type parameters:
///
/// * `'p` refers to the lifetime of the file path, if one is provided. When
/// no file path is given, then this is `'static`.
/// * `'s` refers to the lifetime of the
/// [`Summary`](struct.Summary.html)
/// printer that this type borrows.
/// no file path is given, then this is `'static`.
/// * `'s` refers to the lifetime of the [`Summary`] printer that this type
/// borrows.
/// * `M` refers to the type of matcher used by
/// `grep_searcher::Searcher` that is reporting results to this sink.
/// `grep_searcher::Searcher` that is reporting results to this sink.
/// * `W` refers to the underlying writer that this printer is writing its
/// output to.
/// output to.
#[derive(Debug)]
pub struct SummarySink<'p, 's, M: Matcher, W> {
matcher: M,
@ -531,8 +528,7 @@ impl<'p, 's, M: Matcher, W: WriteColor> SummarySink<'p, 's, M, W> {
/// searches executed on this sink.
///
/// This only returns stats if they were requested via the
/// [`SummaryBuilder`](struct.SummaryBuilder.html)
/// configuration.
/// [`SummaryBuilder`] configuration.
pub fn stats(&self) -> Option<&Stats> {
self.stats.as_ref()
}