Struct ropey::RopeSlice
[−]
[src]
pub struct RopeSlice<'a, S: 'a + GraphemeSegmenter> { /* fields omitted */ }
An immutable view into part of a Rope
.
Methods
impl<'a, S: 'a + GraphemeSegmenter> RopeSlice<'a, S>
[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, S>
[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<R: CharIdxRange>(&self, range: R) -> Self
[src]
Returns a sub-slice of the RopeSlice
in the given char index range.
Panics
Panics if the start of the range is greater than the end, or the end
is out of bounds (i.e. end > len_chars()
).
fn bytes(&self) -> Bytes<'a, S>
[src]
Creates an iterator over the bytes of the RopeSlice
.
fn chars(&self) -> Chars<'a, S>
[src]
Creates an iterator over the chars of the RopeSlice
.
fn graphemes(&self) -> Graphemes<'a, S>
[src]
Creates an iterator over the grapheme clusters of the RopeSlice
.
fn lines(&self) -> Lines<'a, S>
[src]
Creates an iterator over the lines of the RopeSlice
.
fn chunks(&self) -> Chunks<'a, S>
[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<S>
[src]
Creates a new Rope
from the contents of the RopeSlice
.
Trait Implementations
impl<'a, S: Copy + 'a + GraphemeSegmenter> Copy for RopeSlice<'a, S>
[src]
impl<'a, S: Clone + 'a + GraphemeSegmenter> Clone for RopeSlice<'a, S>
[src]
fn clone(&self) -> RopeSlice<'a, S>
[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, S: GraphemeSegmenter> Debug for RopeSlice<'a, S>
[src]
impl<'a, S: GraphemeSegmenter> Display for RopeSlice<'a, S>
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<'a, 'b, S1: GraphemeSegmenter, S2: GraphemeSegmenter> PartialEq<RopeSlice<'b, S2>> for RopeSlice<'a, S1>
[src]
fn eq(&self, other: &RopeSlice<'b, S2>) -> 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, S: GraphemeSegmenter> PartialEq<&'b str> for RopeSlice<'a, S>
[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 !=
.
impl<'a, S: GraphemeSegmenter> PartialEq<str> for RopeSlice<'a, S>
[src]
fn eq(&self, other: &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 !=
.
impl<'a, S: GraphemeSegmenter> PartialEq<String> for RopeSlice<'a, S>
[src]
fn eq(&self, other: &String) -> 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, S: GraphemeSegmenter> PartialEq<Cow<'b, str>> for RopeSlice<'a, S>
[src]
fn eq(&self, other: &Cow<'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 !=
.