-
Notifications
You must be signed in to change notification settings - Fork 287
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
Make alloc optional (embedded rust) #479
Comments
As said in #461 (comment), I don't think it's possible without breaking changes. See also crossbeam-rs/crossbeam#508 (comment). |
So now the question is a little bit political. Are authors interested to make bytes crate embedded devices friendly? Since this issue was know before first major release maybe "not make alloc optional" was considered decision? I think breaking changes are not a problem here, since you can just simply increment major release. |
The main problem is that we recently released v1 and don't want to release v2 right away.
I don't think there was such a decision. I knew about such an issue, but I wasn't noticed that bytes had a similar issue until #461 reported. To be clear: I'm basically in favor of doing this in the next major version. |
There is a way to achieve embedded compatibility (and I hope MSRV 1.36) without breaking |
Note that in this approach, it will break if the user runs |
@taiki-e isn't it the same problem as having two different versions of a crate? |
@Kixunil "the old version of bytes crate" meant the 1.x.y version that does not contain the changes you suggested. They are different traits in the 1.x.y version that does not contain the changes you suggested, but they are the same trait in the version that contains the changes. |
I don't think it's a problem though. Either you have two version of the I think you're describing this situation, please LMK if you mean something else
C no longer compiles In this case B is the one doing breaking change, not bytes.
|
Wouldn't it be possible to have As I see it, the only people that would be affected by that change would be the |
@nils-van-zuijlen Please read previous comments (#479 (comment) and #479 (comment)). |
@taiki-e I think I addressed that in my comment. Is there a specific scenario I'm missing? |
Proposition:
I wonder if is it possible to make
alloc
optional. As far as I have checked the source code the main problem for make alloc optional is with implementation ofBytes
andBytesMut
that require alloc to work. To support partially bytes for embedded devices where alloc is not an option theses structs need re-implementation and this is complicated subject. Things that can be introduced to embedded word areBuf
andBufMut
traits and this works nearly out of the box.Motivation:
Here is example where alloc crate is a problem:
alloc
viaBufMut
rust-iot/rust-ieee802.15.4#33Crate that could benefits from proposed changes:
The text was updated successfully, but these errors were encountered: