pub struct Span {
    pub start: LineColumn,
    pub end: LineColumn,
}Expand description
Relative span in relation to the beginning of a doc comment.
Line values are 1-indexed relative, lines are inclusive. Column values in UTF-8 characters in a line, 0-indexed and inclusive.
Fields§
§start: LineColumnStart of the span, inclusive, see
LineColumn.
end: LineColumnEnd of the span, inclusive, see LineColumn.
Implementations§
Source§impl Span
 
impl Span
Sourcepub fn relative_to<X: Into<Span>>(&self, scope: X) -> Result<Range>
 
pub fn relative_to<X: Into<Span>>(&self, scope: X) -> Result<Range>
Converts a span to a range, where self is converted to a range
relative to the passed span scope. Only works for literals spanning a
single line and the scope full contains self, otherwise an an Err(..)`
is returned.
Sourcepub fn covers_line(&self, line: usize) -> bool
 
pub fn covers_line(&self, line: usize) -> bool
Check if self span covers provided line number, which is 1-indexed.
Sourcepub fn one_line_len(&self) -> Option<usize>
 
pub fn one_line_len(&self) -> Option<usize>
If this one resembles a single line, returns the a Some(len) value.
For multilines this cannot account for the length.
Sourcepub fn is_multiline(&self) -> bool
 
pub fn is_multiline(&self) -> bool
Check if self covers multiple lines
Sourcepub fn to_content_range(&self, chunk: &CheckableChunk) -> Result<Range>
 
pub fn to_content_range(&self, chunk: &CheckableChunk) -> Result<Range>
Convert a given span self into a Range
The Chunk has a associated Span (or a set of Range -> Span
mappings) which are used to map.
Trait Implementations§
Source§impl From<&TrimmedLiteral> for Span
 
impl From<&TrimmedLiteral> for Span
Source§fn from(literal: &TrimmedLiteral) -> Self
 
fn from(literal: &TrimmedLiteral) -> Self
impl Copy for Span
impl Eq for Span
impl StructuralPartialEq for Span
Auto Trait Implementations§
impl Freeze for Span
impl RefUnwindSafe for Span
impl Send for Span
impl Sync for Span
impl Unpin for Span
impl UnwindSafe for Span
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
 
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
 
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
 
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
 
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
 
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
 
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
 
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
 
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
 
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
 
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more