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#[derive(Debug, Clone)]
157pub struct DeviceProxy {
158 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
159}
160
161impl fidl::endpoints::Proxy for DeviceProxy {
162 type Protocol = DeviceMarker;
163
164 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
165 Self::new(inner)
166 }
167
168 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
169 self.client.into_channel().map_err(|client| Self { client })
170 }
171
172 fn as_channel(&self) -> &::fidl::AsyncChannel {
173 self.client.as_channel()
174 }
175}
176
177impl DeviceProxy {
178 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
180 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
181 Self { client: fidl::client::Client::new(channel, protocol_name) }
182 }
183
184 pub fn take_event_stream(&self) -> DeviceEventStream {
190 DeviceEventStream { event_receiver: self.client.take_event_receiver() }
191 }
192
193 pub fn r#get_class(
195 &self,
196 ) -> fidl::client::QueryResponseFut<Class, fidl::encoding::DefaultFuchsiaResourceDialect> {
197 DeviceProxyInterface::r#get_class(self)
198 }
199
200 pub fn r#set_config(
202 &self,
203 mut config: &Config,
204 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
205 DeviceProxyInterface::r#set_config(self, config)
206 }
207
208 pub fn r#read(
210 &self,
211 ) -> fidl::client::QueryResponseFut<
212 DeviceReadResult,
213 fidl::encoding::DefaultFuchsiaResourceDialect,
214 > {
215 DeviceProxyInterface::r#read(self)
216 }
217
218 pub fn r#write(
220 &self,
221 mut data: &[u8],
222 ) -> fidl::client::QueryResponseFut<
223 DeviceWriteResult,
224 fidl::encoding::DefaultFuchsiaResourceDialect,
225 > {
226 DeviceProxyInterface::r#write(self, data)
227 }
228}
229
230impl DeviceProxyInterface for DeviceProxy {
231 type GetClassResponseFut =
232 fidl::client::QueryResponseFut<Class, fidl::encoding::DefaultFuchsiaResourceDialect>;
233 fn r#get_class(&self) -> Self::GetClassResponseFut {
234 fn _decode(
235 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
236 ) -> Result<Class, fidl::Error> {
237 let _response = fidl::client::decode_transaction_body::<
238 DeviceGetClassResponse,
239 fidl::encoding::DefaultFuchsiaResourceDialect,
240 0x3d48bbcee248ab8b,
241 >(_buf?)?;
242 Ok(_response.device_class)
243 }
244 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Class>(
245 (),
246 0x3d48bbcee248ab8b,
247 fidl::encoding::DynamicFlags::empty(),
248 _decode,
249 )
250 }
251
252 type SetConfigResponseFut =
253 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
254 fn r#set_config(&self, mut config: &Config) -> Self::SetConfigResponseFut {
255 fn _decode(
256 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
257 ) -> Result<i32, fidl::Error> {
258 let _response = fidl::client::decode_transaction_body::<
259 DeviceSetConfigResponse,
260 fidl::encoding::DefaultFuchsiaResourceDialect,
261 0x771a0946f6f87173,
262 >(_buf?)?;
263 Ok(_response.s)
264 }
265 self.client.send_query_and_decode::<DeviceSetConfigRequest, i32>(
266 (config,),
267 0x771a0946f6f87173,
268 fidl::encoding::DynamicFlags::empty(),
269 _decode,
270 )
271 }
272
273 type ReadResponseFut = fidl::client::QueryResponseFut<
274 DeviceReadResult,
275 fidl::encoding::DefaultFuchsiaResourceDialect,
276 >;
277 fn r#read(&self) -> Self::ReadResponseFut {
278 fn _decode(
279 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
280 ) -> Result<DeviceReadResult, fidl::Error> {
281 let _response = fidl::client::decode_transaction_body::<
282 fidl::encoding::ResultType<DeviceReadResponse, i32>,
283 fidl::encoding::DefaultFuchsiaResourceDialect,
284 0x63c41d3c053fadd8,
285 >(_buf?)?;
286 Ok(_response.map(|x| x.data))
287 }
288 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceReadResult>(
289 (),
290 0x63c41d3c053fadd8,
291 fidl::encoding::DynamicFlags::empty(),
292 _decode,
293 )
294 }
295
296 type WriteResponseFut = fidl::client::QueryResponseFut<
297 DeviceWriteResult,
298 fidl::encoding::DefaultFuchsiaResourceDialect,
299 >;
300 fn r#write(&self, mut data: &[u8]) -> Self::WriteResponseFut {
301 fn _decode(
302 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
303 ) -> Result<DeviceWriteResult, fidl::Error> {
304 let _response = fidl::client::decode_transaction_body::<
305 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
306 fidl::encoding::DefaultFuchsiaResourceDialect,
307 0x6aa7adae6841779c,
308 >(_buf?)?;
309 Ok(_response.map(|x| x))
310 }
311 self.client.send_query_and_decode::<DeviceWriteRequest, DeviceWriteResult>(
312 (data,),
313 0x6aa7adae6841779c,
314 fidl::encoding::DynamicFlags::empty(),
315 _decode,
316 )
317 }
318}
319
320pub struct DeviceEventStream {
321 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
322}
323
324impl std::marker::Unpin for DeviceEventStream {}
325
326impl futures::stream::FusedStream for DeviceEventStream {
327 fn is_terminated(&self) -> bool {
328 self.event_receiver.is_terminated()
329 }
330}
331
332impl futures::Stream for DeviceEventStream {
333 type Item = Result<DeviceEvent, fidl::Error>;
334
335 fn poll_next(
336 mut self: std::pin::Pin<&mut Self>,
337 cx: &mut std::task::Context<'_>,
338 ) -> std::task::Poll<Option<Self::Item>> {
339 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
340 &mut self.event_receiver,
341 cx
342 )?) {
343 Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
344 None => std::task::Poll::Ready(None),
345 }
346 }
347}
348
349#[derive(Debug)]
350pub enum DeviceEvent {}
351
352impl DeviceEvent {
353 fn decode(
355 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
356 ) -> Result<DeviceEvent, fidl::Error> {
357 let (bytes, _handles) = buf.split_mut();
358 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
359 debug_assert_eq!(tx_header.tx_id, 0);
360 match tx_header.ordinal {
361 _ => Err(fidl::Error::UnknownOrdinal {
362 ordinal: tx_header.ordinal,
363 protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
364 }),
365 }
366 }
367}
368
369pub struct DeviceRequestStream {
371 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
372 is_terminated: bool,
373}
374
375impl std::marker::Unpin for DeviceRequestStream {}
376
377impl futures::stream::FusedStream for DeviceRequestStream {
378 fn is_terminated(&self) -> bool {
379 self.is_terminated
380 }
381}
382
383impl fidl::endpoints::RequestStream for DeviceRequestStream {
384 type Protocol = DeviceMarker;
385 type ControlHandle = DeviceControlHandle;
386
387 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
388 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
389 }
390
391 fn control_handle(&self) -> Self::ControlHandle {
392 DeviceControlHandle { inner: self.inner.clone() }
393 }
394
395 fn into_inner(
396 self,
397 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
398 {
399 (self.inner, self.is_terminated)
400 }
401
402 fn from_inner(
403 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
404 is_terminated: bool,
405 ) -> Self {
406 Self { inner, is_terminated }
407 }
408}
409
410impl futures::Stream for DeviceRequestStream {
411 type Item = Result<DeviceRequest, fidl::Error>;
412
413 fn poll_next(
414 mut self: std::pin::Pin<&mut Self>,
415 cx: &mut std::task::Context<'_>,
416 ) -> std::task::Poll<Option<Self::Item>> {
417 let this = &mut *self;
418 if this.inner.check_shutdown(cx) {
419 this.is_terminated = true;
420 return std::task::Poll::Ready(None);
421 }
422 if this.is_terminated {
423 panic!("polled DeviceRequestStream after completion");
424 }
425 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
426 |bytes, handles| {
427 match this.inner.channel().read_etc(cx, bytes, handles) {
428 std::task::Poll::Ready(Ok(())) => {}
429 std::task::Poll::Pending => return std::task::Poll::Pending,
430 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
431 this.is_terminated = true;
432 return std::task::Poll::Ready(None);
433 }
434 std::task::Poll::Ready(Err(e)) => {
435 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
436 e.into(),
437 ))))
438 }
439 }
440
441 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
443
444 std::task::Poll::Ready(Some(match header.ordinal {
445 0x3d48bbcee248ab8b => {
446 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
447 let mut req = fidl::new_empty!(
448 fidl::encoding::EmptyPayload,
449 fidl::encoding::DefaultFuchsiaResourceDialect
450 );
451 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
452 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
453 Ok(DeviceRequest::GetClass {
454 responder: DeviceGetClassResponder {
455 control_handle: std::mem::ManuallyDrop::new(control_handle),
456 tx_id: header.tx_id,
457 },
458 })
459 }
460 0x771a0946f6f87173 => {
461 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
462 let mut req = fidl::new_empty!(
463 DeviceSetConfigRequest,
464 fidl::encoding::DefaultFuchsiaResourceDialect
465 );
466 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetConfigRequest>(&header, _body_bytes, handles, &mut req)?;
467 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
468 Ok(DeviceRequest::SetConfig {
469 config: req.config,
470
471 responder: DeviceSetConfigResponder {
472 control_handle: std::mem::ManuallyDrop::new(control_handle),
473 tx_id: header.tx_id,
474 },
475 })
476 }
477 0x63c41d3c053fadd8 => {
478 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
479 let mut req = fidl::new_empty!(
480 fidl::encoding::EmptyPayload,
481 fidl::encoding::DefaultFuchsiaResourceDialect
482 );
483 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
484 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
485 Ok(DeviceRequest::Read {
486 responder: DeviceReadResponder {
487 control_handle: std::mem::ManuallyDrop::new(control_handle),
488 tx_id: header.tx_id,
489 },
490 })
491 }
492 0x6aa7adae6841779c => {
493 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
494 let mut req = fidl::new_empty!(
495 DeviceWriteRequest,
496 fidl::encoding::DefaultFuchsiaResourceDialect
497 );
498 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceWriteRequest>(&header, _body_bytes, handles, &mut req)?;
499 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
500 Ok(DeviceRequest::Write {
501 data: req.data,
502
503 responder: DeviceWriteResponder {
504 control_handle: std::mem::ManuallyDrop::new(control_handle),
505 tx_id: header.tx_id,
506 },
507 })
508 }
509 _ => Err(fidl::Error::UnknownOrdinal {
510 ordinal: header.ordinal,
511 protocol_name:
512 <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
513 }),
514 }))
515 },
516 )
517 }
518}
519
520#[derive(Debug)]
522pub enum DeviceRequest {
523 GetClass { responder: DeviceGetClassResponder },
525 SetConfig { config: Config, responder: DeviceSetConfigResponder },
527 Read { responder: DeviceReadResponder },
529 Write { data: Vec<u8>, responder: DeviceWriteResponder },
531}
532
533impl DeviceRequest {
534 #[allow(irrefutable_let_patterns)]
535 pub fn into_get_class(self) -> Option<(DeviceGetClassResponder)> {
536 if let DeviceRequest::GetClass { responder } = self {
537 Some((responder))
538 } else {
539 None
540 }
541 }
542
543 #[allow(irrefutable_let_patterns)]
544 pub fn into_set_config(self) -> Option<(Config, DeviceSetConfigResponder)> {
545 if let DeviceRequest::SetConfig { config, responder } = self {
546 Some((config, responder))
547 } else {
548 None
549 }
550 }
551
552 #[allow(irrefutable_let_patterns)]
553 pub fn into_read(self) -> Option<(DeviceReadResponder)> {
554 if let DeviceRequest::Read { responder } = self {
555 Some((responder))
556 } else {
557 None
558 }
559 }
560
561 #[allow(irrefutable_let_patterns)]
562 pub fn into_write(self) -> Option<(Vec<u8>, DeviceWriteResponder)> {
563 if let DeviceRequest::Write { data, responder } = self {
564 Some((data, responder))
565 } else {
566 None
567 }
568 }
569
570 pub fn method_name(&self) -> &'static str {
572 match *self {
573 DeviceRequest::GetClass { .. } => "get_class",
574 DeviceRequest::SetConfig { .. } => "set_config",
575 DeviceRequest::Read { .. } => "read",
576 DeviceRequest::Write { .. } => "write",
577 }
578 }
579}
580
581#[derive(Debug, Clone)]
582pub struct DeviceControlHandle {
583 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
584}
585
586impl fidl::endpoints::ControlHandle for DeviceControlHandle {
587 fn shutdown(&self) {
588 self.inner.shutdown()
589 }
590 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
591 self.inner.shutdown_with_epitaph(status)
592 }
593
594 fn is_closed(&self) -> bool {
595 self.inner.channel().is_closed()
596 }
597 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
598 self.inner.channel().on_closed()
599 }
600
601 #[cfg(target_os = "fuchsia")]
602 fn signal_peer(
603 &self,
604 clear_mask: zx::Signals,
605 set_mask: zx::Signals,
606 ) -> Result<(), zx_status::Status> {
607 use fidl::Peered;
608 self.inner.channel().signal_peer(clear_mask, set_mask)
609 }
610}
611
612impl DeviceControlHandle {}
613
614#[must_use = "FIDL methods require a response to be sent"]
615#[derive(Debug)]
616pub struct DeviceGetClassResponder {
617 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
618 tx_id: u32,
619}
620
621impl std::ops::Drop for DeviceGetClassResponder {
625 fn drop(&mut self) {
626 self.control_handle.shutdown();
627 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
629 }
630}
631
632impl fidl::endpoints::Responder for DeviceGetClassResponder {
633 type ControlHandle = DeviceControlHandle;
634
635 fn control_handle(&self) -> &DeviceControlHandle {
636 &self.control_handle
637 }
638
639 fn drop_without_shutdown(mut self) {
640 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
642 std::mem::forget(self);
644 }
645}
646
647impl DeviceGetClassResponder {
648 pub fn send(self, mut device_class: Class) -> Result<(), fidl::Error> {
652 let _result = self.send_raw(device_class);
653 if _result.is_err() {
654 self.control_handle.shutdown();
655 }
656 self.drop_without_shutdown();
657 _result
658 }
659
660 pub fn send_no_shutdown_on_err(self, mut device_class: Class) -> Result<(), fidl::Error> {
662 let _result = self.send_raw(device_class);
663 self.drop_without_shutdown();
664 _result
665 }
666
667 fn send_raw(&self, mut device_class: Class) -> Result<(), fidl::Error> {
668 self.control_handle.inner.send::<DeviceGetClassResponse>(
669 (device_class,),
670 self.tx_id,
671 0x3d48bbcee248ab8b,
672 fidl::encoding::DynamicFlags::empty(),
673 )
674 }
675}
676
677#[must_use = "FIDL methods require a response to be sent"]
678#[derive(Debug)]
679pub struct DeviceSetConfigResponder {
680 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
681 tx_id: u32,
682}
683
684impl std::ops::Drop for DeviceSetConfigResponder {
688 fn drop(&mut self) {
689 self.control_handle.shutdown();
690 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
692 }
693}
694
695impl fidl::endpoints::Responder for DeviceSetConfigResponder {
696 type ControlHandle = DeviceControlHandle;
697
698 fn control_handle(&self) -> &DeviceControlHandle {
699 &self.control_handle
700 }
701
702 fn drop_without_shutdown(mut self) {
703 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
705 std::mem::forget(self);
707 }
708}
709
710impl DeviceSetConfigResponder {
711 pub fn send(self, mut s: i32) -> Result<(), fidl::Error> {
715 let _result = self.send_raw(s);
716 if _result.is_err() {
717 self.control_handle.shutdown();
718 }
719 self.drop_without_shutdown();
720 _result
721 }
722
723 pub fn send_no_shutdown_on_err(self, mut s: i32) -> Result<(), fidl::Error> {
725 let _result = self.send_raw(s);
726 self.drop_without_shutdown();
727 _result
728 }
729
730 fn send_raw(&self, mut s: i32) -> Result<(), fidl::Error> {
731 self.control_handle.inner.send::<DeviceSetConfigResponse>(
732 (s,),
733 self.tx_id,
734 0x771a0946f6f87173,
735 fidl::encoding::DynamicFlags::empty(),
736 )
737 }
738}
739
740#[must_use = "FIDL methods require a response to be sent"]
741#[derive(Debug)]
742pub struct DeviceReadResponder {
743 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
744 tx_id: u32,
745}
746
747impl std::ops::Drop for DeviceReadResponder {
751 fn drop(&mut self) {
752 self.control_handle.shutdown();
753 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
755 }
756}
757
758impl fidl::endpoints::Responder for DeviceReadResponder {
759 type ControlHandle = DeviceControlHandle;
760
761 fn control_handle(&self) -> &DeviceControlHandle {
762 &self.control_handle
763 }
764
765 fn drop_without_shutdown(mut self) {
766 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
768 std::mem::forget(self);
770 }
771}
772
773impl DeviceReadResponder {
774 pub fn send(self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
778 let _result = self.send_raw(result);
779 if _result.is_err() {
780 self.control_handle.shutdown();
781 }
782 self.drop_without_shutdown();
783 _result
784 }
785
786 pub fn send_no_shutdown_on_err(
788 self,
789 mut result: Result<&[u8], i32>,
790 ) -> Result<(), fidl::Error> {
791 let _result = self.send_raw(result);
792 self.drop_without_shutdown();
793 _result
794 }
795
796 fn send_raw(&self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
797 self.control_handle.inner.send::<fidl::encoding::ResultType<DeviceReadResponse, i32>>(
798 result.map(|data| (data,)),
799 self.tx_id,
800 0x63c41d3c053fadd8,
801 fidl::encoding::DynamicFlags::empty(),
802 )
803 }
804}
805
806#[must_use = "FIDL methods require a response to be sent"]
807#[derive(Debug)]
808pub struct DeviceWriteResponder {
809 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
810 tx_id: u32,
811}
812
813impl std::ops::Drop for DeviceWriteResponder {
817 fn drop(&mut self) {
818 self.control_handle.shutdown();
819 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
821 }
822}
823
824impl fidl::endpoints::Responder for DeviceWriteResponder {
825 type ControlHandle = DeviceControlHandle;
826
827 fn control_handle(&self) -> &DeviceControlHandle {
828 &self.control_handle
829 }
830
831 fn drop_without_shutdown(mut self) {
832 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
834 std::mem::forget(self);
836 }
837}
838
839impl DeviceWriteResponder {
840 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
844 let _result = self.send_raw(result);
845 if _result.is_err() {
846 self.control_handle.shutdown();
847 }
848 self.drop_without_shutdown();
849 _result
850 }
851
852 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
854 let _result = self.send_raw(result);
855 self.drop_without_shutdown();
856 _result
857 }
858
859 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
860 self.control_handle
861 .inner
862 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
863 result,
864 self.tx_id,
865 0x6aa7adae6841779c,
866 fidl::encoding::DynamicFlags::empty(),
867 )
868 }
869}
870
871#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
872pub struct DeviceProxy_Marker;
873
874impl fidl::endpoints::ProtocolMarker for DeviceProxy_Marker {
875 type Proxy = DeviceProxy_Proxy;
876 type RequestStream = DeviceProxy_RequestStream;
877 #[cfg(target_os = "fuchsia")]
878 type SynchronousProxy = DeviceProxy_SynchronousProxy;
879
880 const DEBUG_NAME: &'static str = "fuchsia.hardware.serial.DeviceProxy";
881}
882impl fidl::endpoints::DiscoverableProtocolMarker for DeviceProxy_Marker {}
883
884pub trait DeviceProxy_ProxyInterface: Send + Sync {
885 fn r#get_channel(
886 &self,
887 req: fidl::endpoints::ServerEnd<DeviceMarker>,
888 ) -> Result<(), fidl::Error>;
889}
890#[derive(Debug)]
891#[cfg(target_os = "fuchsia")]
892pub struct DeviceProxy_SynchronousProxy {
893 client: fidl::client::sync::Client,
894}
895
896#[cfg(target_os = "fuchsia")]
897impl fidl::endpoints::SynchronousProxy for DeviceProxy_SynchronousProxy {
898 type Proxy = DeviceProxy_Proxy;
899 type Protocol = DeviceProxy_Marker;
900
901 fn from_channel(inner: fidl::Channel) -> Self {
902 Self::new(inner)
903 }
904
905 fn into_channel(self) -> fidl::Channel {
906 self.client.into_channel()
907 }
908
909 fn as_channel(&self) -> &fidl::Channel {
910 self.client.as_channel()
911 }
912}
913
914#[cfg(target_os = "fuchsia")]
915impl DeviceProxy_SynchronousProxy {
916 pub fn new(channel: fidl::Channel) -> Self {
917 let protocol_name = <DeviceProxy_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
918 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
919 }
920
921 pub fn into_channel(self) -> fidl::Channel {
922 self.client.into_channel()
923 }
924
925 pub fn wait_for_event(
928 &self,
929 deadline: zx::MonotonicInstant,
930 ) -> Result<DeviceProxy_Event, fidl::Error> {
931 DeviceProxy_Event::decode(self.client.wait_for_event(deadline)?)
932 }
933
934 pub fn r#get_channel(
935 &self,
936 mut req: fidl::endpoints::ServerEnd<DeviceMarker>,
937 ) -> Result<(), fidl::Error> {
938 self.client.send::<DeviceProxyGetChannelRequest>(
939 (req,),
940 0x580f1a3ef6c20fff,
941 fidl::encoding::DynamicFlags::empty(),
942 )
943 }
944}
945
946#[derive(Debug, Clone)]
947pub struct DeviceProxy_Proxy {
948 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
949}
950
951impl fidl::endpoints::Proxy for DeviceProxy_Proxy {
952 type Protocol = DeviceProxy_Marker;
953
954 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
955 Self::new(inner)
956 }
957
958 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
959 self.client.into_channel().map_err(|client| Self { client })
960 }
961
962 fn as_channel(&self) -> &::fidl::AsyncChannel {
963 self.client.as_channel()
964 }
965}
966
967impl DeviceProxy_Proxy {
968 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
970 let protocol_name = <DeviceProxy_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
971 Self { client: fidl::client::Client::new(channel, protocol_name) }
972 }
973
974 pub fn take_event_stream(&self) -> DeviceProxy_EventStream {
980 DeviceProxy_EventStream { event_receiver: self.client.take_event_receiver() }
981 }
982
983 pub fn r#get_channel(
984 &self,
985 mut req: fidl::endpoints::ServerEnd<DeviceMarker>,
986 ) -> Result<(), fidl::Error> {
987 DeviceProxy_ProxyInterface::r#get_channel(self, req)
988 }
989}
990
991impl DeviceProxy_ProxyInterface for DeviceProxy_Proxy {
992 fn r#get_channel(
993 &self,
994 mut req: fidl::endpoints::ServerEnd<DeviceMarker>,
995 ) -> Result<(), fidl::Error> {
996 self.client.send::<DeviceProxyGetChannelRequest>(
997 (req,),
998 0x580f1a3ef6c20fff,
999 fidl::encoding::DynamicFlags::empty(),
1000 )
1001 }
1002}
1003
1004pub struct DeviceProxy_EventStream {
1005 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1006}
1007
1008impl std::marker::Unpin for DeviceProxy_EventStream {}
1009
1010impl futures::stream::FusedStream for DeviceProxy_EventStream {
1011 fn is_terminated(&self) -> bool {
1012 self.event_receiver.is_terminated()
1013 }
1014}
1015
1016impl futures::Stream for DeviceProxy_EventStream {
1017 type Item = Result<DeviceProxy_Event, fidl::Error>;
1018
1019 fn poll_next(
1020 mut self: std::pin::Pin<&mut Self>,
1021 cx: &mut std::task::Context<'_>,
1022 ) -> std::task::Poll<Option<Self::Item>> {
1023 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1024 &mut self.event_receiver,
1025 cx
1026 )?) {
1027 Some(buf) => std::task::Poll::Ready(Some(DeviceProxy_Event::decode(buf))),
1028 None => std::task::Poll::Ready(None),
1029 }
1030 }
1031}
1032
1033#[derive(Debug)]
1034pub enum DeviceProxy_Event {}
1035
1036impl DeviceProxy_Event {
1037 fn decode(
1039 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1040 ) -> Result<DeviceProxy_Event, fidl::Error> {
1041 let (bytes, _handles) = buf.split_mut();
1042 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1043 debug_assert_eq!(tx_header.tx_id, 0);
1044 match tx_header.ordinal {
1045 _ => Err(fidl::Error::UnknownOrdinal {
1046 ordinal: tx_header.ordinal,
1047 protocol_name: <DeviceProxy_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1048 }),
1049 }
1050 }
1051}
1052
1053pub struct DeviceProxy_RequestStream {
1055 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1056 is_terminated: bool,
1057}
1058
1059impl std::marker::Unpin for DeviceProxy_RequestStream {}
1060
1061impl futures::stream::FusedStream for DeviceProxy_RequestStream {
1062 fn is_terminated(&self) -> bool {
1063 self.is_terminated
1064 }
1065}
1066
1067impl fidl::endpoints::RequestStream for DeviceProxy_RequestStream {
1068 type Protocol = DeviceProxy_Marker;
1069 type ControlHandle = DeviceProxy_ControlHandle;
1070
1071 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1072 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1073 }
1074
1075 fn control_handle(&self) -> Self::ControlHandle {
1076 DeviceProxy_ControlHandle { inner: self.inner.clone() }
1077 }
1078
1079 fn into_inner(
1080 self,
1081 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1082 {
1083 (self.inner, self.is_terminated)
1084 }
1085
1086 fn from_inner(
1087 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1088 is_terminated: bool,
1089 ) -> Self {
1090 Self { inner, is_terminated }
1091 }
1092}
1093
1094impl futures::Stream for DeviceProxy_RequestStream {
1095 type Item = Result<DeviceProxy_Request, fidl::Error>;
1096
1097 fn poll_next(
1098 mut self: std::pin::Pin<&mut Self>,
1099 cx: &mut std::task::Context<'_>,
1100 ) -> std::task::Poll<Option<Self::Item>> {
1101 let this = &mut *self;
1102 if this.inner.check_shutdown(cx) {
1103 this.is_terminated = true;
1104 return std::task::Poll::Ready(None);
1105 }
1106 if this.is_terminated {
1107 panic!("polled DeviceProxy_RequestStream after completion");
1108 }
1109 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1110 |bytes, handles| {
1111 match this.inner.channel().read_etc(cx, bytes, handles) {
1112 std::task::Poll::Ready(Ok(())) => {}
1113 std::task::Poll::Pending => return std::task::Poll::Pending,
1114 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1115 this.is_terminated = true;
1116 return std::task::Poll::Ready(None);
1117 }
1118 std::task::Poll::Ready(Err(e)) => {
1119 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1120 e.into(),
1121 ))))
1122 }
1123 }
1124
1125 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1127
1128 std::task::Poll::Ready(Some(match header.ordinal {
1129 0x580f1a3ef6c20fff => {
1130 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1131 let mut req = fidl::new_empty!(
1132 DeviceProxyGetChannelRequest,
1133 fidl::encoding::DefaultFuchsiaResourceDialect
1134 );
1135 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceProxyGetChannelRequest>(&header, _body_bytes, handles, &mut req)?;
1136 let control_handle =
1137 DeviceProxy_ControlHandle { inner: this.inner.clone() };
1138 Ok(DeviceProxy_Request::GetChannel { req: req.req, control_handle })
1139 }
1140 _ => Err(fidl::Error::UnknownOrdinal {
1141 ordinal: header.ordinal,
1142 protocol_name:
1143 <DeviceProxy_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1144 }),
1145 }))
1146 },
1147 )
1148 }
1149}
1150
1151#[derive(Debug)]
1152pub enum DeviceProxy_Request {
1153 GetChannel {
1154 req: fidl::endpoints::ServerEnd<DeviceMarker>,
1155 control_handle: DeviceProxy_ControlHandle,
1156 },
1157}
1158
1159impl DeviceProxy_Request {
1160 #[allow(irrefutable_let_patterns)]
1161 pub fn into_get_channel(
1162 self,
1163 ) -> Option<(fidl::endpoints::ServerEnd<DeviceMarker>, DeviceProxy_ControlHandle)> {
1164 if let DeviceProxy_Request::GetChannel { req, control_handle } = self {
1165 Some((req, control_handle))
1166 } else {
1167 None
1168 }
1169 }
1170
1171 pub fn method_name(&self) -> &'static str {
1173 match *self {
1174 DeviceProxy_Request::GetChannel { .. } => "get_channel",
1175 }
1176 }
1177}
1178
1179#[derive(Debug, Clone)]
1180pub struct DeviceProxy_ControlHandle {
1181 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1182}
1183
1184impl fidl::endpoints::ControlHandle for DeviceProxy_ControlHandle {
1185 fn shutdown(&self) {
1186 self.inner.shutdown()
1187 }
1188 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1189 self.inner.shutdown_with_epitaph(status)
1190 }
1191
1192 fn is_closed(&self) -> bool {
1193 self.inner.channel().is_closed()
1194 }
1195 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1196 self.inner.channel().on_closed()
1197 }
1198
1199 #[cfg(target_os = "fuchsia")]
1200 fn signal_peer(
1201 &self,
1202 clear_mask: zx::Signals,
1203 set_mask: zx::Signals,
1204 ) -> Result<(), zx_status::Status> {
1205 use fidl::Peered;
1206 self.inner.channel().signal_peer(clear_mask, set_mask)
1207 }
1208}
1209
1210impl DeviceProxy_ControlHandle {}
1211
1212#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1213pub struct ServiceMarker;
1214
1215#[cfg(target_os = "fuchsia")]
1216impl fidl::endpoints::ServiceMarker for ServiceMarker {
1217 type Proxy = ServiceProxy;
1218 type Request = ServiceRequest;
1219 const SERVICE_NAME: &'static str = "fuchsia.hardware.serial.Service";
1220}
1221
1222#[cfg(target_os = "fuchsia")]
1225pub enum ServiceRequest {
1226 Device(DeviceRequestStream),
1227}
1228
1229#[cfg(target_os = "fuchsia")]
1230impl fidl::endpoints::ServiceRequest for ServiceRequest {
1231 type Service = ServiceMarker;
1232
1233 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
1234 match name {
1235 "device" => Self::Device(
1236 <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
1237 ),
1238 _ => panic!("no such member protocol name for service Service"),
1239 }
1240 }
1241
1242 fn member_names() -> &'static [&'static str] {
1243 &["device"]
1244 }
1245}
1246#[cfg(target_os = "fuchsia")]
1247pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
1248
1249#[cfg(target_os = "fuchsia")]
1250impl fidl::endpoints::ServiceProxy for ServiceProxy {
1251 type Service = ServiceMarker;
1252
1253 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
1254 Self(opener)
1255 }
1256}
1257
1258#[cfg(target_os = "fuchsia")]
1259impl ServiceProxy {
1260 pub fn connect_to_device(&self) -> Result<DeviceProxy, fidl::Error> {
1261 let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
1262 self.connect_channel_to_device(server_end)?;
1263 Ok(proxy)
1264 }
1265
1266 pub fn connect_to_device_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
1269 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
1270 self.connect_channel_to_device(server_end)?;
1271 Ok(proxy)
1272 }
1273
1274 pub fn connect_channel_to_device(
1277 &self,
1278 server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
1279 ) -> Result<(), fidl::Error> {
1280 self.0.open_member("device", server_end.into_channel())
1281 }
1282
1283 pub fn instance_name(&self) -> &str {
1284 self.0.instance_name()
1285 }
1286}
1287
1288mod internal {
1289 use super::*;
1290
1291 impl fidl::encoding::ResourceTypeMarker for DeviceProxyGetChannelRequest {
1292 type Borrowed<'a> = &'a mut Self;
1293 fn take_or_borrow<'a>(
1294 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1295 ) -> Self::Borrowed<'a> {
1296 value
1297 }
1298 }
1299
1300 unsafe impl fidl::encoding::TypeMarker for DeviceProxyGetChannelRequest {
1301 type Owned = Self;
1302
1303 #[inline(always)]
1304 fn inline_align(_context: fidl::encoding::Context) -> usize {
1305 4
1306 }
1307
1308 #[inline(always)]
1309 fn inline_size(_context: fidl::encoding::Context) -> usize {
1310 4
1311 }
1312 }
1313
1314 unsafe impl
1315 fidl::encoding::Encode<
1316 DeviceProxyGetChannelRequest,
1317 fidl::encoding::DefaultFuchsiaResourceDialect,
1318 > for &mut DeviceProxyGetChannelRequest
1319 {
1320 #[inline]
1321 unsafe fn encode(
1322 self,
1323 encoder: &mut fidl::encoding::Encoder<
1324 '_,
1325 fidl::encoding::DefaultFuchsiaResourceDialect,
1326 >,
1327 offset: usize,
1328 _depth: fidl::encoding::Depth,
1329 ) -> fidl::Result<()> {
1330 encoder.debug_check_bounds::<DeviceProxyGetChannelRequest>(offset);
1331 fidl::encoding::Encode::<DeviceProxyGetChannelRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1333 (
1334 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.req),
1335 ),
1336 encoder, offset, _depth
1337 )
1338 }
1339 }
1340 unsafe impl<
1341 T0: fidl::encoding::Encode<
1342 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
1343 fidl::encoding::DefaultFuchsiaResourceDialect,
1344 >,
1345 >
1346 fidl::encoding::Encode<
1347 DeviceProxyGetChannelRequest,
1348 fidl::encoding::DefaultFuchsiaResourceDialect,
1349 > for (T0,)
1350 {
1351 #[inline]
1352 unsafe fn encode(
1353 self,
1354 encoder: &mut fidl::encoding::Encoder<
1355 '_,
1356 fidl::encoding::DefaultFuchsiaResourceDialect,
1357 >,
1358 offset: usize,
1359 depth: fidl::encoding::Depth,
1360 ) -> fidl::Result<()> {
1361 encoder.debug_check_bounds::<DeviceProxyGetChannelRequest>(offset);
1362 self.0.encode(encoder, offset + 0, depth)?;
1366 Ok(())
1367 }
1368 }
1369
1370 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1371 for DeviceProxyGetChannelRequest
1372 {
1373 #[inline(always)]
1374 fn new_empty() -> Self {
1375 Self {
1376 req: fidl::new_empty!(
1377 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
1378 fidl::encoding::DefaultFuchsiaResourceDialect
1379 ),
1380 }
1381 }
1382
1383 #[inline]
1384 unsafe fn decode(
1385 &mut self,
1386 decoder: &mut fidl::encoding::Decoder<
1387 '_,
1388 fidl::encoding::DefaultFuchsiaResourceDialect,
1389 >,
1390 offset: usize,
1391 _depth: fidl::encoding::Depth,
1392 ) -> fidl::Result<()> {
1393 decoder.debug_check_bounds::<Self>(offset);
1394 fidl::decode!(
1396 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
1397 fidl::encoding::DefaultFuchsiaResourceDialect,
1398 &mut self.req,
1399 decoder,
1400 offset + 0,
1401 _depth
1402 )?;
1403 Ok(())
1404 }
1405 }
1406}