Struct fire_http_api::response::ResponseHeaders
source · pub struct ResponseHeaders(/* private fields */);Methods from Deref<Target = HeaderValues>§
sourcepub fn insert<K, V>(&mut self, key: K, val: V) -> Option<HeaderValue>
pub fn insert<K, V>(&mut self, key: K, val: V) -> Option<HeaderValue>
Insert a new key and value into the header.
If a value to this key is already present that value is dropped.
§Panics
If the value is not a valid HeaderValue.
sourcepub fn try_insert<K, V>(
&mut self,
key: K,
val: V
) -> Result<Option<HeaderValue>, InvalidHeaderValue>
pub fn try_insert<K, V>( &mut self, key: K, val: V ) -> Result<Option<HeaderValue>, InvalidHeaderValue>
Insert a new key and value into the header. Returning None if the value is not valid.
If a value to this key is already present that value is dropped.
sourcepub fn encode_value<K, V>(&mut self, key: K, val: V) -> Option<HeaderValue>where
K: IntoHeaderName,
V: IntoEncodedHeaderValue,
pub fn encode_value<K, V>(&mut self, key: K, val: V) -> Option<HeaderValue>where
K: IntoHeaderName,
V: IntoEncodedHeaderValue,
Insert a new key and value into the header. Percent encoding the value if necessary.
sourcepub fn serialize_value<K, V>(
&mut self,
key: K,
val: &V
) -> Result<Option<HeaderValue>, Error>
pub fn serialize_value<K, V>( &mut self, key: K, val: &V ) -> Result<Option<HeaderValue>, Error>
Insert a new key and a serializeable value. The value will be serialized as json and percent encoded.
Returns None if the value could not be serialized or inserted.
sourcepub fn get<K>(&self, key: K) -> Option<&HeaderValue>where
K: AsHeaderName,
pub fn get<K>(&self, key: K) -> Option<&HeaderValue>where
K: AsHeaderName,
Returns the value if it exists.
sourcepub fn get_mut<K>(&mut self, key: K) -> Option<&mut HeaderValue>where
K: AsHeaderName,
pub fn get_mut<K>(&mut self, key: K) -> Option<&mut HeaderValue>where
K: AsHeaderName,
Returns the value mutably if it exists.
sourcepub fn get_str<K>(&self, key: K) -> Option<&str>where
K: AsHeaderName,
pub fn get_str<K>(&self, key: K) -> Option<&str>where
K: AsHeaderName,
Returns the value as a string if it exists and is valid.
sourcepub fn decode_value<K>(&self, key: K) -> Option<Cow<'_, str>>where
K: AsHeaderName,
pub fn decode_value<K>(&self, key: K) -> Option<Cow<'_, str>>where
K: AsHeaderName,
Returns the value percent decoded as a string if it exists and is valid.
sourcepub fn deserialize_value<K, D>(&self, key: K) -> Option<D>where
K: AsHeaderName,
D: DeserializeOwned,
pub fn deserialize_value<K, D>(&self, key: K) -> Option<D>where
K: AsHeaderName,
D: DeserializeOwned,
Deserializes a given value. Returning None if the value
does not exist or is not valid json.
Trait Implementations§
source§impl Clone for ResponseHeaders
impl Clone for ResponseHeaders
source§fn clone(&self) -> ResponseHeaders
fn clone(&self) -> ResponseHeaders
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more