Crate ropey [] [src]

Ropey is a utf8 text rope library, designed to be the backing text buffer for applications such as text editors. Ropey is fast, Unicode-safe, has low memory overhead, and can handle huge texts and memory-incoherent edits without trouble.

The library is made up of four main components:

  • Rope: the main editable text buffer type.
  • RopeSlice: an immutable view into part of a Rope.
  • RopeBuilder: a type for efficiently creating Ropes from streaming data.
  • iter: iterators over a Rope/RopeSlice's data.

Basic examples

Insertion and deletion

use ropey::Rope;

let mut rope = Rope::from_str("Hello individual!");
rope.remove(6, 16);
rope.insert(6, "world");

assert_eq!(rope, "Hello world!");

Slicing

let mut rope = Rope::from_str("Hello individual!");
let slice = rope.slice(6, 16);

assert_eq!(slice, "individual");

Iterating over lines

let mut rope = Rope::from_str("Hello individual!\nHow are you?");
let mut itr = rope.lines();

assert_eq!(itr.next().unwrap(), "Hello individual!\n");
assert_eq!(itr.next().unwrap(), "How are you?");
assert_eq!(itr.next(), None);

Modules

iter

Iterators over a Rope's data.

Structs

Rope

A utf8 text rope.

RopeBuilder

An incremental Rope builder.

RopeSlice

An immutable view into part of a Rope.