Struct cursive_core::utils::span::SpannedStr
source · pub struct SpannedStr<'a, T> { /* private fields */ }
Expand description
The immutable, borrowed equivalent of SpannedString
.
Implementations§
source§impl<'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>]) -> Self
pub fn new(source: &'a str, spans: &'a [IndexedSpan<T>]) -> Self
Creates a new SpannedStr
from the given references.
sourcepub fn spans<'b>(
&'b self
) -> impl DoubleEndedIterator<Item = Span<'a, T>> + ExactSizeIterator<Item = Span<'a, T>> + 'bwhere
'a: 'b,
pub fn spans<'b>(
&'b self
) -> impl DoubleEndedIterator<Item = Span<'a, T>> + ExactSizeIterator<Item = Span<'a, T>> + '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§
source§impl<'a, T> Clone for SpannedStr<'a, T>
impl<'a, T> Clone for SpannedStr<'a, T>
source§impl<'a, T: Debug> Debug for SpannedStr<'a, T>
impl<'a, T: Debug> Debug for SpannedStr<'a, T>
source§impl<'a, T> From<&'a SpannedString<T>> for SpannedStr<'a, T>
impl<'a, T> From<&'a SpannedString<T>> for SpannedStr<'a, T>
source§fn from(other: &'a SpannedString<T>) -> Self
fn from(other: &'a SpannedString<T>) -> Self
Converts to this type from the input type.
source§impl<'a, T: Hash> Hash for SpannedStr<'a, T>
impl<'a, T: Hash> Hash for SpannedStr<'a, T>
source§impl<'a, T: PartialEq> PartialEq<SpannedStr<'a, T>> for SpannedStr<'a, T>
impl<'a, T: PartialEq> PartialEq<SpannedStr<'a, T>> for SpannedStr<'a, T>
source§fn eq(&self, other: &SpannedStr<'a, T>) -> bool
fn eq(&self, other: &SpannedStr<'a, T>) -> bool
source§impl<'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()
.source§fn spans(&self) -> &[IndexedSpan<T>]
fn spans(&self) -> &[IndexedSpan<T>]
Returns the spans for this text.
source§fn as_ref(&self) -> SpannedTextRef<'_, Self>
fn as_ref(&self) -> SpannedTextRef<'_, Self>
Returns a
SpannedText
by reference.