1#![cfg_attr(docsrs, feature(doc_cfg))]
4
5pub mod global;
6pub mod object;
7pub mod protocol;
8
9mod connection;
10mod debug_message;
11
12pub use connection::{ConnectError, Connection};
13
14#[doc(hidden)]
15pub use wayrs_scanner as _private_scanner;
16
17pub use wayrs_core as core;
18pub use wayrs_core::{Fixed, IoMode};
19
20use std::fmt;
21
22#[macro_export]
24macro_rules! generate {
25 ($path:literal) => {
26 $crate::_private_scanner::generate!($crate, $path);
27 };
28}
29
30#[deprecated = "use c-string literals instead"]
33#[macro_export]
34macro_rules! cstr {
35 ($str:literal) => {{
36 const X: &'static ::std::ffi::CStr =
37 match ::std::ffi::CStr::from_bytes_with_nul(concat!($str, "\0").as_bytes()) {
38 Ok(str) => str,
39 Err(_) => panic!("string is not valind cstr"),
40 };
41 X
42 }};
43}
44
45#[non_exhaustive]
47pub struct EventCtx<'a, D, P: object::Proxy> {
48 pub conn: &'a mut Connection<D>,
49 pub state: &'a mut D,
50 pub proxy: P,
51 pub event: P::Event,
52}
53
54impl<D, P: object::Proxy> fmt::Debug for EventCtx<'_, D, P>
55where
56 P: fmt::Debug,
57 P::Event: fmt::Debug,
58{
59 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
60 f.debug_struct("EventCtx")
61 .field("proxy", &self.proxy)
62 .field("event", &self.event)
63 .finish_non_exhaustive()
64 }
65}
66
67#[doc(hidden)]
68pub mod interface {
69 pub use crate::core::{Interface, MessageDesc};
70}
71#[doc(hidden)]
72pub mod proxy {
73 pub use crate::object::{BadMessage, Proxy, WrongObject};
74}
75#[doc(hidden)]
76pub mod wire {
77 pub use crate::core::{ArgType, ArgValue, Fixed, Message, MessageHeader};
78}