-
-
Notifications
You must be signed in to change notification settings - Fork 334
Closed
Labels
B-rfcBlocked: request for comments. More discussion would help move this along.Blocked: request for comments. More discussion would help move this along.
Milestone
Description
We'd like to disconnect the stability if the http
crate from the bytes
crate. However, using Bytes
inside http
s types facilitates improved performance by reducing copies (especially as headers and URIs can be quite long in the real world).
This proposes a way forward without sacrificing either case:
- Remove all public APIs that uses
Bytes
. This includesfrom_shared
,TryFrom
impls, andinto_bytes
methods. - Add
from_maybe_shared<T: AsRef<[u8]> + 'static>
constructors to types that would most benefit. These constructors could downcast the value into aBytes
if the versions match, and perform a copy if they don't. While a copy not caught at compile-time is unfortunate, the alternatives seem worse.
hawkw and schneiderfelipe
Metadata
Metadata
Assignees
Labels
B-rfcBlocked: request for comments. More discussion would help move this along.Blocked: request for comments. More discussion would help move this along.