Enum x11rb::errors::ParseError[][src]

#[non_exhaustive]pub enum ParseError {
    InsufficientData,
    ConversionFailed,
    InvalidExpression,
    InvalidValue,
    MissingFileDescriptors,
}

An error occurred while parsing some data

Variants (Non-exhaustive)

Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
InsufficientData

Not enough data was provided.

ConversionFailed

A value did not fit.

This error can e.g. happen when a value that was received from the X11 server does not fit into an usize.

InvalidExpression

The value of an expression could not be computed.

As an example, the length of the data in xproto’s GetPropertyReply is described by value_len * (format / 8). The multiplication could cause an overflow, which would be represented by this error.

InvalidValue

A value was outside of its valid range.

There are two kinds of situations where this error can happen:

  1. The protocol was violated and a nonsensical value was found.
  2. The user of the API called the wrong parsing function.

Examples for the first kind of error:

  • One of a set of values should be present (a <switch> in xcb-proto-speak), but none of the <cases> matched. This can e.g. happen when parsing crate::protocol::xinput::InputInfo.
  • Parsing a request with a length field that is too small for the request header to fit.

Examples for the second kind of error:

  • Parsing an X11 error with response_type != 0.
  • Parsing an X11 reply with response_type != 1.
  • Parsing an X11 request with the wrong value for its minor_opcode.
MissingFileDescriptors

Some file descriptors were expected, but not enough were received.

Trait Implementations

impl Clone for ParseError[src]

impl Copy for ParseError[src]

impl Debug for ParseError[src]

impl Display for ParseError[src]

impl Eq for ParseError[src]

impl Error for ParseError[src]

impl From<ParseError> for ConnectError[src]

impl From<ParseError> for ConnectionError[src]

impl From<ParseError> for ReplyError[src]

impl From<ParseError> for ReplyOrIdError[src]

impl PartialEq<ParseError> for ParseError[src]

impl StructuralEq for ParseError[src]

impl StructuralPartialEq for ParseError[src]

Auto Trait Implementations

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> ToString for T where
    T: Display + ?Sized
[src]

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.