fidl_next_fuchsia_examples_gizmo/
fidl_next_fuchsia_examples_gizmo.rs1#![warn(clippy::all)]
3#![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)]
4
5pub mod natural {
6
7 pub use fidl_next_common_fuchsia_examples_gizmo::natural::*;
8
9 #[derive(Debug, PartialEq)]
10 #[repr(C)]
11 pub struct DeviceGetEventResponse {
12 pub event: ::fidl_next::fuchsia::zx::Event,
13 }
14
15 unsafe impl<___E> ::fidl_next::Encode<crate::wire::DeviceGetEventResponse, ___E>
16 for DeviceGetEventResponse
17 where
18 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
19 ___E: ::fidl_next::fuchsia::HandleEncoder,
20 {
21 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
22 Self,
23 crate::wire::DeviceGetEventResponse,
24 > = unsafe {
25 ::fidl_next::CopyOptimization::enable_if(
26 true && <::fidl_next::fuchsia::zx::Event as ::fidl_next::Encode<
27 ::fidl_next::wire::fuchsia::Event,
28 ___E,
29 >>::COPY_OPTIMIZATION
30 .is_enabled(),
31 )
32 };
33
34 #[inline]
35 fn encode(
36 self,
37 encoder_: &mut ___E,
38 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetEventResponse>,
39 _: (),
40 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
41 ::fidl_next::munge! {
42 let crate::wire::DeviceGetEventResponse {
43 event,
44
45 } = out_;
46 }
47
48 ::fidl_next::Encode::encode(self.event, encoder_, event, ())?;
49
50 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(event.as_mut_ptr()) };
51
52 Ok(())
53 }
54 }
55
56 unsafe impl<___E>
57 ::fidl_next::EncodeOption<
58 ::fidl_next::wire::Box<'static, crate::wire::DeviceGetEventResponse>,
59 ___E,
60 > for DeviceGetEventResponse
61 where
62 ___E: ::fidl_next::Encoder + ?Sized,
63 DeviceGetEventResponse: ::fidl_next::Encode<crate::wire::DeviceGetEventResponse, ___E>,
64 {
65 #[inline]
66 fn encode_option(
67 this: ::core::option::Option<Self>,
68 encoder: &mut ___E,
69 out: &mut ::core::mem::MaybeUninit<
70 ::fidl_next::wire::Box<'static, crate::wire::DeviceGetEventResponse>,
71 >,
72 _: (),
73 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
74 if let Some(inner) = this {
75 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
76 ::fidl_next::wire::Box::encode_present(out);
77 } else {
78 ::fidl_next::wire::Box::encode_absent(out);
79 }
80
81 Ok(())
82 }
83 }
84
85 impl ::fidl_next::FromWire<crate::wire::DeviceGetEventResponse> for DeviceGetEventResponse {
86 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
87 crate::wire::DeviceGetEventResponse,
88 Self,
89 > = unsafe {
90 ::fidl_next::CopyOptimization::enable_if(
91 true && <::fidl_next::fuchsia::zx::Event as ::fidl_next::FromWire<
92 ::fidl_next::wire::fuchsia::Event,
93 >>::COPY_OPTIMIZATION
94 .is_enabled(),
95 )
96 };
97
98 #[inline]
99 fn from_wire(wire: crate::wire::DeviceGetEventResponse) -> Self {
100 Self { event: ::fidl_next::FromWire::from_wire(wire.event) }
101 }
102 }
103}
104
105pub mod wire {
106
107 pub use fidl_next_common_fuchsia_examples_gizmo::wire::*;
108
109 #[derive(Debug)]
111 #[repr(C)]
112 pub struct DeviceGetEventResponse {
113 pub event: ::fidl_next::wire::fuchsia::Event,
114 }
115
116 static_assertions::const_assert_eq!(std::mem::size_of::<DeviceGetEventResponse>(), 4);
117 static_assertions::const_assert_eq!(std::mem::align_of::<DeviceGetEventResponse>(), 4);
118
119 static_assertions::const_assert_eq!(std::mem::offset_of!(DeviceGetEventResponse, event), 0);
120
121 impl ::fidl_next::Constrained for DeviceGetEventResponse {
122 type Constraint = ();
123
124 fn validate(
125 _: ::fidl_next::Slot<'_, Self>,
126 _: Self::Constraint,
127 ) -> Result<(), ::fidl_next::ValidationError> {
128 Ok(())
129 }
130 }
131
132 unsafe impl ::fidl_next::Wire for DeviceGetEventResponse {
133 type Narrowed<'de> = DeviceGetEventResponse;
134
135 #[inline]
136 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
137 ::fidl_next::munge! {
138 let Self {
139
140 event,
141
142 } = &mut *out_;
143 }
144
145 ::fidl_next::Wire::zero_padding(event);
146 }
147 }
148
149 unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceGetEventResponse
150 where
151 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
152 ___D: ::fidl_next::fuchsia::HandleDecoder,
153 {
154 fn decode(
155 slot_: ::fidl_next::Slot<'_, Self>,
156 decoder_: &mut ___D,
157 _: (),
158 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
159 ::fidl_next::munge! {
160 let Self {
161
162 mut event,
163
164 } = slot_;
165 }
166
167 let _field = event.as_mut();
168
169 ::fidl_next::Decode::decode(event.as_mut(), decoder_, ())?;
170
171 Ok(())
172 }
173 }
174
175 impl ::fidl_next::IntoNatural for DeviceGetEventResponse {
176 type Natural = crate::natural::DeviceGetEventResponse;
177 }
178}
179
180pub mod wire_optional {
181
182 pub use fidl_next_common_fuchsia_examples_gizmo::wire_optional::*;
183}
184
185pub mod generic {
186
187 pub use fidl_next_common_fuchsia_examples_gizmo::generic::*;
188
189 pub struct DeviceGetEventResponse<T0> {
190 pub event: T0,
191 }
192
193 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceGetEventResponse, ___E>
194 for DeviceGetEventResponse<T0>
195 where
196 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
197 ___E: ::fidl_next::fuchsia::HandleEncoder,
198 T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::Event, ___E>,
199 {
200 #[inline]
201 fn encode(
202 self,
203 encoder_: &mut ___E,
204 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetEventResponse>,
205 _: (),
206 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
207 ::fidl_next::munge! {
208 let crate::wire::DeviceGetEventResponse {
209
210 event,
211
212 } = out_;
213 }
214
215 ::fidl_next::Encode::encode(self.event, encoder_, event, ())?;
216
217 Ok(())
218 }
219 }
220}
221
222pub use self::natural::*;
223
224#[doc = " The protocol provides access to functions of the driver.\n"]
226#[derive(PartialEq, Debug)]
227pub struct Device;
228
229#[cfg(target_os = "fuchsia")]
230impl ::fidl_next::HasTransport for Device {
231 type Transport = ::fidl_next::fuchsia::zx::Channel;
232}
233
234pub mod device {
235 pub mod prelude {
236 pub use crate::{Device, DeviceClientHandler, DeviceServerHandler, device};
237
238 pub use crate::natural::DeviceGetEventResponse;
239
240 pub use crate::natural::DeviceGetHardwareIdResponse;
241 }
242
243 pub struct GetHardwareId;
244
245 impl ::fidl_next::Method for GetHardwareId {
246 const ORDINAL: u64 = 7952116938191896180;
247 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
248 ::fidl_next::protocol::Flexibility::Strict;
249
250 type Protocol = crate::Device;
251
252 type Request = ();
253 }
254
255 impl ::fidl_next::TwoWayMethod for GetHardwareId {
256 type Response = ::fidl_next::wire::Result<
257 'static,
258 crate::wire::DeviceGetHardwareIdResponse,
259 ::fidl_next::wire::Int32,
260 >;
261 }
262
263 impl<___R> ::fidl_next::Respond<___R> for GetHardwareId {
264 type Output = ::core::result::Result<
265 crate::generic::DeviceGetHardwareIdResponse<___R>,
266 ::fidl_next::util::Never,
267 >;
268
269 fn respond(response: ___R) -> Self::Output {
270 ::core::result::Result::Ok(crate::generic::DeviceGetHardwareIdResponse {
271 response: response,
272 })
273 }
274 }
275
276 impl<___R> ::fidl_next::RespondErr<___R> for GetHardwareId {
277 type Output = ::core::result::Result<::fidl_next::util::Never, ___R>;
278
279 fn respond_err(response: ___R) -> Self::Output {
280 ::core::result::Result::Err(response)
281 }
282 }
283
284 pub struct GetEvent;
285
286 impl ::fidl_next::Method for GetEvent {
287 const ORDINAL: u64 = 6100331669860404750;
288 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
289 ::fidl_next::protocol::Flexibility::Strict;
290
291 type Protocol = crate::Device;
292
293 type Request = ();
294 }
295
296 impl ::fidl_next::TwoWayMethod for GetEvent {
297 type Response = crate::wire::DeviceGetEventResponse;
298 }
299
300 impl<___R> ::fidl_next::Respond<___R> for GetEvent {
301 type Output = crate::generic::DeviceGetEventResponse<___R>;
302
303 fn respond(response: ___R) -> Self::Output {
304 crate::generic::DeviceGetEventResponse { event: response }
305 }
306 }
307
308 mod ___detail {
309 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Device
310 where
311 ___T: ::fidl_next::Transport,
312 {
313 type Client = DeviceClient<___T>;
314 type Server = DeviceServer<___T>;
315 }
316
317 #[repr(transparent)]
319 pub struct DeviceClient<___T: ::fidl_next::Transport> {
320 #[allow(dead_code)]
321 client: ::fidl_next::protocol::Client<___T>,
322 }
323
324 impl<___T> DeviceClient<___T>
325 where
326 ___T: ::fidl_next::Transport,
327 {
328 #[doc = " Returns a unique identifier for this device.\n"]
329 pub fn get_hardware_id(
330 &self,
331 ) -> ::fidl_next::TwoWayFuture<'_, super::GetHardwareId, ___T> {
332 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
333 7952116938191896180,
334 <super::GetHardwareId as ::fidl_next::Method>::FLEXIBILITY,
335 (),
336 ))
337 }
338
339 #[doc = " Returns a zircon event object handle!\n"]
340 pub fn get_event(&self) -> ::fidl_next::TwoWayFuture<'_, super::GetEvent, ___T> {
341 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
342 6100331669860404750,
343 <super::GetEvent as ::fidl_next::Method>::FLEXIBILITY,
344 (),
345 ))
346 }
347 }
348
349 #[repr(transparent)]
351 pub struct DeviceServer<___T: ::fidl_next::Transport> {
352 server: ::fidl_next::protocol::Server<___T>,
353 }
354
355 impl<___T> DeviceServer<___T> where ___T: ::fidl_next::Transport {}
356 }
357}
358
359pub trait DeviceClientHandler<
363 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
364 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
365>
366{
367}
368
369impl<___T> DeviceClientHandler<___T> for ::fidl_next::IgnoreEvents where ___T: ::fidl_next::Transport
370{}
371
372impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Device
373where
374 ___H: DeviceClientHandler<___T> + ::core::marker::Send,
375 ___T: ::fidl_next::Transport,
376{
377 async fn on_event(
378 handler: &mut ___H,
379 ordinal: u64,
380 flexibility: ::fidl_next::protocol::Flexibility,
381 body: ::fidl_next::Body<___T>,
382 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
383 match ordinal {
384 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
385 }
386 }
387}
388
389pub trait DeviceServerHandler<
393 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
394 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
395>
396{
397 #[doc = " Returns a unique identifier for this device.\n"]
398 fn get_hardware_id(
399 &mut self,
400
401 responder: ::fidl_next::Responder<device::GetHardwareId, ___T>,
402 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
403
404 #[doc = " Returns a zircon event object handle!\n"]
405 fn get_event(
406 &mut self,
407
408 responder: ::fidl_next::Responder<device::GetEvent, ___T>,
409 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
410}
411
412impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Device
413where
414 ___H: DeviceServerHandler<___T> + ::core::marker::Send,
415 ___T: ::fidl_next::Transport,
416{
417 async fn on_one_way(
418 handler: &mut ___H,
419 ordinal: u64,
420 flexibility: ::fidl_next::protocol::Flexibility,
421 body: ::fidl_next::Body<___T>,
422 ) -> ::core::result::Result<
423 (),
424 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
425 > {
426 match ordinal {
427 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
428 }
429 }
430
431 async fn on_two_way(
432 handler: &mut ___H,
433 ordinal: u64,
434 flexibility: ::fidl_next::protocol::Flexibility,
435 body: ::fidl_next::Body<___T>,
436 responder: ::fidl_next::protocol::Responder<___T>,
437 ) -> ::core::result::Result<
438 (),
439 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
440 > {
441 match ordinal {
442 7952116938191896180 => {
443 let responder = ::fidl_next::Responder::from_untyped(responder);
444
445 handler.get_hardware_id(responder).await;
446 Ok(())
447 }
448
449 6100331669860404750 => {
450 let responder = ::fidl_next::Responder::from_untyped(responder);
451
452 handler.get_event(responder).await;
453 Ok(())
454 }
455
456 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
457 }
458 }
459}
460
461pub use fidl_next_common_fuchsia_examples_gizmo::*;
462
463pub mod compat {
465
466 pub use fidl_next_common_fuchsia_examples_gizmo::compat::*;
467
468 impl ::fidl_next::CompatFrom<crate::DeviceGetEventResponse>
469 for ::fidl_fuchsia_examples_gizmo::DeviceGetEventResponse
470 {
471 #[inline]
472 fn compat_from(value: crate::DeviceGetEventResponse) -> Self {
473 Self { event: ::fidl_next::CompatFrom::compat_from(value.event) }
474 }
475 }
476
477 impl ::fidl_next::CompatFrom<::fidl_fuchsia_examples_gizmo::DeviceGetEventResponse>
478 for crate::DeviceGetEventResponse
479 {
480 #[inline]
481 fn compat_from(value: ::fidl_fuchsia_examples_gizmo::DeviceGetEventResponse) -> Self {
482 Self { event: ::fidl_next::CompatFrom::compat_from(value.event) }
483 }
484 }
485
486 #[cfg(target_os = "fuchsia")]
487 pub type DeviceProxy = ::fidl_next::Client<crate::Device>;
490
491 impl ::fidl_next::CompatFrom<crate::Device> for ::fidl_fuchsia_examples_gizmo::DeviceMarker {
492 fn compat_from(_: crate::Device) -> Self {
493 Self
494 }
495 }
496
497 impl ::fidl_next::CompatFrom<::fidl_fuchsia_examples_gizmo::DeviceMarker> for crate::Device {
498 fn compat_from(_: ::fidl_fuchsia_examples_gizmo::DeviceMarker) -> Self {
499 Self
500 }
501 }
502
503 #[cfg(target_os = "fuchsia")]
504
505 impl ::fidl_next::ClientCompatFrom<::fidl_fuchsia_examples_gizmo::DeviceProxy> for crate::Device {
506 fn client_compat_from(
507 proxy: ::fidl_fuchsia_examples_gizmo::DeviceProxy,
508 ) -> ::fidl_next::ClientDispatcher<Self, ::fidl_next::fuchsia::zx::Channel> {
509 let channel = ::fidl::endpoints::Proxy::into_channel(proxy).unwrap().into_zx_channel();
510 let client_end = ::fidl_next::ClientEnd::from_untyped(channel);
511 ::fidl_next::ClientDispatcher::new(client_end)
512 }
513 }
514}