Enum cursive::utils::span::IndexedCow [−][src]
Expand description
A span of text that can be either owned, or indexed in another String.
Variants
Borrowed
Fields
start: usizeByte offset of the beginning of the span (inclusive)
end: usizeByte offset of the end of the span (exclusive)
Indexes content in a separate string.
Owned(String)
Tuple Fields
0: StringOwns its content.
Implementations
Return the (start, end) indexes if self is IndexedCow::Borrowed.
Returns the embedded text content if self is IndexedCow::Owned.
Returns an indexed view of the given item.
Note: it is assumed cow, if borrowed, is a substring of source.
If self is borrowed, offset its indices by the given value.
Useful to update spans when concatenating sources. This span will now
point to text offset further in the source.
If self is borrowed, offset its indices back by the given value.
Useful to update spans when removing a prefix from the source.
This span will now point to text offset closer to the start of the source.
This span may become empty as a result.
Trait Implementations
Performs the conversion.
This method tests for self and other values to be equal, and is used
by ==. Read more
This method tests for !=.
Auto Trait Implementations
impl RefUnwindSafe for IndexedCow
impl Send for IndexedCow
impl Sync for IndexedCow
impl Unpin for IndexedCow
impl UnwindSafe for IndexedCow
Blanket Implementations
Mutably borrows from an owned value. Read more
Calls the given closure and return the result. Read more
Calls the given closure on self.
