Crates.io | flo_rope |
lib.rs | flo_rope |
version | 0.2.0 |
source | src |
created_at | 2020-06-29 19:47:39.57957 |
updated_at | 2021-11-27 15:53:31.040563 |
description | An attributed and streaming implementation of the rope data structure |
homepage | |
repository | https://github.com/Logicalshift/flo_rope |
max_upload_size | |
id | 259515 |
size | 120,187 |
This is a Rust library containing an implementation of the rope data structure. Ropes are an extension of the string type that support efficient manipulation of very large amounts of data.
flo_rope
adds a couple of extensions to the usual features of the data structure:
Ropes are quite typically used for text editors for their performance
characteristics: flo_rope
provides a way to represent text colours and set up a
pipeline to use those colours to perform syntax highlighting. The 'pull' model is
highly suited to representing text regions (and other collection data structures)
in a reactive user interface.
A companion library, flo_binding
will provide support for the reactive model of
ropes, suitable for integrating into a user interface.
Replacing a range in a rope
use flo_rope::*;
let mut rope = AttributedRope::<_, ()>::from(vec![1, 2, 3, 4, 5, 6, 7, 8]);
rope.replace(1..3, vec![42]);
assert!(rope.read_cells(0..rope.len()).cloned().collect::<Vec<_>>() == vec![1,42,4,5,6,7,8]);