[−][src]Struct http_header::Header
A generic HTTP/1.* header implementation
Can be converted into a RequestHeader
/ResponseHeader
using the TryFrom
/TryInto
-traits
Fields
status_line: (Data<Ascii>, Data<Ascii>, Data<Ascii>)
The header status line
fields: HashMap<Data<HeaderFieldKey>, Data<Ascii>>
The header fields
Methods
impl Header
[src]
pub fn scan(data: &[u8]) -> Option<(&[u8], &[u8])>
[src]
Checks if data
starts with a header-like structure and returns either
Some((header, body))
or None
if no header-like structure was found
pub fn read(source: impl Read, buf: &mut [u8]) -> Result<Option<usize>, Error>
[src]
Reads from source
into buf
until a HTTP-header-end is matched or buf
is filled
completely
Returns either Some(header_len)
if the header end has been matched or None
if buf
has
been filled completely without a match.
pub fn parse(bytes: &[u8]) -> Result<Self, HttpError>
[src]
Parses a HTTP request header from bytes
pub fn write(&self, sink: impl WriteExt) -> Result<usize, Error>
[src]
Serializes and writes the header to sink
and returns the amount of bytes written
pub fn to_vec(&self) -> Vec<u8>
[src]
Serializes the header into a vector
Trait Implementations
impl AsRef<Header> for RequestHeader
[src]
impl AsRef<Header> for ResponseHeader
[src]
impl Clone for Header
[src]
impl From<RequestHeader> for Header
[src]
fn from(s: RequestHeader) -> Self
[src]
impl From<ResponseHeader> for Header
[src]
fn from(s: ResponseHeader) -> Self
[src]
impl Debug for Header
[src]
impl TryFrom<Header> for RequestHeader
[src]
type Error = HttpError
The type returned in the event of a conversion error.
fn try_from(header: Header) -> Result<Self, Self::Error>
[src]
Tries to create a RequestHeader
from a Header
impl TryFrom<Header> for ResponseHeader
[src]
Auto Trait Implementations
impl Sync for Header
impl Send for Header
impl Unpin for Header
impl UnwindSafe for Header
impl RefUnwindSafe for Header
Blanket Implementations
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> From<T> for T
[src]
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,