Struct tom::TextRange [−][src]
pub struct TextRange { /* fields omitted */ }
A range in the text, represented as a pair of TextUnit
s.
Panics
Slicing a &str
with TextRange
panics if the result is
not a valid utf8 string.
Methods
impl TextRange
[src]
impl TextRange
pub fn from_to(from: TextUnit, to: TextUnit) -> TextRange
[src]
pub fn from_to(from: TextUnit, to: TextUnit) -> TextRange
The left-inclusive range ([from..to)
) between to points in the text
pub fn offset_len(offset: TextUnit, len: TextUnit) -> TextRange
[src]
pub fn offset_len(offset: TextUnit, len: TextUnit) -> TextRange
The left-inclusive range ([offset..offset + len)
) between to points in the text
pub fn start(&self) -> TextUnit
[src]
pub fn start(&self) -> TextUnit
The inclusive start of this range
pub fn end(&self) -> TextUnit
[src]
pub fn end(&self) -> TextUnit
The exclusive end of this range
pub fn len(&self) -> TextUnit
[src]
pub fn len(&self) -> TextUnit
The length of this range
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
Is this range empty of any content?
Trait Implementations
impl Index<TextRange> for str
[src]
impl Index<TextRange> for str
type Output = str
The returned type after indexing.
fn index(&self, index: TextRange) -> &str
[src]
fn index(&self, index: TextRange) -> &str
Performs the indexing (container[index]
) operation.
impl Index<TextRange> for String
[src]
impl Index<TextRange> for String
type Output = str
The returned type after indexing.
fn index(&self, index: TextRange) -> &str
[src]
fn index(&self, index: TextRange) -> &str
Performs the indexing (container[index]
) operation.
impl Hash for TextRange
[src]
impl Hash for TextRange
fn hash<__H>(&self, state: &mut __H) where
__H: Hasher,
[src]
fn hash<__H>(&self, state: &mut __H) where
__H: Hasher,
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Display for TextRange
[src]
impl Display for TextRange
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl Clone for TextRange
[src]
impl Clone for TextRange
fn clone(&self) -> TextRange
[src]
fn clone(&self) -> TextRange
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 Debug for TextRange
[src]
impl Debug for TextRange
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl Copy for TextRange
[src]
impl Copy for TextRange
impl Eq for TextRange
[src]
impl Eq for TextRange
impl PartialEq<TextRange> for TextRange
[src]
impl PartialEq<TextRange> for TextRange