pub struct HeaderName(/* private fields */);
Expand description
A header name.
Implementations§
Source§impl HeaderName
impl HeaderName
Sourcepub fn from_bytes(bytes: Vec<u8>) -> Result<Self, Error>
pub fn from_bytes(bytes: Vec<u8>) -> Result<Self, Error>
Create a new HeaderName
from a Vec of ASCII bytes.
§Error
This function will error if the bytes is not valid ASCII.
Sourcepub fn from_string(s: String) -> Result<Self, Error>
pub fn from_string(s: String) -> Result<Self, Error>
Create a new HeaderName
from an ASCII string.
§Error
This function will error if the string is not valid ASCII.
Sourcepub unsafe fn from_bytes_unchecked(bytes: Vec<u8>) -> Self
pub unsafe fn from_bytes_unchecked(bytes: Vec<u8>) -> Self
Converts a vector of bytes to a HeaderName
without checking that the string contains
valid ASCII.
§Safety
This function is unsafe because it does not check that the bytes passed to it are valid ASCII. If this constraint is violated, it may cause memory unsafety issues with future users of the HeaderName, as the rest of the library assumes that Strings are valid ASCII.
Trait Implementations§
Source§impl Clone for HeaderName
impl Clone for HeaderName
Source§fn clone(&self) -> HeaderName
fn clone(&self) -> HeaderName
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for HeaderName
impl Debug for HeaderName
Source§impl Display for HeaderName
impl Display for HeaderName
Source§impl From<&HeaderName> for HeaderName
impl From<&HeaderName> for HeaderName
Source§fn from(value: &HeaderName) -> HeaderName
fn from(value: &HeaderName) -> HeaderName
Source§impl<'a> From<&'a str> for HeaderName
impl<'a> From<&'a str> for HeaderName
Source§impl FromStr for HeaderName
impl FromStr for HeaderName
Source§impl Hash for HeaderName
impl Hash for HeaderName
Source§impl Index<HeaderName> for Headers
impl Index<HeaderName> for Headers
Source§fn index(&self, name: HeaderName) -> &HeaderValues
fn index(&self, name: HeaderName) -> &HeaderValues
Returns a reference to the value corresponding to the supplied name.
§Panics
Panics if the name is not present in Headers
.
Source§type Output = HeaderValues
type Output = HeaderValues
Source§impl Index<HeaderName> for Request
impl Index<HeaderName> for Request
Source§fn index(&self, name: HeaderName) -> &HeaderValues
fn index(&self, name: HeaderName) -> &HeaderValues
Returns a reference to the value corresponding to the supplied name.
§Panics
Panics if the name is not present in Request
.
Source§type Output = HeaderValues
type Output = HeaderValues
Source§impl Index<HeaderName> for Response
impl Index<HeaderName> for Response
Source§fn index(&self, name: HeaderName) -> &HeaderValues
fn index(&self, name: HeaderName) -> &HeaderValues
Returns a reference to the value corresponding to the supplied name.
§Panics
Panics if the name is not present in Response
.
Source§type Output = HeaderValues
type Output = HeaderValues
Source§impl Index<HeaderName> for Trailers
impl Index<HeaderName> for Trailers
Source§fn index(&self, name: HeaderName) -> &HeaderValues
fn index(&self, name: HeaderName) -> &HeaderValues
Returns a reference to the value corresponding to the supplied name.
§Panics
Panics if the name is not present in Trailers
.