-
Notifications
You must be signed in to change notification settings - Fork 315
feat: make alloc optional #606
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
base: master
Are you sure you want to change the base?
Conversation
|
Sorry, but this is a breaking change. Code that previously compiled with no features enabled would break. Unfortunately, we also cannot add a |
|
Oh, I see. Would it be possible to maybe create a different crate (say we name it |
|
See #479 for previous discussions. |
|
Can we finally get that in? Every year I'm starting a new project that would benefit from using From #479 (comment)
I would assume that more than 3 years after v1 release we can allow a major update that would allow more people to finally use this lib. |
|
The only possible way that this is happening is that we accept the minor breakage. We will not make a bytes v2. |
|
So what's your opinion on that, in regard to #480 (comment) ? |
|
I do not really know how many libraries out there specify |
|
Sorry, I failed to respond to this. We already have std as a default feature, so it's extremely likely that there are users of |
Currently the
no_stdsupport for the crate still depends onalloc. However, this is only required forBytesandBytesMutdata structures and notBufandBufMuttraits or its other impls. This PR makesallocoptional in order to make the crate more suitable for embedded environments.The main benefit of this change is beeing able to depend only on the
BufandBufMuttraits, which is very usefull not only to embedded environments, but also for other crates that would like to use those traits but don't needBytesandBytesMut. I think this would be a good thing, since it encorages everyone to usebytesand reduce the number of parallel implementations of this same concept.As an example usecase,
rust-mavlinkhad to pretty much reimplementBufandBufMutbecause they don't want a hard dependency onalloc.This PR adds a
allocdefault feature that can be disabled if not required. However, maybe it would be better to add aembeddedorno_allocfeature instead, so that it doesn't break any code that depends onbytes. Please let me know what you think of this change.