piece-tree 0.1.1

Purely functional (immutable) implementation of Piece Tree, inspired by fredbuf
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
fn main() {
    use piece_tree::PieceTree;

    let mut tree = PieceTree::new();
    tree.insert(0, "Hello");
    tree.insert(5, ", World!");
    assert_eq!(tree.to_string(), "Hello, World!");

    tree.try_undo(0);
    assert_eq!(tree.to_string(), "Hello");

    tree.try_redo(0);
    assert_eq!(tree.to_string(), "Hello, World!");
}