Module breadx::connection
source · [−]Expand description
Implementation of the Connection
type, which is used as a byte
transport for the actual X11 protocol.
X11 communication can take place over “any reliable byte stream”
(source). Although this byte stream is most often a TCP connection
or a Unix domain socket, it can be anything else. The Connection
trait aims to define the interface for this byte stream.
Note that in the overwhelming majority of cases, NameConnection
will
fulfill all of your connection-related needs. All other connection types
exist to give the user as much freedom as possible in using the protocol.
Details
In X11, the requirements for a byte stream include:
- Being able to write bytes.
- Being able to read bytes.
- Being able to read bytes without blocking.
In addition, certain extensions requires the ability to pass file descriptors between the client and the server. This is not a requirement.
StdConnection
(enabled with thestd
feature) is a wrapper around any type that implementsRead
andWrite
. In addition, it also requiresAsRawFd
on Unix andAsRawSocket
on Windows, in order to take advantage of system APIs for non-blocking I/O.SendmsgConnection
(requires Unix) is a wrapper around a Unix domain socket that includes message passing functionality.BufConnection
is a wrapper around anything that implementsConnection
that buffers all data written to and read from it.
Structs
A wrapper around a Connection
that buffers all of the I/O.
A variant of the UnixStream
connection that uses sendmsg
to send data
and recvmsg
to receive it.
A newtype wrapper around a type that implements Connection
for
certain types in the standard library.
Traits
A “suitable byte stream” where communication with the X11 server can occur.