Struct asserhttp::headers::HeaderName
source · [−]pub struct HeaderName(_);
Expand description
A header name.
Implementations
sourceimpl HeaderName
impl HeaderName
sourcepub fn from_bytes(bytes: Vec<u8, Global>) -> Result<HeaderName, Error>
pub fn from_bytes(bytes: Vec<u8, Global>) -> Result<HeaderName, 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<HeaderName, Error>
pub fn from_string(s: String) -> Result<HeaderName, 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, Global>) -> HeaderName
pub unsafe fn from_bytes_unchecked(bytes: Vec<u8, Global>) -> HeaderName
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
sourceimpl Clone for HeaderName
impl Clone for HeaderName
sourcefn clone(&self) -> HeaderName
fn clone(&self) -> HeaderName
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for HeaderName
impl Debug for HeaderName
sourceimpl Display for HeaderName
impl Display for HeaderName
sourceimpl<'_> From<&'_ HeaderName> for HeaderName
impl<'_> From<&'_ HeaderName> for HeaderName
sourcefn from(value: &HeaderName) -> HeaderName
fn from(value: &HeaderName) -> HeaderName
Converts to this type from the input type.
sourceimpl<'a> From<&'a str> for HeaderName
impl<'a> From<&'a str> for HeaderName
sourcefn from(value: &'a str) -> HeaderName
fn from(value: &'a str) -> HeaderName
Converts to this type from the input type.
sourceimpl FromStr for HeaderName
impl FromStr for HeaderName
sourcefn from_str(s: &str) -> Result<HeaderName, <HeaderName as FromStr>::Err>
fn from_str(s: &str) -> Result<HeaderName, <HeaderName as FromStr>::Err>
Create a new HeaderName
.
This checks it’s valid ASCII, and lowercases it.
sourceimpl Hash for HeaderName
impl Hash for HeaderName
sourceimpl Index<HeaderName> for Headers
impl Index<HeaderName> for Headers
sourcefn 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
.
type Output = HeaderValues
type Output = HeaderValues
The returned type after indexing.
sourceimpl<'a, '_> PartialEq<&'_ String> for HeaderName
impl<'a, '_> PartialEq<&'_ String> for HeaderName
sourceimpl<'a> PartialEq<&'a str> for HeaderName
impl<'a> PartialEq<&'a str> for HeaderName
sourceimpl PartialEq<HeaderName> for HeaderName
impl PartialEq<HeaderName> for HeaderName
sourcefn eq(&self, other: &HeaderName) -> bool
fn eq(&self, other: &HeaderName) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &HeaderName) -> bool
fn ne(&self, other: &HeaderName) -> bool
This method tests for !=
.
sourceimpl PartialEq<String> for HeaderName
impl PartialEq<String> for HeaderName
sourceimpl PartialEq<str> for HeaderName
impl PartialEq<str> for HeaderName
impl Eq for HeaderName
impl StructuralEq for HeaderName
impl StructuralPartialEq for HeaderName
Auto Trait Implementations
impl RefUnwindSafe for HeaderName
impl Send for HeaderName
impl Sync for HeaderName
impl Unpin for HeaderName
impl UnwindSafe for HeaderName
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more