1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_hardware_serial_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct DeviceProxyGetChannelRequest {
16 pub req: fidl::endpoints::ServerEnd<DeviceMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20 for DeviceProxyGetChannelRequest
21{
22}
23
24#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
25pub struct DeviceMarker;
26
27impl fidl::endpoints::ProtocolMarker for DeviceMarker {
28 type Proxy = DeviceProxy;
29 type RequestStream = DeviceRequestStream;
30 #[cfg(target_os = "fuchsia")]
31 type SynchronousProxy = DeviceSynchronousProxy;
32
33 const DEBUG_NAME: &'static str = "(anonymous) Device";
34}
35pub type DeviceReadResult = Result<Vec<u8>, i32>;
36pub type DeviceWriteResult = Result<(), i32>;
37
38pub trait DeviceProxyInterface: Send + Sync {
39 type GetClassResponseFut: std::future::Future<Output = Result<Class, fidl::Error>> + Send;
40 fn r#get_class(&self) -> Self::GetClassResponseFut;
41 type SetConfigResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
42 fn r#set_config(&self, config: &Config) -> Self::SetConfigResponseFut;
43 type ReadResponseFut: std::future::Future<Output = Result<DeviceReadResult, fidl::Error>> + Send;
44 fn r#read(&self) -> Self::ReadResponseFut;
45 type WriteResponseFut: std::future::Future<Output = Result<DeviceWriteResult, fidl::Error>>
46 + Send;
47 fn r#write(&self, data: &[u8]) -> Self::WriteResponseFut;
48}
49#[derive(Debug)]
50#[cfg(target_os = "fuchsia")]
51pub struct DeviceSynchronousProxy {
52 client: fidl::client::sync::Client,
53}
54
55#[cfg(target_os = "fuchsia")]
56impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
57 type Proxy = DeviceProxy;
58 type Protocol = DeviceMarker;
59
60 fn from_channel(inner: fidl::Channel) -> Self {
61 Self::new(inner)
62 }
63
64 fn into_channel(self) -> fidl::Channel {
65 self.client.into_channel()
66 }
67
68 fn as_channel(&self) -> &fidl::Channel {
69 self.client.as_channel()
70 }
71}
72
73#[cfg(target_os = "fuchsia")]
74impl DeviceSynchronousProxy {
75 pub fn new(channel: fidl::Channel) -> Self {
76 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
77 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
78 }
79
80 pub fn into_channel(self) -> fidl::Channel {
81 self.client.into_channel()
82 }
83
84 pub fn wait_for_event(
87 &self,
88 deadline: zx::MonotonicInstant,
89 ) -> Result<DeviceEvent, fidl::Error> {
90 DeviceEvent::decode(self.client.wait_for_event(deadline)?)
91 }
92
93 pub fn r#get_class(&self, ___deadline: zx::MonotonicInstant) -> Result<Class, fidl::Error> {
95 let _response =
96 self.client.send_query::<fidl::encoding::EmptyPayload, DeviceGetClassResponse>(
97 (),
98 0x3d48bbcee248ab8b,
99 fidl::encoding::DynamicFlags::empty(),
100 ___deadline,
101 )?;
102 Ok(_response.device_class)
103 }
104
105 pub fn r#set_config(
107 &self,
108 mut config: &Config,
109 ___deadline: zx::MonotonicInstant,
110 ) -> Result<i32, fidl::Error> {
111 let _response = self.client.send_query::<DeviceSetConfigRequest, DeviceSetConfigResponse>(
112 (config,),
113 0x771a0946f6f87173,
114 fidl::encoding::DynamicFlags::empty(),
115 ___deadline,
116 )?;
117 Ok(_response.s)
118 }
119
120 pub fn r#read(
122 &self,
123 ___deadline: zx::MonotonicInstant,
124 ) -> Result<DeviceReadResult, fidl::Error> {
125 let _response = self.client.send_query::<
126 fidl::encoding::EmptyPayload,
127 fidl::encoding::ResultType<DeviceReadResponse, i32>,
128 >(
129 (),
130 0x63c41d3c053fadd8,
131 fidl::encoding::DynamicFlags::empty(),
132 ___deadline,
133 )?;
134 Ok(_response.map(|x| x.data))
135 }
136
137 pub fn r#write(
139 &self,
140 mut data: &[u8],
141 ___deadline: zx::MonotonicInstant,
142 ) -> Result<DeviceWriteResult, fidl::Error> {
143 let _response = self.client.send_query::<
144 DeviceWriteRequest,
145 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
146 >(
147 (data,),
148 0x6aa7adae6841779c,
149 fidl::encoding::DynamicFlags::empty(),
150 ___deadline,
151 )?;
152 Ok(_response.map(|x| x))
153 }
154}
155
156#[cfg(target_os = "fuchsia")]
157impl From<DeviceSynchronousProxy> for zx::Handle {
158 fn from(value: DeviceSynchronousProxy) -> Self {
159 value.into_channel().into()
160 }
161}
162
163#[cfg(target_os = "fuchsia")]
164impl From<fidl::Channel> for DeviceSynchronousProxy {
165 fn from(value: fidl::Channel) -> Self {
166 Self::new(value)
167 }
168}
169
170#[derive(Debug, Clone)]
171pub struct DeviceProxy {
172 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
173}
174
175impl fidl::endpoints::Proxy for DeviceProxy {
176 type Protocol = DeviceMarker;
177
178 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
179 Self::new(inner)
180 }
181
182 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
183 self.client.into_channel().map_err(|client| Self { client })
184 }
185
186 fn as_channel(&self) -> &::fidl::AsyncChannel {
187 self.client.as_channel()
188 }
189}
190
191impl DeviceProxy {
192 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
194 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
195 Self { client: fidl::client::Client::new(channel, protocol_name) }
196 }
197
198 pub fn take_event_stream(&self) -> DeviceEventStream {
204 DeviceEventStream { event_receiver: self.client.take_event_receiver() }
205 }
206
207 pub fn r#get_class(
209 &self,
210 ) -> fidl::client::QueryResponseFut<Class, fidl::encoding::DefaultFuchsiaResourceDialect> {
211 DeviceProxyInterface::r#get_class(self)
212 }
213
214 pub fn r#set_config(
216 &self,
217 mut config: &Config,
218 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
219 DeviceProxyInterface::r#set_config(self, config)
220 }
221
222 pub fn r#read(
224 &self,
225 ) -> fidl::client::QueryResponseFut<
226 DeviceReadResult,
227 fidl::encoding::DefaultFuchsiaResourceDialect,
228 > {
229 DeviceProxyInterface::r#read(self)
230 }
231
232 pub fn r#write(
234 &self,
235 mut data: &[u8],
236 ) -> fidl::client::QueryResponseFut<
237 DeviceWriteResult,
238 fidl::encoding::DefaultFuchsiaResourceDialect,
239 > {
240 DeviceProxyInterface::r#write(self, data)
241 }
242}
243
244impl DeviceProxyInterface for DeviceProxy {
245 type GetClassResponseFut =
246 fidl::client::QueryResponseFut<Class, fidl::encoding::DefaultFuchsiaResourceDialect>;
247 fn r#get_class(&self) -> Self::GetClassResponseFut {
248 fn _decode(
249 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
250 ) -> Result<Class, fidl::Error> {
251 let _response = fidl::client::decode_transaction_body::<
252 DeviceGetClassResponse,
253 fidl::encoding::DefaultFuchsiaResourceDialect,
254 0x3d48bbcee248ab8b,
255 >(_buf?)?;
256 Ok(_response.device_class)
257 }
258 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Class>(
259 (),
260 0x3d48bbcee248ab8b,
261 fidl::encoding::DynamicFlags::empty(),
262 _decode,
263 )
264 }
265
266 type SetConfigResponseFut =
267 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
268 fn r#set_config(&self, mut config: &Config) -> Self::SetConfigResponseFut {
269 fn _decode(
270 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
271 ) -> Result<i32, fidl::Error> {
272 let _response = fidl::client::decode_transaction_body::<
273 DeviceSetConfigResponse,
274 fidl::encoding::DefaultFuchsiaResourceDialect,
275 0x771a0946f6f87173,
276 >(_buf?)?;
277 Ok(_response.s)
278 }
279 self.client.send_query_and_decode::<DeviceSetConfigRequest, i32>(
280 (config,),
281 0x771a0946f6f87173,
282 fidl::encoding::DynamicFlags::empty(),
283 _decode,
284 )
285 }
286
287 type ReadResponseFut = fidl::client::QueryResponseFut<
288 DeviceReadResult,
289 fidl::encoding::DefaultFuchsiaResourceDialect,
290 >;
291 fn r#read(&self) -> Self::ReadResponseFut {
292 fn _decode(
293 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
294 ) -> Result<DeviceReadResult, fidl::Error> {
295 let _response = fidl::client::decode_transaction_body::<
296 fidl::encoding::ResultType<DeviceReadResponse, i32>,
297 fidl::encoding::DefaultFuchsiaResourceDialect,
298 0x63c41d3c053fadd8,
299 >(_buf?)?;
300 Ok(_response.map(|x| x.data))
301 }
302 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceReadResult>(
303 (),
304 0x63c41d3c053fadd8,
305 fidl::encoding::DynamicFlags::empty(),
306 _decode,
307 )
308 }
309
310 type WriteResponseFut = fidl::client::QueryResponseFut<
311 DeviceWriteResult,
312 fidl::encoding::DefaultFuchsiaResourceDialect,
313 >;
314 fn r#write(&self, mut data: &[u8]) -> Self::WriteResponseFut {
315 fn _decode(
316 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
317 ) -> Result<DeviceWriteResult, fidl::Error> {
318 let _response = fidl::client::decode_transaction_body::<
319 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
320 fidl::encoding::DefaultFuchsiaResourceDialect,
321 0x6aa7adae6841779c,
322 >(_buf?)?;
323 Ok(_response.map(|x| x))
324 }
325 self.client.send_query_and_decode::<DeviceWriteRequest, DeviceWriteResult>(
326 (data,),
327 0x6aa7adae6841779c,
328 fidl::encoding::DynamicFlags::empty(),
329 _decode,
330 )
331 }
332}
333
334pub struct DeviceEventStream {
335 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
336}
337
338impl std::marker::Unpin for DeviceEventStream {}
339
340impl futures::stream::FusedStream for DeviceEventStream {
341 fn is_terminated(&self) -> bool {
342 self.event_receiver.is_terminated()
343 }
344}
345
346impl futures::Stream for DeviceEventStream {
347 type Item = Result<DeviceEvent, fidl::Error>;
348
349 fn poll_next(
350 mut self: std::pin::Pin<&mut Self>,
351 cx: &mut std::task::Context<'_>,
352 ) -> std::task::Poll<Option<Self::Item>> {
353 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
354 &mut self.event_receiver,
355 cx
356 )?) {
357 Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
358 None => std::task::Poll::Ready(None),
359 }
360 }
361}
362
363#[derive(Debug)]
364pub enum DeviceEvent {}
365
366impl DeviceEvent {
367 fn decode(
369 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
370 ) -> Result<DeviceEvent, fidl::Error> {
371 let (bytes, _handles) = buf.split_mut();
372 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
373 debug_assert_eq!(tx_header.tx_id, 0);
374 match tx_header.ordinal {
375 _ => Err(fidl::Error::UnknownOrdinal {
376 ordinal: tx_header.ordinal,
377 protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
378 }),
379 }
380 }
381}
382
383pub struct DeviceRequestStream {
385 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
386 is_terminated: bool,
387}
388
389impl std::marker::Unpin for DeviceRequestStream {}
390
391impl futures::stream::FusedStream for DeviceRequestStream {
392 fn is_terminated(&self) -> bool {
393 self.is_terminated
394 }
395}
396
397impl fidl::endpoints::RequestStream for DeviceRequestStream {
398 type Protocol = DeviceMarker;
399 type ControlHandle = DeviceControlHandle;
400
401 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
402 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
403 }
404
405 fn control_handle(&self) -> Self::ControlHandle {
406 DeviceControlHandle { inner: self.inner.clone() }
407 }
408
409 fn into_inner(
410 self,
411 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
412 {
413 (self.inner, self.is_terminated)
414 }
415
416 fn from_inner(
417 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
418 is_terminated: bool,
419 ) -> Self {
420 Self { inner, is_terminated }
421 }
422}
423
424impl futures::Stream for DeviceRequestStream {
425 type Item = Result<DeviceRequest, fidl::Error>;
426
427 fn poll_next(
428 mut self: std::pin::Pin<&mut Self>,
429 cx: &mut std::task::Context<'_>,
430 ) -> std::task::Poll<Option<Self::Item>> {
431 let this = &mut *self;
432 if this.inner.check_shutdown(cx) {
433 this.is_terminated = true;
434 return std::task::Poll::Ready(None);
435 }
436 if this.is_terminated {
437 panic!("polled DeviceRequestStream after completion");
438 }
439 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
440 |bytes, handles| {
441 match this.inner.channel().read_etc(cx, bytes, handles) {
442 std::task::Poll::Ready(Ok(())) => {}
443 std::task::Poll::Pending => return std::task::Poll::Pending,
444 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
445 this.is_terminated = true;
446 return std::task::Poll::Ready(None);
447 }
448 std::task::Poll::Ready(Err(e)) => {
449 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
450 e.into(),
451 ))))
452 }
453 }
454
455 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
457
458 std::task::Poll::Ready(Some(match header.ordinal {
459 0x3d48bbcee248ab8b => {
460 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
461 let mut req = fidl::new_empty!(
462 fidl::encoding::EmptyPayload,
463 fidl::encoding::DefaultFuchsiaResourceDialect
464 );
465 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
466 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
467 Ok(DeviceRequest::GetClass {
468 responder: DeviceGetClassResponder {
469 control_handle: std::mem::ManuallyDrop::new(control_handle),
470 tx_id: header.tx_id,
471 },
472 })
473 }
474 0x771a0946f6f87173 => {
475 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
476 let mut req = fidl::new_empty!(
477 DeviceSetConfigRequest,
478 fidl::encoding::DefaultFuchsiaResourceDialect
479 );
480 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetConfigRequest>(&header, _body_bytes, handles, &mut req)?;
481 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
482 Ok(DeviceRequest::SetConfig {
483 config: req.config,
484
485 responder: DeviceSetConfigResponder {
486 control_handle: std::mem::ManuallyDrop::new(control_handle),
487 tx_id: header.tx_id,
488 },
489 })
490 }
491 0x63c41d3c053fadd8 => {
492 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
493 let mut req = fidl::new_empty!(
494 fidl::encoding::EmptyPayload,
495 fidl::encoding::DefaultFuchsiaResourceDialect
496 );
497 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
498 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
499 Ok(DeviceRequest::Read {
500 responder: DeviceReadResponder {
501 control_handle: std::mem::ManuallyDrop::new(control_handle),
502 tx_id: header.tx_id,
503 },
504 })
505 }
506 0x6aa7adae6841779c => {
507 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
508 let mut req = fidl::new_empty!(
509 DeviceWriteRequest,
510 fidl::encoding::DefaultFuchsiaResourceDialect
511 );
512 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceWriteRequest>(&header, _body_bytes, handles, &mut req)?;
513 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
514 Ok(DeviceRequest::Write {
515 data: req.data,
516
517 responder: DeviceWriteResponder {
518 control_handle: std::mem::ManuallyDrop::new(control_handle),
519 tx_id: header.tx_id,
520 },
521 })
522 }
523 _ => Err(fidl::Error::UnknownOrdinal {
524 ordinal: header.ordinal,
525 protocol_name:
526 <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
527 }),
528 }))
529 },
530 )
531 }
532}
533
534#[derive(Debug)]
536pub enum DeviceRequest {
537 GetClass { responder: DeviceGetClassResponder },
539 SetConfig { config: Config, responder: DeviceSetConfigResponder },
541 Read { responder: DeviceReadResponder },
543 Write { data: Vec<u8>, responder: DeviceWriteResponder },
545}
546
547impl DeviceRequest {
548 #[allow(irrefutable_let_patterns)]
549 pub fn into_get_class(self) -> Option<(DeviceGetClassResponder)> {
550 if let DeviceRequest::GetClass { responder } = self {
551 Some((responder))
552 } else {
553 None
554 }
555 }
556
557 #[allow(irrefutable_let_patterns)]
558 pub fn into_set_config(self) -> Option<(Config, DeviceSetConfigResponder)> {
559 if let DeviceRequest::SetConfig { config, responder } = self {
560 Some((config, responder))
561 } else {
562 None
563 }
564 }
565
566 #[allow(irrefutable_let_patterns)]
567 pub fn into_read(self) -> Option<(DeviceReadResponder)> {
568 if let DeviceRequest::Read { responder } = self {
569 Some((responder))
570 } else {
571 None
572 }
573 }
574
575 #[allow(irrefutable_let_patterns)]
576 pub fn into_write(self) -> Option<(Vec<u8>, DeviceWriteResponder)> {
577 if let DeviceRequest::Write { data, responder } = self {
578 Some((data, responder))
579 } else {
580 None
581 }
582 }
583
584 pub fn method_name(&self) -> &'static str {
586 match *self {
587 DeviceRequest::GetClass { .. } => "get_class",
588 DeviceRequest::SetConfig { .. } => "set_config",
589 DeviceRequest::Read { .. } => "read",
590 DeviceRequest::Write { .. } => "write",
591 }
592 }
593}
594
595#[derive(Debug, Clone)]
596pub struct DeviceControlHandle {
597 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
598}
599
600impl fidl::endpoints::ControlHandle for DeviceControlHandle {
601 fn shutdown(&self) {
602 self.inner.shutdown()
603 }
604 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
605 self.inner.shutdown_with_epitaph(status)
606 }
607
608 fn is_closed(&self) -> bool {
609 self.inner.channel().is_closed()
610 }
611 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
612 self.inner.channel().on_closed()
613 }
614
615 #[cfg(target_os = "fuchsia")]
616 fn signal_peer(
617 &self,
618 clear_mask: zx::Signals,
619 set_mask: zx::Signals,
620 ) -> Result<(), zx_status::Status> {
621 use fidl::Peered;
622 self.inner.channel().signal_peer(clear_mask, set_mask)
623 }
624}
625
626impl DeviceControlHandle {}
627
628#[must_use = "FIDL methods require a response to be sent"]
629#[derive(Debug)]
630pub struct DeviceGetClassResponder {
631 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
632 tx_id: u32,
633}
634
635impl std::ops::Drop for DeviceGetClassResponder {
639 fn drop(&mut self) {
640 self.control_handle.shutdown();
641 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
643 }
644}
645
646impl fidl::endpoints::Responder for DeviceGetClassResponder {
647 type ControlHandle = DeviceControlHandle;
648
649 fn control_handle(&self) -> &DeviceControlHandle {
650 &self.control_handle
651 }
652
653 fn drop_without_shutdown(mut self) {
654 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
656 std::mem::forget(self);
658 }
659}
660
661impl DeviceGetClassResponder {
662 pub fn send(self, mut device_class: Class) -> Result<(), fidl::Error> {
666 let _result = self.send_raw(device_class);
667 if _result.is_err() {
668 self.control_handle.shutdown();
669 }
670 self.drop_without_shutdown();
671 _result
672 }
673
674 pub fn send_no_shutdown_on_err(self, mut device_class: Class) -> Result<(), fidl::Error> {
676 let _result = self.send_raw(device_class);
677 self.drop_without_shutdown();
678 _result
679 }
680
681 fn send_raw(&self, mut device_class: Class) -> Result<(), fidl::Error> {
682 self.control_handle.inner.send::<DeviceGetClassResponse>(
683 (device_class,),
684 self.tx_id,
685 0x3d48bbcee248ab8b,
686 fidl::encoding::DynamicFlags::empty(),
687 )
688 }
689}
690
691#[must_use = "FIDL methods require a response to be sent"]
692#[derive(Debug)]
693pub struct DeviceSetConfigResponder {
694 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
695 tx_id: u32,
696}
697
698impl std::ops::Drop for DeviceSetConfigResponder {
702 fn drop(&mut self) {
703 self.control_handle.shutdown();
704 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
706 }
707}
708
709impl fidl::endpoints::Responder for DeviceSetConfigResponder {
710 type ControlHandle = DeviceControlHandle;
711
712 fn control_handle(&self) -> &DeviceControlHandle {
713 &self.control_handle
714 }
715
716 fn drop_without_shutdown(mut self) {
717 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
719 std::mem::forget(self);
721 }
722}
723
724impl DeviceSetConfigResponder {
725 pub fn send(self, mut s: i32) -> Result<(), fidl::Error> {
729 let _result = self.send_raw(s);
730 if _result.is_err() {
731 self.control_handle.shutdown();
732 }
733 self.drop_without_shutdown();
734 _result
735 }
736
737 pub fn send_no_shutdown_on_err(self, mut s: i32) -> Result<(), fidl::Error> {
739 let _result = self.send_raw(s);
740 self.drop_without_shutdown();
741 _result
742 }
743
744 fn send_raw(&self, mut s: i32) -> Result<(), fidl::Error> {
745 self.control_handle.inner.send::<DeviceSetConfigResponse>(
746 (s,),
747 self.tx_id,
748 0x771a0946f6f87173,
749 fidl::encoding::DynamicFlags::empty(),
750 )
751 }
752}
753
754#[must_use = "FIDL methods require a response to be sent"]
755#[derive(Debug)]
756pub struct DeviceReadResponder {
757 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
758 tx_id: u32,
759}
760
761impl std::ops::Drop for DeviceReadResponder {
765 fn drop(&mut self) {
766 self.control_handle.shutdown();
767 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
769 }
770}
771
772impl fidl::endpoints::Responder for DeviceReadResponder {
773 type ControlHandle = DeviceControlHandle;
774
775 fn control_handle(&self) -> &DeviceControlHandle {
776 &self.control_handle
777 }
778
779 fn drop_without_shutdown(mut self) {
780 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
782 std::mem::forget(self);
784 }
785}
786
787impl DeviceReadResponder {
788 pub fn send(self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
792 let _result = self.send_raw(result);
793 if _result.is_err() {
794 self.control_handle.shutdown();
795 }
796 self.drop_without_shutdown();
797 _result
798 }
799
800 pub fn send_no_shutdown_on_err(
802 self,
803 mut result: Result<&[u8], i32>,
804 ) -> Result<(), fidl::Error> {
805 let _result = self.send_raw(result);
806 self.drop_without_shutdown();
807 _result
808 }
809
810 fn send_raw(&self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
811 self.control_handle.inner.send::<fidl::encoding::ResultType<DeviceReadResponse, i32>>(
812 result.map(|data| (data,)),
813 self.tx_id,
814 0x63c41d3c053fadd8,
815 fidl::encoding::DynamicFlags::empty(),
816 )
817 }
818}
819
820#[must_use = "FIDL methods require a response to be sent"]
821#[derive(Debug)]
822pub struct DeviceWriteResponder {
823 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
824 tx_id: u32,
825}
826
827impl std::ops::Drop for DeviceWriteResponder {
831 fn drop(&mut self) {
832 self.control_handle.shutdown();
833 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
835 }
836}
837
838impl fidl::endpoints::Responder for DeviceWriteResponder {
839 type ControlHandle = DeviceControlHandle;
840
841 fn control_handle(&self) -> &DeviceControlHandle {
842 &self.control_handle
843 }
844
845 fn drop_without_shutdown(mut self) {
846 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
848 std::mem::forget(self);
850 }
851}
852
853impl DeviceWriteResponder {
854 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
858 let _result = self.send_raw(result);
859 if _result.is_err() {
860 self.control_handle.shutdown();
861 }
862 self.drop_without_shutdown();
863 _result
864 }
865
866 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
868 let _result = self.send_raw(result);
869 self.drop_without_shutdown();
870 _result
871 }
872
873 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
874 self.control_handle
875 .inner
876 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
877 result,
878 self.tx_id,
879 0x6aa7adae6841779c,
880 fidl::encoding::DynamicFlags::empty(),
881 )
882 }
883}
884
885#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
886pub struct DeviceProxy_Marker;
887
888impl fidl::endpoints::ProtocolMarker for DeviceProxy_Marker {
889 type Proxy = DeviceProxy_Proxy;
890 type RequestStream = DeviceProxy_RequestStream;
891 #[cfg(target_os = "fuchsia")]
892 type SynchronousProxy = DeviceProxy_SynchronousProxy;
893
894 const DEBUG_NAME: &'static str = "fuchsia.hardware.serial.DeviceProxy";
895}
896impl fidl::endpoints::DiscoverableProtocolMarker for DeviceProxy_Marker {}
897
898pub trait DeviceProxy_ProxyInterface: Send + Sync {
899 fn r#get_channel(
900 &self,
901 req: fidl::endpoints::ServerEnd<DeviceMarker>,
902 ) -> Result<(), fidl::Error>;
903}
904#[derive(Debug)]
905#[cfg(target_os = "fuchsia")]
906pub struct DeviceProxy_SynchronousProxy {
907 client: fidl::client::sync::Client,
908}
909
910#[cfg(target_os = "fuchsia")]
911impl fidl::endpoints::SynchronousProxy for DeviceProxy_SynchronousProxy {
912 type Proxy = DeviceProxy_Proxy;
913 type Protocol = DeviceProxy_Marker;
914
915 fn from_channel(inner: fidl::Channel) -> Self {
916 Self::new(inner)
917 }
918
919 fn into_channel(self) -> fidl::Channel {
920 self.client.into_channel()
921 }
922
923 fn as_channel(&self) -> &fidl::Channel {
924 self.client.as_channel()
925 }
926}
927
928#[cfg(target_os = "fuchsia")]
929impl DeviceProxy_SynchronousProxy {
930 pub fn new(channel: fidl::Channel) -> Self {
931 let protocol_name = <DeviceProxy_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
932 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
933 }
934
935 pub fn into_channel(self) -> fidl::Channel {
936 self.client.into_channel()
937 }
938
939 pub fn wait_for_event(
942 &self,
943 deadline: zx::MonotonicInstant,
944 ) -> Result<DeviceProxy_Event, fidl::Error> {
945 DeviceProxy_Event::decode(self.client.wait_for_event(deadline)?)
946 }
947
948 pub fn r#get_channel(
949 &self,
950 mut req: fidl::endpoints::ServerEnd<DeviceMarker>,
951 ) -> Result<(), fidl::Error> {
952 self.client.send::<DeviceProxyGetChannelRequest>(
953 (req,),
954 0x580f1a3ef6c20fff,
955 fidl::encoding::DynamicFlags::empty(),
956 )
957 }
958}
959
960#[cfg(target_os = "fuchsia")]
961impl From<DeviceProxy_SynchronousProxy> for zx::Handle {
962 fn from(value: DeviceProxy_SynchronousProxy) -> Self {
963 value.into_channel().into()
964 }
965}
966
967#[cfg(target_os = "fuchsia")]
968impl From<fidl::Channel> for DeviceProxy_SynchronousProxy {
969 fn from(value: fidl::Channel) -> Self {
970 Self::new(value)
971 }
972}
973
974#[derive(Debug, Clone)]
975pub struct DeviceProxy_Proxy {
976 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
977}
978
979impl fidl::endpoints::Proxy for DeviceProxy_Proxy {
980 type Protocol = DeviceProxy_Marker;
981
982 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
983 Self::new(inner)
984 }
985
986 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
987 self.client.into_channel().map_err(|client| Self { client })
988 }
989
990 fn as_channel(&self) -> &::fidl::AsyncChannel {
991 self.client.as_channel()
992 }
993}
994
995impl DeviceProxy_Proxy {
996 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
998 let protocol_name = <DeviceProxy_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
999 Self { client: fidl::client::Client::new(channel, protocol_name) }
1000 }
1001
1002 pub fn take_event_stream(&self) -> DeviceProxy_EventStream {
1008 DeviceProxy_EventStream { event_receiver: self.client.take_event_receiver() }
1009 }
1010
1011 pub fn r#get_channel(
1012 &self,
1013 mut req: fidl::endpoints::ServerEnd<DeviceMarker>,
1014 ) -> Result<(), fidl::Error> {
1015 DeviceProxy_ProxyInterface::r#get_channel(self, req)
1016 }
1017}
1018
1019impl DeviceProxy_ProxyInterface for DeviceProxy_Proxy {
1020 fn r#get_channel(
1021 &self,
1022 mut req: fidl::endpoints::ServerEnd<DeviceMarker>,
1023 ) -> Result<(), fidl::Error> {
1024 self.client.send::<DeviceProxyGetChannelRequest>(
1025 (req,),
1026 0x580f1a3ef6c20fff,
1027 fidl::encoding::DynamicFlags::empty(),
1028 )
1029 }
1030}
1031
1032pub struct DeviceProxy_EventStream {
1033 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1034}
1035
1036impl std::marker::Unpin for DeviceProxy_EventStream {}
1037
1038impl futures::stream::FusedStream for DeviceProxy_EventStream {
1039 fn is_terminated(&self) -> bool {
1040 self.event_receiver.is_terminated()
1041 }
1042}
1043
1044impl futures::Stream for DeviceProxy_EventStream {
1045 type Item = Result<DeviceProxy_Event, fidl::Error>;
1046
1047 fn poll_next(
1048 mut self: std::pin::Pin<&mut Self>,
1049 cx: &mut std::task::Context<'_>,
1050 ) -> std::task::Poll<Option<Self::Item>> {
1051 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1052 &mut self.event_receiver,
1053 cx
1054 )?) {
1055 Some(buf) => std::task::Poll::Ready(Some(DeviceProxy_Event::decode(buf))),
1056 None => std::task::Poll::Ready(None),
1057 }
1058 }
1059}
1060
1061#[derive(Debug)]
1062pub enum DeviceProxy_Event {}
1063
1064impl DeviceProxy_Event {
1065 fn decode(
1067 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1068 ) -> Result<DeviceProxy_Event, fidl::Error> {
1069 let (bytes, _handles) = buf.split_mut();
1070 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1071 debug_assert_eq!(tx_header.tx_id, 0);
1072 match tx_header.ordinal {
1073 _ => Err(fidl::Error::UnknownOrdinal {
1074 ordinal: tx_header.ordinal,
1075 protocol_name: <DeviceProxy_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1076 }),
1077 }
1078 }
1079}
1080
1081pub struct DeviceProxy_RequestStream {
1083 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1084 is_terminated: bool,
1085}
1086
1087impl std::marker::Unpin for DeviceProxy_RequestStream {}
1088
1089impl futures::stream::FusedStream for DeviceProxy_RequestStream {
1090 fn is_terminated(&self) -> bool {
1091 self.is_terminated
1092 }
1093}
1094
1095impl fidl::endpoints::RequestStream for DeviceProxy_RequestStream {
1096 type Protocol = DeviceProxy_Marker;
1097 type ControlHandle = DeviceProxy_ControlHandle;
1098
1099 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1100 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1101 }
1102
1103 fn control_handle(&self) -> Self::ControlHandle {
1104 DeviceProxy_ControlHandle { inner: self.inner.clone() }
1105 }
1106
1107 fn into_inner(
1108 self,
1109 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1110 {
1111 (self.inner, self.is_terminated)
1112 }
1113
1114 fn from_inner(
1115 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1116 is_terminated: bool,
1117 ) -> Self {
1118 Self { inner, is_terminated }
1119 }
1120}
1121
1122impl futures::Stream for DeviceProxy_RequestStream {
1123 type Item = Result<DeviceProxy_Request, fidl::Error>;
1124
1125 fn poll_next(
1126 mut self: std::pin::Pin<&mut Self>,
1127 cx: &mut std::task::Context<'_>,
1128 ) -> std::task::Poll<Option<Self::Item>> {
1129 let this = &mut *self;
1130 if this.inner.check_shutdown(cx) {
1131 this.is_terminated = true;
1132 return std::task::Poll::Ready(None);
1133 }
1134 if this.is_terminated {
1135 panic!("polled DeviceProxy_RequestStream after completion");
1136 }
1137 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1138 |bytes, handles| {
1139 match this.inner.channel().read_etc(cx, bytes, handles) {
1140 std::task::Poll::Ready(Ok(())) => {}
1141 std::task::Poll::Pending => return std::task::Poll::Pending,
1142 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1143 this.is_terminated = true;
1144 return std::task::Poll::Ready(None);
1145 }
1146 std::task::Poll::Ready(Err(e)) => {
1147 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1148 e.into(),
1149 ))))
1150 }
1151 }
1152
1153 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1155
1156 std::task::Poll::Ready(Some(match header.ordinal {
1157 0x580f1a3ef6c20fff => {
1158 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1159 let mut req = fidl::new_empty!(
1160 DeviceProxyGetChannelRequest,
1161 fidl::encoding::DefaultFuchsiaResourceDialect
1162 );
1163 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceProxyGetChannelRequest>(&header, _body_bytes, handles, &mut req)?;
1164 let control_handle =
1165 DeviceProxy_ControlHandle { inner: this.inner.clone() };
1166 Ok(DeviceProxy_Request::GetChannel { req: req.req, control_handle })
1167 }
1168 _ => Err(fidl::Error::UnknownOrdinal {
1169 ordinal: header.ordinal,
1170 protocol_name:
1171 <DeviceProxy_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1172 }),
1173 }))
1174 },
1175 )
1176 }
1177}
1178
1179#[derive(Debug)]
1180pub enum DeviceProxy_Request {
1181 GetChannel {
1182 req: fidl::endpoints::ServerEnd<DeviceMarker>,
1183 control_handle: DeviceProxy_ControlHandle,
1184 },
1185}
1186
1187impl DeviceProxy_Request {
1188 #[allow(irrefutable_let_patterns)]
1189 pub fn into_get_channel(
1190 self,
1191 ) -> Option<(fidl::endpoints::ServerEnd<DeviceMarker>, DeviceProxy_ControlHandle)> {
1192 if let DeviceProxy_Request::GetChannel { req, control_handle } = self {
1193 Some((req, control_handle))
1194 } else {
1195 None
1196 }
1197 }
1198
1199 pub fn method_name(&self) -> &'static str {
1201 match *self {
1202 DeviceProxy_Request::GetChannel { .. } => "get_channel",
1203 }
1204 }
1205}
1206
1207#[derive(Debug, Clone)]
1208pub struct DeviceProxy_ControlHandle {
1209 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1210}
1211
1212impl fidl::endpoints::ControlHandle for DeviceProxy_ControlHandle {
1213 fn shutdown(&self) {
1214 self.inner.shutdown()
1215 }
1216 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1217 self.inner.shutdown_with_epitaph(status)
1218 }
1219
1220 fn is_closed(&self) -> bool {
1221 self.inner.channel().is_closed()
1222 }
1223 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1224 self.inner.channel().on_closed()
1225 }
1226
1227 #[cfg(target_os = "fuchsia")]
1228 fn signal_peer(
1229 &self,
1230 clear_mask: zx::Signals,
1231 set_mask: zx::Signals,
1232 ) -> Result<(), zx_status::Status> {
1233 use fidl::Peered;
1234 self.inner.channel().signal_peer(clear_mask, set_mask)
1235 }
1236}
1237
1238impl DeviceProxy_ControlHandle {}
1239
1240#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1241pub struct ServiceMarker;
1242
1243#[cfg(target_os = "fuchsia")]
1244impl fidl::endpoints::ServiceMarker for ServiceMarker {
1245 type Proxy = ServiceProxy;
1246 type Request = ServiceRequest;
1247 const SERVICE_NAME: &'static str = "fuchsia.hardware.serial.Service";
1248}
1249
1250#[cfg(target_os = "fuchsia")]
1253pub enum ServiceRequest {
1254 Device(DeviceRequestStream),
1255}
1256
1257#[cfg(target_os = "fuchsia")]
1258impl fidl::endpoints::ServiceRequest for ServiceRequest {
1259 type Service = ServiceMarker;
1260
1261 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
1262 match name {
1263 "device" => Self::Device(
1264 <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
1265 ),
1266 _ => panic!("no such member protocol name for service Service"),
1267 }
1268 }
1269
1270 fn member_names() -> &'static [&'static str] {
1271 &["device"]
1272 }
1273}
1274#[cfg(target_os = "fuchsia")]
1275pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
1276
1277#[cfg(target_os = "fuchsia")]
1278impl fidl::endpoints::ServiceProxy for ServiceProxy {
1279 type Service = ServiceMarker;
1280
1281 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
1282 Self(opener)
1283 }
1284}
1285
1286#[cfg(target_os = "fuchsia")]
1287impl ServiceProxy {
1288 pub fn connect_to_device(&self) -> Result<DeviceProxy, fidl::Error> {
1289 let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
1290 self.connect_channel_to_device(server_end)?;
1291 Ok(proxy)
1292 }
1293
1294 pub fn connect_to_device_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
1297 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
1298 self.connect_channel_to_device(server_end)?;
1299 Ok(proxy)
1300 }
1301
1302 pub fn connect_channel_to_device(
1305 &self,
1306 server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
1307 ) -> Result<(), fidl::Error> {
1308 self.0.open_member("device", server_end.into_channel())
1309 }
1310
1311 pub fn instance_name(&self) -> &str {
1312 self.0.instance_name()
1313 }
1314}
1315
1316mod internal {
1317 use super::*;
1318
1319 impl fidl::encoding::ResourceTypeMarker for DeviceProxyGetChannelRequest {
1320 type Borrowed<'a> = &'a mut Self;
1321 fn take_or_borrow<'a>(
1322 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1323 ) -> Self::Borrowed<'a> {
1324 value
1325 }
1326 }
1327
1328 unsafe impl fidl::encoding::TypeMarker for DeviceProxyGetChannelRequest {
1329 type Owned = Self;
1330
1331 #[inline(always)]
1332 fn inline_align(_context: fidl::encoding::Context) -> usize {
1333 4
1334 }
1335
1336 #[inline(always)]
1337 fn inline_size(_context: fidl::encoding::Context) -> usize {
1338 4
1339 }
1340 }
1341
1342 unsafe impl
1343 fidl::encoding::Encode<
1344 DeviceProxyGetChannelRequest,
1345 fidl::encoding::DefaultFuchsiaResourceDialect,
1346 > for &mut DeviceProxyGetChannelRequest
1347 {
1348 #[inline]
1349 unsafe fn encode(
1350 self,
1351 encoder: &mut fidl::encoding::Encoder<
1352 '_,
1353 fidl::encoding::DefaultFuchsiaResourceDialect,
1354 >,
1355 offset: usize,
1356 _depth: fidl::encoding::Depth,
1357 ) -> fidl::Result<()> {
1358 encoder.debug_check_bounds::<DeviceProxyGetChannelRequest>(offset);
1359 fidl::encoding::Encode::<DeviceProxyGetChannelRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1361 (
1362 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.req),
1363 ),
1364 encoder, offset, _depth
1365 )
1366 }
1367 }
1368 unsafe impl<
1369 T0: fidl::encoding::Encode<
1370 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
1371 fidl::encoding::DefaultFuchsiaResourceDialect,
1372 >,
1373 >
1374 fidl::encoding::Encode<
1375 DeviceProxyGetChannelRequest,
1376 fidl::encoding::DefaultFuchsiaResourceDialect,
1377 > for (T0,)
1378 {
1379 #[inline]
1380 unsafe fn encode(
1381 self,
1382 encoder: &mut fidl::encoding::Encoder<
1383 '_,
1384 fidl::encoding::DefaultFuchsiaResourceDialect,
1385 >,
1386 offset: usize,
1387 depth: fidl::encoding::Depth,
1388 ) -> fidl::Result<()> {
1389 encoder.debug_check_bounds::<DeviceProxyGetChannelRequest>(offset);
1390 self.0.encode(encoder, offset + 0, depth)?;
1394 Ok(())
1395 }
1396 }
1397
1398 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1399 for DeviceProxyGetChannelRequest
1400 {
1401 #[inline(always)]
1402 fn new_empty() -> Self {
1403 Self {
1404 req: fidl::new_empty!(
1405 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
1406 fidl::encoding::DefaultFuchsiaResourceDialect
1407 ),
1408 }
1409 }
1410
1411 #[inline]
1412 unsafe fn decode(
1413 &mut self,
1414 decoder: &mut fidl::encoding::Decoder<
1415 '_,
1416 fidl::encoding::DefaultFuchsiaResourceDialect,
1417 >,
1418 offset: usize,
1419 _depth: fidl::encoding::Depth,
1420 ) -> fidl::Result<()> {
1421 decoder.debug_check_bounds::<Self>(offset);
1422 fidl::decode!(
1424 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
1425 fidl::encoding::DefaultFuchsiaResourceDialect,
1426 &mut self.req,
1427 decoder,
1428 offset + 0,
1429 _depth
1430 )?;
1431 Ok(())
1432 }
1433 }
1434}