6 releases (3 breaking)

0.4.0 Jul 20, 2023
0.3.0 Jul 20, 2023
0.2.0 Jul 19, 2023
0.1.2 Jul 19, 2023

#1636 in Data structures

MIT license

20KB
451 lines

rope_rd

A rope data structure in rust, comprised of Read and Seekable nodes, which itself implements Read and Seek.


lib.rs:

A rope data structure which implements std::io::Read and std::io::Seek by delegating to its leaf nodes.

use std::io::{Cursor, Read};
use rope_rd::Node;

let mut rope = Node::branch(
    Node::leaf(Cursor::new(vec![1, 2, 3])).unwrap(),
    Node::leaf_with_length(Cursor::new(vec![4, 5, 6]), 3),
);

let mut out = Vec::default();
rope.read_to_end(&mut out).unwrap();

This rope does not allow insertions into the middle of the tree, or any removals.

No runtime deps