A simple gap buffer implementation in Rust.
# You can just add it to Cargo.toml as such:
[dependencies]
gap_buffer = { git = "https://github.com/andrejfox/gap-buffer-rust.git" }- Insert
- Delete
- Backspace
- Cursor movement
- Efficient editing near the cursor
use gap_buffer::GapBuffer;
let mut buf = GapBuffer::new("hello");
buf.move_cursor(5).unwrap();
buf.insert(" world");
assert_eq!(buf.fetch(0, 10).unwrap(), "hello world");