-
Notifications
You must be signed in to change notification settings - Fork 296
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? |
4 years latter with 2024 edition coming soon seems like a good time to release a breaking version that includes all of those nice to have features (separate core crate, alloc, fixes for thumb arm...) |
We have no plans to ever make a breaking change of the bytes crate. |
So the plan is just to pile up issues until eventually someone decides to fork the repo? It doesn't seem like a great roadmap for the crate nor gives tokio a good look. Specially when other projects, like axum, are constantly bringing in breaking changes. Its beyond my comprehension why would tokio keep such basic functionality missing. Specially when the breaking changes should affect only a small userbase. |
bytes 2.0 means tokio 2.0, this affects large userbase. Also, some of the things you mentioned require breaking changes and some do not, and you seem to be confusing the two. |
As far as i know,
This issue, for example. |
A breaking change that does not affect tokio is also a breaking change. And if we do that, we need to increase the major version of bytes. For example, if this issue were done as a non-breaking change, it would break the prost user's code since prost disables default features of bytes and generates code that uses Bytes. |
Tokio uses the bytes crate in the public API in several different places related to the
The plan is to evolve the bytes crate in a non-breaking way. That is not different from the Tokio crate. Some features will be out of scope for Tokio, and some will be out of scope for the bytes crate. That's just how it is. As for this particular issue, we will discuss options in the Tokio Discord. There are possibilities, but none of them are great. We may decide to close this issue as out of scope. |
Then it looks like putting the traits in a separate crate is the only solution. |
As I said in the Tokio Discord, (IIUC) separate crate approach is not possible without a breaking change.
|
Oh! That's true. But now I'm thinking, if it's just about features shouldn't semver trick work just fine? Release |
|
The |
As per discussion on #tokio-internals, we have decided to go ahead with a v2 release of bytes using the semver hack. The accepted changes for this issue involve:
To allow Tokio to upgrade from bytes v1 in a non-breaking manner, there will be a v1 release of bytes that depends on bytes v2 with the Let me know if I have missed anything. Please see #758 for more information or to suggest additional breaking changes. |
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: