-
Notifications
You must be signed in to change notification settings - Fork 310
feat: create Bytes
from std::sync::Arc
#775
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
I'm not sold on this idea. You can do something pretty similar with the existing |
That would work but it's a lot of otherwise-unneeded allocations I'd prefer to avoid. |
Expanding a bit... I'm trying to use this to replace my use of If I did this via an owner + |
...via infallible (`Bytes::from_arc_projection`) and fallible (`Bytes::try_from_arc_projection`) constructors. tokio-rs#359 (comment) tokio-rs#437 (comment)
Fixed no-std. |
...or not quite, on
Hmm, would the best thing be to just gate this feature with something like |
I'm sorry, but I don't think we want to add this feature at this time. I recommend using
You can write your own custom struct that stores an |
Thanks, I hadn't considered layering an unsafe on top of a safe interface like that. It does work. The extra allocations and deallocations are about 2% of my program's user+system CPU time under load in CPU profiles. 2% might not sound like much, but I'd love to eliminate it if you'd ever be willing to reconsider either this approach or exposing the vtable in some fashion. If there's anything I can do to make either of those acceptable to you, I'm all ears. (I'm trying to mux |
Would an implementation for |
Please open a new issue for feature requests, instead of commenting on old closed issues. |
...via infallible (
Bytes::from_arc_projection
) and fallible (Bytes::try_from_arc_projection
) constructors.#359 (comment) #437 (comment)