Struct x11rb::rust_connection::RustConnection
source · pub struct RustConnection<S: Stream = DefaultStream> { /* private fields */ }
Expand description
A connection to an X11 server implemented in pure rust
This type is generic over S
, which allows to use a generic stream to communicate with the
server. This stream can written to and read from, but it can also be polled, meaning that one
checks if new data can be read or written.
RustConnection
always used an internal buffer for reading, so R
does not need
to be buffered.
Implementations§
source§impl<S: Stream> RustConnection<S>
impl<S: Stream> RustConnection<S>
sourcepub fn connect_to_stream(stream: S, screen: usize) -> Result<Self, ConnectError>
pub fn connect_to_stream(stream: S, screen: usize) -> Result<Self, ConnectError>
Establish a new connection to the given streams.
read
is used for reading data from the X11 server and write
is used for writing.
screen
is the number of the screen that should be used. This function checks that a
screen with that number exists.
sourcepub fn connect_to_stream_with_auth_info(
stream: S,
screen: usize,
auth_name: Vec<u8>,
auth_data: Vec<u8>
) -> Result<Self, ConnectError>
pub fn connect_to_stream_with_auth_info( stream: S, screen: usize, auth_name: Vec<u8>, auth_data: Vec<u8> ) -> Result<Self, ConnectError>
Establish a new connection to the given streams.
read
is used for reading data from the X11 server and write
is used for writing.
screen
is the number of the screen that should be used. This function checks that a
screen with that number exists.
The parameters auth_name
and auth_data
are used for the members
authorization_protocol_name
and authorization_protocol_data
of the SetupRequest
that
is sent to the X11 server.
sourcepub fn for_connected_stream(
stream: S,
setup: Setup
) -> Result<Self, ConnectError>
pub fn for_connected_stream( stream: S, setup: Setup ) -> Result<Self, ConnectError>
Establish a new connection for an already connected stream.
The given stream
is used for communicating with the X11 server.
It is assumed that setup
was just received from the server. Thus, the first reply to a
request that is sent will have sequence number one.