pub type Headers<'a> = AvailableHeaders<&'a HeaderMap>;
Implementations
sourceimpl<'a> Headers<'a>
impl<'a> Headers<'a>
sourcepub fn unprotected(&self) -> Option<&'a HeaderMap>
pub fn unprotected(&self) -> Option<&'a HeaderMap>
Get the unprotected header, if it is available.
sourcepub fn get(&self, key: &str) -> Option<&'a JsonValue>
pub fn get(&self, key: &str) -> Option<&'a JsonValue>
Get a parameter from either the protected or unprotected header, depending on which are available and which has the parameter.
If a parameter is found in the protected header, the unprotected header is not consulted anymore.
sourcepub fn get_required(&self, key: &str) -> Result<&'a JsonValue>
pub fn get_required(&self, key: &str) -> Result<&'a JsonValue>
Get a required parameter from either header.
This is almost identical to get
, except that this function returns a properly formatter error instead of an empty optional.
sourcepub fn deserialize_required<T: Deserialize<'a> + 'a>(
&self,
key: &str
) -> Result<T>
pub fn deserialize_required<T: Deserialize<'a> + 'a>(
&self,
key: &str
) -> Result<T>
Get and deserialize a required parameter from either header.
This function delegates to get_required
and deserializes the result into the desired type.
Deserialization errors are reported as error::InvalidHeaderParam
errors.