Skip to main content

Crate pbtree

Crate pbtree 

Source
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§

CompactIter
CompactPieceTable
Compact index-arena backend using node IDs instead of pointer-linked ownership.
CompactRangeIter
Cursor
Iter
PieceTable
Primary piece-table backend using a pooled B+ tree.
RangeIter
Stats
Runtime counters useful for profiling edit behavior.

Enums§

BufferKind
Identifies which underlying immutable buffer a piece references.
SearchAlgorithm
Selects the substring search strategy for byte-oriented APIs.

Traits§

TextBuffer
Stable common API shared by editable text backends in this crate.