pub enum ParseError {
Incomplete(usize),
Prefix,
Version(u8),
Command(u8),
AddressFamily(u8),
Protocol(u8),
Partial(usize, usize),
InvalidAddresses(usize, usize),
InvalidTLV(u8, u16),
Leftovers(usize),
}
Expand description
An error in parsing a binary PROXY protocol header.
Variants§
Incomplete(usize)
Expected header to the protocol prefix plus 4 bytes after the prefix.
Prefix
Expected header to start with a prefix of ‘\r\n\r\n\0\r\nQUIT\n’.
Version(u8)
Expected version to be equal to 2.
Command(u8)
Invalid command. Command must be one of: Local, Proxy.
AddressFamily(u8)
Invalid Address Family. Address Family must be one of: Unspecified, IPv4, IPv6, Unix.
Protocol(u8)
Invalid protocol. Protocol must be one of: Unspecified, Stream, or Datagram.
Partial(usize, usize)
Header does not contain the advertised length of the address information and TLVs.
InvalidAddresses(usize, usize)
Header length of {0} bytes cannot store the {1} bytes required for the address family.
InvalidTLV(u8, u16)
Header is not long enough to contain TLV {0} with length {1}.
Leftovers(usize)
Header contains leftover {0} bytes not accounted for by the address family or TLVs.
Trait Implementations§
Source§impl Clone for ParseError
impl Clone for ParseError
Source§fn clone(&self) -> ParseError
fn clone(&self) -> ParseError
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ParseError
impl Debug for ParseError
Source§impl Display for ParseError
impl Display for ParseError
Source§impl Error for ParseError
impl Error for ParseError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl Hash for ParseError
impl Hash for ParseError
Source§impl PartialEq for ParseError
impl PartialEq for ParseError
Source§impl PartialResult for ParseError
impl PartialResult for ParseError
Source§fn is_incomplete(&self) -> bool
fn is_incomplete(&self) -> bool
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.Source§fn is_complete(&self) -> bool
fn is_complete(&self) -> bool
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.impl Eq for ParseError
impl StructuralPartialEq for ParseError
Auto Trait Implementations§
impl Freeze for ParseError
impl RefUnwindSafe for ParseError
impl Send for ParseError
impl Sync for ParseError
impl Unpin for ParseError
impl UnwindSafe for ParseError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Error> ErrorExt for Error
impl<Error> ErrorExt for Error
Source§fn context<M>(self, context: M) -> OpaqueError
fn context<M>(self, context: M) -> OpaqueError
Wrap the error in a context. Read more
Source§fn with_context<C, F>(self, context: F) -> OpaqueError
fn with_context<C, F>(self, context: F) -> OpaqueError
Lazily wrap the error with a context. Read more
Source§fn into_opaque(self) -> OpaqueError
fn into_opaque(self) -> OpaqueError
Convert the error into an
OpaqueError
. Read more