FixedStorage / StorageResizable
- Dominant language
- Rust
- Stars
- 10
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
Hi! Someone on reddit [mentioned your storages-api](https://www.reddit.com/r/rust/comments/viiw79/comment/idek6xv/?utm_source=share&utm_medium=web2x&context=3).
I made similar storage/mem interface for my [any_vec lib](https://docs.rs/any_vec/0.9.0/any_vec/index.html#membuilder). I called it MemBuilder. MemBuilder constructs Mem, Mem then can be used as your Storage.
The thing I wanted to point out, is that I found it useful to split Mem on Mem + MemResizable and MemBuilder on MemBuilder + MemBuilderResizable. That allowed my Vec implementation to opt-out size-change operations whenever provided Mem implementation does not support them. For example, `reserve_exact` have no meaning for Stack allocated memory (InlineStorage of yours), and [thanks to the type knowledge we can opt out it compile time](https://docs.rs/any_vec/0.9.0/src/any_vec/any_vec.rs.html#197-201), without making separate implementation for it. Same thing with [with_capacity](https://docs.rs/any_vec/0.9.0/any_vec/struct.AnyVec.html#method.with_capacity).
In your api you could move out `grow` and `shrink` into some `StorageResizable`. That would allow `storage-api` consumers to opt-out operations compile time in their container implementations. Or at least make marker trait for that.
Just wanted to share my "experience" from similar design....
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.