wl_client/test_protocols/core/
wl_dummy.rs1use {super::super::all_types::*, crate::builder::prelude::*};
2
3static INTERFACE: wl_interface = wl_interface {
4 name: c"wl_dummy".as_ptr(),
5 version: 1,
6 method_count: 3,
7 methods: {
8 static MESSAGES: [wl_message; 3] = [
9 wl_message {
10 name: c"destroy".as_ptr(),
11 signature: c"".as_ptr(),
12 types: {
13 static TYPES: [Option<&'static wl_interface>; 0] = [];
14 TYPES.as_ptr().cast()
15 },
16 },
17 wl_message {
18 name: c"recycle".as_ptr(),
19 signature: c"n".as_ptr(),
20 types: {
21 static TYPES: [Option<&'static wl_interface>; 1] =
22 [Some(WlDummy::WL_INTERFACE)];
23 TYPES.as_ptr().cast()
24 },
25 },
26 wl_message {
27 name: c"get_string".as_ptr(),
28 signature: c"n".as_ptr(),
29 types: {
30 static TYPES: [Option<&'static wl_interface>; 1] =
31 [Some(WlString::WL_INTERFACE)];
32 TYPES.as_ptr().cast()
33 },
34 },
35 ];
36 MESSAGES.as_ptr()
37 },
38 event_count: 0,
39 events: ptr::null(),
40};
41
42#[derive(Clone, Eq, PartialEq)]
46#[repr(transparent)]
47pub struct WlDummy {
48 proxy: UntypedOwnedProxy,
50}
51
52#[derive(Eq, PartialEq)]
56#[repr(transparent)]
57pub struct WlDummyRef {
58 proxy: UntypedBorrowedProxy,
60}
61
62unsafe impl UntypedOwnedProxyWrapper for WlDummy {}
64
65unsafe impl OwnedProxy for WlDummy {
68 const INTERFACE: &'static str = "wl_dummy";
69 const WL_INTERFACE: &'static wl_interface = &INTERFACE;
70 const NO_OP_EVENT_HANDLER: Self::NoOpEventHandler =
71 private::EventHandler(private::NoOpEventHandler);
72 const MAX_VERSION: u32 = 1;
73
74 type Borrowed = WlDummyRef;
75 type Api = private::ProxyApi;
76 type NoOpEventHandler = private::EventHandler<private::NoOpEventHandler>;
77}
78
79unsafe impl UntypedBorrowedProxyWrapper for WlDummyRef {}
81
82unsafe impl BorrowedProxy for WlDummyRef {
84 type Owned = WlDummy;
85}
86
87impl Deref for WlDummy {
88 type Target = WlDummyRef;
89
90 fn deref(&self) -> &Self::Target {
91 proxy::low_level::deref(self)
92 }
93}
94
95mod private {
96 pub struct ProxyApi;
97
98 #[allow(dead_code)]
99 pub struct EventHandler<H>(pub(super) H);
100
101 #[allow(dead_code)]
102 pub struct NoOpEventHandler;
103}
104
105impl Debug for WlDummy {
106 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
107 write!(f, "wl_dummy#{}", self.proxy.id())
108 }
109}
110
111impl Debug for WlDummyRef {
112 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
113 write!(f, "wl_dummy#{}", self.proxy.id())
114 }
115}
116
117impl PartialEq<WlDummyRef> for WlDummy {
118 fn eq(&self, other: &WlDummyRef) -> bool {
119 self.proxy == other.proxy
120 }
121}
122
123impl PartialEq<WlDummy> for WlDummyRef {
124 fn eq(&self, other: &WlDummy) -> bool {
125 self.proxy == other.proxy
126 }
127}
128
129#[allow(dead_code)]
130impl WlDummy {
131 #[allow(dead_code)]
133 pub const REQ__DESTROY__SINCE: u32 = 1;
134
135 #[inline]
136 pub fn destroy(&self) {
137 let mut args = [];
138 unsafe {
142 self.proxy.send_destructor(0, &mut args);
143 }
144 }
145
146 #[allow(dead_code)]
148 pub const REQ__RECYCLE__SINCE: u32 = 1;
149
150 #[inline]
151 pub fn recycle(&self) -> WlDummy {
152 let mut args = [wl_argument { n: 0 }];
153 let data = unsafe {
158 self.proxy
159 .send_constructor::<true>(1, &mut args, WlDummy::WL_INTERFACE, None)
160 };
161 unsafe { proxy::low_level::from_untyped_owned(data) }
163 }
164
165 #[allow(dead_code)]
167 pub const REQ__GET_STRING__SINCE: u32 = 1;
168
169 #[inline]
170 pub fn get_string(&self) -> WlString {
171 let mut args = [wl_argument { n: 0 }];
172 let data = unsafe {
177 self.proxy
178 .send_constructor::<false>(2, &mut args, WlString::WL_INTERFACE, None)
179 };
180 unsafe { proxy::low_level::from_untyped_owned(data) }
182 }
183}
184
185#[allow(dead_code)]
186impl WlDummyRef {
187 #[inline]
191 pub fn get_string(&self, _queue: &Queue) -> WlString {
192 let mut args = [wl_argument { n: 0 }];
193 let data = unsafe {
198 self.proxy
199 .send_constructor(_queue, 2, &mut args, WlString::WL_INTERFACE, None)
200 };
201 unsafe { proxy::low_level::from_untyped_owned(data) }
203 }
204}
205
206#[allow(dead_code)]
208pub trait WlDummyEventHandler {}
209
210impl WlDummyEventHandler for private::NoOpEventHandler {}
211
212unsafe impl<H> EventHandler for private::EventHandler<H>
214where
215 H: WlDummyEventHandler,
216{
217 const WL_INTERFACE: &'static wl_interface = &INTERFACE;
218
219 #[allow(unused_variables)]
220 unsafe fn handle_event(
221 &self,
222 queue: &Queue,
223 slf: &UntypedBorrowedProxy,
224 opcode: u32,
225 args: *mut wl_argument,
226 ) {
227 invalid_opcode("wl_dummy", opcode);
228 }
229}
230
231impl<H> CreateEventHandler<H> for private::ProxyApi
232where
233 H: WlDummyEventHandler,
234{
235 type EventHandler = private::EventHandler<H>;
236
237 #[inline]
238 fn create_event_handler(handler: H) -> Self::EventHandler {
239 private::EventHandler(handler)
240 }
241}
242
243pub mod event_handlers {
245 use super::*;
246
247 impl WlDummy {}
248}