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.
Panics
Panics if char_idx
is out of bounds (i.e. char_idx > len_chars()
).
fn line_to_char(&self, line_idx: usize) -> usize
[src]
Returns the char index of the start of the given line.
Note: lines are zero-indexed.
Panics
Panics if line_idx
is out of bounds (i.e. line_idx > len_lines()
).
fn char(&self, char_idx: usize) -> char
[src]
Returns the char at char_idx
.
Panics
Panics if char_idx
is out of bounds (i.e. char_idx >= len_chars()
).
fn line(&self, line_idx: usize) -> RopeSlice<'a>
[src]
Returns the line at line_idx
.
Note: lines are zero-indexed.
Panics
Panics if line_idx
is out of bounds (i.e. line_idx >= len_lines()
).
fn is_grapheme_boundary(&self, char_idx: usize) -> bool
[src]
Returns whether char_idx
is a grapheme cluster boundary or not.
Panics
Panics if char_idx
is out of bounds (i.e. char_idx > len_chars()
).
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.
Panics
Panics if char_idx
is out of bounds (i.e. char_idx > len_chars()
).
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.
Panics
Panics if char_idx
is out of bounds (i.e. char_idx > len_chars()
).
fn slice(&self, start: usize, end: usize) -> RopeSlice<'a>
[src]
Returns an immutable slice of the RopeSlice
in the char range start..end
.
Panics
Panics if start
is greater than end
or end
is out of bounds
(i.e. end > len_chars()
).
fn bytes(&self) -> Bytes<'a>
[src]
Creates an iterator over the bytes of the RopeSlice
.
fn chars(&self) -> Chars<'a>
[src]
Creates an iterator over the chars of the RopeSlice
.
fn graphemes(&self) -> Graphemes<'a>
[src]
Creates an iterator over the grapheme clusters of the RopeSlice
.
fn lines(&self) -> Lines<'a>
[src]
Creates an iterator over the lines of the RopeSlice
.
fn chunks(&self) -> Chunks<'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 !=
.