Expand description
Refers to a part of a span
Fields§
§span_id: usize
ID of the span this segment refers to
start: usize
Beginning of this segment within the span (included)
end: usize
End of this segment within the span (excluded)
width: usize
Width of this segment
Implementations§
source§impl Segment
impl Segment
sourcepub fn resolve<'a, T>(&self, source: &SpannedStr<'a, T>) -> Span<'a, T>
pub fn resolve<'a, T>(&self, source: &SpannedStr<'a, T>) -> Span<'a, T>
Resolve this segment to a string slice and an attribute.
sourcepub fn resolve_plain<'a, S>(&self, source: &'a S) -> &'a strwhere
S: SpannedText,
pub fn resolve_plain<'a, S>(&self, source: &'a S) -> &'a strwhere
S: SpannedText,
Resolves this segment to plain text.
sourcepub fn source_indices<S>(&self, spans: &[S]) -> Option<(usize, usize)>where
S: AsRef<IndexedCow>,
pub fn source_indices<S>(&self, spans: &[S]) -> Option<(usize, usize)>where
S: AsRef<IndexedCow>,
Returns indices in the source string, if possible.
Returns (start, end)
, or None
if the target span is an owned string.