1#![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 event,
140
141 } = &mut *out_;
142 }
143
144 ::fidl_next::Wire::zero_padding(event);
145 }
146 }
147
148 unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceGetEventResponse
149 where
150 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
151 ___D: ::fidl_next::fuchsia::HandleDecoder,
152 {
153 fn decode(
154 slot_: ::fidl_next::Slot<'_, Self>,
155 decoder_: &mut ___D,
156 _: (),
157 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
158 ::fidl_next::munge! {
159 let Self {
160 mut event,
161
162 } = slot_;
163 }
164
165 let _field = event.as_mut();
166
167 ::fidl_next::Decode::decode(event.as_mut(), decoder_, ())?;
168
169 Ok(())
170 }
171 }
172
173 impl ::fidl_next::IntoNatural for DeviceGetEventResponse {
174 type Natural = crate::natural::DeviceGetEventResponse;
175 }
176}
177
178pub mod wire_optional {
179
180 pub use fidl_next_common_fuchsia_examples_gizmo::wire_optional::*;
181}
182
183pub mod generic {
184
185 pub use fidl_next_common_fuchsia_examples_gizmo::generic::*;
186
187 pub struct DeviceGetEventResponse<T0> {
189 pub event: T0,
190 }
191
192 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceGetEventResponse, ___E>
193 for DeviceGetEventResponse<T0>
194 where
195 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
196 ___E: ::fidl_next::fuchsia::HandleEncoder,
197 T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::Event, ___E>,
198 {
199 #[inline]
200 fn encode(
201 self,
202 encoder_: &mut ___E,
203 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetEventResponse>,
204 _: (),
205 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
206 ::fidl_next::munge! {
207 let crate::wire::DeviceGetEventResponse {
208 event,
209
210 } = out_;
211 }
212
213 ::fidl_next::Encode::encode(self.event, encoder_, event, ())?;
214
215 Ok(())
216 }
217 }
218}
219
220pub use self::natural::*;
221
222#[doc = " The protocol provides access to functions of the driver.\n"]
224#[derive(PartialEq, Debug)]
225pub struct Device;
226
227#[cfg(target_os = "fuchsia")]
228impl ::fidl_next::HasTransport for Device {
229 type Transport = ::fidl_next::fuchsia::zx::Channel;
230}
231
232pub mod device {
233 pub mod prelude {
234 pub use crate::{
235 Device, DeviceClientHandler, DeviceLocalClientHandler, DeviceLocalServerHandler,
236 DeviceServerHandler, device,
237 };
238
239 pub use crate::natural::DeviceGetEventResponse;
240
241 pub use crate::natural::DeviceGetHardwareIdResponse;
242 }
243
244 pub struct GetHardwareId;
245
246 impl ::fidl_next::Method for GetHardwareId {
247 const ORDINAL: u64 = 7952116938191896180;
248 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
249 ::fidl_next::protocol::Flexibility::Strict;
250
251 type Protocol = crate::Device;
252
253 type Request = ::fidl_next::wire::EmptyMessageBody;
254 }
255
256 impl ::fidl_next::TwoWayMethod for GetHardwareId {
257 type Response = ::fidl_next::wire::Result<
258 'static,
259 crate::wire::DeviceGetHardwareIdResponse,
260 ::fidl_next::wire::Int32,
261 >;
262 }
263
264 impl<___R> ::fidl_next::Respond<___R> for GetHardwareId {
265 type Output = ::core::result::Result<
266 crate::generic::DeviceGetHardwareIdResponse<___R>,
267 ::fidl_next::util::Never,
268 >;
269
270 fn respond(response: ___R) -> Self::Output {
271 ::core::result::Result::Ok(crate::generic::DeviceGetHardwareIdResponse {
272 response: response,
273 })
274 }
275 }
276
277 impl<___R> ::fidl_next::RespondErr<___R> for GetHardwareId {
278 type Output = ::core::result::Result<::fidl_next::util::Never, ___R>;
279
280 fn respond_err(response: ___R) -> Self::Output {
281 ::core::result::Result::Err(response)
282 }
283 }
284
285 pub struct GetEvent;
286
287 impl ::fidl_next::Method for GetEvent {
288 const ORDINAL: u64 = 6100331669860404750;
289 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
290 ::fidl_next::protocol::Flexibility::Strict;
291
292 type Protocol = crate::Device;
293
294 type Request = ::fidl_next::wire::EmptyMessageBody;
295 }
296
297 impl ::fidl_next::TwoWayMethod for GetEvent {
298 type Response = crate::wire::DeviceGetEventResponse;
299 }
300
301 impl<___R> ::fidl_next::Respond<___R> for GetEvent {
302 type Output = crate::generic::DeviceGetEventResponse<___R>;
303
304 fn respond(response: ___R) -> Self::Output {
305 crate::generic::DeviceGetEventResponse { event: response }
306 }
307 }
308
309 mod ___detail {
310 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Device
311 where
312 ___T: ::fidl_next::Transport,
313 {
314 type Client = DeviceClient<___T>;
315 type Server = DeviceServer<___T>;
316 }
317
318 #[repr(transparent)]
320 pub struct DeviceClient<___T: ::fidl_next::Transport> {
321 #[allow(dead_code)]
322 client: ::fidl_next::protocol::Client<___T>,
323 }
324
325 impl<___T> DeviceClient<___T>
326 where
327 ___T: ::fidl_next::Transport,
328 {
329 #[doc = " Returns a unique identifier for this device.\n"]
330 pub fn get_hardware_id(
331 &self,
332 ) -> ::fidl_next::TwoWayFuture<'_, super::GetHardwareId, ___T> {
333 ::fidl_next::TwoWayFuture::from_untyped(
334 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
335 7952116938191896180,
336 <super::GetHardwareId as ::fidl_next::Method>::FLEXIBILITY,
337 (),
338 ),
339 )
340 }
341
342 #[doc = " Returns a zircon event object handle!\n"]
343 pub fn get_event(&self) -> ::fidl_next::TwoWayFuture<'_, super::GetEvent, ___T> {
344 ::fidl_next::TwoWayFuture::from_untyped(
345 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
346 6100331669860404750,
347 <super::GetEvent as ::fidl_next::Method>::FLEXIBILITY,
348 (),
349 ),
350 )
351 }
352 }
353
354 #[repr(transparent)]
356 pub struct DeviceServer<___T: ::fidl_next::Transport> {
357 server: ::fidl_next::protocol::Server<___T>,
358 }
359
360 impl<___T> DeviceServer<___T> where ___T: ::fidl_next::Transport {}
361 }
362}
363
364#[diagnostic::on_unimplemented(
365 note = "If {Self} implements the non-local DeviceClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
366)]
367
368pub trait DeviceLocalClientHandler<
372 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
373 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
374>
375{
376}
377
378impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Device
379where
380 ___H: DeviceLocalClientHandler<___T>,
381 ___T: ::fidl_next::Transport,
382{
383 async fn on_event(
384 handler: &mut ___H,
385 ordinal: u64,
386 flexibility: ::fidl_next::protocol::Flexibility,
387 body: ::fidl_next::Body<___T>,
388 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
389 match ordinal {
390 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
391 }
392 }
393}
394
395#[diagnostic::on_unimplemented(
396 note = "If {Self} implements the non-local DeviceServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
397)]
398
399pub trait DeviceLocalServerHandler<
403 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
404 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
405>
406{
407 #[doc = " Returns a unique identifier for this device.\n"]
408 fn get_hardware_id(
409 &mut self,
410
411 responder: ::fidl_next::Responder<device::GetHardwareId, ___T>,
412 ) -> impl ::core::future::Future<Output = ()>;
413
414 #[doc = " Returns a zircon event object handle!\n"]
415 fn get_event(
416 &mut self,
417
418 responder: ::fidl_next::Responder<device::GetEvent, ___T>,
419 ) -> impl ::core::future::Future<Output = ()>;
420}
421
422impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Device
423where
424 ___H: DeviceLocalServerHandler<___T>,
425 ___T: ::fidl_next::Transport,
426{
427 async fn on_one_way(
428 handler: &mut ___H,
429 ordinal: u64,
430 flexibility: ::fidl_next::protocol::Flexibility,
431 body: ::fidl_next::Body<___T>,
432 ) -> ::core::result::Result<
433 (),
434 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
435 > {
436 match ordinal {
437 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
438 }
439 }
440
441 async fn on_two_way(
442 handler: &mut ___H,
443 ordinal: u64,
444 flexibility: ::fidl_next::protocol::Flexibility,
445 body: ::fidl_next::Body<___T>,
446 responder: ::fidl_next::protocol::Responder<___T>,
447 ) -> ::core::result::Result<
448 (),
449 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
450 > {
451 match ordinal {
452 7952116938191896180 => {
453 let responder = ::fidl_next::Responder::from_untyped(responder);
454
455 handler.get_hardware_id(responder).await;
456 Ok(())
457 }
458
459 6100331669860404750 => {
460 let responder = ::fidl_next::Responder::from_untyped(responder);
461
462 handler.get_event(responder).await;
463 Ok(())
464 }
465
466 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
467 }
468 }
469}
470
471pub trait DeviceClientHandler<
475 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
476 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
477>
478{
479}
480
481impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Device
482where
483 ___H: DeviceClientHandler<___T> + ::core::marker::Send,
484 ___T: ::fidl_next::Transport,
485{
486 async fn on_event(
487 handler: &mut ___H,
488 ordinal: u64,
489 flexibility: ::fidl_next::protocol::Flexibility,
490 body: ::fidl_next::Body<___T>,
491 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
492 match ordinal {
493 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
494 }
495 }
496}
497
498pub trait DeviceServerHandler<
502 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
503 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
504>
505{
506 #[doc = " Returns a unique identifier for this device.\n"]
507 fn get_hardware_id(
508 &mut self,
509
510 responder: ::fidl_next::Responder<device::GetHardwareId, ___T>,
511 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
512
513 #[doc = " Returns a zircon event object handle!\n"]
514 fn get_event(
515 &mut self,
516
517 responder: ::fidl_next::Responder<device::GetEvent, ___T>,
518 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
519}
520
521impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Device
522where
523 ___H: DeviceServerHandler<___T> + ::core::marker::Send,
524 ___T: ::fidl_next::Transport,
525{
526 async fn on_one_way(
527 handler: &mut ___H,
528 ordinal: u64,
529 flexibility: ::fidl_next::protocol::Flexibility,
530 body: ::fidl_next::Body<___T>,
531 ) -> ::core::result::Result<
532 (),
533 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
534 > {
535 match ordinal {
536 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
537 }
538 }
539
540 async fn on_two_way(
541 handler: &mut ___H,
542 ordinal: u64,
543 flexibility: ::fidl_next::protocol::Flexibility,
544 body: ::fidl_next::Body<___T>,
545 responder: ::fidl_next::protocol::Responder<___T>,
546 ) -> ::core::result::Result<
547 (),
548 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
549 > {
550 match ordinal {
551 7952116938191896180 => {
552 let responder = ::fidl_next::Responder::from_untyped(responder);
553
554 handler.get_hardware_id(responder).await;
555 Ok(())
556 }
557
558 6100331669860404750 => {
559 let responder = ::fidl_next::Responder::from_untyped(responder);
560
561 handler.get_event(responder).await;
562 Ok(())
563 }
564
565 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
566 }
567 }
568}
569
570impl<___T> DeviceClientHandler<___T> for ::fidl_next::IgnoreEvents where ___T: ::fidl_next::Transport
571{}
572
573impl<___H, ___T> DeviceLocalClientHandler<___T> for ::fidl_next::Local<___H>
574where
575 ___H: DeviceClientHandler<___T>,
576 ___T: ::fidl_next::Transport,
577{
578}
579
580impl<___H, ___T> DeviceLocalServerHandler<___T> for ::fidl_next::Local<___H>
581where
582 ___H: DeviceServerHandler<___T>,
583 ___T: ::fidl_next::Transport,
584{
585 async fn get_hardware_id(
586 &mut self,
587
588 responder: ::fidl_next::Responder<device::GetHardwareId, ___T>,
589 ) {
590 ___H::get_hardware_id(&mut self.0, responder).await
591 }
592
593 async fn get_event(&mut self, responder: ::fidl_next::Responder<device::GetEvent, ___T>) {
594 ___H::get_event(&mut self.0, responder).await
595 }
596}
597
598pub use fidl_next_common_fuchsia_examples_gizmo::*;