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
229pub use self::natural::*;
230
231#[derive(PartialEq, Debug)]
233pub struct DeviceProxy;
234
235impl ::fidl_next::Discoverable for DeviceProxy {
236 const PROTOCOL_NAME: &'static str = "fuchsia.hardware.serial.DeviceProxy";
237}
238
239#[cfg(target_os = "fuchsia")]
240impl ::fidl_next::HasTransport for DeviceProxy {
241 type Transport = ::fidl_next::fuchsia::zx::Channel;
242}
243
244pub mod device_proxy {
245 pub mod prelude {
246 pub use crate::{
247 DeviceProxy, DeviceProxyClientHandler, DeviceProxyLocalClientHandler,
248 DeviceProxyLocalServerHandler, DeviceProxyServerHandler, device_proxy,
249 };
250
251 pub use crate::natural::DeviceProxyGetChannelRequest;
252 }
253
254 pub struct GetChannel;
255
256 impl ::fidl_next::Method for GetChannel {
257 const ORDINAL: u64 = 6345319257718525951;
258 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
259 ::fidl_next::protocol::Flexibility::Strict;
260
261 type Protocol = crate::DeviceProxy;
262
263 type Request = crate::wire::DeviceProxyGetChannelRequest;
264 }
265
266 mod ___detail {
267 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::DeviceProxy
268 where
269 ___T: ::fidl_next::Transport,
270 {
271 type Client = DeviceProxyClient<___T>;
272 type Server = DeviceProxyServer<___T>;
273 }
274
275 #[repr(transparent)]
277 pub struct DeviceProxyClient<___T: ::fidl_next::Transport> {
278 #[allow(dead_code)]
279 client: ::fidl_next::protocol::Client<___T>,
280 }
281
282 impl<___T> DeviceProxyClient<___T>
283 where
284 ___T: ::fidl_next::Transport,
285 {
286 pub fn get_channel(
287 &self,
288
289 req: impl ::fidl_next::Encode<
290 ::fidl_next::ServerEnd<crate::Device, ::fidl_next::wire::fuchsia::Channel>,
291 <___T as ::fidl_next::Transport>::SendBuffer,
292 >,
293 ) -> ::fidl_next::SendFuture<'_, ___T>
294 where
295 <___T as ::fidl_next::Transport>::SendBuffer:
296 ::fidl_next::encoder::InternalHandleEncoder,
297 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
298 {
299 self.get_channel_with(crate::generic::DeviceProxyGetChannelRequest { req })
300 }
301
302 pub fn get_channel_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
303 where
304 ___R: ::fidl_next::Encode<
305 crate::wire::DeviceProxyGetChannelRequest,
306 <___T as ::fidl_next::Transport>::SendBuffer,
307 >,
308 {
309 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
310 6345319257718525951,
311 <super::GetChannel as ::fidl_next::Method>::FLEXIBILITY,
312 request,
313 ))
314 }
315 }
316
317 #[repr(transparent)]
319 pub struct DeviceProxyServer<___T: ::fidl_next::Transport> {
320 server: ::fidl_next::protocol::Server<___T>,
321 }
322
323 impl<___T> DeviceProxyServer<___T> where ___T: ::fidl_next::Transport {}
324 }
325}
326
327#[diagnostic::on_unimplemented(
328 note = "If {Self} implements the non-local DeviceProxyClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
329)]
330
331pub trait DeviceProxyLocalClientHandler<
335 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
336 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
337>
338{
339}
340
341impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for DeviceProxy
342where
343 ___H: DeviceProxyLocalClientHandler<___T>,
344 ___T: ::fidl_next::Transport,
345{
346 async fn on_event(
347 handler: &mut ___H,
348 mut message: ::fidl_next::Message<___T>,
349 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
350 match *message.header().ordinal {
351 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
352 }
353 }
354}
355
356#[diagnostic::on_unimplemented(
357 note = "If {Self} implements the non-local DeviceProxyServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
358)]
359
360pub trait DeviceProxyLocalServerHandler<
364 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
365 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
366>
367{
368 fn get_channel(
369 &mut self,
370
371 request: ::fidl_next::Request<device_proxy::GetChannel, ___T>,
372 ) -> impl ::core::future::Future<Output = ()>;
373}
374
375impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for DeviceProxy
376where
377 ___H: DeviceProxyLocalServerHandler<___T>,
378 ___T: ::fidl_next::Transport,
379 for<'de> crate::wire::DeviceProxyGetChannelRequest: ::fidl_next::Decode<
380 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
381 Constraint = (),
382 >,
383{
384 async fn on_one_way(
385 handler: &mut ___H,
386 mut message: ::fidl_next::Message<___T>,
387 ) -> ::core::result::Result<
388 (),
389 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
390 > {
391 match *message.header().ordinal {
392 6345319257718525951 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
393 Ok(decoded) => {
394 handler.get_channel(::fidl_next::Request::from_decoded(decoded)).await;
395 Ok(())
396 }
397 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
398 ordinal: 6345319257718525951,
399 error,
400 }),
401 },
402
403 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
404 }
405 }
406
407 async fn on_two_way(
408 handler: &mut ___H,
409 mut message: ::fidl_next::Message<___T>,
410 responder: ::fidl_next::protocol::Responder<___T>,
411 ) -> ::core::result::Result<
412 (),
413 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
414 > {
415 match *message.header().ordinal {
416 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
417 }
418 }
419}
420
421pub trait DeviceProxyClientHandler<
425 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
426 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
427>
428{
429}
430
431impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for DeviceProxy
432where
433 ___H: DeviceProxyClientHandler<___T> + ::core::marker::Send,
434 ___T: ::fidl_next::Transport,
435{
436 async fn on_event(
437 handler: &mut ___H,
438 mut message: ::fidl_next::Message<___T>,
439 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
440 match *message.header().ordinal {
441 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
442 }
443 }
444}
445
446pub trait DeviceProxyServerHandler<
450 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
451 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
452>
453{
454 fn get_channel(
455 &mut self,
456
457 request: ::fidl_next::Request<device_proxy::GetChannel, ___T>,
458 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
459}
460
461impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for DeviceProxy
462where
463 ___H: DeviceProxyServerHandler<___T> + ::core::marker::Send,
464 ___T: ::fidl_next::Transport,
465 for<'de> crate::wire::DeviceProxyGetChannelRequest: ::fidl_next::Decode<
466 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
467 Constraint = (),
468 >,
469{
470 async fn on_one_way(
471 handler: &mut ___H,
472 mut message: ::fidl_next::Message<___T>,
473 ) -> ::core::result::Result<
474 (),
475 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
476 > {
477 match *message.header().ordinal {
478 6345319257718525951 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
479 Ok(decoded) => {
480 handler.get_channel(::fidl_next::Request::from_decoded(decoded)).await;
481 Ok(())
482 }
483 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
484 ordinal: 6345319257718525951,
485 error,
486 }),
487 },
488
489 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
490 }
491 }
492
493 async fn on_two_way(
494 handler: &mut ___H,
495 mut message: ::fidl_next::Message<___T>,
496 responder: ::fidl_next::protocol::Responder<___T>,
497 ) -> ::core::result::Result<
498 (),
499 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
500 > {
501 match *message.header().ordinal {
502 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
503 }
504 }
505}
506
507impl<___T> DeviceProxyClientHandler<___T> for ::fidl_next::IgnoreEvents where
508 ___T: ::fidl_next::Transport
509{
510}
511
512impl<___H, ___T> DeviceProxyLocalClientHandler<___T> for ::fidl_next::Local<___H>
513where
514 ___H: DeviceProxyClientHandler<___T>,
515 ___T: ::fidl_next::Transport,
516{
517}
518
519impl<___H, ___T> DeviceProxyLocalServerHandler<___T> for ::fidl_next::Local<___H>
520where
521 ___H: DeviceProxyServerHandler<___T>,
522 ___T: ::fidl_next::Transport,
523{
524 async fn get_channel(&mut self, request: ::fidl_next::Request<device_proxy::GetChannel, ___T>) {
525 ___H::get_channel(&mut self.0, request).await
526 }
527}
528
529#[derive(Debug)]
531pub struct Service;
532
533impl ::fidl_next::DiscoverableService for Service {
534 const SERVICE_NAME: &'static str = "fuchsia.hardware.serial.Service";
535 const MEMBER_NAMES: &'static [&'static str] = &["device"];
536}
537
538impl ::fidl_next::HasServiceRequest<::fidl_next::fuchsia::zx::Channel> for Service {}
539
540impl<___C> ::fidl_next::Service<___C> for Service
541where
542 ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
543{
544 type Connector = ServiceConnector<___C>;
545}
546
547#[repr(transparent)]
549pub struct ServiceConnector<___C> {
550 #[allow(dead_code)]
551 connector: ___C,
552}
553
554impl<___C> ServiceConnector<___C>
555where
556 ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
557{
558 pub fn device(
560 &self,
561 server_end: ::fidl_next::ServerEnd<crate::Device, ::fidl_next::fuchsia::zx::Channel>,
562 ) -> ::core::result::Result<
563 (),
564 <___C as ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>>::Error,
565 > {
566 ::fidl_next::protocol::ServiceConnector::<
567 ::fidl_next::fuchsia::zx::Channel
568 >::connect_to_member(
569 &self.connector,
570 "device",
571 server_end.into_untyped(),
572 )
573 }
574}
575
576pub trait ServiceHandler {
578 fn device(
580 &self,
581 server_end: ::fidl_next::ServerEnd<crate::Device, ::fidl_next::fuchsia::zx::Channel>,
582 );
583}
584
585impl<___H, ___T> ::fidl_next::DispatchServiceHandler<___H, ___T> for Service
586where
587 ___H: ServiceHandler,
588 ::fidl_next::fuchsia::zx::Channel: ::fidl_next::InstanceFromServiceTransport<___T>,
589{
590 fn on_connection(handler: &___H, member: &str, server_end: ___T) {
591 use ::fidl_next::InstanceFromServiceTransport;
592 match member {
593 "device" => handler.device(::fidl_next::ServerEnd::from_untyped(
594 ::fidl_next::fuchsia::zx::Channel::from_service_transport(server_end),
595 )),
596
597 _ => unreachable!(),
598 }
599 }
600}
601
602pub use fidl_next_common_fuchsia_hardware_serial::*;