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) -> IndexedSpan<T>
pub fn simple_borrowed(content: &str, attr: T) -> IndexedSpan<T>
Returns a single indexed span around the entire text.
Sourcepub fn simple_owned(content: String, attr: T) -> IndexedSpan<T>
pub fn simple_owned(content: String, attr: T) -> IndexedSpan<T>
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 for IndexedSpan<T>where
T: Clone,
impl<T> Clone for IndexedSpan<T>where
T: Clone,
Source§fn clone(&self) -> IndexedSpan<T>
fn clone(&self) -> IndexedSpan<T>
Returns a duplicate 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 moreSource§impl<T> Debug for IndexedSpan<T>where
T: Debug,
impl<T> Debug for IndexedSpan<T>where
T: Debug,
Source§impl<T> Hash for IndexedSpan<T>where
T: Hash,
impl<T> Hash for IndexedSpan<T>where
T: Hash,
Source§impl<T> PartialEq for IndexedSpan<T>where
T: PartialEq,
impl<T> PartialEq for IndexedSpan<T>where
T: PartialEq,
impl<T> Eq for IndexedSpan<T>where
T: Eq,
impl<T> StructuralPartialEq for IndexedSpan<T>
Auto Trait Implementations§
impl<T> Freeze for IndexedSpan<T>where
T: Freeze,
impl<T> RefUnwindSafe for IndexedSpan<T>where
T: RefUnwindSafe,
impl<T> Send for IndexedSpan<T>where
T: Send,
impl<T> Sync for IndexedSpan<T>where
T: Sync,
impl<T> Unpin for IndexedSpan<T>where
T: Unpin,
impl<T> UnwindSafe for IndexedSpan<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.