Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/psychollama/piece-table.rs
A tiny piece table implementation in Rust
https://github.com/psychollama/piece-table.rs
code editor modern rust terminal-based vim
Last synced: 13 days ago
JSON representation
A tiny piece table implementation in Rust
- Host: GitHub
- URL: https://github.com/psychollama/piece-table.rs
- Owner: PsychoLlama
- Created: 2019-01-18T05:31:52.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-21T00:55:49.000Z (over 4 years ago)
- Last Synced: 2024-10-03T20:41:34.551Z (about 1 month ago)
- Topics: code, editor, modern, rust, terminal-based, vim
- Language: Rust
- Homepage:
- Size: 54.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Piece Table
This was part of a larger ambition to write my own text editor. Then I got
bored and gave up. But hey, at least I finished the piece table
implementation.If you're curious, a [piece table](https://darrenburns.net/posts/piece-table/)
is a clever data structure designed to optimize string manipulations and their
affect on memory. But considering you found this repository, you probably know
that already. So here's a disclaimer: I have no idea what I'm doing, and I'm
a terrible Rust programmer. I wouldn't recommend using it.Anyway, here's the gist:
```rust
use piece_table::Document;fn main() {
let mut doc = Document::from("Old title");
doc.insert(3, " revised");
doc.delete(&(0..5));
doc.insert(0, "R");assert_eq!(doc.to_string(), "Revised title");
}
```