Enum x11rb_protocol::errors::ParseError
source · [−]#[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
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:
- The protocol was violated and a nonsensical value was found.
- 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
sourceimpl Clone for ParseError
impl Clone for ParseError
sourcefn clone(&self) -> ParseError
fn clone(&self) -> ParseError
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for ParseError
impl Debug for ParseError
sourceimpl Display for ParseError
impl Display for ParseError
sourceimpl Error for ParseError
impl Error for ParseError
1.30.0 · sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
sourcefn backtrace(&self) -> Option<&Backtrace>
fn backtrace(&self) -> Option<&Backtrace>
backtrace
)Returns a stack backtrace, if available, of where this error occurred. Read more
1.0.0 · sourcefn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
sourceimpl From<ParseError> for ConnectError
impl From<ParseError> for ConnectError
sourcefn from(err: ParseError) -> Self
fn from(err: ParseError) -> Self
Converts to this type from the input type.
sourceimpl PartialEq<ParseError> for ParseError
impl PartialEq<ParseError> for ParseError
impl Copy for ParseError
impl Eq for ParseError
impl StructuralEq for ParseError
impl StructuralPartialEq for ParseError
Auto Trait Implementations
impl RefUnwindSafe for ParseError
impl Send for ParseError
impl Sync for ParseError
impl Unpin for ParseError
impl UnwindSafe for ParseError
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more