-
Notifications
You must be signed in to change notification settings - Fork 210
Add some conversion options for alloc vecs #541
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
Conversation
On embedded platforms people may want to handle allocation errors locally, such as using try_with_capacity (sadly not stable at the moment). I'm hesitant to implement an infallible implementation because in #381 I found that implementing infallible conversions prevents fallible ones from being implemented later. |
Would you be willing to remove the conversion from I'm happy to merge from |
I realized a fallible
|
This allows to catch OOM errors.
This PR introudces a new feature
alloc
which will makeheapless
depend on thealloc
crate and adds two trait implementations onheapless::Vec
andalloc::vec::Vec
to allow conversion between them.Conversion from
heapless::Vec
toalloc::vec::Vec
is fallible (due to OOM errors) and implemented viaTryFrom
.Conversion from
alloc::vec::Vec
toheapless::Vec
is fallible (due to capacity limit) and implemented viaTryFrom
.