pub trait Connection: RequestConnection {
// Required methods
fn wait_for_raw_event_with_sequence(
&self,
) -> Result<RawEventAndSeqNumber<Self::Buf>, ConnectionError>;
fn poll_for_raw_event_with_sequence(
&self,
) -> Result<Option<RawEventAndSeqNumber<Self::Buf>>, ConnectionError>;
fn flush(&self) -> Result<(), ConnectionError>;
fn setup(&self) -> &Setup;
fn generate_id(&self) -> Result<u32, ReplyOrIdError>;
// Provided methods
fn wait_for_event(&self) -> Result<Event, ConnectionError> { ... }
fn wait_for_raw_event(&self) -> Result<Self::Buf, ConnectionError> { ... }
fn wait_for_event_with_sequence(
&self,
) -> Result<EventAndSeqNumber, ConnectionError> { ... }
fn poll_for_event(&self) -> Result<Option<Event>, ConnectionError> { ... }
fn poll_for_raw_event(&self) -> Result<Option<Self::Buf>, ConnectionError> { ... }
fn poll_for_event_with_sequence(
&self,
) -> Result<Option<EventAndSeqNumber>, ConnectionError> { ... }
}
Expand description
A connection to an X11 server.
Required Methods§
Sourcefn wait_for_raw_event_with_sequence(
&self,
) -> Result<RawEventAndSeqNumber<Self::Buf>, ConnectionError>
fn wait_for_raw_event_with_sequence( &self, ) -> Result<RawEventAndSeqNumber<Self::Buf>, ConnectionError>
Wait for a new raw/unparsed event from the X11 server.
Sourcefn poll_for_raw_event_with_sequence(
&self,
) -> Result<Option<RawEventAndSeqNumber<Self::Buf>>, ConnectionError>
fn poll_for_raw_event_with_sequence( &self, ) -> Result<Option<RawEventAndSeqNumber<Self::Buf>>, ConnectionError>
Poll for a new unparsed/raw event from the X11 server.
Sourcefn flush(&self) -> Result<(), ConnectionError>
fn flush(&self) -> Result<(), ConnectionError>
Send all pending requests to the server.
Implementations of this trait may buffer requests for batched sending. When this method is called, all pending requests are sent.
You do not have to call this method before wait_for_reply()
. If the request you want to
wait for was not yet sent, it will be sent by wait_for_reply()
.
Sourcefn setup(&self) -> &Setup
fn setup(&self) -> &Setup
Get the setup information sent by the X11 server.
The setup information contains X11 server, for example the window id of the root window.
Sourcefn generate_id(&self) -> Result<u32, ReplyOrIdError>
fn generate_id(&self) -> Result<u32, ReplyOrIdError>
Generate a new X11 identifier.
This method can, for example, be used for creating a new window. First, this method is
called to generate an identifier. Next, xproto::create_window
can be called to
actually create the window.
Provided Methods§
Sourcefn wait_for_event(&self) -> Result<Event, ConnectionError>
fn wait_for_event(&self) -> Result<Event, ConnectionError>
Wait for a new event from the X11 server.
Sourcefn wait_for_raw_event(&self) -> Result<Self::Buf, ConnectionError>
fn wait_for_raw_event(&self) -> Result<Self::Buf, ConnectionError>
Wait for a new raw/unparsed event from the X11 server.
Sourcefn wait_for_event_with_sequence(
&self,
) -> Result<EventAndSeqNumber, ConnectionError>
fn wait_for_event_with_sequence( &self, ) -> Result<EventAndSeqNumber, ConnectionError>
Wait for a new event from the X11 server.
Sourcefn poll_for_event(&self) -> Result<Option<Event>, ConnectionError>
fn poll_for_event(&self) -> Result<Option<Event>, ConnectionError>
Poll for a new event from the X11 server.
Sourcefn poll_for_raw_event(&self) -> Result<Option<Self::Buf>, ConnectionError>
fn poll_for_raw_event(&self) -> Result<Option<Self::Buf>, ConnectionError>
Poll for a new raw/unparsed event from the X11 server.
Sourcefn poll_for_event_with_sequence(
&self,
) -> Result<Option<EventAndSeqNumber>, ConnectionError>
fn poll_for_event_with_sequence( &self, ) -> Result<Option<EventAndSeqNumber>, ConnectionError>
Poll for a new event from the X11 server.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.