Trait edge::header::Header [] [src]

pub trait Header: Send + Sync + HeaderClone + Any + Typeable {
    fn header_name() -> &'static str;
    fn parse_header(raw: &[Vec<u8>]) -> Result<Self, Error>;
    fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>;
}

A trait for any object that will represent a header field and value.

This trait represents the construction and identification of headers, and contains trait-object unsafe methods.

Required Methods

fn header_name() -> &'static str

Returns the name of the header field this belongs to.

This will become an associated constant once available.

fn parse_header(raw: &[Vec<u8>]) -> Result<Self, Error>

Parse a header from a raw stream of bytes.

It's possible that a request can include a header field more than once, and in that case, the slice will have a length greater than 1. However, it's not necessarily the case that a Header is allowed to have more than one field value. If that's the case, you should return None if raw.len() > 1.

fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>

Format a header to be output into a TcpStream.

This method is not allowed to introduce an Err not produced by the passed-in Formatter.

Trait Implementations

impl<'a> Display for &'a Header + 'static + Send + Sync

fn fmt(&self, f: &mut Formatter) -> Result<(), Error>

Implementors