-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add fallible APIs for StringInterner
#70
Comments
Hi @royaltm , thank you for your feature request. Given that Rust's own Furthermore user with custom When implementing we should make sure to keep the Also we should simply name it |
StringInterner
Thanks @Robbepop for your swift response! I'm glad you agreed to my request. I'll then attempt to implement changes according to your directions and see how it goes. Expect to hear from me soon with some more questions. |
First I want to say that this is a pretty awesome project. It provides interning for strings only but that's exactly what I needed. Other interning crates are usually more generic, but this always comes with some strings attached (no pun intended).
My point being - this is the only decent interning crate that works for
no_std
that I was able to find.That said,
string-interner
API is designed with an assumption most modern projects make: the memory is the last thing to go. (so is the Rust std/alloc btw. but that's another story and it's currently changing)Unfortunately in embedded systems this is not the case, and RAM is usually one of the fastest-depleting resources.
You might think it's a bit insane trying to build a JIT MAL compiler for a little MCU board, but that's exactly what I'm doing 🤔.
My humble request is if you can add a fallible API calls to
StringInterner
so users can take some action on failure instead of just relying on a watchdog to restart the firmware on panic.The failure being either running out of symbols or RAM whichever comes first.
For example:
where
try_reserve
allows to change capacity ahead of time. This may also come with a complementarycapacity
method and areserve
method that panics.I'm aware that this might be a big ask, involving substantial internal changes, but I'm ready to contribute myself if you are willing to go forward with this.
At least please let me know your thoughts. Thanks!
The text was updated successfully, but these errors were encountered: