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
5#[derive(PartialEq, Clone, Debug)]
6#[repr(C)]
7pub struct DeviceGetHardwareIdResponse {
8 pub response: u32,
9}
10
11impl ::fidl_next::Encodable for DeviceGetHardwareIdResponse {
12 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self, WireDeviceGetHardwareIdResponse> = unsafe {
13 ::fidl_next::CopyOptimization::enable_if(
14 true && <u32 as ::fidl_next::Encodable>::COPY_OPTIMIZATION.is_enabled(),
15 )
16 };
17
18 type Encoded = WireDeviceGetHardwareIdResponse;
19}
20
21unsafe impl<___E> ::fidl_next::Encode<___E> for DeviceGetHardwareIdResponse
22where
23 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
24{
25 #[inline]
26 fn encode(
27 self,
28 encoder_: &mut ___E,
29 out_: &mut ::core::mem::MaybeUninit<Self::Encoded>,
30 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
31 ::fidl_next::munge! {
32 let Self::Encoded {
33 response,
34
35 } = out_;
36 }
37
38 ::fidl_next::Encode::encode(self.response, encoder_, response)?;
39
40 Ok(())
41 }
42}
43
44unsafe impl<___E> ::fidl_next::EncodeRef<___E> for DeviceGetHardwareIdResponse
45where
46 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
47{
48 #[inline]
49 fn encode_ref(
50 &self,
51 encoder_: &mut ___E,
52 out_: &mut ::core::mem::MaybeUninit<Self::Encoded>,
53 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
54 ::fidl_next::munge! {
55 let Self::Encoded {
56
57 response,
58
59 } = out_;
60 }
61
62 ::fidl_next::EncodeRef::encode_ref(&self.response, encoder_, response)?;
63
64 Ok(())
65 }
66}
67
68impl ::fidl_next::EncodableOption for DeviceGetHardwareIdResponse {
69 type EncodedOption = ::fidl_next::WireBox<'static, WireDeviceGetHardwareIdResponse>;
70}
71
72unsafe impl<___E> ::fidl_next::EncodeOption<___E> for DeviceGetHardwareIdResponse
73where
74 ___E: ::fidl_next::Encoder + ?Sized,
75 DeviceGetHardwareIdResponse: ::fidl_next::Encode<___E>,
76{
77 #[inline]
78 fn encode_option(
79 this: ::core::option::Option<Self>,
80 encoder: &mut ___E,
81 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
82 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
83 if let Some(inner) = this {
84 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
85 ::fidl_next::WireBox::encode_present(out);
86 } else {
87 ::fidl_next::WireBox::encode_absent(out);
88 }
89
90 Ok(())
91 }
92}
93
94unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for DeviceGetHardwareIdResponse
95where
96 ___E: ::fidl_next::Encoder + ?Sized,
97 DeviceGetHardwareIdResponse: ::fidl_next::EncodeRef<___E>,
98{
99 #[inline]
100 fn encode_option_ref(
101 this: ::core::option::Option<&Self>,
102 encoder: &mut ___E,
103 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
104 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
105 if let Some(inner) = this {
106 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
107 ::fidl_next::WireBox::encode_present(out);
108 } else {
109 ::fidl_next::WireBox::encode_absent(out);
110 }
111
112 Ok(())
113 }
114}
115
116impl ::fidl_next::FromWire<WireDeviceGetHardwareIdResponse> for DeviceGetHardwareIdResponse {
117 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<WireDeviceGetHardwareIdResponse, Self> = unsafe {
118 ::fidl_next::CopyOptimization::enable_if(
119 true && <u32 as ::fidl_next::FromWire<::fidl_next::WireU32>>::COPY_OPTIMIZATION
120 .is_enabled(),
121 )
122 };
123
124 #[inline]
125 fn from_wire(wire: WireDeviceGetHardwareIdResponse) -> Self {
126 Self { response: ::fidl_next::FromWire::from_wire(wire.response) }
127 }
128}
129
130impl ::fidl_next::IntoNatural for WireDeviceGetHardwareIdResponse {
131 type Natural = DeviceGetHardwareIdResponse;
132}
133
134impl ::fidl_next::FromWireRef<WireDeviceGetHardwareIdResponse> for DeviceGetHardwareIdResponse {
135 #[inline]
136 fn from_wire_ref(wire: &WireDeviceGetHardwareIdResponse) -> Self {
137 Self { response: ::fidl_next::FromWireRef::from_wire_ref(&wire.response) }
138 }
139}
140
141#[derive(Clone, Debug)]
143#[repr(C)]
144pub struct WireDeviceGetHardwareIdResponse {
145 pub response: ::fidl_next::WireU32,
146}
147static_assertions::const_assert_eq!(std::mem::size_of::<WireDeviceGetHardwareIdResponse>(), 4);
148static_assertions::const_assert_eq!(std::mem::align_of::<WireDeviceGetHardwareIdResponse>(), 4);
149
150static_assertions::const_assert_eq!(
151 std::mem::offset_of!(WireDeviceGetHardwareIdResponse, response),
152 0
153);
154
155unsafe impl ::fidl_next::Wire for WireDeviceGetHardwareIdResponse {
156 type Decoded<'de> = WireDeviceGetHardwareIdResponse;
157
158 #[inline]
159 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
160 ::fidl_next::munge! {
161 let Self {
162
163 response,
164
165 } = &mut *out_;
166 }
167
168 ::fidl_next::Wire::zero_padding(response);
169 }
170}
171
172unsafe impl<___D> ::fidl_next::Decode<___D> for WireDeviceGetHardwareIdResponse
173where
174 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
175{
176 fn decode(
177 slot_: ::fidl_next::Slot<'_, Self>,
178 decoder_: &mut ___D,
179 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
180 ::fidl_next::munge! {
181 let Self {
182
183 mut response,
184
185 } = slot_;
186 }
187
188 ::fidl_next::Decode::decode(response.as_mut(), decoder_)?;
189
190 Ok(())
191 }
192}
193
194#[derive(PartialEq, Debug)]
195#[repr(C)]
196pub struct DeviceGetEventResponse {
197 pub event: ::fidl_next::fuchsia::zx::Event,
198}
199
200impl ::fidl_next::Encodable for DeviceGetEventResponse {
201 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self, WireDeviceGetEventResponse> = unsafe {
202 ::fidl_next::CopyOptimization::enable_if(
203 true && <::fidl_next::fuchsia::zx::Event as ::fidl_next::Encodable>::COPY_OPTIMIZATION
204 .is_enabled(),
205 )
206 };
207
208 type Encoded = WireDeviceGetEventResponse;
209}
210
211unsafe impl<___E> ::fidl_next::Encode<___E> for DeviceGetEventResponse
212where
213 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
214 ___E: ::fidl_next::fuchsia::HandleEncoder,
215{
216 #[inline]
217 fn encode(
218 self,
219 encoder_: &mut ___E,
220 out_: &mut ::core::mem::MaybeUninit<Self::Encoded>,
221 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
222 ::fidl_next::munge! {
223 let Self::Encoded {
224 event,
225
226 } = out_;
227 }
228
229 ::fidl_next::Encode::encode(self.event, encoder_, event)?;
230
231 Ok(())
232 }
233}
234
235impl ::fidl_next::EncodableOption for DeviceGetEventResponse {
236 type EncodedOption = ::fidl_next::WireBox<'static, WireDeviceGetEventResponse>;
237}
238
239unsafe impl<___E> ::fidl_next::EncodeOption<___E> for DeviceGetEventResponse
240where
241 ___E: ::fidl_next::Encoder + ?Sized,
242 DeviceGetEventResponse: ::fidl_next::Encode<___E>,
243{
244 #[inline]
245 fn encode_option(
246 this: ::core::option::Option<Self>,
247 encoder: &mut ___E,
248 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
249 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
250 if let Some(inner) = this {
251 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
252 ::fidl_next::WireBox::encode_present(out);
253 } else {
254 ::fidl_next::WireBox::encode_absent(out);
255 }
256
257 Ok(())
258 }
259}
260
261impl ::fidl_next::FromWire<WireDeviceGetEventResponse> for DeviceGetEventResponse {
262 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<WireDeviceGetEventResponse, Self> = unsafe {
263 ::fidl_next::CopyOptimization::enable_if(
264 true && <::fidl_next::fuchsia::zx::Event as ::fidl_next::FromWire<
265 ::fidl_next::fuchsia::WireEvent,
266 >>::COPY_OPTIMIZATION
267 .is_enabled(),
268 )
269 };
270
271 #[inline]
272 fn from_wire(wire: WireDeviceGetEventResponse) -> Self {
273 Self { event: ::fidl_next::FromWire::from_wire(wire.event) }
274 }
275}
276
277impl ::fidl_next::IntoNatural for WireDeviceGetEventResponse {
278 type Natural = DeviceGetEventResponse;
279}
280
281#[derive(Debug)]
283#[repr(C)]
284pub struct WireDeviceGetEventResponse {
285 pub event: ::fidl_next::fuchsia::WireEvent,
286}
287static_assertions::const_assert_eq!(std::mem::size_of::<WireDeviceGetEventResponse>(), 4);
288static_assertions::const_assert_eq!(std::mem::align_of::<WireDeviceGetEventResponse>(), 4);
289
290static_assertions::const_assert_eq!(std::mem::offset_of!(WireDeviceGetEventResponse, event), 0);
291
292unsafe impl ::fidl_next::Wire for WireDeviceGetEventResponse {
293 type Decoded<'de> = WireDeviceGetEventResponse;
294
295 #[inline]
296 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
297 ::fidl_next::munge! {
298 let Self {
299
300 event,
301
302 } = &mut *out_;
303 }
304
305 ::fidl_next::Wire::zero_padding(event);
306 }
307}
308
309unsafe impl<___D> ::fidl_next::Decode<___D> for WireDeviceGetEventResponse
310where
311 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
312 ___D: ::fidl_next::fuchsia::HandleDecoder,
313{
314 fn decode(
315 slot_: ::fidl_next::Slot<'_, Self>,
316 decoder_: &mut ___D,
317 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
318 ::fidl_next::munge! {
319 let Self {
320
321 mut event,
322
323 } = slot_;
324 }
325
326 ::fidl_next::Decode::decode(event.as_mut(), decoder_)?;
327
328 Ok(())
329 }
330}
331
332#[doc = " The protocol provides access to functions of the driver.\n"]
334#[derive(PartialEq, Debug)]
335pub struct Device;
336
337pub mod device {
338 pub mod prelude {
339 pub use crate::{Device, DeviceClientHandler, DeviceServerHandler, device};
340
341 pub use crate::DeviceGetEventResponse;
342
343 pub use crate::DeviceGetHardwareIdResponse;
344 }
345
346 pub struct GetHardwareId;
347
348 impl ::fidl_next::Method for GetHardwareId {
349 const ORDINAL: u64 = 7952116938191896180;
350
351 type Protocol = crate::Device;
352
353 type Request = ();
354
355 type Response = ::fidl_next::WireResult<
356 'static,
357 crate::WireDeviceGetHardwareIdResponse,
358 ::fidl_next::WireI32,
359 >;
360 }
361
362 pub struct GetEvent;
363
364 impl ::fidl_next::Method for GetEvent {
365 const ORDINAL: u64 = 6100331669860404750;
366
367 type Protocol = crate::Device;
368
369 type Request = ();
370
371 type Response = crate::WireDeviceGetEventResponse;
372 }
373
374 mod ___detail {
375
376 unsafe impl<___T> ::fidl_next::Protocol<___T> for crate::Device
377 where
378 ___T: ::fidl_next::Transport,
379 {
380 type Client = DeviceClient<___T>;
381 type Server = DeviceServer<___T>;
382 }
383
384 #[repr(transparent)]
386 pub struct DeviceClient<___T: ::fidl_next::Transport> {
387 #[allow(dead_code)]
388 client: ::fidl_next::protocol::Client<___T>,
389 }
390
391 impl<___T> DeviceClient<___T>
392 where
393 ___T: ::fidl_next::Transport,
394 {
395 #[doc = " Returns a unique identifier for this device.\n"]
396 pub fn get_hardware_id(
397 &self,
398 ) -> ::fidl_next::TwoWayFuture<'_, super::GetHardwareId, ___T> {
399 ::fidl_next::TwoWayFuture::from_untyped(
400 self.client.send_two_way(7952116938191896180, ()),
401 )
402 }
403
404 #[doc = " Returns a zircon event object handle!\n"]
405 pub fn get_event(&self) -> ::fidl_next::TwoWayFuture<'_, super::GetEvent, ___T> {
406 ::fidl_next::TwoWayFuture::from_untyped(
407 self.client.send_two_way(6100331669860404750, ()),
408 )
409 }
410 }
411
412 #[repr(transparent)]
414 pub struct DeviceServer<___T: ::fidl_next::Transport> {
415 server: ::fidl_next::protocol::Server<___T>,
416 }
417
418 impl<___T> DeviceServer<___T> where ___T: ::fidl_next::Transport {}
419 }
420}
421
422pub trait DeviceClientHandler<
426 #[cfg(not(feature = "fuchsia"))] ___T: ::fidl_next::Transport,
427 #[cfg(feature = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
428>
429{
430}
431
432impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Device
433where
434 ___H: DeviceClientHandler<___T> + ::core::marker::Send,
435 ___T: ::fidl_next::Transport,
436 <device::GetHardwareId as ::fidl_next::Method>::Response:
437 ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
438 <device::GetEvent as ::fidl_next::Method>::Response:
439 ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
440{
441 async fn on_event(
442 handler: &mut ___H,
443 ordinal: u64,
444 buffer: ___T::RecvBuffer,
445 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
446 match ordinal {
447 ordinal => Err(::fidl_next::ProtocolError::InvalidOrdinal(ordinal)),
448 }
449 }
450}
451
452pub trait DeviceServerHandler<
456 #[cfg(not(feature = "fuchsia"))] ___T: ::fidl_next::Transport,
457 #[cfg(feature = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
458>
459{
460 #[doc = " Returns a unique identifier for this device.\n"]
461 fn get_hardware_id(
462 &mut self,
463
464 responder: ::fidl_next::Responder<device::GetHardwareId, ___T>,
465 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
466
467 #[doc = " Returns a zircon event object handle!\n"]
468 fn get_event(
469 &mut self,
470
471 responder: ::fidl_next::Responder<device::GetEvent, ___T>,
472 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
473}
474
475impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Device
476where
477 ___H: DeviceServerHandler<___T> + ::core::marker::Send,
478 ___T: ::fidl_next::Transport,
479{
480 async fn on_one_way(
481 handler: &mut ___H,
482 ordinal: u64,
483 buffer: ___T::RecvBuffer,
484 ) -> ::core::result::Result<
485 (),
486 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
487 > {
488 match ordinal {
489 ordinal => Err(::fidl_next::ProtocolError::InvalidOrdinal(ordinal)),
490 }
491 }
492
493 async fn on_two_way(
494 handler: &mut ___H,
495 ordinal: u64,
496 buffer: ___T::RecvBuffer,
497 responder: ::fidl_next::protocol::Responder<___T>,
498 ) -> ::core::result::Result<
499 (),
500 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
501 > {
502 match ordinal {
503 7952116938191896180 => {
504 let responder = ::fidl_next::Responder::from_untyped(responder);
505
506 handler.get_hardware_id(responder).await;
507 Ok(())
508 }
509
510 6100331669860404750 => {
511 let responder = ::fidl_next::Responder::from_untyped(responder);
512
513 handler.get_event(responder).await;
514 Ok(())
515 }
516
517 ordinal => Err(::fidl_next::ProtocolError::InvalidOrdinal(ordinal)),
518 }
519 }
520}
521
522pub mod compat {
524
525 #[cfg(feature = "driver")]
526 impl ::fidl_next::CompatFrom<crate::DeviceGetHardwareIdResponse>
527 for ::fidl_fuchsia_examples_gizmo::DeviceGetHardwareIdResponse
528 {
529 #[inline]
530 fn compat_from(value: crate::DeviceGetHardwareIdResponse) -> Self {
531 Self { response: ::fidl_next::CompatFrom::compat_from(value.response) }
532 }
533 }
534
535 #[cfg(feature = "driver")]
536 impl ::fidl_next::CompatFrom<::fidl_fuchsia_examples_gizmo::DeviceGetHardwareIdResponse>
537 for crate::DeviceGetHardwareIdResponse
538 {
539 #[inline]
540 fn compat_from(value: ::fidl_fuchsia_examples_gizmo::DeviceGetHardwareIdResponse) -> Self {
541 Self { response: ::fidl_next::CompatFrom::compat_from(value.response) }
542 }
543 }
544
545 #[cfg(feature = "driver")]
546 impl ::fidl_next::CompatFrom<crate::DeviceGetEventResponse>
547 for ::fidl_fuchsia_examples_gizmo::DeviceGetEventResponse
548 {
549 #[inline]
550 fn compat_from(value: crate::DeviceGetEventResponse) -> Self {
551 Self { event: ::fidl_next::CompatFrom::compat_from(value.event) }
552 }
553 }
554
555 #[cfg(feature = "driver")]
556 impl ::fidl_next::CompatFrom<::fidl_fuchsia_examples_gizmo::DeviceGetEventResponse>
557 for crate::DeviceGetEventResponse
558 {
559 #[inline]
560 fn compat_from(value: ::fidl_fuchsia_examples_gizmo::DeviceGetEventResponse) -> Self {
561 Self { event: ::fidl_next::CompatFrom::compat_from(value.event) }
562 }
563 }
564
565 #[cfg(target_os = "fuchsia")]
566 pub type DeviceProxy = ::fidl_next::Client<crate::Device>;
569
570 #[cfg(feature = "driver")]
571 impl ::fidl_next::CompatFrom<crate::Device> for ::fidl_fuchsia_examples_gizmo::DeviceMarker {
572 fn compat_from(_: crate::Device) -> Self {
573 Self
574 }
575 }
576
577 #[cfg(feature = "driver")]
578 impl ::fidl_next::CompatFrom<::fidl_fuchsia_examples_gizmo::DeviceMarker> for crate::Device {
579 fn compat_from(_: ::fidl_fuchsia_examples_gizmo::DeviceMarker) -> Self {
580 Self
581 }
582 }
583}