feat: Extend HeaderValue to provide access to/semantics of backing Bytes #817
+230
−15
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change adds (or makes public),
HeaderValue::from_shared[_unchecked]which directly accept aBytesobject as an argument. This should allow for lwss copying when
constructing
HeaderValues from pre-existingBytesbuffers.HeaderValue::as_sharedwhich returns a clone of theBytesobjectthat backs the given
HeaderValue.HeaderValue::into_sharedwhich is a self-consuming version of theabove.
HeaderValue::[try_]slicewhich mirrors theBytes::sliceinterface,and provides copy-free construction of sub-sliced
HeaderValues.HeaderName::into_sharedwhich is a rename of the previouslypub(crate).into_bytesmethod. Allows access to aBytesrepresentation of a HeaderName, though it will usually copy via
Bytes::from_static.Uri::from_sharedwhich was previouslypub(crate)and is nowpubwith an expanded doc comment.