Struct x11_clipboard::RustConnection
source · pub struct RustConnection<S = DefaultStream>where
S: Stream,{ /* 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 RustConnection<DefaultStream>
impl RustConnection<DefaultStream>
sourcepub fn connect(
dpy_name: Option<&str>
) -> Result<(RustConnection<DefaultStream>, usize), ConnectError>
pub fn connect( dpy_name: Option<&str> ) -> Result<(RustConnection<DefaultStream>, usize), ConnectError>
Establish a new connection.
If no dpy_name
is provided, the value from $DISPLAY
is used.
source§impl<S> RustConnection<S>where
S: Stream,
impl<S> RustConnection<S>where S: Stream,
sourcepub fn connect_to_stream(
stream: S,
screen: usize
) -> Result<RustConnection<S>, ConnectError>
pub fn connect_to_stream( stream: S, screen: usize ) -> Result<RustConnection<S>, 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, Global>,
auth_data: Vec<u8, Global>
) -> Result<RustConnection<S>, ConnectError>
pub fn connect_to_stream_with_auth_info( stream: S, screen: usize, auth_name: Vec<u8, Global>, auth_data: Vec<u8, Global> ) -> Result<RustConnection<S>, 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<RustConnection<S>, ConnectError>
pub fn for_connected_stream( stream: S, setup: Setup ) -> Result<RustConnection<S>, 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.