Enum cursive::utils::span::IndexedCow [−][src]
A span of text that can be either owned, or indexed in another String.
Variants
Borrowed
Indexes content in a separate string.
Fields of Borrowed
start: usize | Byte offset of the beginning of the span (inclusive) |
end: usize | Byte offset of the end of the span (exclusive) |
Owned(String)
Owns its content.
Methods
impl IndexedCow
[src]
impl IndexedCow
pub fn resolve<'a>(&'a self, source: &'a str) -> &'a str
[src]
pub fn resolve<'a>(&'a self, source: &'a str) -> &'a str
Resolve the span to a string slice.
pub fn from_cow(cow: Cow<str>, source: &str) -> Self
[src]
pub fn from_cow(cow: Cow<str>, source: &str) -> Self
Returns an indexed view of the given item.
Note: it is assumed cow
, if borrowed, is a substring of source
.
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
Returns ŧrue
if this represents an empty span.
pub fn offset(&mut self, offset: usize)
[src]
pub fn offset(&mut self, offset: usize)
If self
is borrowed, offset its indices by the given value.
Useful to update spans when concatenating sources.
Trait Implementations
impl<T> AsRef<IndexedCow> for IndexedSpan<T>
[src]
impl<T> AsRef<IndexedCow> for IndexedSpan<T>
fn as_ref(&self) -> &IndexedCow
[src]
fn as_ref(&self) -> &IndexedCow
Performs the conversion.
impl Debug for IndexedCow
[src]
impl Debug for IndexedCow
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Clone for IndexedCow
[src]
impl Clone for IndexedCow
fn clone(&self) -> IndexedCow
[src]
fn clone(&self) -> IndexedCow
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl PartialEq for IndexedCow
[src]
impl PartialEq for IndexedCow
fn eq(&self, other: &IndexedCow) -> bool
[src]
fn eq(&self, other: &IndexedCow) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &IndexedCow) -> bool
[src]
fn ne(&self, other: &IndexedCow) -> bool
This method tests for !=
.
impl Eq for IndexedCow
[src]
impl Eq for IndexedCow
Auto Trait Implementations
impl Send for IndexedCow
impl Send for IndexedCow
impl Sync for IndexedCow
impl Sync for IndexedCow