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§

source

fn wait_for_raw_event_with_sequence( &self ) -> Result<RawEventAndSeqNumber<Self::Buf>, ConnectionError>

Wait for a new raw/unparsed event from the X11 server.

source

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.

source

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

source

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.

source

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§

source

fn wait_for_event(&self) -> Result<Event, ConnectionError>

Wait for a new event from the X11 server.

source

fn wait_for_raw_event(&self) -> Result<Self::Buf, ConnectionError>

Wait for a new raw/unparsed event from the X11 server.

source

fn wait_for_event_with_sequence( &self ) -> Result<EventAndSeqNumber, ConnectionError>

Wait for a new event from the X11 server.

source

fn poll_for_event(&self) -> Result<Option<Event>, ConnectionError>

Poll for a new event from the X11 server.

source

fn poll_for_raw_event(&self) -> Result<Option<Self::Buf>, ConnectionError>

Poll for a new raw/unparsed event from the X11 server.

source

fn poll_for_event_with_sequence( &self ) -> Result<Option<EventAndSeqNumber>, ConnectionError>

Poll for a new event from the X11 server.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<C: Connection + ToOwned + ?Sized> Connection for Cow<'_, C>

source§

impl<C: Connection + ?Sized> Connection for &C

source§

impl<C: Connection + ?Sized> Connection for &mut C

source§

impl<C: Connection + ?Sized> Connection for Box<C>

source§

impl<C: Connection + ?Sized> Connection for Rc<C>

source§

impl<C: Connection + ?Sized> Connection for Arc<C>

Implementors§