pub struct Connection { /* private fields */ }
Expand description

A pure-rust, sans-I/O implementation of the X11 protocol.

This object is designed to be used in combination with an I/O backend, in order to keep state for the X11 protocol.

Implementations

Create a new Connection.

It is assumed that the connection was just established. This means that the next request that is sent will have sequence number one.

Send a request to the X11 server.

When this returns None, a sync with the server is necessary. Afterwards, the caller should try again.

Ignore the reply for a request that was previously sent.

Add FDs that were received to the internal state.

This must be called before the corresponding packets are enqueued.

An X11 packet was received from the connection and is now enqueued into our state.

Any FDs that were received must already be enqueued before this can be called.

Check if the server already sent an answer to the request with the given sequence number.

This function is meant to be used for requests that have a reply. Such requests always cause a reply or an error to be sent.

Prepare for calling poll_check_for_reply_or_error().

To check if a request with a reply caused an error, one simply has to wait for the error or reply to be received. However, this approach does not work for requests without errors: Success is indicated by the absence of an error.

Thus, this function returns true if a sync is necessary to ensure that a reply with a higher sequence number will be received. Since the X11 server handles requests in-order, if the reply to a later request is received, this means that the earlier request did not fail.

Check if the request with the given sequence number was already handled by the server.

Before calling this function, you must call prepare_check_for_reply_or_error() with the sequence number.

This function can be used for requests with and without a reply.

Find the reply for the request with the given sequence number.

If the request caused an error, that error will be handled as an event. This means that a latter call to poll_for_event() will return it.

Get a pending event.

Trait Implementations

Formats the value using the given formatter. 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

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 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.