Struct spin_sdk::http::HeaderValue
source · pub struct HeaderValue { /* private fields */ }
Expand description
A header value.
Since header values do not have to be valid utf8, this allows for both utf8 strings and bags of bytes.
Implementations§
source§impl HeaderValue
impl HeaderValue
sourcepub fn string(str: String) -> HeaderValue
pub fn string(str: String) -> HeaderValue
Construct a HeaderValue
from a string
sourcepub fn bytes(bytes: Vec<u8>) -> HeaderValue
pub fn bytes(bytes: Vec<u8>) -> HeaderValue
Construct a HeaderValue
from a bag of bytes
sourcepub fn as_str(&self) -> Option<&str>
pub fn as_str(&self) -> Option<&str>
Get the HeaderValue
as a utf8 encoded string
Returns None
if the value is a non utf8 encoded header value
sourcepub fn into_utf8_lossy(self) -> String
pub fn into_utf8_lossy(self) -> String
Turn the HeaderValue
into a String (in a lossy way if the HeaderValue
is a bag of bytes)
sourcepub fn into_bytes(self) -> Vec<u8> ⓘ
pub fn into_bytes(self) -> Vec<u8> ⓘ
Turn the HeaderValue
into bytes
Trait Implementations§
source§impl AsRef<[u8]> for HeaderValue
impl AsRef<[u8]> for HeaderValue
source§impl Clone for HeaderValue
impl Clone for HeaderValue
source§fn clone(&self) -> HeaderValue
fn clone(&self) -> HeaderValue
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for HeaderValue
impl Debug for HeaderValue
source§impl PartialEq for HeaderValue
impl PartialEq for HeaderValue
source§fn eq(&self, other: &HeaderValue) -> bool
fn eq(&self, other: &HeaderValue) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Eq for HeaderValue
impl StructuralPartialEq for HeaderValue
Auto Trait Implementations§
impl RefUnwindSafe for HeaderValue
impl Send for HeaderValue
impl Sync for HeaderValue
impl Unpin for HeaderValue
impl UnwindSafe for HeaderValue
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more