Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently the
no_std
support for the crate still depends onalloc
. However, this is only required forBytes
andBytesMut
data structures and notBuf
andBufMut
traits or its other impls. This PR makesalloc
optional 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
Buf
andBufMut
traits, which is very usefull not only to embedded environments, but also for other crates that would like to use those traits but don't needBytes
andBytesMut
. I think this would be a good thing, since it encorages everyone to usebytes
and reduce the number of parallel implementations of this same concept.As an example usecase,
rust-mavlink
had to pretty much reimplementBuf
andBufMut
because they don't want a hard dependency onalloc
.This PR adds a
alloc
default feature that can be disabled if not required. However, maybe it would be better to add aembedded
orno_alloc
feature instead, so that it doesn't break any code that depends onbytes
. Please let me know what you think of this change.