1 | //! X11 rust bindings. |
2 | //! |
3 | //! This crate provides a representation of the X11 protocol in Rust. With this protocol, raw X11 |
4 | //! bytes can be parsed into a structured representation or raw bytes can be produces. |
5 | //! |
6 | //! This protocol does not do any I/O. If you need an X11 client library, look at |
7 | //! <https://docs.rs/x11rb/latest/x11rb/>. |
8 | |
9 | #![forbid ( |
10 | missing_copy_implementations, |
11 | missing_debug_implementations, |
12 | rustdoc::private_doc_tests, |
13 | //single_use_lifetimes, |
14 | trivial_casts, |
15 | trivial_numeric_casts, |
16 | unreachable_pub, |
17 | unsafe_code, |
18 | unused_import_braces, |
19 | unused_results, |
20 | clippy::cast_lossless, |
21 | clippy::needless_pass_by_value, |
22 | )] |
23 | // A list of lints that are only #![deny] and not the stronger #![forbid]. Each one has a comment |
24 | // explaining why it gets the weaker treatment. |
25 | #![deny ( |
26 | // #[derive] generates an #[allow] for this |
27 | unused_qualifications, |
28 | // serde's Deserialize/Serialize impls add allows for this |
29 | rust_2018_idioms, |
30 | // Not everything in x11rb_protocol::protocol has doc comments |
31 | missing_docs, |
32 | )] |
33 | #![no_std ] |
34 | |
35 | // std crate imports |
36 | extern crate alloc; |
37 | #[cfg (feature = "std" )] |
38 | extern crate std; |
39 | |
40 | use alloc::borrow::Cow; |
41 | use alloc::vec::Vec; |
42 | |
43 | pub mod connect; |
44 | pub mod connection; |
45 | #[macro_use ] |
46 | pub mod x11_utils; |
47 | pub mod errors; |
48 | pub mod id_allocator; |
49 | pub mod packet_reader; |
50 | pub mod parse_display; |
51 | #[rustfmt::skip] |
52 | #[allow (missing_docs)] |
53 | pub mod protocol; |
54 | #[cfg (feature = "resource_manager" )] |
55 | pub mod resource_manager; |
56 | #[cfg (test)] |
57 | mod test; |
58 | mod utils; |
59 | pub mod wrapper; |
60 | #[cfg (feature = "std" )] |
61 | pub mod xauth; |
62 | |
63 | pub use utils::RawFdContainer; |
64 | |
65 | // Used to avoid too-complex types. |
66 | /// A combination of a buffer and a list of file descriptors. |
67 | pub type BufWithFds<B> = (B, Vec<RawFdContainer>); |
68 | /// A buffer that is logically continuous, but presented in a number of pieces. |
69 | pub type PiecewiseBuf<'a> = Vec<Cow<'a, [u8]>>; |
70 | |
71 | /// Number type used for referring to things that were sent to the server in responses from the |
72 | /// server. |
73 | /// |
74 | /// Each request sent to the X11 server is implicitly assigned a monotonically increasing sequence |
75 | /// number. Replies, events, and errors contain the sequence number of the last request that the |
76 | /// server received. This allows to map replies to their requests and to figure out which request |
77 | /// caused an error. |
78 | pub type SequenceNumber = u64; |
79 | |
80 | /// The raw bytes of an event and its sequence number. |
81 | pub type RawEventAndSeqNumber<B> = (B, SequenceNumber); |
82 | |
83 | /// Variants describing which responses to a request should be discarded. |
84 | #[derive (Debug, Copy, Clone, PartialEq, Eq)] |
85 | pub enum DiscardMode { |
86 | /// Only discard the actual reply. Errors go to the main loop. |
87 | DiscardReply, |
88 | /// Ignore any kind of response that this request generates. |
89 | DiscardReplyAndError, |
90 | } |
91 | |