- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.3k
Description
- I have looked for existing issues (including closed) about this
Feature Request
Motivation
I'm working on a Fediverse server implementation, using axum as the web framework. Fediverse servers receive thousands of request every second, even for small instances, like the one I run, so performance is important. Because ActivityPub uses copious amounts of JSON, I figure it's best to use a high-performance JSON parser, like simd-json. However, simd-json's simd_json::from_slice takes a mutable byte slice rather than an immutable one, so I can't use Bytes for that.
This is just one particular usecase, but I'm confident there are other performance-critical scenarios where you'd want a BytesMut value instead of a Bytes value.
Proposal
In axum-core, add the impl, using the existing Bytes impl as a starting point.
Alternatives
For my usecase, I could theoretically turn the Bytes value into a Vec<u8> and then into a BytesMut, but that would likely involve expensive copy operations that would nullify the performance gains from using simd-json.