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_hardware_serial::natural::*;
8
9 #[derive(Debug, PartialEq)]
10 #[repr(C)]
11 pub struct DeviceProxyGetChannelRequest {
12 pub req: ::fidl_next::ServerEnd<crate::Device, ::fidl_next::fuchsia::zx::Channel>,
13 }
14
15 unsafe impl<___E> ::fidl_next::Encode<crate::wire::DeviceProxyGetChannelRequest, ___E>
16 for DeviceProxyGetChannelRequest
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::DeviceProxyGetChannelRequest,
24 > = unsafe {
25 ::fidl_next::CopyOptimization::enable_if(
26 true
27
28 && <
29 ::fidl_next::ServerEnd<crate::Device, ::fidl_next::fuchsia::zx::Channel> as ::fidl_next::Encode<::fidl_next::ServerEnd<crate::Device, ::fidl_next::wire::fuchsia::Channel>, ___E>
30 >::COPY_OPTIMIZATION.is_enabled()
31
32 )
33 };
34
35 #[inline]
36 fn encode(
37 self,
38 encoder_: &mut ___E,
39 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceProxyGetChannelRequest>,
40 _: (),
41 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
42 ::fidl_next::munge! {
43 let crate::wire::DeviceProxyGetChannelRequest {
44 req,
45
46 } = out_;
47 }
48
49 ::fidl_next::Encode::encode(self.req, encoder_, req, ())?;
50
51 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(req.as_mut_ptr()) };
52
53 Ok(())
54 }
55 }
56
57 unsafe impl<___E>
58 ::fidl_next::EncodeOption<
59 ::fidl_next::wire::Box<'static, crate::wire::DeviceProxyGetChannelRequest>,
60 ___E,
61 > for DeviceProxyGetChannelRequest
62 where
63 ___E: ::fidl_next::Encoder + ?Sized,
64 DeviceProxyGetChannelRequest:
65 ::fidl_next::Encode<crate::wire::DeviceProxyGetChannelRequest, ___E>,
66 {
67 #[inline]
68 fn encode_option(
69 this: ::core::option::Option<Self>,
70 encoder: &mut ___E,
71 out: &mut ::core::mem::MaybeUninit<
72 ::fidl_next::wire::Box<'static, crate::wire::DeviceProxyGetChannelRequest>,
73 >,
74 _: (),
75 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
76 if let Some(inner) = this {
77 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
78 ::fidl_next::wire::Box::encode_present(out);
79 } else {
80 ::fidl_next::wire::Box::encode_absent(out);
81 }
82
83 Ok(())
84 }
85 }
86
87 impl ::fidl_next::FromWire<crate::wire::DeviceProxyGetChannelRequest>
88 for DeviceProxyGetChannelRequest
89 {
90 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
91 crate::wire::DeviceProxyGetChannelRequest,
92 Self,
93 > = unsafe {
94 ::fidl_next::CopyOptimization::enable_if(
95 true
96
97 && <
98 ::fidl_next::ServerEnd<crate::Device, ::fidl_next::fuchsia::zx::Channel> as ::fidl_next::FromWire<::fidl_next::ServerEnd<crate::Device, ::fidl_next::wire::fuchsia::Channel>>
99 >::COPY_OPTIMIZATION.is_enabled()
100
101 )
102 };
103
104 #[inline]
105 fn from_wire(wire: crate::wire::DeviceProxyGetChannelRequest) -> Self {
106 Self { req: ::fidl_next::FromWire::from_wire(wire.req) }
107 }
108 }
109}
110
111pub mod wire {
112
113 pub use fidl_next_common_fuchsia_hardware_serial::wire::*;
114
115 #[derive(Debug)]
117 #[repr(C)]
118 pub struct DeviceProxyGetChannelRequest {
119 pub req: ::fidl_next::ServerEnd<crate::Device, ::fidl_next::wire::fuchsia::Channel>,
120 }
121
122 static_assertions::const_assert_eq!(std::mem::size_of::<DeviceProxyGetChannelRequest>(), 4);
123 static_assertions::const_assert_eq!(std::mem::align_of::<DeviceProxyGetChannelRequest>(), 4);
124
125 static_assertions::const_assert_eq!(std::mem::offset_of!(DeviceProxyGetChannelRequest, req), 0);
126
127 impl ::fidl_next::Constrained for DeviceProxyGetChannelRequest {
128 type Constraint = ();
129
130 fn validate(
131 _: ::fidl_next::Slot<'_, Self>,
132 _: Self::Constraint,
133 ) -> Result<(), ::fidl_next::ValidationError> {
134 Ok(())
135 }
136 }
137
138 unsafe impl ::fidl_next::Wire for DeviceProxyGetChannelRequest {
139 type Narrowed<'de> = DeviceProxyGetChannelRequest;
140
141 #[inline]
142 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
143 ::fidl_next::munge! {
144 let Self {
145 req,
146
147 } = &mut *out_;
148 }
149
150 ::fidl_next::Wire::zero_padding(req);
151 }
152 }
153
154 unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceProxyGetChannelRequest
155 where
156 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
157 ___D: ::fidl_next::fuchsia::HandleDecoder,
158 {
159 fn decode(
160 slot_: ::fidl_next::Slot<'_, Self>,
161 decoder_: &mut ___D,
162 _: (),
163 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
164 ::fidl_next::munge! {
165 let Self {
166 mut req,
167
168 } = slot_;
169 }
170
171 let _field = req.as_mut();
172
173 ::fidl_next::Decode::decode(req.as_mut(), decoder_, ())?;
174
175 Ok(())
176 }
177 }
178
179 impl ::fidl_next::IntoNatural for DeviceProxyGetChannelRequest {
180 type Natural = crate::natural::DeviceProxyGetChannelRequest;
181 }
182}
183
184pub mod wire_optional {
185
186 pub use fidl_next_common_fuchsia_hardware_serial::wire_optional::*;
187}
188
189pub mod generic {
190
191 pub use fidl_next_common_fuchsia_hardware_serial::generic::*;
192
193 pub struct DeviceProxyGetChannelRequest<T0> {
195 pub req: T0,
196 }
197
198 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceProxyGetChannelRequest, ___E>
199 for DeviceProxyGetChannelRequest<T0>
200 where
201 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
202 ___E: ::fidl_next::fuchsia::HandleEncoder,
203 T0: ::fidl_next::Encode<
204 ::fidl_next::ServerEnd<crate::Device, ::fidl_next::wire::fuchsia::Channel>,
205 ___E,
206 >,
207 {
208 #[inline]
209 fn encode(
210 self,
211 encoder_: &mut ___E,
212 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceProxyGetChannelRequest>,
213 _: (),
214 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
215 ::fidl_next::munge! {
216 let crate::wire::DeviceProxyGetChannelRequest {
217 req,
218
219 } = out_;
220 }
221
222 ::fidl_next::Encode::encode(self.req, encoder_, req, ())?;
223
224 Ok(())
225 }
226 }
227
228 unsafe impl<'a, ___E, T0> ::fidl_next::Encode<crate::wire::DeviceProxyGetChannelRequest, ___E>
229 for &'a DeviceProxyGetChannelRequest<T0>
230 where
231 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
232 ___E: ::fidl_next::fuchsia::HandleEncoder,
233 &'a T0: ::fidl_next::Encode<
234 ::fidl_next::ServerEnd<crate::Device, ::fidl_next::wire::fuchsia::Channel>,
235 ___E,
236 >,
237 {
238 #[inline]
239 fn encode(
240 self,
241 encoder_: &mut ___E,
242 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceProxyGetChannelRequest>,
243 _: (),
244 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
245 ::fidl_next::munge! {
246 let crate::wire::DeviceProxyGetChannelRequest {
247 req,
248
249 } = out_;
250 }
251
252 ::fidl_next::Encode::encode(&self.req, encoder_, req, ())?;
253
254 Ok(())
255 }
256 }
257}
258
259pub use self::natural::*;
260
261#[derive(PartialEq, Debug)]
263pub struct DeviceProxy;
264
265impl ::fidl_next::Discoverable for DeviceProxy {
266 const PROTOCOL_NAME: &'static str = "fuchsia.hardware.serial.DeviceProxy";
267}
268
269#[cfg(target_os = "fuchsia")]
270impl ::fidl_next::HasTransport for DeviceProxy {
271 type Transport = ::fidl_next::fuchsia::zx::Channel;
272}
273
274pub mod device_proxy {
275 pub mod prelude {
276 pub use crate::{
277 DeviceProxy, DeviceProxyClientHandler, DeviceProxyLocalClientHandler,
278 DeviceProxyLocalServerHandler, DeviceProxyServerHandler, device_proxy,
279 };
280
281 pub use crate::natural::DeviceProxyGetChannelRequest;
282 }
283
284 pub struct GetChannel;
285
286 impl ::fidl_next::Method for GetChannel {
287 const ORDINAL: u64 = 6345319257718525951;
288 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
289 ::fidl_next::protocol::Flexibility::Strict;
290
291 type Protocol = crate::DeviceProxy;
292
293 type Request = crate::wire::DeviceProxyGetChannelRequest;
294 }
295
296 mod ___detail {
297 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::DeviceProxy
298 where
299 ___T: ::fidl_next::Transport,
300 {
301 type Client = DeviceProxyClient<___T>;
302 type Server = DeviceProxyServer<___T>;
303 }
304
305 #[repr(transparent)]
307 pub struct DeviceProxyClient<___T: ::fidl_next::Transport> {
308 #[allow(dead_code)]
309 client: ::fidl_next::protocol::Client<___T>,
310 }
311
312 impl<___T> DeviceProxyClient<___T>
313 where
314 ___T: ::fidl_next::Transport,
315 {
316 pub fn get_channel(
317 &self,
318
319 req: impl ::fidl_next::Encode<
320 ::fidl_next::ServerEnd<crate::Device, ::fidl_next::wire::fuchsia::Channel>,
321 <___T as ::fidl_next::Transport>::SendBuffer,
322 >,
323 ) -> ::fidl_next::SendFuture<'_, ___T>
324 where
325 <___T as ::fidl_next::Transport>::SendBuffer:
326 ::fidl_next::encoder::InternalHandleEncoder,
327 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
328 {
329 self.get_channel_with(crate::generic::DeviceProxyGetChannelRequest { req })
330 }
331
332 pub fn get_channel_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
333 where
334 ___R: ::fidl_next::Encode<
335 crate::wire::DeviceProxyGetChannelRequest,
336 <___T as ::fidl_next::Transport>::SendBuffer,
337 >,
338 {
339 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
340 6345319257718525951,
341 <super::GetChannel as ::fidl_next::Method>::FLEXIBILITY,
342 request,
343 ))
344 }
345 }
346
347 #[repr(transparent)]
349 pub struct DeviceProxyServer<___T: ::fidl_next::Transport> {
350 server: ::fidl_next::protocol::Server<___T>,
351 }
352
353 impl<___T> DeviceProxyServer<___T> where ___T: ::fidl_next::Transport {}
354 }
355}
356
357#[diagnostic::on_unimplemented(
358 note = "If {Self} implements the non-local DeviceProxyClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
359)]
360
361pub trait DeviceProxyLocalClientHandler<
365 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
366 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
367>
368{
369}
370
371impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for DeviceProxy
372where
373 ___H: DeviceProxyLocalClientHandler<___T>,
374 ___T: ::fidl_next::Transport,
375{
376 async fn on_event(
377 handler: &mut ___H,
378 mut message: ::fidl_next::Message<___T>,
379 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
380 match *message.header().ordinal {
381 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
382 }
383 }
384}
385
386#[diagnostic::on_unimplemented(
387 note = "If {Self} implements the non-local DeviceProxyServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
388)]
389
390pub trait DeviceProxyLocalServerHandler<
394 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
395 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
396>
397{
398 fn get_channel(
399 &mut self,
400
401 request: ::fidl_next::Request<device_proxy::GetChannel, ___T>,
402 ) -> impl ::core::future::Future<Output = ()>;
403}
404
405impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for DeviceProxy
406where
407 ___H: DeviceProxyLocalServerHandler<___T>,
408 ___T: ::fidl_next::Transport,
409 for<'de> crate::wire::DeviceProxyGetChannelRequest: ::fidl_next::Decode<
410 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
411 Constraint = (),
412 >,
413{
414 async fn on_one_way(
415 handler: &mut ___H,
416 mut message: ::fidl_next::Message<___T>,
417 ) -> ::core::result::Result<
418 (),
419 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
420 > {
421 match *message.header().ordinal {
422 6345319257718525951 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
423 Ok(decoded) => {
424 handler.get_channel(::fidl_next::Request::from_decoded(decoded)).await;
425 Ok(())
426 }
427 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
428 ordinal: 6345319257718525951,
429 error,
430 }),
431 },
432
433 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
434 }
435 }
436
437 async fn on_two_way(
438 handler: &mut ___H,
439 mut message: ::fidl_next::Message<___T>,
440 responder: ::fidl_next::protocol::Responder<___T>,
441 ) -> ::core::result::Result<
442 (),
443 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
444 > {
445 match *message.header().ordinal {
446 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
447 }
448 }
449}
450
451pub trait DeviceProxyClientHandler<
455 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
456 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
457>
458{
459}
460
461impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for DeviceProxy
462where
463 ___H: DeviceProxyClientHandler<___T> + ::core::marker::Send,
464 ___T: ::fidl_next::Transport,
465{
466 async fn on_event(
467 handler: &mut ___H,
468 mut message: ::fidl_next::Message<___T>,
469 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
470 match *message.header().ordinal {
471 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
472 }
473 }
474}
475
476pub trait DeviceProxyServerHandler<
480 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
481 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
482>
483{
484 fn get_channel(
485 &mut self,
486
487 request: ::fidl_next::Request<device_proxy::GetChannel, ___T>,
488 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
489}
490
491impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for DeviceProxy
492where
493 ___H: DeviceProxyServerHandler<___T> + ::core::marker::Send,
494 ___T: ::fidl_next::Transport,
495 for<'de> crate::wire::DeviceProxyGetChannelRequest: ::fidl_next::Decode<
496 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
497 Constraint = (),
498 >,
499{
500 async fn on_one_way(
501 handler: &mut ___H,
502 mut message: ::fidl_next::Message<___T>,
503 ) -> ::core::result::Result<
504 (),
505 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
506 > {
507 match *message.header().ordinal {
508 6345319257718525951 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
509 Ok(decoded) => {
510 handler.get_channel(::fidl_next::Request::from_decoded(decoded)).await;
511 Ok(())
512 }
513 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
514 ordinal: 6345319257718525951,
515 error,
516 }),
517 },
518
519 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
520 }
521 }
522
523 async fn on_two_way(
524 handler: &mut ___H,
525 mut message: ::fidl_next::Message<___T>,
526 responder: ::fidl_next::protocol::Responder<___T>,
527 ) -> ::core::result::Result<
528 (),
529 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
530 > {
531 match *message.header().ordinal {
532 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
533 }
534 }
535}
536
537impl<___T> DeviceProxyClientHandler<___T> for ::fidl_next::IgnoreEvents where
538 ___T: ::fidl_next::Transport
539{
540}
541
542impl<___H, ___T> DeviceProxyLocalClientHandler<___T> for ::fidl_next::Local<___H>
543where
544 ___H: DeviceProxyClientHandler<___T>,
545 ___T: ::fidl_next::Transport,
546{
547}
548
549impl<___H, ___T> DeviceProxyLocalServerHandler<___T> for ::fidl_next::Local<___H>
550where
551 ___H: DeviceProxyServerHandler<___T>,
552 ___T: ::fidl_next::Transport,
553{
554 async fn get_channel(&mut self, request: ::fidl_next::Request<device_proxy::GetChannel, ___T>) {
555 ___H::get_channel(&mut self.0, request).await
556 }
557}
558
559#[derive(Debug)]
561pub struct Service;
562
563impl ::fidl_next::DiscoverableService for Service {
564 const SERVICE_NAME: &'static str = "fuchsia.hardware.serial.Service";
565 const MEMBER_NAMES: &'static [&'static str] = &["device"];
566}
567
568impl ::fidl_next::HasServiceRequest<::fidl_next::fuchsia::zx::Channel> for Service {}
569
570impl<___C> ::fidl_next::Service<___C> for Service
571where
572 ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
573{
574 type Connector = ServiceConnector<___C>;
575}
576
577#[repr(transparent)]
579pub struct ServiceConnector<___C> {
580 #[allow(dead_code)]
581 connector: ___C,
582}
583
584impl<___C> ServiceConnector<___C>
585where
586 ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
587{
588 pub fn device(
590 &self,
591 server_end: ::fidl_next::ServerEnd<crate::Device, ::fidl_next::fuchsia::zx::Channel>,
592 ) -> ::core::result::Result<
593 (),
594 <___C as ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>>::Error,
595 > {
596 ::fidl_next::protocol::ServiceConnector::<
597 ::fidl_next::fuchsia::zx::Channel
598 >::connect_to_member(
599 &self.connector,
600 "device",
601 server_end.into_untyped(),
602 )
603 }
604}
605
606pub trait ServiceHandler {
608 fn device(
610 &self,
611 server_end: ::fidl_next::ServerEnd<crate::Device, ::fidl_next::fuchsia::zx::Channel>,
612 );
613}
614
615impl<___H, ___T> ::fidl_next::DispatchServiceHandler<___H, ___T> for Service
616where
617 ___H: ServiceHandler,
618 ::fidl_next::fuchsia::zx::Channel: ::fidl_next::InstanceFromServiceTransport<___T>,
619{
620 fn on_connection(handler: &___H, member: &str, server_end: ___T) {
621 use ::fidl_next::InstanceFromServiceTransport;
622 match member {
623 "device" => handler.device(::fidl_next::ServerEnd::from_untyped(
624 ::fidl_next::fuchsia::zx::Channel::from_service_transport(server_end),
625 )),
626
627 _ => unreachable!(),
628 }
629 }
630}
631
632pub use fidl_next_common_fuchsia_hardware_serial::*;