[][src]Struct httpbis::Headers

pub struct Headers { /* fields omitted */ }

HTTP message headers (or trailers)

Implementations

impl Headers[src]

pub fn new() -> Headers[src]

Construct empty headers

pub fn from_vec(headers: Vec<Header>) -> Headers[src]

Construct headers from a vec of individual headers

pub fn iter(&self) -> impl Iterator<Item = &Header>[src]

Return an iterator over headers.

Pseudo headers returned first.

pub fn dump(&self) -> String[src]

Dump all headers as multiline string.

pub fn new_get(path: impl Into<HeaderValue>) -> Headers[src]

Construct a Headers object with specified :method and :path headers

pub fn new_post(path: impl Into<HeaderValue>) -> Headers[src]

Construct a Headers object with specified :method and :path headers

pub fn new_status(code: u32) -> Headers[src]

Construct a Headers object with single :status header

pub fn ok_200() -> Headers[src]

Construct :status 200 headers

pub fn not_found_404() -> Headers[src]

Construct :status 404 headers

pub fn internal_error_500() -> Headers[src]

Construct :status 500 headers

pub fn redirect_302(location: impl Into<HeaderValue>) -> Headers[src]

Construct :status 302; location: <location> headers

pub fn get_opt<'a>(&'a self, name: &str) -> Option<&'a str>[src]

Lookup header.

pub fn get<'a>(&'a self, name: &str) -> &'a str[src]

Lookup header.

Panics

If header is not found.

pub fn get_opt_parse<I: FromStr>(&self, name: &str) -> Option<I>[src]

Lookup header.

pub fn status(&self) -> u32[src]

Status header value.

pub fn path(&self) -> &str[src]

Path header.

pub fn method(&self) -> &str[src]

Method header.

pub fn content_length(&self) -> Option<u64>[src]

Content-length header.

pub fn add(
    &mut self,
    name: impl Into<HeaderName>,
    value: impl Into<HeaderValue>
)
[src]

Add a header

pub fn add_header(&mut self, header: Header)[src]

Add a header

pub fn extend(&mut self, headers: Headers)[src]

Add all headers

Trait Implementations

impl Clone for Headers[src]

impl Debug for Headers[src]

impl Default for Headers[src]

impl Eq for Headers[src]

impl FromIterator<Header> for Headers[src]

impl PartialEq<Headers> for Headers[src]

impl StructuralEq for Headers[src]

impl StructuralPartialEq for Headers[src]

Auto Trait Implementations

impl RefUnwindSafe for Headers

impl Send for Headers

impl Sync for Headers

impl Unpin for Headers

impl UnwindSafe for Headers

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.