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
sourceimpl Segment
impl Segment
sourcepub fn resolve<T>(&self, source: &SpannedStr<'a, T>) -> Span<'a, T>
pub fn resolve<T>(&self, source: &SpannedStr<'a, T>) -> Span<'a, T>
Resolve this segment to a string slice and an attribute.
sourcepub fn resolve_plain<S>(&self, source: &'a S) -> &'a strwhere
S: SpannedText,
pub fn resolve_plain<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.
Trait Implementations
sourceimpl PartialEq<Segment> for Segment
impl PartialEq<Segment> for Segment
impl Copy for Segment
impl Eq for Segment
impl StructuralEq for Segment
impl StructuralPartialEq for Segment
Auto Trait Implementations
impl RefUnwindSafe for Segment
impl Send for Segment
impl Sync for Segment
impl Unpin for Segment
impl UnwindSafe for Segment
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more