pub struct CheckableChunk { /* private fields */ }
Expand description

A chunk of documentation that is supposed to be checked.

Implementations

Specific to rust source code, either as part of doc test comments or file scope.

Load content from string, may contain common mark content.

Load content from string, may contain common mark content.

Find which part of the range maps to which span. Note that Range can very well be split into multiple fragments where each of them can be mapped to a potentially non-continuous span.

Example:

0..40 -> [
          (0,10) => (1,0)->(3,5),
          (10,12) => (3,6)->(3,7),
          (13,17) => (4,0)->(4,3),
]

Extract all spans which at least partially overlap with range, i.e. report all spans that either

  • contain range.start
  • contain range.end
  • are totally enclosed in range

Example:

Below setup results in [s2, s3, s4]

|-- s1 --|-- s2 --|-- s3 --|-- s4 --|
            |----- range -----|

Attention:

For large #[doc="long multiline text"] comments, the covered span might be large (i.e. just one single) which leads to a surprising result of just one span for a relatively small input range.

Below setup results in [s0]

|---...--- s0 ----------------------...---|
            |--- range ---|

Yields a set of ranges covering all spanned lines (the full line).

Extract the overall length of all covered lines as they appear in the origin.

Obtain the content as str representation.

Get the display wrapper type to be used with i.e. format!(..).

Iterate over all ranges and the associated span.

Number of fragments.

A fragment is a continuous sub-string which is not split up any further.

Obtain an accessor object containing mapping and string representation, removing the markdown annotations.

Obtain the length in characters.

The variant type of comment.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Compare self to key and return true if they are equal.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.