[−][src]Struct viaduct::headers::Header
A single header. Headers have a name (case insensitive) and a value. The character set for header and values are both restrictive.
-
Names must only contain a-zA-Z0-9 and and ('!' | '#' | '$' | '%' | '&' | ''' | '*' | '+' | '-' | '.' | '^' | '_' | '`' | '|' | '~') characters (the field-name token production defined at https://tools.ietf.org/html/rfc7230#section-3.2). For request headers, we expect these to all be specified statically, and so we panic if you provide an invalid one. (For response headers, we ignore headers with invalid names, but emit a warning).
Header names are case insensitive, and we have several pre-defined ones in the [
header_names
] module. -
Values may only contain printable ascii characters, and may not contain \r or \n. Strictly speaking, HTTP is more flexible for header values, however we don't need to support binary header values, and so we do not.
Note that typically you should not interact with this directly, and instead
use the methods on [Request
] or [Headers
] to manipulate these.
Fields
name: HeaderName
value: String
Implementations
impl Header
[src]
pub fn new<Name, Value>(name: Name, value: Value) -> Result<Self, Error> where
Name: Into<HeaderName>,
Value: AsRef<str> + Into<String>,
[src]
Name: Into<HeaderName>,
Value: AsRef<str> + Into<String>,
pub fn new_unchecked<Value>(name: HeaderName, value: Value) -> Self where
Value: AsRef<str> + Into<String>,
[src]
Value: AsRef<str> + Into<String>,
pub fn name(&self) -> &HeaderName
[src]
pub fn value(&self) -> &str
[src]
fn set_value<V: AsRef<str>>(&mut self, s: V) -> Result<(), Error>
[src]
Trait Implementations
impl Clone for Header
[src]
impl Debug for Header
[src]
impl Display for Header
[src]
impl Eq for Header
[src]
impl FromIterator<Header> for Headers
[src]
fn from_iter<T>(iter: T) -> Self where
T: IntoIterator<Item = Header>,
[src]
T: IntoIterator<Item = Header>,
impl Hash for Header
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for Header
[src]
fn cmp(&self, other: &Header) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<Header> for Header
[src]
impl PartialOrd<Header> for Header
[src]
fn partial_cmp(&self, other: &Header) -> Option<Ordering>
[src]
fn lt(&self, other: &Header) -> bool
[src]
fn le(&self, other: &Header) -> bool
[src]
fn gt(&self, other: &Header) -> bool
[src]
fn ge(&self, other: &Header) -> bool
[src]
impl StructuralEq for Header
[src]
impl StructuralPartialEq for Header
[src]
Auto Trait Implementations
impl RefUnwindSafe for Header
impl Send for Header
impl Sync for Header
impl Unpin for Header
impl UnwindSafe for Header
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,