Trait noggin::FromHeaderValue
source · pub trait FromHeaderValue<'de>: Sized {
// Required method
fn parse_header_value(slice: &'de str) -> Option<Self>;
}
Expand description
The FromHeaderValue
trait provides a mechanism for parsing individual
HTTP header values from string slices.
Implementers of this trait can convert a raw string representation of an HTTP header value into a more strongly typed representation. This trait abstracts the parsing logic for specific header value types.
This trait is similar in spirit to the standard library’s FromStr
trait,
but specifically tailored for HTTP header values and capable of supporting
zero-copy parsing.
Required Methods§
sourcefn parse_header_value(slice: &'de str) -> Option<Self>
fn parse_header_value(slice: &'de str) -> Option<Self>
Parses an HTTP header value from the provided string slice.
Parameters
slice
: A string slice representing the raw value of an HTTP header.
Returns
Option<Self>
: Returns the parsed header value if parsing is successful, orNone
if parsing fails.
Object Safety§
This trait is not object safe.