Struct cursive_core::utils::span::IndexedSpan
source · pub struct IndexedSpan<T> {
pub content: IndexedCow,
pub attr: T,
pub width: usize,
}
Expand description
An indexed span with an associated attribute.
Fields§
§content: IndexedCow
Content of the span.
attr: T
Attribute applied to the span.
width: usize
Width of the text for this span.
Implementations§
source§impl<T> IndexedSpan<T>
impl<T> IndexedSpan<T>
sourcepub fn resolve<'a>(&'a self, source: &'a str) -> Span<'a, T>where
T: 'a,
pub fn resolve<'a>(&'a self, source: &'a str) -> Span<'a, T>where
T: 'a,
Resolve the span to a string slice and an attribute.
sourcepub fn resolve_mut<'a>(&'a mut self, source: &'a str) -> SpanMut<'a, T>where
T: 'a,
pub fn resolve_mut<'a>(&'a mut self, source: &'a str) -> SpanMut<'a, T>where
T: 'a,
Resolve the span to a string slice and a mutable attribute.
sourcepub fn as_ref_mut(&mut self) -> IndexedSpanRefMut<'_, T>
pub fn as_ref_mut(&mut self) -> IndexedSpanRefMut<'_, T>
Returns a reference struct to only access mutation of the attribute.
sourcepub fn simple_borrowed(content: &str, attr: T) -> Self
pub fn simple_borrowed(content: &str, attr: T) -> Self
Returns a single indexed span around the entire text.
sourcepub fn simple_owned(content: String, attr: T) -> Self
pub fn simple_owned(content: String, attr: T) -> Self
Returns a single owned indexed span around the entire text.
Trait Implementations§
source§impl<T> AsRef<IndexedCow> for IndexedSpan<T>
impl<T> AsRef<IndexedCow> for IndexedSpan<T>
source§fn as_ref(&self) -> &IndexedCow
fn as_ref(&self) -> &IndexedCow
Converts this type into a shared reference of the (usually inferred) input type.
source§impl<T: Clone> Clone for IndexedSpan<T>
impl<T: Clone> Clone for IndexedSpan<T>
source§fn clone(&self) -> IndexedSpan<T>
fn clone(&self) -> IndexedSpan<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more