Enum ppp::HeaderResult[][src]

pub enum HeaderResult<'a> {
    V1(Result<Header<'a>, BinaryParseError>),
    V2(Result<Header<'a>, ParseError>),
}
Expand description

An enumeration of the supported header version’s parse results. Useful for parsing either version 1 or version 2 of the PROXY protocol.

Examples

use ppp::{HeaderResult, PartialResult, v1, v2};

let input = "PROXY UNKNOWN\r\n";
let header = HeaderResult::parse(input.as_bytes());

assert_eq!(header, Ok(v1::Header::new(input, v1::Addresses::Unknown)).into());

Variants

V1(Result<Header<'a>, BinaryParseError>)

Tuple Fields

V2(Result<Header<'a>, ParseError>)

Tuple Fields

Implementations

Parses a PROXY protocol version 2 Header. If the input is not a valid version 2 Header, attempts to parse a version 1 Header.

Trait Implementations

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Tests whether this Result is incomplete. An action that leads to an incomplete result may have a different result with more bytes. Retrying with the same input will not change the result. Read more

Tests whether this Result is successful or whether the error is terminal. A terminal error will not result in a success even with more bytes. Retrying with the same – or more – input will not change the result. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.