Struct x11rb::xcb_ffi::XCBConnection
source · pub struct XCBConnection { /* private fields */ }
Expand description
A connection to an X11 server.
This type wraps *mut xcb_connection_t
that is provided by libxcb. It provides a rust
interface to this C library.
Implementations§
source§impl XCBConnection
impl XCBConnection
sourcepub fn connect(
dpy_name: Option<&CStr>
) -> Result<(XCBConnection, usize), ConnectError>
pub fn connect( dpy_name: Option<&CStr> ) -> Result<(XCBConnection, usize), ConnectError>
Establish a new connection to an X11 server.
If a dpy_name
is provided, it describes the display that should be connected to, for
example 127.0.0.1:1
. If no value is provided, the $DISPLAY
environment variable is
used.
sourcepub unsafe fn from_raw_xcb_connection(
ptr: *mut c_void,
should_drop: bool
) -> Result<XCBConnection, ConnectError>
pub unsafe fn from_raw_xcb_connection( ptr: *mut c_void, should_drop: bool ) -> Result<XCBConnection, ConnectError>
Create a connection wrapper for a raw libxcb xcb_connection_t
.
xcb_disconnect
is called on drop only if should_drop
is true
.
If this function returns an Err()
and should_drop
was true, then
xcb_disconnect
was already called.
Safety
If should_drop
is false
, the connection must live longer than the returned
XCBConnection
. If should_drop
is true
, the returned XCBConnection
will
take the ownership of the connection.
sourcepub fn has_error(&self) -> Option<ConnectionError>
pub fn has_error(&self) -> Option<ConnectionError>
Check if the underlying XCB connection is in an error state.
sourcepub fn get_raw_xcb_connection(&self) -> *mut c_void
pub fn get_raw_xcb_connection(&self) -> *mut c_void
Get access to the raw libxcb xcb_connection_t
.
The returned pointer is valid for as long as the original object was not dropped. No ownerhsip is transferred.