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

An error occurred while parsing some data

Variants (Non-exhaustive)

This enum is marked as 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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

The lower-level source of this error, if any. Read more

🔬 This is a nightly-only experimental API. (backtrace)

Returns a stack backtrace, if available, of where this error occurred. Read more

👎 Deprecated since 1.42.0:

use the Display impl or to_string()

👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Converts to this type from the input type.

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

This method tests for !=.

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

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.