x11rb_async/
lib.rs

1// This code is dual licensed under MIT OR Apache 2.0.
2
3//! Asynchronous X11 rust bindings.
4//!
5//! This library allows to interact with an X11 server from rust code. A connection to an X11
6//! server is represented by an implementation of the `Connection` trait.
7//!
8//! The client can interact with the server by sending requests. The server can answer requests and
9//! can also generate events.
10//!
11//! The examples that come with this library might be a good starting point for new users.
12//!
13//!
14//! # Feature flags
15//!
16//! This crate uses [feature
17//! flags](https://doc.rust-lang.org/cargo/reference/manifest.html#the-features-section) to reduce
18//! the amount of compiled code. There are two kinds of feature flags available:
19//!
20//! * Feature flags for specific X11 extensions
21//! * Feature flags for additional functionality
22//!
23//! ## Feature flags for specific X11 extensions
24//!
25//! By default, only the core X11 protocol and X11 extensions that are needed internally are
26//! enabled. These are the `bigreq`, `ge` and `xc_misc` extensions. Further extensions need to be
27//! explicitly enabled via their feature flag:
28//!
29//! `composite`, `damage`, `dpms`, `dri2`, `dri3`, `glx`, `present`, `randr`, `record`, `render`,
30//! `res`, `screensaver`, `shape`, `shm`, `sync`, `xevie`, `xf86dri`, `xf86vidmode`, `xfixes`,
31//! `xinerama`, `xinput`, `xkb`, `xprint`, `xselinux`, `xtest`, `xv`, `xvmc`.
32//!
33//! If you want to take the "I do not want to think about this"-approach, you can enable the
34//! `all-extensions` feature to just enable, well, all extensions.
35//!
36//! ## Feature flags for additional functionality
37//!
38//! Additionally, the following flags exist:
39//! * `allow-unsafe-code`: Enable the same feature in x11rb and implement
40//!   [`blocking::BlockingConnection`] for [`x11rb::xcb_ffi::XCBConnection`]
41//! * `extra-traits`: Implement extra traits for X11 types. This improves the output of the `Debug`
42//!   impl and adds `PartialEq`, `Eq`, `PartialOrd`, `Ord`, and `Hash` where possible.
43
44// A list of lints that are only #![deny] and not the stronger #![forbid]. Each one has a comment
45// explaining why it gets the weaker treatment.
46#![deny(
47    // Contains unreachable_code and "?" generates an #[allow] for this
48    unused,
49    // #[derive] generates an #[allow] for this; not part of "unused"
50    unused_qualifications,
51    // Not everything in x11rb::protocol has doc comments
52    missing_docs,
53)]
54#![forbid(
55    missing_copy_implementations,
56    missing_debug_implementations,
57    rustdoc::private_doc_tests,
58    rust_2018_idioms,
59    //single_use_lifetimes,
60    trivial_casts,
61    trivial_numeric_casts,
62    unreachable_pub,
63    unused_must_use,
64    unused_results,
65    clippy::cast_lossless,
66    clippy::needless_pass_by_value,
67)]
68#![cfg_attr(not(feature = "allow-unsafe-code"), forbid(unsafe_code))]
69
70// -- Public Modules --
71
72pub mod blocking;
73pub mod connection;
74#[allow(clippy::type_complexity, missing_docs)]
75#[rustfmt::skip]
76pub mod protocol;
77pub mod rust_connection;
78
79#[doc(inline)]
80pub use x11rb::{errors, x11_utils};
81
82#[doc(inline)]
83pub use x11rb_protocol::SequenceNumber;
84
85// -- Private Modules --
86
87mod cookie;
88
89pub use cookie::{Cookie, CookieWithFds, VoidCookie};
90
91pub mod utils {
92    //! Utility functions that are not specific to X11.
93    pub use x11rb::utils::RawFdContainer;
94}