nomad / crop

🌾 A pretty fast text rope
https://crates.io/crates/crop
MIT License
261 stars 13 forks source link

Efficient API to access chunk at given offset #15

Open flyingmutant opened 8 months ago

flyingmutant commented 8 months ago

For use-cases like logos::Source, efficient access to raw bytes can be important. Would you be OK with adding a method like ropey::RopeSlice::chunk_at_byte? Not a feature request, just want to know your stance on expanding API in this direction.

linrongbin16 commented 3 weeks ago

hi @flyingmutant , is it possible to use the logos::Source with lines or bytes related APIs from this crate? Or it's a must to use chunk related APIs to do it?

(Actually I'm comparing this crate with Ropey, and want to understand in what scenario we must use the chunk related APIs)


Update:

@flyingmutant , I found in the latest version of this crate, it already support chunk related APIs: https://docs.rs/crop/latest/crop/iter/struct.Chunks.html.