Enum cursive::utils::span::IndexedCow [−][src]
A span of text that can be either owned, or indexed in another String.
Variants
BorrowedIndexes 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 IndexedCowpub fn resolve<'a>(&'a self, source: &'a str) -> &'a str[src]
pub fn resolve<'a>(&'a self, source: &'a str) -> &'a strResolve 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) -> SelfReturns 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) -> boolReturns ŧ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) -> &IndexedCowPerforms the conversion.
impl Debug for IndexedCow[src]
impl Debug for IndexedCowfn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl Clone for IndexedCow[src]
impl Clone for IndexedCowfn clone(&self) -> IndexedCow[src]
fn clone(&self) -> IndexedCowReturns 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 IndexedCowfn eq(&self, other: &IndexedCow) -> bool[src]
fn eq(&self, other: &IndexedCow) -> boolThis 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) -> boolThis method tests for !=.
impl Eq for IndexedCow[src]
impl Eq for IndexedCowAuto Trait Implementations
impl Send for IndexedCow
impl Send for IndexedCowimpl Sync for IndexedCow
impl Sync for IndexedCow