feat: Extend HeaderValue to provide access to/semantics of backing Bytes#817
Open
pyrrho wants to merge 1 commit intohyperium:masterfrom
Open
feat: Extend HeaderValue to provide access to/semantics of backing Bytes#817pyrrho wants to merge 1 commit intohyperium:masterfrom
pyrrho wants to merge 1 commit intohyperium:masterfrom
Conversation
497a758 to
cd6a422
Compare
This change adds (or makes public), - `HeaderValue::from_shared[_unchecked]` which directly accept a `Bytes` object as an argument. This should allow for lwss copying when constructing `HeaderValue`s from pre-existing `Bytes` buffers. - `HeaderValue::as_shared` which returns a clone of the `Bytes` object that backs the given `HeaderValue`. - `HeaderValue::into_shared` which is a self-consuming version of the above. - `HeaderValue::[try_]slice` which mirrors the `Bytes::slice` interface, and provides copy-free construction of sub-sliced `HeaderValue`s. - `HeaderName::into_shared` which is a rename of the previously `pub(crate)` `.into_bytes` method. Allows access to a `Bytes` representation of a HeaderName, though it will usually copy via `Bytes::from_static`. - `Uri::from_shared` which was previously `pub(crate)` and is now `pub` with an expanded doc comment.
cd6a422 to
2462244
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.