pub struct SpannedStr<'a, T> { /* private fields */ }
Expand description
The immutable, borrowed equivalent of SpannedString
.
Implementations
sourceimpl<'a, T> SpannedStr<'a, T>where
T: 'a,
impl<'a, T> SpannedStr<'a, T>where
T: 'a,
sourcepub fn new(source: &'a str, spans: &'a [IndexedSpan<T>]) -> SpannedStr<'a, T>
pub fn new(source: &'a str, spans: &'a [IndexedSpan<T>]) -> SpannedStr<'a, T>
Creates a new SpannedStr
from the given references.
sourcepub fn spans<'b>(&'b self) -> impl DoubleEndedIterator + ExactSizeIterator + 'bwhere
'a: 'b,
pub fn spans<'b>(&'b self) -> impl DoubleEndedIterator + ExactSizeIterator + 'bwhere
'a: 'b,
Gives access to the parsed styled spans.
sourcepub fn spans_raw(&self) -> &'a [IndexedSpan<T>]
pub fn spans_raw(&self) -> &'a [IndexedSpan<T>]
Returns a reference to the indexed spans.
Trait Implementations
sourceimpl<'a, T> Clone for SpannedStr<'a, T>
impl<'a, T> Clone for SpannedStr<'a, T>
sourcefn clone(&self) -> SpannedStr<'a, T>
fn clone(&self) -> SpannedStr<'a, T>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<'a, T> Debug for SpannedStr<'a, T>where
T: Debug,
impl<'a, T> Debug for SpannedStr<'a, T>where
T: Debug,
sourceimpl<'a, T> From<&'a SpannedString<T>> for SpannedStr<'a, T>
impl<'a, T> From<&'a SpannedString<T>> for SpannedStr<'a, T>
sourcefn from(other: &'a SpannedString<T>) -> SpannedStr<'a, T>
fn from(other: &'a SpannedString<T>) -> SpannedStr<'a, T>
Converts to this type from the input type.
sourceimpl<'a, T> Hash for SpannedStr<'a, T>where
T: Hash,
impl<'a, T> Hash for SpannedStr<'a, T>where
T: Hash,
sourceimpl<'a, T> PartialEq<SpannedStr<'a, T>> for SpannedStr<'a, T>where
T: PartialEq<T>,
impl<'a, T> PartialEq<SpannedStr<'a, T>> for SpannedStr<'a, T>where
T: PartialEq<T>,
sourcefn eq(&self, other: &SpannedStr<'a, T>) -> bool
fn eq(&self, other: &SpannedStr<'a, T>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourceimpl<'a, T> SpannedText for SpannedStr<'a, T>where
T: 'a,
impl<'a, T> SpannedText for SpannedStr<'a, T>where
T: 'a,
type S = IndexedSpan<T>
type S = IndexedSpan<T>
Type of span returned by SpannedText::spans()
.
sourcefn spans(&self) -> &[IndexedSpan<T>]
fn spans(&self) -> &[IndexedSpan<T>]
Returns the spans for this text.
sourcefn as_ref(&self) -> SpannedTextRef<'_, Self>
fn as_ref(&self) -> SpannedTextRef<'_, Self>
Returns a SpannedText
by reference.
impl<'a, T> Eq for SpannedStr<'a, T>where
T: Eq,
impl<'a, T> StructuralEq for SpannedStr<'a, T>
impl<'a, T> StructuralPartialEq for SpannedStr<'a, T>
Auto Trait Implementations
impl<'a, T> RefUnwindSafe for SpannedStr<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for SpannedStr<'a, T>where
T: Sync,
impl<'a, T> Sync for SpannedStr<'a, T>where
T: Sync,
impl<'a, T> Unpin for SpannedStr<'a, T>
impl<'a, T> UnwindSafe for SpannedStr<'a, T>where
T: RefUnwindSafe,
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