We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 8afef1b + bc684b8 commit 5467861Copy full SHA for 5467861
src/headers/header_value.rs
@@ -18,11 +18,11 @@ impl HeaderValue {
18
/// # Error
19
///
20
/// This function will error if the bytes is not valid ASCII.
21
- pub fn from_bytes(bytes: &[u8]) -> Result<Self, Error> {
+ pub fn from_bytes(bytes: Vec<u8>) -> Result<Self, Error> {
22
crate::ensure!(bytes.is_ascii(), "Bytes should be valid ASCII");
23
24
// This is permitted because ASCII is valid UTF-8, and we just checked that.
25
- let string = unsafe { String::from_utf8_unchecked(bytes.to_vec()) };
+ let string = unsafe { String::from_utf8_unchecked(bytes) };
26
Ok(Self { inner: string })
27
}
28
0 commit comments