arc-slice 0.1.0: a generalized and more performant tokio-rs/bytes
https://github.com/wyfo/arc-slice
Hello guys, three months ago, I introduced arc-slice in a previous Reddit post. Since then, I've rewritten almost all the code, improved performance and ergonomics, added even more features, and written complete documentation. I've come to a point where I find it ready enough to stabilize, so I've just published the 0.1.0 version!
As a reminder, arc-slice shares the same goal as tokio-rs/bytes: making it easy to work with shared slices of memory. However, arc-slice:
- is generic over the slice type, so you can use it with
[u8]orstr, or any custom slice; - has a customizable generic layout that can trade a little performance for additional features;
- default layout uses only 3 bytes in memory (4 for
bytes::Bytes), and compiles to faster and more inlinable code thanbytes; - can wrap arbitrary buffers, and attach contextual metadata to them;
- goes beyond just no_std, as it supports fallible allocations, global OOM handler disabling, and refcount saturation on overflow;
- provides optimized borrowed views, shared-mutable slice uniqueness, and a few other exclusive features;
- can be used to reimplement
bytes, so it also provides a drop-in replacement that can be used to patchbytesdependency and test the result.
I already gave some details about my motivation behind this crate in a previous comment. I'm just a nobody in the Rust ecosystem, especially compared to tokio, so it would be honest to say that I don't have high expectations regarding the future adoption of this crate. However, I think the results of this experiment are significant enough to be worth it, and status quo exists to be questioned.
Don't hesitate to take a look at the README/documentation/code, I would be pleased to read your feedback.