Struct ropey::RopeSlice
[−]
[src]
pub struct RopeSlice<'a> { /* fields omitted */ }
An immutable view into part of a Rope
.
Methods
impl<'a> RopeSlice<'a>
[src]
fn len_bytes(&self) -> usize
[src]
Total number of bytes in the RopeSlice
.
fn len_chars(&self) -> usize
[src]
Total number of chars in the RopeSlice
.
fn len_lines(&self) -> usize
[src]
Total number of lines in the RopeSlice
.
fn char_to_line(&self, char_idx: usize) -> usize
[src]
Returns the line index of the given char.
fn line_to_char(&self, line_idx: usize) -> usize
[src]
Returns the char index of the start of the given line.
fn get_char(&self, char_idx: usize) -> char
[src]
Returns the char at char_idx
.
fn get_line(&self, line_idx: usize) -> RopeSlice<'a>
[src]
Returns the line at line_idx
.
Note: lines are zero-indexed.
fn is_grapheme_boundary(&self, char_idx: usize) -> bool
[src]
Returns whether char_idx
is a grapheme cluster boundary or not.
fn prev_grapheme_boundary(&self, char_idx: usize) -> usize
[src]
Returns the char index of the grapheme cluster boundary to the left
of char_idx
.
This excludes any boundary that might be at char_idx
itself, unless
char_idx
is at the beginning of the rope.
fn next_grapheme_boundary(&self, char_idx: usize) -> usize
[src]
Returns the char index of the grapheme cluster boundary to the right
of char_idx
.
This excludes any boundary that might be at char_idx
itself, unless
char_idx
is at the end of the rope.
fn slice(&self, start: usize, end: usize) -> RopeSlice<'a>
[src]
Returns an immutable slice of the RopeSlice
in the char range start..end
.
fn bytes(&self) -> RopeBytes<'a>
[src]
Creates an iterator over the bytes of the RopeSlice
.
fn chars(&self) -> RopeChars<'a>
[src]
Creates an iterator over the chars of the RopeSlice
.
fn graphemes(&self) -> RopeGraphemes<'a>
[src]
Creates an iterator over the grapheme clusters of the RopeSlice
.
fn lines(&self) -> RopeLines<'a>
[src]
Creates an iterator over the lines of the RopeSlice
.
fn chunks(&self) -> RopeChunks<'a>
[src]
Creates an iterator over the chunks of the RopeSlice
.
fn to_string(&self) -> String
[src]
Returns the entire text of the RopeSlice
as a newly allocated String
.
fn to_rope(&self) -> Rope
[src]
Creates a new Rope
from the contents of the RopeSlice
.
Trait Implementations
impl<'a> Copy for RopeSlice<'a>
[src]
impl<'a> Clone for RopeSlice<'a>
[src]
fn clone(&self) -> RopeSlice<'a>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<'a> Debug for RopeSlice<'a>
[src]
impl<'a> Display for RopeSlice<'a>
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<'a, 'b> PartialEq<RopeSlice<'b>> for RopeSlice<'a>
[src]
fn eq(&self, other: &RopeSlice<'b>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<'a, 'b> PartialEq<&'b str> for RopeSlice<'a>
[src]
fn eq(&self, other: &&'b str) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.