Expand description
Piece-table text editing buffers with two interchangeable backends.
§Examples
use piece_table::PieceTable;
let mut table = PieceTable::new("hello".chars().collect());
table.insert(5, &[' ', 'w', 'o', 'r', 'l', 'd']);
table.delete(0, 1);
let text: String = table.iter().copied().collect();
assert_eq!(text, "ello world");use piece_table::{CompactPieceTable, TextBuffer};
let mut table = CompactPieceTable::new(Vec::<char>::new());
table.insert(0, &['a', 'b', 'c']);
assert_eq!(table.get(1), Some(&'b'));
assert!(table.validate().is_ok());Structs§
- Compact
Iter - Compact
Piece Table - Compact index-arena backend using node IDs instead of pointer-linked ownership.
- Compact
Range Iter - Cursor
- Iter
- Piece
Table - Primary piece-table backend using a pooled B+ tree.
- Range
Iter - Stats
- Runtime counters useful for profiling edit behavior.
Enums§
- Buffer
Kind - Identifies which underlying immutable buffer a piece references.
- Search
Algorithm - Selects the substring search strategy for byte-oriented APIs.
Traits§
- Text
Buffer - Stable common API shared by editable text backends in this crate.