Enum persistent_rope::Rope
[−]
[src]
pub enum Rope { Node(usize, Arc<Rope>, Arc<Rope>), Leaf(Arc<String>), }
Variants
Node(usize, Arc<Rope>, Arc<Rope>)
Leaf(Arc<String>)
Methods
impl Rope
[src]
fn new() -> Self
[src]
Examples
use persistent_rope::Rope; let rope = Rope::new(); assert_eq!(&rope, "");
fn len(&self) -> usize
[src]
Examples
use persistent_rope::Rope; let rope = Rope::from("Hello, world!"); assert_eq!(rope.len(), 13);
fn bytes_len(&self) -> usize
[src]
Examples
use persistent_rope::Rope; let rope = Rope::from("Hello, world!"); assert_eq!(rope.bytes_len(), 13);
fn chars_len(&self) -> usize
[src]
Examples
use persistent_rope::Rope; let rope = Rope::from("長さ"); assert_eq!(rope.chars_len(), 2);
fn is_empty(&self) -> bool
[src]
Examples
use persistent_rope::Rope; let rope = Rope::from("Hello, world!"); assert!(!rope.is_empty());
fn height(&self) -> usize
[src]
Examples
use persistent_rope::Rope; let a = Rope::from("Hello"); let b = a.insert_at_byte(5, ", world!"); assert_eq!(b.height(), 2);
fn count_lines(&self) -> usize
[src]
Examples
use persistent_rope::Rope; let a = Rope::from("Hello,\n"); let b = a.insert_at_byte(5, "world!\n"); assert_eq!(b.count_lines(), 2);
fn insert_at_byte<T>(&self, index: usize, value: T) -> Rope where
T: Into<Rope>,
[src]
T: Into<Rope>,
Examples
use persistent_rope::Rope; let rope = Rope::from("Helloworld!"); assert_eq!(&rope.insert_at_byte(5, ", "), "Hello, world!");
fn insert<T>(&self, index: usize, value: T) -> Rope where
T: Into<Rope>,
[src]
T: Into<Rope>,
Examples
use persistent_rope::Rope; let rope = Rope::from("長さ"); assert_eq!(&rope.insert(1, ", "), "長, さ");
fn insert_char_at_byte(&self, index: usize, ch: char) -> Rope
[src]
Examples
use persistent_rope::Rope; let a = Rope::from("Hello").concat(" world"); let b = a.insert_char_at_byte(5, ','); let c = b.insert_char_at_byte(12, '!'); assert_eq!(&b, "Hello, world"); assert_eq!(&c, "Hello, world!");
fn insert_char(&self, index: usize, ch: char) -> Rope
[src]
Examples
use persistent_rope::Rope; let a = Rope::from("長").concat("さ"); let b = a.insert_char(1, ','); let c = b.insert_char(3, '!'); assert_eq!(&b, "長,さ"); assert_eq!(&c, "長,さ!");
fn remove_byte_range(&self, range: Range<usize>) -> Rope
[src]
Examples
use persistent_rope::Rope; let rope = Rope::from("Hello, world!"); assert_eq!(&rope.remove_byte_range(5..13), "Hello");
fn remove_range(&self, range: Range<usize>) -> Rope
[src]
Examples
use persistent_rope::Rope; let rope = Rope::from("長 さ"); assert_eq!(&rope.remove_range(1..2), "長さ");
fn remove_at_byte(&self, index: usize) -> Rope
[src]
Examples
use persistent_rope::Rope; let rope = Rope::from("Hello, world!"); assert_eq!(&rope.remove_at_byte(12), "Hello, world"); assert_eq!(&rope.remove_at_byte(5), "Hello world!");
fn remove(&self, index: usize) -> Rope
[src]
Examples
use persistent_rope::Rope; let rope = Rope::from("長さ"); assert_eq!(&rope.remove(0), "さ"); assert_eq!(&rope.remove(1), "長");
fn split_at_byte(&self, index: usize) -> (Rope, Rope)
[src]
Examples
use persistent_rope::Rope; let rope = Rope::from("Hello, world!"); let (left, right) = rope.split_at_byte(7); assert_eq!(&left, "Hello, "); assert_eq!(&right, "world!"); let rope = Rope::new(); let (left, right) = rope.split_at_byte(0); assert_eq!(&left, ""); assert_eq!(&right, "");
fn split(&self, index: usize) -> (Rope, Rope)
[src]
Examples
use persistent_rope::Rope; let rope = Rope::from("長さ"); let (left, right) = rope.split(1); assert_eq!(&left, "長"); assert_eq!(&right, "さ");
fn concat<T>(&self, value: T) -> Rope where
T: Into<Rope>,
[src]
T: Into<Rope>,
Examples
use persistent_rope::Rope; let left = Rope::from("Hello, "); let right = Rope::from("world!"); assert_eq!(&left.concat(right), "Hello, world!");
fn concat_char(&self, ch: char) -> Rope
[src]
Examples
use persistent_rope::Rope; let rope = Rope::from("Hello").concat(", world"); println!("{:?}", rope); assert_eq!(&rope.concat_char('!'), "Hello, world!");
fn char_at(&self, index: usize) -> Option<char>
[src]
Examples
use persistent_rope::Rope; let rope = Rope::from("長").concat(", さ!"); assert_eq!(rope.char_at(0), Some('長')); assert_eq!(rope.char_at(1), Some(',')); assert_eq!(rope.char_at(2), Some(' ')); assert_eq!(rope.char_at(3), Some('さ')); assert_eq!(rope.char_at(4), Some('!'));
fn chunks(&self) -> Chunks
[src]
Examples
use persistent_rope::Rope; let rope = Rope::from("Hello").concat(", world!"); assert_eq!(rope.chunks().collect::<Vec<&String>>(), ["Hello", ", world!"].to_vec());
fn bytes(&self) -> Bytes
[src]
Examples
use persistent_rope::Rope; let rope = Rope::from("Hello"); assert_eq!(rope.bytes().collect::<Vec<u8>>(), [72, 101, 108, 108, 111].to_vec());
fn chars(&self) -> Chars
[src]
Examples
use persistent_rope::Rope; let rope = Rope::from("Hello"); assert_eq!(rope.chars().collect::<Vec<char>>(), ['H', 'e', 'l', 'l', 'o'].to_vec());
fn lines(&self) -> Lines
[src]
Examples
use persistent_rope::Rope; let rope = Rope::from("Hello\n world!"); let lines = rope.lines().collect::<Vec<String>>(); assert_eq!(lines.get(0), Some(&String::from("Hello"))); assert_eq!(lines.get(1), Some(&String::from(" world!")));
fn iter(&self) -> Chars
[src]
Trait Implementations
impl Clone for Rope
[src]
fn clone(&self) -> Rope
[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 PartialEq for Rope
[src]
fn eq(&self, __arg_0: &Rope) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Rope) -> bool
[src]
This method tests for !=
.
impl Eq for Rope
[src]
impl PartialOrd for Rope
[src]
fn partial_cmp(&self, __arg_0: &Rope) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &Rope) -> bool
[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &Rope) -> bool
[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &Rope) -> bool
[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &Rope) -> bool
[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Ord for Rope
[src]
fn cmp(&self, __arg_0: &Rope) -> Ordering
[src]
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.22.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.22.0[src]
Compares and returns the minimum of two values. Read more
impl Hash for Rope
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
[src]
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]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Sync for Rope
[src]
impl Send for Rope
[src]
impl From<Arc<Rope>> for Rope
[src]
impl<'a> From<&'a Arc<Rope>> for Rope
[src]
impl<'a> From<&'a Rope> for Rope
[src]
impl<'a> From<&'a str> for Rope
[src]
impl<'a> From<&'a String> for Rope
[src]
impl From<String> for Rope
[src]
impl Into<String> for Rope
[src]
impl<'a> IntoIterator for &'a Rope
[src]
type Item = char
The type of the elements being iterated over.
type IntoIter = Chars<'a>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
Creates an iterator from a value. Read more
impl<T> Add<T> for Rope where
T: Into<Rope>,
[src]
T: Into<Rope>,
type Output = Rope
The resulting type after applying the +
operator.
fn add(self, other: T) -> Self::Output
[src]
Examples
use persistent_rope::Rope; let a = Rope::from("Hello"); let b = Rope::from(", world!"); assert_eq!(a.clone() + b, "Hello, world!"); assert_eq!(a + ", world!", "Hello, world!");
impl<'a, T> Add<T> for &'a Rope where
T: Into<Rope>,
[src]
T: Into<Rope>,
type Output = Rope
The resulting type after applying the +
operator.
fn add(self, other: T) -> Self::Output
[src]
Examples
use persistent_rope::Rope; let a = Rope::from("Hello"); let b = Rope::from(", world!"); assert_eq!(&a + &b, "Hello, world!"); assert_eq!(&a + b.clone(), "Hello, world!"); assert_eq!(a.clone() + &b, "Hello, world!");
impl Add<char> for Rope
[src]
type Output = Rope
The resulting type after applying the +
operator.
fn add(self, ch: char) -> Self::Output
[src]
Examples
use persistent_rope::Rope; let a = Rope::from("Hello"); assert_eq!(a + '!', "Hello!");
impl<'a> Add<char> for &'a Rope
[src]
type Output = Rope
The resulting type after applying the +
operator.
fn add(self, ch: char) -> Self::Output
[src]
Examples
use persistent_rope::Rope; let a = Rope::from("Hello"); assert_eq!(&a + '!', "Hello!");
impl ToString for Rope
[src]
fn to_string(&self) -> String
[src]
Examples
use persistent_rope::Rope; let rope = Rope::from("Hello, world!"); assert_eq!(rope.to_string(), "Hello, world!");
impl Debug for Rope
[src]
impl<'a> PartialEq<&'a str> for Rope
[src]
fn eq(&self, other: &&'a str) -> bool
[src]
Examples
use persistent_rope::Rope; let rope = Rope::from("Hello, world!"); assert_eq!(&rope, "Hello, world!"); assert_ne!(&rope, "Hello!");
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl PartialEq<str> for Rope
[src]
fn eq(&self, other: &str) -> bool
[src]
Examples
use persistent_rope::Rope; let rope = Rope::from("Hello, world!"); assert_eq!(rope, "Hello, world!"); assert_ne!(rope, "Hello!");
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.