Minimal rope implementation in rust.
Written as an exercise in the language, so do not expect any particular degree of correctness, functionality, stability, performance, sanity, etc.
Minimal rope inplementation in rust
License: ISC License
shifting the normalise_range()
method onto a trait would allow it to more easily be applied to e.g. LeafNode
, Index
, etc.
it could be perhaps something like:
byte_index(char_index, offset = 0) -> byte_index | (char_index, offset)
the need for an enum to return could make it a little fiddly, though you could also just try each Run in sequence to get the eventual answer, as it can handle checking the char count against the char_index, calculating the final byte_index on a match, and decrement char_index and increment offset on a miss.
the enum aspect could be shifted to cover just the (str|l + r) part, allowing for heavier nodes with e.g. indexes and shit.
at minimum the 'length' field should probably be pulled out, as there is no real need to duplicate it and defer through etc. etc...
with that said, length itself may possibly be superceded by something from the new index module.
atm all Splittable
are also ranged.
however, CharWidth
& Newline
(from index
) are both able (and required) to be split()
, but are unaware of their ending bounds.
could remove the Ranged
parent from Splittable
, and add in a new RangedSplittable
(for example) which is essentially just Splittable
with some assertions and such applied for error checking purposes?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.