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_google_nanohub__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct DataChannelRegisterRequest {
16 pub event: fidl::Event,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20 for DataChannelRegisterRequest
21{
22}
23
24#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25pub struct DeviceDownloadFirmwareRequest {
26 pub firmware: fidl::Vmo,
27 pub offset: u64,
28}
29
30impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
31 for DeviceDownloadFirmwareRequest
32{
33}
34
35#[derive(Debug, Default, PartialEq)]
36pub struct DataChannelReadResponse {
37 pub data: Option<Vec<u8>>,
38 pub wake_lease: Option<fidl::EventPair>,
39 #[doc(hidden)]
40 pub __source_breaking: fidl::marker::SourceBreaking,
41}
42
43impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DataChannelReadResponse {}
44
45#[derive(Debug, Default, PartialEq)]
46pub struct HangingDataChannelReadResponse {
47 pub data: Option<Vec<u8>>,
48 pub wake_lease: Option<fidl::EventPair>,
49 #[doc(hidden)]
50 pub __source_breaking: fidl::marker::SourceBreaking,
51}
52
53impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
54 for HangingDataChannelReadResponse
55{
56}
57
58#[derive(Debug, Default, PartialEq)]
59pub struct UnboundHangingDataChannelBindRequest {
60 pub server: Option<fidl::endpoints::ServerEnd<HangingDataChannelMarker>>,
61 #[doc(hidden)]
62 pub __source_breaking: fidl::marker::SourceBreaking,
63}
64
65impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
66 for UnboundHangingDataChannelBindRequest
67{
68}
69
70#[derive(Debug, Default, PartialEq)]
71pub struct UnboundWaitableDataChannelBindRequest {
72 pub event: Option<fidl::Event>,
73 pub server: Option<fidl::endpoints::ServerEnd<WaitableDataChannelMarker>>,
74 #[doc(hidden)]
75 pub __source_breaking: fidl::marker::SourceBreaking,
76}
77
78impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
79 for UnboundWaitableDataChannelBindRequest
80{
81}
82
83#[derive(Debug, Default, PartialEq)]
84pub struct WaitableDataChannelReadResponse {
85 pub data: Option<Vec<u8>>,
86 #[doc(hidden)]
87 pub __source_breaking: fidl::marker::SourceBreaking,
88}
89
90impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
91 for WaitableDataChannelReadResponse
92{
93}
94
95#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
96pub struct DataChannelMarker;
97
98impl fidl::endpoints::ProtocolMarker for DataChannelMarker {
99 type Proxy = DataChannelProxy;
100 type RequestStream = DataChannelRequestStream;
101 #[cfg(target_os = "fuchsia")]
102 type SynchronousProxy = DataChannelSynchronousProxy;
103
104 const DEBUG_NAME: &'static str = "(anonymous) DataChannel";
105}
106pub type DataChannelRegisterResult = Result<(), i32>;
107pub type DataChannelReadResult = Result<DataChannelReadResponse, i32>;
108pub type DataChannelWriteResult = Result<(), i32>;
109
110pub trait DataChannelProxyInterface: Send + Sync {
111 type RegisterResponseFut: std::future::Future<Output = Result<DataChannelRegisterResult, fidl::Error>>
112 + Send;
113 fn r#register(&self, event: fidl::Event) -> Self::RegisterResponseFut;
114 type GetIdentifierResponseFut: std::future::Future<Output = Result<DataChannelGetIdentifierResponse, fidl::Error>>
115 + Send;
116 fn r#get_identifier(&self) -> Self::GetIdentifierResponseFut;
117 type ReadResponseFut: std::future::Future<Output = Result<DataChannelReadResult, fidl::Error>>
118 + Send;
119 fn r#read(&self, payload: &DataChannelReadRequest) -> Self::ReadResponseFut;
120 type WriteResponseFut: std::future::Future<Output = Result<DataChannelWriteResult, fidl::Error>>
121 + Send;
122 fn r#write(&self, payload: &DataChannelWriteRequest) -> Self::WriteResponseFut;
123}
124#[derive(Debug)]
125#[cfg(target_os = "fuchsia")]
126pub struct DataChannelSynchronousProxy {
127 client: fidl::client::sync::Client,
128}
129
130#[cfg(target_os = "fuchsia")]
131impl fidl::endpoints::SynchronousProxy for DataChannelSynchronousProxy {
132 type Proxy = DataChannelProxy;
133 type Protocol = DataChannelMarker;
134
135 fn from_channel(inner: fidl::Channel) -> Self {
136 Self::new(inner)
137 }
138
139 fn into_channel(self) -> fidl::Channel {
140 self.client.into_channel()
141 }
142
143 fn as_channel(&self) -> &fidl::Channel {
144 self.client.as_channel()
145 }
146}
147
148#[cfg(target_os = "fuchsia")]
149impl DataChannelSynchronousProxy {
150 pub fn new(channel: fidl::Channel) -> Self {
151 let protocol_name = <DataChannelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
152 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
153 }
154
155 pub fn into_channel(self) -> fidl::Channel {
156 self.client.into_channel()
157 }
158
159 pub fn wait_for_event(
162 &self,
163 deadline: zx::MonotonicInstant,
164 ) -> Result<DataChannelEvent, fidl::Error> {
165 DataChannelEvent::decode(self.client.wait_for_event(deadline)?)
166 }
167
168 pub fn r#register(
173 &self,
174 mut event: fidl::Event,
175 ___deadline: zx::MonotonicInstant,
176 ) -> Result<DataChannelRegisterResult, fidl::Error> {
177 let _response = self.client.send_query::<
178 DataChannelRegisterRequest,
179 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
180 >(
181 (event,),
182 0x1778251ad75157b6,
183 fidl::encoding::DynamicFlags::FLEXIBLE,
184 ___deadline,
185 )?
186 .into_result::<DataChannelMarker>("register")?;
187 Ok(_response.map(|x| x))
188 }
189
190 pub fn r#get_identifier(
192 &self,
193 ___deadline: zx::MonotonicInstant,
194 ) -> Result<DataChannelGetIdentifierResponse, fidl::Error> {
195 let _response = self.client.send_query::<
196 fidl::encoding::EmptyPayload,
197 fidl::encoding::FlexibleType<DataChannelGetIdentifierResponse>,
198 >(
199 (),
200 0x4bf148d0ddbd4f69,
201 fidl::encoding::DynamicFlags::FLEXIBLE,
202 ___deadline,
203 )?
204 .into_result::<DataChannelMarker>("get_identifier")?;
205 Ok(_response)
206 }
207
208 pub fn r#read(
212 &self,
213 mut payload: &DataChannelReadRequest,
214 ___deadline: zx::MonotonicInstant,
215 ) -> Result<DataChannelReadResult, fidl::Error> {
216 let _response = self.client.send_query::<
217 DataChannelReadRequest,
218 fidl::encoding::FlexibleResultType<DataChannelReadResponse, i32>,
219 >(
220 payload,
221 0x12ab08cf21533d26,
222 fidl::encoding::DynamicFlags::FLEXIBLE,
223 ___deadline,
224 )?
225 .into_result::<DataChannelMarker>("read")?;
226 Ok(_response.map(|x| x))
227 }
228
229 pub fn r#write(
235 &self,
236 mut payload: &DataChannelWriteRequest,
237 ___deadline: zx::MonotonicInstant,
238 ) -> Result<DataChannelWriteResult, fidl::Error> {
239 let _response = self.client.send_query::<
240 DataChannelWriteRequest,
241 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
242 >(
243 payload,
244 0xf2e12121698789b,
245 fidl::encoding::DynamicFlags::FLEXIBLE,
246 ___deadline,
247 )?
248 .into_result::<DataChannelMarker>("write")?;
249 Ok(_response.map(|x| x))
250 }
251}
252
253#[cfg(target_os = "fuchsia")]
254impl From<DataChannelSynchronousProxy> for zx::NullableHandle {
255 fn from(value: DataChannelSynchronousProxy) -> Self {
256 value.into_channel().into()
257 }
258}
259
260#[cfg(target_os = "fuchsia")]
261impl From<fidl::Channel> for DataChannelSynchronousProxy {
262 fn from(value: fidl::Channel) -> Self {
263 Self::new(value)
264 }
265}
266
267#[cfg(target_os = "fuchsia")]
268impl fidl::endpoints::FromClient for DataChannelSynchronousProxy {
269 type Protocol = DataChannelMarker;
270
271 fn from_client(value: fidl::endpoints::ClientEnd<DataChannelMarker>) -> Self {
272 Self::new(value.into_channel())
273 }
274}
275
276#[derive(Debug, Clone)]
277pub struct DataChannelProxy {
278 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
279}
280
281impl fidl::endpoints::Proxy for DataChannelProxy {
282 type Protocol = DataChannelMarker;
283
284 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
285 Self::new(inner)
286 }
287
288 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
289 self.client.into_channel().map_err(|client| Self { client })
290 }
291
292 fn as_channel(&self) -> &::fidl::AsyncChannel {
293 self.client.as_channel()
294 }
295}
296
297impl DataChannelProxy {
298 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
300 let protocol_name = <DataChannelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
301 Self { client: fidl::client::Client::new(channel, protocol_name) }
302 }
303
304 pub fn take_event_stream(&self) -> DataChannelEventStream {
310 DataChannelEventStream { event_receiver: self.client.take_event_receiver() }
311 }
312
313 pub fn r#register(
318 &self,
319 mut event: fidl::Event,
320 ) -> fidl::client::QueryResponseFut<
321 DataChannelRegisterResult,
322 fidl::encoding::DefaultFuchsiaResourceDialect,
323 > {
324 DataChannelProxyInterface::r#register(self, event)
325 }
326
327 pub fn r#get_identifier(
329 &self,
330 ) -> fidl::client::QueryResponseFut<
331 DataChannelGetIdentifierResponse,
332 fidl::encoding::DefaultFuchsiaResourceDialect,
333 > {
334 DataChannelProxyInterface::r#get_identifier(self)
335 }
336
337 pub fn r#read(
341 &self,
342 mut payload: &DataChannelReadRequest,
343 ) -> fidl::client::QueryResponseFut<
344 DataChannelReadResult,
345 fidl::encoding::DefaultFuchsiaResourceDialect,
346 > {
347 DataChannelProxyInterface::r#read(self, payload)
348 }
349
350 pub fn r#write(
356 &self,
357 mut payload: &DataChannelWriteRequest,
358 ) -> fidl::client::QueryResponseFut<
359 DataChannelWriteResult,
360 fidl::encoding::DefaultFuchsiaResourceDialect,
361 > {
362 DataChannelProxyInterface::r#write(self, payload)
363 }
364}
365
366impl DataChannelProxyInterface for DataChannelProxy {
367 type RegisterResponseFut = fidl::client::QueryResponseFut<
368 DataChannelRegisterResult,
369 fidl::encoding::DefaultFuchsiaResourceDialect,
370 >;
371 fn r#register(&self, mut event: fidl::Event) -> Self::RegisterResponseFut {
372 fn _decode(
373 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
374 ) -> Result<DataChannelRegisterResult, fidl::Error> {
375 let _response = fidl::client::decode_transaction_body::<
376 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
377 fidl::encoding::DefaultFuchsiaResourceDialect,
378 0x1778251ad75157b6,
379 >(_buf?)?
380 .into_result::<DataChannelMarker>("register")?;
381 Ok(_response.map(|x| x))
382 }
383 self.client.send_query_and_decode::<DataChannelRegisterRequest, DataChannelRegisterResult>(
384 (event,),
385 0x1778251ad75157b6,
386 fidl::encoding::DynamicFlags::FLEXIBLE,
387 _decode,
388 )
389 }
390
391 type GetIdentifierResponseFut = fidl::client::QueryResponseFut<
392 DataChannelGetIdentifierResponse,
393 fidl::encoding::DefaultFuchsiaResourceDialect,
394 >;
395 fn r#get_identifier(&self) -> Self::GetIdentifierResponseFut {
396 fn _decode(
397 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
398 ) -> Result<DataChannelGetIdentifierResponse, fidl::Error> {
399 let _response = fidl::client::decode_transaction_body::<
400 fidl::encoding::FlexibleType<DataChannelGetIdentifierResponse>,
401 fidl::encoding::DefaultFuchsiaResourceDialect,
402 0x4bf148d0ddbd4f69,
403 >(_buf?)?
404 .into_result::<DataChannelMarker>("get_identifier")?;
405 Ok(_response)
406 }
407 self.client.send_query_and_decode::<
408 fidl::encoding::EmptyPayload,
409 DataChannelGetIdentifierResponse,
410 >(
411 (),
412 0x4bf148d0ddbd4f69,
413 fidl::encoding::DynamicFlags::FLEXIBLE,
414 _decode,
415 )
416 }
417
418 type ReadResponseFut = fidl::client::QueryResponseFut<
419 DataChannelReadResult,
420 fidl::encoding::DefaultFuchsiaResourceDialect,
421 >;
422 fn r#read(&self, mut payload: &DataChannelReadRequest) -> Self::ReadResponseFut {
423 fn _decode(
424 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
425 ) -> Result<DataChannelReadResult, fidl::Error> {
426 let _response = fidl::client::decode_transaction_body::<
427 fidl::encoding::FlexibleResultType<DataChannelReadResponse, i32>,
428 fidl::encoding::DefaultFuchsiaResourceDialect,
429 0x12ab08cf21533d26,
430 >(_buf?)?
431 .into_result::<DataChannelMarker>("read")?;
432 Ok(_response.map(|x| x))
433 }
434 self.client.send_query_and_decode::<DataChannelReadRequest, DataChannelReadResult>(
435 payload,
436 0x12ab08cf21533d26,
437 fidl::encoding::DynamicFlags::FLEXIBLE,
438 _decode,
439 )
440 }
441
442 type WriteResponseFut = fidl::client::QueryResponseFut<
443 DataChannelWriteResult,
444 fidl::encoding::DefaultFuchsiaResourceDialect,
445 >;
446 fn r#write(&self, mut payload: &DataChannelWriteRequest) -> Self::WriteResponseFut {
447 fn _decode(
448 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
449 ) -> Result<DataChannelWriteResult, fidl::Error> {
450 let _response = fidl::client::decode_transaction_body::<
451 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
452 fidl::encoding::DefaultFuchsiaResourceDialect,
453 0xf2e12121698789b,
454 >(_buf?)?
455 .into_result::<DataChannelMarker>("write")?;
456 Ok(_response.map(|x| x))
457 }
458 self.client.send_query_and_decode::<DataChannelWriteRequest, DataChannelWriteResult>(
459 payload,
460 0xf2e12121698789b,
461 fidl::encoding::DynamicFlags::FLEXIBLE,
462 _decode,
463 )
464 }
465}
466
467pub struct DataChannelEventStream {
468 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
469}
470
471impl std::marker::Unpin for DataChannelEventStream {}
472
473impl futures::stream::FusedStream for DataChannelEventStream {
474 fn is_terminated(&self) -> bool {
475 self.event_receiver.is_terminated()
476 }
477}
478
479impl futures::Stream for DataChannelEventStream {
480 type Item = Result<DataChannelEvent, fidl::Error>;
481
482 fn poll_next(
483 mut self: std::pin::Pin<&mut Self>,
484 cx: &mut std::task::Context<'_>,
485 ) -> std::task::Poll<Option<Self::Item>> {
486 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
487 &mut self.event_receiver,
488 cx
489 )?) {
490 Some(buf) => std::task::Poll::Ready(Some(DataChannelEvent::decode(buf))),
491 None => std::task::Poll::Ready(None),
492 }
493 }
494}
495
496#[derive(Debug)]
497pub enum DataChannelEvent {
498 #[non_exhaustive]
499 _UnknownEvent {
500 ordinal: u64,
502 },
503}
504
505impl DataChannelEvent {
506 fn decode(
508 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
509 ) -> Result<DataChannelEvent, fidl::Error> {
510 let (bytes, _handles) = buf.split_mut();
511 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
512 debug_assert_eq!(tx_header.tx_id, 0);
513 match tx_header.ordinal {
514 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
515 Ok(DataChannelEvent::_UnknownEvent { ordinal: tx_header.ordinal })
516 }
517 _ => Err(fidl::Error::UnknownOrdinal {
518 ordinal: tx_header.ordinal,
519 protocol_name: <DataChannelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
520 }),
521 }
522 }
523}
524
525pub struct DataChannelRequestStream {
527 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
528 is_terminated: bool,
529}
530
531impl std::marker::Unpin for DataChannelRequestStream {}
532
533impl futures::stream::FusedStream for DataChannelRequestStream {
534 fn is_terminated(&self) -> bool {
535 self.is_terminated
536 }
537}
538
539impl fidl::endpoints::RequestStream for DataChannelRequestStream {
540 type Protocol = DataChannelMarker;
541 type ControlHandle = DataChannelControlHandle;
542
543 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
544 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
545 }
546
547 fn control_handle(&self) -> Self::ControlHandle {
548 DataChannelControlHandle { inner: self.inner.clone() }
549 }
550
551 fn into_inner(
552 self,
553 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
554 {
555 (self.inner, self.is_terminated)
556 }
557
558 fn from_inner(
559 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
560 is_terminated: bool,
561 ) -> Self {
562 Self { inner, is_terminated }
563 }
564}
565
566impl futures::Stream for DataChannelRequestStream {
567 type Item = Result<DataChannelRequest, fidl::Error>;
568
569 fn poll_next(
570 mut self: std::pin::Pin<&mut Self>,
571 cx: &mut std::task::Context<'_>,
572 ) -> std::task::Poll<Option<Self::Item>> {
573 let this = &mut *self;
574 if this.inner.check_shutdown(cx) {
575 this.is_terminated = true;
576 return std::task::Poll::Ready(None);
577 }
578 if this.is_terminated {
579 panic!("polled DataChannelRequestStream after completion");
580 }
581 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
582 |bytes, handles| {
583 match this.inner.channel().read_etc(cx, bytes, handles) {
584 std::task::Poll::Ready(Ok(())) => {}
585 std::task::Poll::Pending => return std::task::Poll::Pending,
586 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
587 this.is_terminated = true;
588 return std::task::Poll::Ready(None);
589 }
590 std::task::Poll::Ready(Err(e)) => {
591 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
592 e.into(),
593 ))));
594 }
595 }
596
597 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
599
600 std::task::Poll::Ready(Some(match header.ordinal {
601 0x1778251ad75157b6 => {
602 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
603 let mut req = fidl::new_empty!(
604 DataChannelRegisterRequest,
605 fidl::encoding::DefaultFuchsiaResourceDialect
606 );
607 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DataChannelRegisterRequest>(&header, _body_bytes, handles, &mut req)?;
608 let control_handle = DataChannelControlHandle { inner: this.inner.clone() };
609 Ok(DataChannelRequest::Register {
610 event: req.event,
611
612 responder: DataChannelRegisterResponder {
613 control_handle: std::mem::ManuallyDrop::new(control_handle),
614 tx_id: header.tx_id,
615 },
616 })
617 }
618 0x4bf148d0ddbd4f69 => {
619 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
620 let mut req = fidl::new_empty!(
621 fidl::encoding::EmptyPayload,
622 fidl::encoding::DefaultFuchsiaResourceDialect
623 );
624 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
625 let control_handle = DataChannelControlHandle { inner: this.inner.clone() };
626 Ok(DataChannelRequest::GetIdentifier {
627 responder: DataChannelGetIdentifierResponder {
628 control_handle: std::mem::ManuallyDrop::new(control_handle),
629 tx_id: header.tx_id,
630 },
631 })
632 }
633 0x12ab08cf21533d26 => {
634 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
635 let mut req = fidl::new_empty!(
636 DataChannelReadRequest,
637 fidl::encoding::DefaultFuchsiaResourceDialect
638 );
639 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DataChannelReadRequest>(&header, _body_bytes, handles, &mut req)?;
640 let control_handle = DataChannelControlHandle { inner: this.inner.clone() };
641 Ok(DataChannelRequest::Read {
642 payload: req,
643 responder: DataChannelReadResponder {
644 control_handle: std::mem::ManuallyDrop::new(control_handle),
645 tx_id: header.tx_id,
646 },
647 })
648 }
649 0xf2e12121698789b => {
650 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
651 let mut req = fidl::new_empty!(
652 DataChannelWriteRequest,
653 fidl::encoding::DefaultFuchsiaResourceDialect
654 );
655 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DataChannelWriteRequest>(&header, _body_bytes, handles, &mut req)?;
656 let control_handle = DataChannelControlHandle { inner: this.inner.clone() };
657 Ok(DataChannelRequest::Write {
658 payload: req,
659 responder: DataChannelWriteResponder {
660 control_handle: std::mem::ManuallyDrop::new(control_handle),
661 tx_id: header.tx_id,
662 },
663 })
664 }
665 _ if header.tx_id == 0
666 && header
667 .dynamic_flags()
668 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
669 {
670 Ok(DataChannelRequest::_UnknownMethod {
671 ordinal: header.ordinal,
672 control_handle: DataChannelControlHandle { inner: this.inner.clone() },
673 method_type: fidl::MethodType::OneWay,
674 })
675 }
676 _ if header
677 .dynamic_flags()
678 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
679 {
680 this.inner.send_framework_err(
681 fidl::encoding::FrameworkErr::UnknownMethod,
682 header.tx_id,
683 header.ordinal,
684 header.dynamic_flags(),
685 (bytes, handles),
686 )?;
687 Ok(DataChannelRequest::_UnknownMethod {
688 ordinal: header.ordinal,
689 control_handle: DataChannelControlHandle { inner: this.inner.clone() },
690 method_type: fidl::MethodType::TwoWay,
691 })
692 }
693 _ => Err(fidl::Error::UnknownOrdinal {
694 ordinal: header.ordinal,
695 protocol_name:
696 <DataChannelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
697 }),
698 }))
699 },
700 )
701 }
702}
703
704#[derive(Debug)]
706pub enum DataChannelRequest {
707 Register { event: fidl::Event, responder: DataChannelRegisterResponder },
712 GetIdentifier { responder: DataChannelGetIdentifierResponder },
714 Read { payload: DataChannelReadRequest, responder: DataChannelReadResponder },
718 Write { payload: DataChannelWriteRequest, responder: DataChannelWriteResponder },
724 #[non_exhaustive]
726 _UnknownMethod {
727 ordinal: u64,
729 control_handle: DataChannelControlHandle,
730 method_type: fidl::MethodType,
731 },
732}
733
734impl DataChannelRequest {
735 #[allow(irrefutable_let_patterns)]
736 pub fn into_register(self) -> Option<(fidl::Event, DataChannelRegisterResponder)> {
737 if let DataChannelRequest::Register { event, responder } = self {
738 Some((event, responder))
739 } else {
740 None
741 }
742 }
743
744 #[allow(irrefutable_let_patterns)]
745 pub fn into_get_identifier(self) -> Option<(DataChannelGetIdentifierResponder)> {
746 if let DataChannelRequest::GetIdentifier { responder } = self {
747 Some((responder))
748 } else {
749 None
750 }
751 }
752
753 #[allow(irrefutable_let_patterns)]
754 pub fn into_read(self) -> Option<(DataChannelReadRequest, DataChannelReadResponder)> {
755 if let DataChannelRequest::Read { payload, responder } = self {
756 Some((payload, responder))
757 } else {
758 None
759 }
760 }
761
762 #[allow(irrefutable_let_patterns)]
763 pub fn into_write(self) -> Option<(DataChannelWriteRequest, DataChannelWriteResponder)> {
764 if let DataChannelRequest::Write { payload, responder } = self {
765 Some((payload, responder))
766 } else {
767 None
768 }
769 }
770
771 pub fn method_name(&self) -> &'static str {
773 match *self {
774 DataChannelRequest::Register { .. } => "register",
775 DataChannelRequest::GetIdentifier { .. } => "get_identifier",
776 DataChannelRequest::Read { .. } => "read",
777 DataChannelRequest::Write { .. } => "write",
778 DataChannelRequest::_UnknownMethod {
779 method_type: fidl::MethodType::OneWay, ..
780 } => "unknown one-way method",
781 DataChannelRequest::_UnknownMethod {
782 method_type: fidl::MethodType::TwoWay, ..
783 } => "unknown two-way method",
784 }
785 }
786}
787
788#[derive(Debug, Clone)]
789pub struct DataChannelControlHandle {
790 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
791}
792
793impl fidl::endpoints::ControlHandle for DataChannelControlHandle {
794 fn shutdown(&self) {
795 self.inner.shutdown()
796 }
797
798 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
799 self.inner.shutdown_with_epitaph(status)
800 }
801
802 fn is_closed(&self) -> bool {
803 self.inner.channel().is_closed()
804 }
805 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
806 self.inner.channel().on_closed()
807 }
808
809 #[cfg(target_os = "fuchsia")]
810 fn signal_peer(
811 &self,
812 clear_mask: zx::Signals,
813 set_mask: zx::Signals,
814 ) -> Result<(), zx_status::Status> {
815 use fidl::Peered;
816 self.inner.channel().signal_peer(clear_mask, set_mask)
817 }
818}
819
820impl DataChannelControlHandle {}
821
822#[must_use = "FIDL methods require a response to be sent"]
823#[derive(Debug)]
824pub struct DataChannelRegisterResponder {
825 control_handle: std::mem::ManuallyDrop<DataChannelControlHandle>,
826 tx_id: u32,
827}
828
829impl std::ops::Drop for DataChannelRegisterResponder {
833 fn drop(&mut self) {
834 self.control_handle.shutdown();
835 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
837 }
838}
839
840impl fidl::endpoints::Responder for DataChannelRegisterResponder {
841 type ControlHandle = DataChannelControlHandle;
842
843 fn control_handle(&self) -> &DataChannelControlHandle {
844 &self.control_handle
845 }
846
847 fn drop_without_shutdown(mut self) {
848 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
850 std::mem::forget(self);
852 }
853}
854
855impl DataChannelRegisterResponder {
856 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
860 let _result = self.send_raw(result);
861 if _result.is_err() {
862 self.control_handle.shutdown();
863 }
864 self.drop_without_shutdown();
865 _result
866 }
867
868 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
870 let _result = self.send_raw(result);
871 self.drop_without_shutdown();
872 _result
873 }
874
875 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
876 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
877 fidl::encoding::EmptyStruct,
878 i32,
879 >>(
880 fidl::encoding::FlexibleResult::new(result),
881 self.tx_id,
882 0x1778251ad75157b6,
883 fidl::encoding::DynamicFlags::FLEXIBLE,
884 )
885 }
886}
887
888#[must_use = "FIDL methods require a response to be sent"]
889#[derive(Debug)]
890pub struct DataChannelGetIdentifierResponder {
891 control_handle: std::mem::ManuallyDrop<DataChannelControlHandle>,
892 tx_id: u32,
893}
894
895impl std::ops::Drop for DataChannelGetIdentifierResponder {
899 fn drop(&mut self) {
900 self.control_handle.shutdown();
901 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
903 }
904}
905
906impl fidl::endpoints::Responder for DataChannelGetIdentifierResponder {
907 type ControlHandle = DataChannelControlHandle;
908
909 fn control_handle(&self) -> &DataChannelControlHandle {
910 &self.control_handle
911 }
912
913 fn drop_without_shutdown(mut self) {
914 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
916 std::mem::forget(self);
918 }
919}
920
921impl DataChannelGetIdentifierResponder {
922 pub fn send(self, mut payload: &DataChannelGetIdentifierResponse) -> Result<(), fidl::Error> {
926 let _result = self.send_raw(payload);
927 if _result.is_err() {
928 self.control_handle.shutdown();
929 }
930 self.drop_without_shutdown();
931 _result
932 }
933
934 pub fn send_no_shutdown_on_err(
936 self,
937 mut payload: &DataChannelGetIdentifierResponse,
938 ) -> Result<(), fidl::Error> {
939 let _result = self.send_raw(payload);
940 self.drop_without_shutdown();
941 _result
942 }
943
944 fn send_raw(&self, mut payload: &DataChannelGetIdentifierResponse) -> Result<(), fidl::Error> {
945 self.control_handle
946 .inner
947 .send::<fidl::encoding::FlexibleType<DataChannelGetIdentifierResponse>>(
948 fidl::encoding::Flexible::new(payload),
949 self.tx_id,
950 0x4bf148d0ddbd4f69,
951 fidl::encoding::DynamicFlags::FLEXIBLE,
952 )
953 }
954}
955
956#[must_use = "FIDL methods require a response to be sent"]
957#[derive(Debug)]
958pub struct DataChannelReadResponder {
959 control_handle: std::mem::ManuallyDrop<DataChannelControlHandle>,
960 tx_id: u32,
961}
962
963impl std::ops::Drop for DataChannelReadResponder {
967 fn drop(&mut self) {
968 self.control_handle.shutdown();
969 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
971 }
972}
973
974impl fidl::endpoints::Responder for DataChannelReadResponder {
975 type ControlHandle = DataChannelControlHandle;
976
977 fn control_handle(&self) -> &DataChannelControlHandle {
978 &self.control_handle
979 }
980
981 fn drop_without_shutdown(mut self) {
982 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
984 std::mem::forget(self);
986 }
987}
988
989impl DataChannelReadResponder {
990 pub fn send(self, mut result: Result<DataChannelReadResponse, i32>) -> Result<(), fidl::Error> {
994 let _result = self.send_raw(result);
995 if _result.is_err() {
996 self.control_handle.shutdown();
997 }
998 self.drop_without_shutdown();
999 _result
1000 }
1001
1002 pub fn send_no_shutdown_on_err(
1004 self,
1005 mut result: Result<DataChannelReadResponse, i32>,
1006 ) -> Result<(), fidl::Error> {
1007 let _result = self.send_raw(result);
1008 self.drop_without_shutdown();
1009 _result
1010 }
1011
1012 fn send_raw(
1013 &self,
1014 mut result: Result<DataChannelReadResponse, i32>,
1015 ) -> Result<(), fidl::Error> {
1016 self.control_handle
1017 .inner
1018 .send::<fidl::encoding::FlexibleResultType<DataChannelReadResponse, i32>>(
1019 fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
1020 self.tx_id,
1021 0x12ab08cf21533d26,
1022 fidl::encoding::DynamicFlags::FLEXIBLE,
1023 )
1024 }
1025}
1026
1027#[must_use = "FIDL methods require a response to be sent"]
1028#[derive(Debug)]
1029pub struct DataChannelWriteResponder {
1030 control_handle: std::mem::ManuallyDrop<DataChannelControlHandle>,
1031 tx_id: u32,
1032}
1033
1034impl std::ops::Drop for DataChannelWriteResponder {
1038 fn drop(&mut self) {
1039 self.control_handle.shutdown();
1040 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1042 }
1043}
1044
1045impl fidl::endpoints::Responder for DataChannelWriteResponder {
1046 type ControlHandle = DataChannelControlHandle;
1047
1048 fn control_handle(&self) -> &DataChannelControlHandle {
1049 &self.control_handle
1050 }
1051
1052 fn drop_without_shutdown(mut self) {
1053 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1055 std::mem::forget(self);
1057 }
1058}
1059
1060impl DataChannelWriteResponder {
1061 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1065 let _result = self.send_raw(result);
1066 if _result.is_err() {
1067 self.control_handle.shutdown();
1068 }
1069 self.drop_without_shutdown();
1070 _result
1071 }
1072
1073 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1075 let _result = self.send_raw(result);
1076 self.drop_without_shutdown();
1077 _result
1078 }
1079
1080 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1081 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1082 fidl::encoding::EmptyStruct,
1083 i32,
1084 >>(
1085 fidl::encoding::FlexibleResult::new(result),
1086 self.tx_id,
1087 0xf2e12121698789b,
1088 fidl::encoding::DynamicFlags::FLEXIBLE,
1089 )
1090 }
1091}
1092
1093#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1094pub struct DeviceMarker;
1095
1096impl fidl::endpoints::ProtocolMarker for DeviceMarker {
1097 type Proxy = DeviceProxy;
1098 type RequestStream = DeviceRequestStream;
1099 #[cfg(target_os = "fuchsia")]
1100 type SynchronousProxy = DeviceSynchronousProxy;
1101
1102 const DEBUG_NAME: &'static str = "fuchsia.hardware.google.nanohub.Device";
1103}
1104impl fidl::endpoints::DiscoverableProtocolMarker for DeviceMarker {}
1105pub type DeviceDownloadFirmwareResult = Result<(), i32>;
1106pub type DeviceGetTimeSyncResult = Result<McuTimeSyncInfo, i32>;
1107pub type DeviceSetWakeLockResult = Result<(), i32>;
1108pub type DeviceGetWakeUpEventDurationResult = Result<i64, i32>;
1109pub type DeviceSetWakeUpEventDurationResult = Result<(), i32>;
1110pub type DeviceHardwareResetResult = Result<(), i32>;
1111
1112pub trait DeviceProxyInterface: Send + Sync {
1113 type DownloadFirmwareResponseFut: std::future::Future<Output = Result<DeviceDownloadFirmwareResult, fidl::Error>>
1114 + Send;
1115 fn r#download_firmware(
1116 &self,
1117 firmware: fidl::Vmo,
1118 offset: u64,
1119 ) -> Self::DownloadFirmwareResponseFut;
1120 type GetFirmwareNameResponseFut: std::future::Future<Output = Result<String, fidl::Error>>
1121 + Send;
1122 fn r#get_firmware_name(&self) -> Self::GetFirmwareNameResponseFut;
1123 type GetFirmwareVersionResponseFut: std::future::Future<Output = Result<McuVersionInfo, fidl::Error>>
1124 + Send;
1125 fn r#get_firmware_version(&self) -> Self::GetFirmwareVersionResponseFut;
1126 type GetTimeSyncResponseFut: std::future::Future<Output = Result<DeviceGetTimeSyncResult, fidl::Error>>
1127 + Send;
1128 fn r#get_time_sync(&self) -> Self::GetTimeSyncResponseFut;
1129 type SetWakeLockResponseFut: std::future::Future<Output = Result<DeviceSetWakeLockResult, fidl::Error>>
1130 + Send;
1131 fn r#set_wake_lock(&self, value: McuWakeLockValue) -> Self::SetWakeLockResponseFut;
1132 type GetWakeUpEventDurationResponseFut: std::future::Future<Output = Result<DeviceGetWakeUpEventDurationResult, fidl::Error>>
1133 + Send;
1134 fn r#get_wake_up_event_duration(&self) -> Self::GetWakeUpEventDurationResponseFut;
1135 type SetWakeUpEventDurationResponseFut: std::future::Future<Output = Result<DeviceSetWakeUpEventDurationResult, fidl::Error>>
1136 + Send;
1137 fn r#set_wake_up_event_duration(
1138 &self,
1139 duration: i64,
1140 ) -> Self::SetWakeUpEventDurationResponseFut;
1141 type HardwareResetResponseFut: std::future::Future<Output = Result<DeviceHardwareResetResult, fidl::Error>>
1142 + Send;
1143 fn r#hardware_reset(
1144 &self,
1145 isp_pin_0: PinState,
1146 isp_pin_1: PinState,
1147 isp_pin_2: PinState,
1148 ) -> Self::HardwareResetResponseFut;
1149}
1150#[derive(Debug)]
1151#[cfg(target_os = "fuchsia")]
1152pub struct DeviceSynchronousProxy {
1153 client: fidl::client::sync::Client,
1154}
1155
1156#[cfg(target_os = "fuchsia")]
1157impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
1158 type Proxy = DeviceProxy;
1159 type Protocol = DeviceMarker;
1160
1161 fn from_channel(inner: fidl::Channel) -> Self {
1162 Self::new(inner)
1163 }
1164
1165 fn into_channel(self) -> fidl::Channel {
1166 self.client.into_channel()
1167 }
1168
1169 fn as_channel(&self) -> &fidl::Channel {
1170 self.client.as_channel()
1171 }
1172}
1173
1174#[cfg(target_os = "fuchsia")]
1175impl DeviceSynchronousProxy {
1176 pub fn new(channel: fidl::Channel) -> Self {
1177 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1178 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1179 }
1180
1181 pub fn into_channel(self) -> fidl::Channel {
1182 self.client.into_channel()
1183 }
1184
1185 pub fn wait_for_event(
1188 &self,
1189 deadline: zx::MonotonicInstant,
1190 ) -> Result<DeviceEvent, fidl::Error> {
1191 DeviceEvent::decode(self.client.wait_for_event(deadline)?)
1192 }
1193
1194 pub fn r#download_firmware(
1196 &self,
1197 mut firmware: fidl::Vmo,
1198 mut offset: u64,
1199 ___deadline: zx::MonotonicInstant,
1200 ) -> Result<DeviceDownloadFirmwareResult, fidl::Error> {
1201 let _response = self.client.send_query::<
1202 DeviceDownloadFirmwareRequest,
1203 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1204 >(
1205 (firmware, offset,),
1206 0x7bba8137e24661e5,
1207 fidl::encoding::DynamicFlags::empty(),
1208 ___deadline,
1209 )?;
1210 Ok(_response.map(|x| x))
1211 }
1212
1213 pub fn r#get_firmware_name(
1215 &self,
1216 ___deadline: zx::MonotonicInstant,
1217 ) -> Result<String, fidl::Error> {
1218 let _response =
1219 self.client.send_query::<fidl::encoding::EmptyPayload, DeviceGetFirmwareNameResponse>(
1220 (),
1221 0x1649434b5e5bcb8d,
1222 fidl::encoding::DynamicFlags::empty(),
1223 ___deadline,
1224 )?;
1225 Ok(_response.firmware_name)
1226 }
1227
1228 pub fn r#get_firmware_version(
1230 &self,
1231 ___deadline: zx::MonotonicInstant,
1232 ) -> Result<McuVersionInfo, fidl::Error> {
1233 let _response = self
1234 .client
1235 .send_query::<fidl::encoding::EmptyPayload, DeviceGetFirmwareVersionResponse>(
1236 (),
1237 0x4f0599abcc95736b,
1238 fidl::encoding::DynamicFlags::empty(),
1239 ___deadline,
1240 )?;
1241 Ok(_response.version_info)
1242 }
1243
1244 pub fn r#get_time_sync(
1246 &self,
1247 ___deadline: zx::MonotonicInstant,
1248 ) -> Result<DeviceGetTimeSyncResult, fidl::Error> {
1249 let _response = self.client.send_query::<
1250 fidl::encoding::EmptyPayload,
1251 fidl::encoding::ResultType<McuTimeSyncInfo, i32>,
1252 >(
1253 (),
1254 0x4406991222e3975d,
1255 fidl::encoding::DynamicFlags::empty(),
1256 ___deadline,
1257 )?;
1258 Ok(_response.map(|x| x))
1259 }
1260
1261 pub fn r#set_wake_lock(
1263 &self,
1264 mut value: McuWakeLockValue,
1265 ___deadline: zx::MonotonicInstant,
1266 ) -> Result<DeviceSetWakeLockResult, fidl::Error> {
1267 let _response = self.client.send_query::<
1268 DeviceSetWakeLockRequest,
1269 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1270 >(
1271 (value,),
1272 0x9f83f614affa1dc,
1273 fidl::encoding::DynamicFlags::empty(),
1274 ___deadline,
1275 )?;
1276 Ok(_response.map(|x| x))
1277 }
1278
1279 pub fn r#get_wake_up_event_duration(
1281 &self,
1282 ___deadline: zx::MonotonicInstant,
1283 ) -> Result<DeviceGetWakeUpEventDurationResult, fidl::Error> {
1284 let _response = self.client.send_query::<
1285 fidl::encoding::EmptyPayload,
1286 fidl::encoding::ResultType<DeviceGetWakeUpEventDurationResponse, i32>,
1287 >(
1288 (),
1289 0x45c79749f65e7176,
1290 fidl::encoding::DynamicFlags::empty(),
1291 ___deadline,
1292 )?;
1293 Ok(_response.map(|x| x.duration))
1294 }
1295
1296 pub fn r#set_wake_up_event_duration(
1298 &self,
1299 mut duration: i64,
1300 ___deadline: zx::MonotonicInstant,
1301 ) -> Result<DeviceSetWakeUpEventDurationResult, fidl::Error> {
1302 let _response = self.client.send_query::<
1303 DeviceSetWakeUpEventDurationRequest,
1304 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1305 >(
1306 (duration,),
1307 0x1fa1771ffa5f570,
1308 fidl::encoding::DynamicFlags::empty(),
1309 ___deadline,
1310 )?;
1311 Ok(_response.map(|x| x))
1312 }
1313
1314 pub fn r#hardware_reset(
1316 &self,
1317 mut isp_pin_0: PinState,
1318 mut isp_pin_1: PinState,
1319 mut isp_pin_2: PinState,
1320 ___deadline: zx::MonotonicInstant,
1321 ) -> Result<DeviceHardwareResetResult, fidl::Error> {
1322 let _response = self.client.send_query::<
1323 HardwareResetPinStates,
1324 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1325 >(
1326 (isp_pin_0, isp_pin_1, isp_pin_2,),
1327 0x78e3d2ded2f929f,
1328 fidl::encoding::DynamicFlags::empty(),
1329 ___deadline,
1330 )?;
1331 Ok(_response.map(|x| x))
1332 }
1333}
1334
1335#[cfg(target_os = "fuchsia")]
1336impl From<DeviceSynchronousProxy> for zx::NullableHandle {
1337 fn from(value: DeviceSynchronousProxy) -> Self {
1338 value.into_channel().into()
1339 }
1340}
1341
1342#[cfg(target_os = "fuchsia")]
1343impl From<fidl::Channel> for DeviceSynchronousProxy {
1344 fn from(value: fidl::Channel) -> Self {
1345 Self::new(value)
1346 }
1347}
1348
1349#[cfg(target_os = "fuchsia")]
1350impl fidl::endpoints::FromClient for DeviceSynchronousProxy {
1351 type Protocol = DeviceMarker;
1352
1353 fn from_client(value: fidl::endpoints::ClientEnd<DeviceMarker>) -> Self {
1354 Self::new(value.into_channel())
1355 }
1356}
1357
1358#[derive(Debug, Clone)]
1359pub struct DeviceProxy {
1360 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1361}
1362
1363impl fidl::endpoints::Proxy for DeviceProxy {
1364 type Protocol = DeviceMarker;
1365
1366 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1367 Self::new(inner)
1368 }
1369
1370 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1371 self.client.into_channel().map_err(|client| Self { client })
1372 }
1373
1374 fn as_channel(&self) -> &::fidl::AsyncChannel {
1375 self.client.as_channel()
1376 }
1377}
1378
1379impl DeviceProxy {
1380 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1382 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1383 Self { client: fidl::client::Client::new(channel, protocol_name) }
1384 }
1385
1386 pub fn take_event_stream(&self) -> DeviceEventStream {
1392 DeviceEventStream { event_receiver: self.client.take_event_receiver() }
1393 }
1394
1395 pub fn r#download_firmware(
1397 &self,
1398 mut firmware: fidl::Vmo,
1399 mut offset: u64,
1400 ) -> fidl::client::QueryResponseFut<
1401 DeviceDownloadFirmwareResult,
1402 fidl::encoding::DefaultFuchsiaResourceDialect,
1403 > {
1404 DeviceProxyInterface::r#download_firmware(self, firmware, offset)
1405 }
1406
1407 pub fn r#get_firmware_name(
1409 &self,
1410 ) -> fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect> {
1411 DeviceProxyInterface::r#get_firmware_name(self)
1412 }
1413
1414 pub fn r#get_firmware_version(
1416 &self,
1417 ) -> fidl::client::QueryResponseFut<McuVersionInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
1418 {
1419 DeviceProxyInterface::r#get_firmware_version(self)
1420 }
1421
1422 pub fn r#get_time_sync(
1424 &self,
1425 ) -> fidl::client::QueryResponseFut<
1426 DeviceGetTimeSyncResult,
1427 fidl::encoding::DefaultFuchsiaResourceDialect,
1428 > {
1429 DeviceProxyInterface::r#get_time_sync(self)
1430 }
1431
1432 pub fn r#set_wake_lock(
1434 &self,
1435 mut value: McuWakeLockValue,
1436 ) -> fidl::client::QueryResponseFut<
1437 DeviceSetWakeLockResult,
1438 fidl::encoding::DefaultFuchsiaResourceDialect,
1439 > {
1440 DeviceProxyInterface::r#set_wake_lock(self, value)
1441 }
1442
1443 pub fn r#get_wake_up_event_duration(
1445 &self,
1446 ) -> fidl::client::QueryResponseFut<
1447 DeviceGetWakeUpEventDurationResult,
1448 fidl::encoding::DefaultFuchsiaResourceDialect,
1449 > {
1450 DeviceProxyInterface::r#get_wake_up_event_duration(self)
1451 }
1452
1453 pub fn r#set_wake_up_event_duration(
1455 &self,
1456 mut duration: i64,
1457 ) -> fidl::client::QueryResponseFut<
1458 DeviceSetWakeUpEventDurationResult,
1459 fidl::encoding::DefaultFuchsiaResourceDialect,
1460 > {
1461 DeviceProxyInterface::r#set_wake_up_event_duration(self, duration)
1462 }
1463
1464 pub fn r#hardware_reset(
1466 &self,
1467 mut isp_pin_0: PinState,
1468 mut isp_pin_1: PinState,
1469 mut isp_pin_2: PinState,
1470 ) -> fidl::client::QueryResponseFut<
1471 DeviceHardwareResetResult,
1472 fidl::encoding::DefaultFuchsiaResourceDialect,
1473 > {
1474 DeviceProxyInterface::r#hardware_reset(self, isp_pin_0, isp_pin_1, isp_pin_2)
1475 }
1476}
1477
1478impl DeviceProxyInterface for DeviceProxy {
1479 type DownloadFirmwareResponseFut = fidl::client::QueryResponseFut<
1480 DeviceDownloadFirmwareResult,
1481 fidl::encoding::DefaultFuchsiaResourceDialect,
1482 >;
1483 fn r#download_firmware(
1484 &self,
1485 mut firmware: fidl::Vmo,
1486 mut offset: u64,
1487 ) -> Self::DownloadFirmwareResponseFut {
1488 fn _decode(
1489 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1490 ) -> Result<DeviceDownloadFirmwareResult, fidl::Error> {
1491 let _response = fidl::client::decode_transaction_body::<
1492 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1493 fidl::encoding::DefaultFuchsiaResourceDialect,
1494 0x7bba8137e24661e5,
1495 >(_buf?)?;
1496 Ok(_response.map(|x| x))
1497 }
1498 self.client
1499 .send_query_and_decode::<DeviceDownloadFirmwareRequest, DeviceDownloadFirmwareResult>(
1500 (firmware, offset),
1501 0x7bba8137e24661e5,
1502 fidl::encoding::DynamicFlags::empty(),
1503 _decode,
1504 )
1505 }
1506
1507 type GetFirmwareNameResponseFut =
1508 fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect>;
1509 fn r#get_firmware_name(&self) -> Self::GetFirmwareNameResponseFut {
1510 fn _decode(
1511 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1512 ) -> Result<String, fidl::Error> {
1513 let _response = fidl::client::decode_transaction_body::<
1514 DeviceGetFirmwareNameResponse,
1515 fidl::encoding::DefaultFuchsiaResourceDialect,
1516 0x1649434b5e5bcb8d,
1517 >(_buf?)?;
1518 Ok(_response.firmware_name)
1519 }
1520 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, String>(
1521 (),
1522 0x1649434b5e5bcb8d,
1523 fidl::encoding::DynamicFlags::empty(),
1524 _decode,
1525 )
1526 }
1527
1528 type GetFirmwareVersionResponseFut = fidl::client::QueryResponseFut<
1529 McuVersionInfo,
1530 fidl::encoding::DefaultFuchsiaResourceDialect,
1531 >;
1532 fn r#get_firmware_version(&self) -> Self::GetFirmwareVersionResponseFut {
1533 fn _decode(
1534 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1535 ) -> Result<McuVersionInfo, fidl::Error> {
1536 let _response = fidl::client::decode_transaction_body::<
1537 DeviceGetFirmwareVersionResponse,
1538 fidl::encoding::DefaultFuchsiaResourceDialect,
1539 0x4f0599abcc95736b,
1540 >(_buf?)?;
1541 Ok(_response.version_info)
1542 }
1543 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, McuVersionInfo>(
1544 (),
1545 0x4f0599abcc95736b,
1546 fidl::encoding::DynamicFlags::empty(),
1547 _decode,
1548 )
1549 }
1550
1551 type GetTimeSyncResponseFut = fidl::client::QueryResponseFut<
1552 DeviceGetTimeSyncResult,
1553 fidl::encoding::DefaultFuchsiaResourceDialect,
1554 >;
1555 fn r#get_time_sync(&self) -> Self::GetTimeSyncResponseFut {
1556 fn _decode(
1557 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1558 ) -> Result<DeviceGetTimeSyncResult, fidl::Error> {
1559 let _response = fidl::client::decode_transaction_body::<
1560 fidl::encoding::ResultType<McuTimeSyncInfo, i32>,
1561 fidl::encoding::DefaultFuchsiaResourceDialect,
1562 0x4406991222e3975d,
1563 >(_buf?)?;
1564 Ok(_response.map(|x| x))
1565 }
1566 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceGetTimeSyncResult>(
1567 (),
1568 0x4406991222e3975d,
1569 fidl::encoding::DynamicFlags::empty(),
1570 _decode,
1571 )
1572 }
1573
1574 type SetWakeLockResponseFut = fidl::client::QueryResponseFut<
1575 DeviceSetWakeLockResult,
1576 fidl::encoding::DefaultFuchsiaResourceDialect,
1577 >;
1578 fn r#set_wake_lock(&self, mut value: McuWakeLockValue) -> Self::SetWakeLockResponseFut {
1579 fn _decode(
1580 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1581 ) -> Result<DeviceSetWakeLockResult, fidl::Error> {
1582 let _response = fidl::client::decode_transaction_body::<
1583 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1584 fidl::encoding::DefaultFuchsiaResourceDialect,
1585 0x9f83f614affa1dc,
1586 >(_buf?)?;
1587 Ok(_response.map(|x| x))
1588 }
1589 self.client.send_query_and_decode::<DeviceSetWakeLockRequest, DeviceSetWakeLockResult>(
1590 (value,),
1591 0x9f83f614affa1dc,
1592 fidl::encoding::DynamicFlags::empty(),
1593 _decode,
1594 )
1595 }
1596
1597 type GetWakeUpEventDurationResponseFut = fidl::client::QueryResponseFut<
1598 DeviceGetWakeUpEventDurationResult,
1599 fidl::encoding::DefaultFuchsiaResourceDialect,
1600 >;
1601 fn r#get_wake_up_event_duration(&self) -> Self::GetWakeUpEventDurationResponseFut {
1602 fn _decode(
1603 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1604 ) -> Result<DeviceGetWakeUpEventDurationResult, fidl::Error> {
1605 let _response = fidl::client::decode_transaction_body::<
1606 fidl::encoding::ResultType<DeviceGetWakeUpEventDurationResponse, i32>,
1607 fidl::encoding::DefaultFuchsiaResourceDialect,
1608 0x45c79749f65e7176,
1609 >(_buf?)?;
1610 Ok(_response.map(|x| x.duration))
1611 }
1612 self.client.send_query_and_decode::<
1613 fidl::encoding::EmptyPayload,
1614 DeviceGetWakeUpEventDurationResult,
1615 >(
1616 (),
1617 0x45c79749f65e7176,
1618 fidl::encoding::DynamicFlags::empty(),
1619 _decode,
1620 )
1621 }
1622
1623 type SetWakeUpEventDurationResponseFut = fidl::client::QueryResponseFut<
1624 DeviceSetWakeUpEventDurationResult,
1625 fidl::encoding::DefaultFuchsiaResourceDialect,
1626 >;
1627 fn r#set_wake_up_event_duration(
1628 &self,
1629 mut duration: i64,
1630 ) -> Self::SetWakeUpEventDurationResponseFut {
1631 fn _decode(
1632 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1633 ) -> Result<DeviceSetWakeUpEventDurationResult, fidl::Error> {
1634 let _response = fidl::client::decode_transaction_body::<
1635 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1636 fidl::encoding::DefaultFuchsiaResourceDialect,
1637 0x1fa1771ffa5f570,
1638 >(_buf?)?;
1639 Ok(_response.map(|x| x))
1640 }
1641 self.client.send_query_and_decode::<
1642 DeviceSetWakeUpEventDurationRequest,
1643 DeviceSetWakeUpEventDurationResult,
1644 >(
1645 (duration,),
1646 0x1fa1771ffa5f570,
1647 fidl::encoding::DynamicFlags::empty(),
1648 _decode,
1649 )
1650 }
1651
1652 type HardwareResetResponseFut = fidl::client::QueryResponseFut<
1653 DeviceHardwareResetResult,
1654 fidl::encoding::DefaultFuchsiaResourceDialect,
1655 >;
1656 fn r#hardware_reset(
1657 &self,
1658 mut isp_pin_0: PinState,
1659 mut isp_pin_1: PinState,
1660 mut isp_pin_2: PinState,
1661 ) -> Self::HardwareResetResponseFut {
1662 fn _decode(
1663 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1664 ) -> Result<DeviceHardwareResetResult, fidl::Error> {
1665 let _response = fidl::client::decode_transaction_body::<
1666 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1667 fidl::encoding::DefaultFuchsiaResourceDialect,
1668 0x78e3d2ded2f929f,
1669 >(_buf?)?;
1670 Ok(_response.map(|x| x))
1671 }
1672 self.client.send_query_and_decode::<HardwareResetPinStates, DeviceHardwareResetResult>(
1673 (isp_pin_0, isp_pin_1, isp_pin_2),
1674 0x78e3d2ded2f929f,
1675 fidl::encoding::DynamicFlags::empty(),
1676 _decode,
1677 )
1678 }
1679}
1680
1681pub struct DeviceEventStream {
1682 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1683}
1684
1685impl std::marker::Unpin for DeviceEventStream {}
1686
1687impl futures::stream::FusedStream for DeviceEventStream {
1688 fn is_terminated(&self) -> bool {
1689 self.event_receiver.is_terminated()
1690 }
1691}
1692
1693impl futures::Stream for DeviceEventStream {
1694 type Item = Result<DeviceEvent, fidl::Error>;
1695
1696 fn poll_next(
1697 mut self: std::pin::Pin<&mut Self>,
1698 cx: &mut std::task::Context<'_>,
1699 ) -> std::task::Poll<Option<Self::Item>> {
1700 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1701 &mut self.event_receiver,
1702 cx
1703 )?) {
1704 Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
1705 None => std::task::Poll::Ready(None),
1706 }
1707 }
1708}
1709
1710#[derive(Debug)]
1711pub enum DeviceEvent {
1712 #[non_exhaustive]
1713 _UnknownEvent {
1714 ordinal: u64,
1716 },
1717}
1718
1719impl DeviceEvent {
1720 fn decode(
1722 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1723 ) -> Result<DeviceEvent, fidl::Error> {
1724 let (bytes, _handles) = buf.split_mut();
1725 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1726 debug_assert_eq!(tx_header.tx_id, 0);
1727 match tx_header.ordinal {
1728 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1729 Ok(DeviceEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1730 }
1731 _ => Err(fidl::Error::UnknownOrdinal {
1732 ordinal: tx_header.ordinal,
1733 protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1734 }),
1735 }
1736 }
1737}
1738
1739pub struct DeviceRequestStream {
1741 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1742 is_terminated: bool,
1743}
1744
1745impl std::marker::Unpin for DeviceRequestStream {}
1746
1747impl futures::stream::FusedStream for DeviceRequestStream {
1748 fn is_terminated(&self) -> bool {
1749 self.is_terminated
1750 }
1751}
1752
1753impl fidl::endpoints::RequestStream for DeviceRequestStream {
1754 type Protocol = DeviceMarker;
1755 type ControlHandle = DeviceControlHandle;
1756
1757 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1758 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1759 }
1760
1761 fn control_handle(&self) -> Self::ControlHandle {
1762 DeviceControlHandle { inner: self.inner.clone() }
1763 }
1764
1765 fn into_inner(
1766 self,
1767 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1768 {
1769 (self.inner, self.is_terminated)
1770 }
1771
1772 fn from_inner(
1773 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1774 is_terminated: bool,
1775 ) -> Self {
1776 Self { inner, is_terminated }
1777 }
1778}
1779
1780impl futures::Stream for DeviceRequestStream {
1781 type Item = Result<DeviceRequest, fidl::Error>;
1782
1783 fn poll_next(
1784 mut self: std::pin::Pin<&mut Self>,
1785 cx: &mut std::task::Context<'_>,
1786 ) -> std::task::Poll<Option<Self::Item>> {
1787 let this = &mut *self;
1788 if this.inner.check_shutdown(cx) {
1789 this.is_terminated = true;
1790 return std::task::Poll::Ready(None);
1791 }
1792 if this.is_terminated {
1793 panic!("polled DeviceRequestStream after completion");
1794 }
1795 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1796 |bytes, handles| {
1797 match this.inner.channel().read_etc(cx, bytes, handles) {
1798 std::task::Poll::Ready(Ok(())) => {}
1799 std::task::Poll::Pending => return std::task::Poll::Pending,
1800 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1801 this.is_terminated = true;
1802 return std::task::Poll::Ready(None);
1803 }
1804 std::task::Poll::Ready(Err(e)) => {
1805 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1806 e.into(),
1807 ))));
1808 }
1809 }
1810
1811 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1813
1814 std::task::Poll::Ready(Some(match header.ordinal {
1815 0x7bba8137e24661e5 => {
1816 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1817 let mut req = fidl::new_empty!(
1818 DeviceDownloadFirmwareRequest,
1819 fidl::encoding::DefaultFuchsiaResourceDialect
1820 );
1821 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceDownloadFirmwareRequest>(&header, _body_bytes, handles, &mut req)?;
1822 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1823 Ok(DeviceRequest::DownloadFirmware {
1824 firmware: req.firmware,
1825 offset: req.offset,
1826
1827 responder: DeviceDownloadFirmwareResponder {
1828 control_handle: std::mem::ManuallyDrop::new(control_handle),
1829 tx_id: header.tx_id,
1830 },
1831 })
1832 }
1833 0x1649434b5e5bcb8d => {
1834 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1835 let mut req = fidl::new_empty!(
1836 fidl::encoding::EmptyPayload,
1837 fidl::encoding::DefaultFuchsiaResourceDialect
1838 );
1839 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1840 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1841 Ok(DeviceRequest::GetFirmwareName {
1842 responder: DeviceGetFirmwareNameResponder {
1843 control_handle: std::mem::ManuallyDrop::new(control_handle),
1844 tx_id: header.tx_id,
1845 },
1846 })
1847 }
1848 0x4f0599abcc95736b => {
1849 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1850 let mut req = fidl::new_empty!(
1851 fidl::encoding::EmptyPayload,
1852 fidl::encoding::DefaultFuchsiaResourceDialect
1853 );
1854 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1855 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1856 Ok(DeviceRequest::GetFirmwareVersion {
1857 responder: DeviceGetFirmwareVersionResponder {
1858 control_handle: std::mem::ManuallyDrop::new(control_handle),
1859 tx_id: header.tx_id,
1860 },
1861 })
1862 }
1863 0x4406991222e3975d => {
1864 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1865 let mut req = fidl::new_empty!(
1866 fidl::encoding::EmptyPayload,
1867 fidl::encoding::DefaultFuchsiaResourceDialect
1868 );
1869 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1870 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1871 Ok(DeviceRequest::GetTimeSync {
1872 responder: DeviceGetTimeSyncResponder {
1873 control_handle: std::mem::ManuallyDrop::new(control_handle),
1874 tx_id: header.tx_id,
1875 },
1876 })
1877 }
1878 0x9f83f614affa1dc => {
1879 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1880 let mut req = fidl::new_empty!(
1881 DeviceSetWakeLockRequest,
1882 fidl::encoding::DefaultFuchsiaResourceDialect
1883 );
1884 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetWakeLockRequest>(&header, _body_bytes, handles, &mut req)?;
1885 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1886 Ok(DeviceRequest::SetWakeLock {
1887 value: req.value,
1888
1889 responder: DeviceSetWakeLockResponder {
1890 control_handle: std::mem::ManuallyDrop::new(control_handle),
1891 tx_id: header.tx_id,
1892 },
1893 })
1894 }
1895 0x45c79749f65e7176 => {
1896 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1897 let mut req = fidl::new_empty!(
1898 fidl::encoding::EmptyPayload,
1899 fidl::encoding::DefaultFuchsiaResourceDialect
1900 );
1901 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1902 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1903 Ok(DeviceRequest::GetWakeUpEventDuration {
1904 responder: DeviceGetWakeUpEventDurationResponder {
1905 control_handle: std::mem::ManuallyDrop::new(control_handle),
1906 tx_id: header.tx_id,
1907 },
1908 })
1909 }
1910 0x1fa1771ffa5f570 => {
1911 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1912 let mut req = fidl::new_empty!(
1913 DeviceSetWakeUpEventDurationRequest,
1914 fidl::encoding::DefaultFuchsiaResourceDialect
1915 );
1916 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetWakeUpEventDurationRequest>(&header, _body_bytes, handles, &mut req)?;
1917 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1918 Ok(DeviceRequest::SetWakeUpEventDuration {
1919 duration: req.duration,
1920
1921 responder: DeviceSetWakeUpEventDurationResponder {
1922 control_handle: std::mem::ManuallyDrop::new(control_handle),
1923 tx_id: header.tx_id,
1924 },
1925 })
1926 }
1927 0x78e3d2ded2f929f => {
1928 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1929 let mut req = fidl::new_empty!(
1930 HardwareResetPinStates,
1931 fidl::encoding::DefaultFuchsiaResourceDialect
1932 );
1933 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HardwareResetPinStates>(&header, _body_bytes, handles, &mut req)?;
1934 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1935 Ok(DeviceRequest::HardwareReset {
1936 isp_pin_0: req.isp_pin_0,
1937 isp_pin_1: req.isp_pin_1,
1938 isp_pin_2: req.isp_pin_2,
1939
1940 responder: DeviceHardwareResetResponder {
1941 control_handle: std::mem::ManuallyDrop::new(control_handle),
1942 tx_id: header.tx_id,
1943 },
1944 })
1945 }
1946 _ if header.tx_id == 0
1947 && header
1948 .dynamic_flags()
1949 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1950 {
1951 Ok(DeviceRequest::_UnknownMethod {
1952 ordinal: header.ordinal,
1953 control_handle: DeviceControlHandle { inner: this.inner.clone() },
1954 method_type: fidl::MethodType::OneWay,
1955 })
1956 }
1957 _ if header
1958 .dynamic_flags()
1959 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1960 {
1961 this.inner.send_framework_err(
1962 fidl::encoding::FrameworkErr::UnknownMethod,
1963 header.tx_id,
1964 header.ordinal,
1965 header.dynamic_flags(),
1966 (bytes, handles),
1967 )?;
1968 Ok(DeviceRequest::_UnknownMethod {
1969 ordinal: header.ordinal,
1970 control_handle: DeviceControlHandle { inner: this.inner.clone() },
1971 method_type: fidl::MethodType::TwoWay,
1972 })
1973 }
1974 _ => Err(fidl::Error::UnknownOrdinal {
1975 ordinal: header.ordinal,
1976 protocol_name:
1977 <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1978 }),
1979 }))
1980 },
1981 )
1982 }
1983}
1984
1985#[derive(Debug)]
1987pub enum DeviceRequest {
1988 DownloadFirmware {
1990 firmware: fidl::Vmo,
1991 offset: u64,
1992 responder: DeviceDownloadFirmwareResponder,
1993 },
1994 GetFirmwareName { responder: DeviceGetFirmwareNameResponder },
1996 GetFirmwareVersion { responder: DeviceGetFirmwareVersionResponder },
1998 GetTimeSync { responder: DeviceGetTimeSyncResponder },
2000 SetWakeLock { value: McuWakeLockValue, responder: DeviceSetWakeLockResponder },
2002 GetWakeUpEventDuration { responder: DeviceGetWakeUpEventDurationResponder },
2004 SetWakeUpEventDuration { duration: i64, responder: DeviceSetWakeUpEventDurationResponder },
2006 HardwareReset {
2008 isp_pin_0: PinState,
2009 isp_pin_1: PinState,
2010 isp_pin_2: PinState,
2011 responder: DeviceHardwareResetResponder,
2012 },
2013 #[non_exhaustive]
2015 _UnknownMethod {
2016 ordinal: u64,
2018 control_handle: DeviceControlHandle,
2019 method_type: fidl::MethodType,
2020 },
2021}
2022
2023impl DeviceRequest {
2024 #[allow(irrefutable_let_patterns)]
2025 pub fn into_download_firmware(
2026 self,
2027 ) -> Option<(fidl::Vmo, u64, DeviceDownloadFirmwareResponder)> {
2028 if let DeviceRequest::DownloadFirmware { firmware, offset, responder } = self {
2029 Some((firmware, offset, responder))
2030 } else {
2031 None
2032 }
2033 }
2034
2035 #[allow(irrefutable_let_patterns)]
2036 pub fn into_get_firmware_name(self) -> Option<(DeviceGetFirmwareNameResponder)> {
2037 if let DeviceRequest::GetFirmwareName { responder } = self {
2038 Some((responder))
2039 } else {
2040 None
2041 }
2042 }
2043
2044 #[allow(irrefutable_let_patterns)]
2045 pub fn into_get_firmware_version(self) -> Option<(DeviceGetFirmwareVersionResponder)> {
2046 if let DeviceRequest::GetFirmwareVersion { responder } = self {
2047 Some((responder))
2048 } else {
2049 None
2050 }
2051 }
2052
2053 #[allow(irrefutable_let_patterns)]
2054 pub fn into_get_time_sync(self) -> Option<(DeviceGetTimeSyncResponder)> {
2055 if let DeviceRequest::GetTimeSync { responder } = self { Some((responder)) } else { None }
2056 }
2057
2058 #[allow(irrefutable_let_patterns)]
2059 pub fn into_set_wake_lock(self) -> Option<(McuWakeLockValue, DeviceSetWakeLockResponder)> {
2060 if let DeviceRequest::SetWakeLock { value, responder } = self {
2061 Some((value, responder))
2062 } else {
2063 None
2064 }
2065 }
2066
2067 #[allow(irrefutable_let_patterns)]
2068 pub fn into_get_wake_up_event_duration(
2069 self,
2070 ) -> Option<(DeviceGetWakeUpEventDurationResponder)> {
2071 if let DeviceRequest::GetWakeUpEventDuration { responder } = self {
2072 Some((responder))
2073 } else {
2074 None
2075 }
2076 }
2077
2078 #[allow(irrefutable_let_patterns)]
2079 pub fn into_set_wake_up_event_duration(
2080 self,
2081 ) -> Option<(i64, DeviceSetWakeUpEventDurationResponder)> {
2082 if let DeviceRequest::SetWakeUpEventDuration { duration, responder } = self {
2083 Some((duration, responder))
2084 } else {
2085 None
2086 }
2087 }
2088
2089 #[allow(irrefutable_let_patterns)]
2090 pub fn into_hardware_reset(
2091 self,
2092 ) -> Option<(PinState, PinState, PinState, DeviceHardwareResetResponder)> {
2093 if let DeviceRequest::HardwareReset { isp_pin_0, isp_pin_1, isp_pin_2, responder } = self {
2094 Some((isp_pin_0, isp_pin_1, isp_pin_2, responder))
2095 } else {
2096 None
2097 }
2098 }
2099
2100 pub fn method_name(&self) -> &'static str {
2102 match *self {
2103 DeviceRequest::DownloadFirmware { .. } => "download_firmware",
2104 DeviceRequest::GetFirmwareName { .. } => "get_firmware_name",
2105 DeviceRequest::GetFirmwareVersion { .. } => "get_firmware_version",
2106 DeviceRequest::GetTimeSync { .. } => "get_time_sync",
2107 DeviceRequest::SetWakeLock { .. } => "set_wake_lock",
2108 DeviceRequest::GetWakeUpEventDuration { .. } => "get_wake_up_event_duration",
2109 DeviceRequest::SetWakeUpEventDuration { .. } => "set_wake_up_event_duration",
2110 DeviceRequest::HardwareReset { .. } => "hardware_reset",
2111 DeviceRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
2112 "unknown one-way method"
2113 }
2114 DeviceRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
2115 "unknown two-way method"
2116 }
2117 }
2118 }
2119}
2120
2121#[derive(Debug, Clone)]
2122pub struct DeviceControlHandle {
2123 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2124}
2125
2126impl fidl::endpoints::ControlHandle for DeviceControlHandle {
2127 fn shutdown(&self) {
2128 self.inner.shutdown()
2129 }
2130
2131 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2132 self.inner.shutdown_with_epitaph(status)
2133 }
2134
2135 fn is_closed(&self) -> bool {
2136 self.inner.channel().is_closed()
2137 }
2138 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2139 self.inner.channel().on_closed()
2140 }
2141
2142 #[cfg(target_os = "fuchsia")]
2143 fn signal_peer(
2144 &self,
2145 clear_mask: zx::Signals,
2146 set_mask: zx::Signals,
2147 ) -> Result<(), zx_status::Status> {
2148 use fidl::Peered;
2149 self.inner.channel().signal_peer(clear_mask, set_mask)
2150 }
2151}
2152
2153impl DeviceControlHandle {}
2154
2155#[must_use = "FIDL methods require a response to be sent"]
2156#[derive(Debug)]
2157pub struct DeviceDownloadFirmwareResponder {
2158 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2159 tx_id: u32,
2160}
2161
2162impl std::ops::Drop for DeviceDownloadFirmwareResponder {
2166 fn drop(&mut self) {
2167 self.control_handle.shutdown();
2168 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2170 }
2171}
2172
2173impl fidl::endpoints::Responder for DeviceDownloadFirmwareResponder {
2174 type ControlHandle = DeviceControlHandle;
2175
2176 fn control_handle(&self) -> &DeviceControlHandle {
2177 &self.control_handle
2178 }
2179
2180 fn drop_without_shutdown(mut self) {
2181 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2183 std::mem::forget(self);
2185 }
2186}
2187
2188impl DeviceDownloadFirmwareResponder {
2189 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2193 let _result = self.send_raw(result);
2194 if _result.is_err() {
2195 self.control_handle.shutdown();
2196 }
2197 self.drop_without_shutdown();
2198 _result
2199 }
2200
2201 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2203 let _result = self.send_raw(result);
2204 self.drop_without_shutdown();
2205 _result
2206 }
2207
2208 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2209 self.control_handle
2210 .inner
2211 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2212 result,
2213 self.tx_id,
2214 0x7bba8137e24661e5,
2215 fidl::encoding::DynamicFlags::empty(),
2216 )
2217 }
2218}
2219
2220#[must_use = "FIDL methods require a response to be sent"]
2221#[derive(Debug)]
2222pub struct DeviceGetFirmwareNameResponder {
2223 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2224 tx_id: u32,
2225}
2226
2227impl std::ops::Drop for DeviceGetFirmwareNameResponder {
2231 fn drop(&mut self) {
2232 self.control_handle.shutdown();
2233 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2235 }
2236}
2237
2238impl fidl::endpoints::Responder for DeviceGetFirmwareNameResponder {
2239 type ControlHandle = DeviceControlHandle;
2240
2241 fn control_handle(&self) -> &DeviceControlHandle {
2242 &self.control_handle
2243 }
2244
2245 fn drop_without_shutdown(mut self) {
2246 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2248 std::mem::forget(self);
2250 }
2251}
2252
2253impl DeviceGetFirmwareNameResponder {
2254 pub fn send(self, mut firmware_name: &str) -> Result<(), fidl::Error> {
2258 let _result = self.send_raw(firmware_name);
2259 if _result.is_err() {
2260 self.control_handle.shutdown();
2261 }
2262 self.drop_without_shutdown();
2263 _result
2264 }
2265
2266 pub fn send_no_shutdown_on_err(self, mut firmware_name: &str) -> Result<(), fidl::Error> {
2268 let _result = self.send_raw(firmware_name);
2269 self.drop_without_shutdown();
2270 _result
2271 }
2272
2273 fn send_raw(&self, mut firmware_name: &str) -> Result<(), fidl::Error> {
2274 self.control_handle.inner.send::<DeviceGetFirmwareNameResponse>(
2275 (firmware_name,),
2276 self.tx_id,
2277 0x1649434b5e5bcb8d,
2278 fidl::encoding::DynamicFlags::empty(),
2279 )
2280 }
2281}
2282
2283#[must_use = "FIDL methods require a response to be sent"]
2284#[derive(Debug)]
2285pub struct DeviceGetFirmwareVersionResponder {
2286 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2287 tx_id: u32,
2288}
2289
2290impl std::ops::Drop for DeviceGetFirmwareVersionResponder {
2294 fn drop(&mut self) {
2295 self.control_handle.shutdown();
2296 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2298 }
2299}
2300
2301impl fidl::endpoints::Responder for DeviceGetFirmwareVersionResponder {
2302 type ControlHandle = DeviceControlHandle;
2303
2304 fn control_handle(&self) -> &DeviceControlHandle {
2305 &self.control_handle
2306 }
2307
2308 fn drop_without_shutdown(mut self) {
2309 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2311 std::mem::forget(self);
2313 }
2314}
2315
2316impl DeviceGetFirmwareVersionResponder {
2317 pub fn send(self, mut version_info: &McuVersionInfo) -> Result<(), fidl::Error> {
2321 let _result = self.send_raw(version_info);
2322 if _result.is_err() {
2323 self.control_handle.shutdown();
2324 }
2325 self.drop_without_shutdown();
2326 _result
2327 }
2328
2329 pub fn send_no_shutdown_on_err(
2331 self,
2332 mut version_info: &McuVersionInfo,
2333 ) -> Result<(), fidl::Error> {
2334 let _result = self.send_raw(version_info);
2335 self.drop_without_shutdown();
2336 _result
2337 }
2338
2339 fn send_raw(&self, mut version_info: &McuVersionInfo) -> Result<(), fidl::Error> {
2340 self.control_handle.inner.send::<DeviceGetFirmwareVersionResponse>(
2341 (version_info,),
2342 self.tx_id,
2343 0x4f0599abcc95736b,
2344 fidl::encoding::DynamicFlags::empty(),
2345 )
2346 }
2347}
2348
2349#[must_use = "FIDL methods require a response to be sent"]
2350#[derive(Debug)]
2351pub struct DeviceGetTimeSyncResponder {
2352 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2353 tx_id: u32,
2354}
2355
2356impl std::ops::Drop for DeviceGetTimeSyncResponder {
2360 fn drop(&mut self) {
2361 self.control_handle.shutdown();
2362 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2364 }
2365}
2366
2367impl fidl::endpoints::Responder for DeviceGetTimeSyncResponder {
2368 type ControlHandle = DeviceControlHandle;
2369
2370 fn control_handle(&self) -> &DeviceControlHandle {
2371 &self.control_handle
2372 }
2373
2374 fn drop_without_shutdown(mut self) {
2375 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2377 std::mem::forget(self);
2379 }
2380}
2381
2382impl DeviceGetTimeSyncResponder {
2383 pub fn send(self, mut result: Result<&McuTimeSyncInfo, i32>) -> Result<(), fidl::Error> {
2387 let _result = self.send_raw(result);
2388 if _result.is_err() {
2389 self.control_handle.shutdown();
2390 }
2391 self.drop_without_shutdown();
2392 _result
2393 }
2394
2395 pub fn send_no_shutdown_on_err(
2397 self,
2398 mut result: Result<&McuTimeSyncInfo, i32>,
2399 ) -> Result<(), fidl::Error> {
2400 let _result = self.send_raw(result);
2401 self.drop_without_shutdown();
2402 _result
2403 }
2404
2405 fn send_raw(&self, mut result: Result<&McuTimeSyncInfo, i32>) -> Result<(), fidl::Error> {
2406 self.control_handle.inner.send::<fidl::encoding::ResultType<McuTimeSyncInfo, i32>>(
2407 result,
2408 self.tx_id,
2409 0x4406991222e3975d,
2410 fidl::encoding::DynamicFlags::empty(),
2411 )
2412 }
2413}
2414
2415#[must_use = "FIDL methods require a response to be sent"]
2416#[derive(Debug)]
2417pub struct DeviceSetWakeLockResponder {
2418 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2419 tx_id: u32,
2420}
2421
2422impl std::ops::Drop for DeviceSetWakeLockResponder {
2426 fn drop(&mut self) {
2427 self.control_handle.shutdown();
2428 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2430 }
2431}
2432
2433impl fidl::endpoints::Responder for DeviceSetWakeLockResponder {
2434 type ControlHandle = DeviceControlHandle;
2435
2436 fn control_handle(&self) -> &DeviceControlHandle {
2437 &self.control_handle
2438 }
2439
2440 fn drop_without_shutdown(mut self) {
2441 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2443 std::mem::forget(self);
2445 }
2446}
2447
2448impl DeviceSetWakeLockResponder {
2449 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2453 let _result = self.send_raw(result);
2454 if _result.is_err() {
2455 self.control_handle.shutdown();
2456 }
2457 self.drop_without_shutdown();
2458 _result
2459 }
2460
2461 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2463 let _result = self.send_raw(result);
2464 self.drop_without_shutdown();
2465 _result
2466 }
2467
2468 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2469 self.control_handle
2470 .inner
2471 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2472 result,
2473 self.tx_id,
2474 0x9f83f614affa1dc,
2475 fidl::encoding::DynamicFlags::empty(),
2476 )
2477 }
2478}
2479
2480#[must_use = "FIDL methods require a response to be sent"]
2481#[derive(Debug)]
2482pub struct DeviceGetWakeUpEventDurationResponder {
2483 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2484 tx_id: u32,
2485}
2486
2487impl std::ops::Drop for DeviceGetWakeUpEventDurationResponder {
2491 fn drop(&mut self) {
2492 self.control_handle.shutdown();
2493 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2495 }
2496}
2497
2498impl fidl::endpoints::Responder for DeviceGetWakeUpEventDurationResponder {
2499 type ControlHandle = DeviceControlHandle;
2500
2501 fn control_handle(&self) -> &DeviceControlHandle {
2502 &self.control_handle
2503 }
2504
2505 fn drop_without_shutdown(mut self) {
2506 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2508 std::mem::forget(self);
2510 }
2511}
2512
2513impl DeviceGetWakeUpEventDurationResponder {
2514 pub fn send(self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
2518 let _result = self.send_raw(result);
2519 if _result.is_err() {
2520 self.control_handle.shutdown();
2521 }
2522 self.drop_without_shutdown();
2523 _result
2524 }
2525
2526 pub fn send_no_shutdown_on_err(self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
2528 let _result = self.send_raw(result);
2529 self.drop_without_shutdown();
2530 _result
2531 }
2532
2533 fn send_raw(&self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
2534 self.control_handle.inner.send::<fidl::encoding::ResultType<
2535 DeviceGetWakeUpEventDurationResponse,
2536 i32,
2537 >>(
2538 result.map(|duration| (duration,)),
2539 self.tx_id,
2540 0x45c79749f65e7176,
2541 fidl::encoding::DynamicFlags::empty(),
2542 )
2543 }
2544}
2545
2546#[must_use = "FIDL methods require a response to be sent"]
2547#[derive(Debug)]
2548pub struct DeviceSetWakeUpEventDurationResponder {
2549 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2550 tx_id: u32,
2551}
2552
2553impl std::ops::Drop for DeviceSetWakeUpEventDurationResponder {
2557 fn drop(&mut self) {
2558 self.control_handle.shutdown();
2559 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2561 }
2562}
2563
2564impl fidl::endpoints::Responder for DeviceSetWakeUpEventDurationResponder {
2565 type ControlHandle = DeviceControlHandle;
2566
2567 fn control_handle(&self) -> &DeviceControlHandle {
2568 &self.control_handle
2569 }
2570
2571 fn drop_without_shutdown(mut self) {
2572 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2574 std::mem::forget(self);
2576 }
2577}
2578
2579impl DeviceSetWakeUpEventDurationResponder {
2580 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2584 let _result = self.send_raw(result);
2585 if _result.is_err() {
2586 self.control_handle.shutdown();
2587 }
2588 self.drop_without_shutdown();
2589 _result
2590 }
2591
2592 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2594 let _result = self.send_raw(result);
2595 self.drop_without_shutdown();
2596 _result
2597 }
2598
2599 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2600 self.control_handle
2601 .inner
2602 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2603 result,
2604 self.tx_id,
2605 0x1fa1771ffa5f570,
2606 fidl::encoding::DynamicFlags::empty(),
2607 )
2608 }
2609}
2610
2611#[must_use = "FIDL methods require a response to be sent"]
2612#[derive(Debug)]
2613pub struct DeviceHardwareResetResponder {
2614 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2615 tx_id: u32,
2616}
2617
2618impl std::ops::Drop for DeviceHardwareResetResponder {
2622 fn drop(&mut self) {
2623 self.control_handle.shutdown();
2624 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2626 }
2627}
2628
2629impl fidl::endpoints::Responder for DeviceHardwareResetResponder {
2630 type ControlHandle = DeviceControlHandle;
2631
2632 fn control_handle(&self) -> &DeviceControlHandle {
2633 &self.control_handle
2634 }
2635
2636 fn drop_without_shutdown(mut self) {
2637 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2639 std::mem::forget(self);
2641 }
2642}
2643
2644impl DeviceHardwareResetResponder {
2645 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2649 let _result = self.send_raw(result);
2650 if _result.is_err() {
2651 self.control_handle.shutdown();
2652 }
2653 self.drop_without_shutdown();
2654 _result
2655 }
2656
2657 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2659 let _result = self.send_raw(result);
2660 self.drop_without_shutdown();
2661 _result
2662 }
2663
2664 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2665 self.control_handle
2666 .inner
2667 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2668 result,
2669 self.tx_id,
2670 0x78e3d2ded2f929f,
2671 fidl::encoding::DynamicFlags::empty(),
2672 )
2673 }
2674}
2675
2676#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2677pub struct DisplayDeviceMarker;
2678
2679impl fidl::endpoints::ProtocolMarker for DisplayDeviceMarker {
2680 type Proxy = DisplayDeviceProxy;
2681 type RequestStream = DisplayDeviceRequestStream;
2682 #[cfg(target_os = "fuchsia")]
2683 type SynchronousProxy = DisplayDeviceSynchronousProxy;
2684
2685 const DEBUG_NAME: &'static str = "fuchsia.hardware.google.nanohub.DisplayDevice";
2686}
2687impl fidl::endpoints::DiscoverableProtocolMarker for DisplayDeviceMarker {}
2688pub type DisplayDeviceGetDisplayStateResult = Result<DisplayState, i32>;
2689pub type DisplayDeviceGetDisplayInfoResult = Result<DisplaySyncInfo, i32>;
2690pub type DisplayDeviceGetDisplaySelectResult = Result<DisplayDeviceGetDisplaySelectResponse, i32>;
2691pub type DisplayDeviceSetDisplaySelectResult = Result<(), i32>;
2692
2693pub trait DisplayDeviceProxyInterface: Send + Sync {
2694 type GetDisplayStateResponseFut: std::future::Future<Output = Result<DisplayDeviceGetDisplayStateResult, fidl::Error>>
2695 + Send;
2696 fn r#get_display_state(&self) -> Self::GetDisplayStateResponseFut;
2697 type GetDisplayInfoResponseFut: std::future::Future<Output = Result<DisplayDeviceGetDisplayInfoResult, fidl::Error>>
2698 + Send;
2699 fn r#get_display_info(&self) -> Self::GetDisplayInfoResponseFut;
2700 type GetDisplaySelectResponseFut: std::future::Future<Output = Result<DisplayDeviceGetDisplaySelectResult, fidl::Error>>
2701 + Send;
2702 fn r#get_display_select(&self) -> Self::GetDisplaySelectResponseFut;
2703 type SetDisplaySelectResponseFut: std::future::Future<Output = Result<DisplayDeviceSetDisplaySelectResult, fidl::Error>>
2704 + Send;
2705 fn r#set_display_select(
2706 &self,
2707 payload: &DisplayDeviceSetDisplaySelectRequest,
2708 ) -> Self::SetDisplaySelectResponseFut;
2709}
2710#[derive(Debug)]
2711#[cfg(target_os = "fuchsia")]
2712pub struct DisplayDeviceSynchronousProxy {
2713 client: fidl::client::sync::Client,
2714}
2715
2716#[cfg(target_os = "fuchsia")]
2717impl fidl::endpoints::SynchronousProxy for DisplayDeviceSynchronousProxy {
2718 type Proxy = DisplayDeviceProxy;
2719 type Protocol = DisplayDeviceMarker;
2720
2721 fn from_channel(inner: fidl::Channel) -> Self {
2722 Self::new(inner)
2723 }
2724
2725 fn into_channel(self) -> fidl::Channel {
2726 self.client.into_channel()
2727 }
2728
2729 fn as_channel(&self) -> &fidl::Channel {
2730 self.client.as_channel()
2731 }
2732}
2733
2734#[cfg(target_os = "fuchsia")]
2735impl DisplayDeviceSynchronousProxy {
2736 pub fn new(channel: fidl::Channel) -> Self {
2737 let protocol_name = <DisplayDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2738 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2739 }
2740
2741 pub fn into_channel(self) -> fidl::Channel {
2742 self.client.into_channel()
2743 }
2744
2745 pub fn wait_for_event(
2748 &self,
2749 deadline: zx::MonotonicInstant,
2750 ) -> Result<DisplayDeviceEvent, fidl::Error> {
2751 DisplayDeviceEvent::decode(self.client.wait_for_event(deadline)?)
2752 }
2753
2754 pub fn r#get_display_state(
2756 &self,
2757 ___deadline: zx::MonotonicInstant,
2758 ) -> Result<DisplayDeviceGetDisplayStateResult, fidl::Error> {
2759 let _response = self.client.send_query::<
2760 fidl::encoding::EmptyPayload,
2761 fidl::encoding::ResultType<DisplayState, i32>,
2762 >(
2763 (),
2764 0x1648924f6e003444,
2765 fidl::encoding::DynamicFlags::empty(),
2766 ___deadline,
2767 )?;
2768 Ok(_response.map(|x| x))
2769 }
2770
2771 pub fn r#get_display_info(
2774 &self,
2775 ___deadline: zx::MonotonicInstant,
2776 ) -> Result<DisplayDeviceGetDisplayInfoResult, fidl::Error> {
2777 let _response = self.client.send_query::<
2778 fidl::encoding::EmptyPayload,
2779 fidl::encoding::ResultType<DisplaySyncInfo, i32>,
2780 >(
2781 (),
2782 0x311c8e4cb6b1b4d1,
2783 fidl::encoding::DynamicFlags::empty(),
2784 ___deadline,
2785 )?;
2786 Ok(_response.map(|x| x))
2787 }
2788
2789 pub fn r#get_display_select(
2792 &self,
2793 ___deadline: zx::MonotonicInstant,
2794 ) -> Result<DisplayDeviceGetDisplaySelectResult, fidl::Error> {
2795 let _response = self.client.send_query::<
2796 fidl::encoding::EmptyPayload,
2797 fidl::encoding::ResultType<DisplayDeviceGetDisplaySelectResponse, i32>,
2798 >(
2799 (),
2800 0x6191c86cffd6323,
2801 fidl::encoding::DynamicFlags::empty(),
2802 ___deadline,
2803 )?;
2804 Ok(_response.map(|x| x))
2805 }
2806
2807 pub fn r#set_display_select(
2810 &self,
2811 mut payload: &DisplayDeviceSetDisplaySelectRequest,
2812 ___deadline: zx::MonotonicInstant,
2813 ) -> Result<DisplayDeviceSetDisplaySelectResult, fidl::Error> {
2814 let _response = self.client.send_query::<
2815 DisplayDeviceSetDisplaySelectRequest,
2816 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2817 >(
2818 payload,
2819 0x2b07f6ba12e7a412,
2820 fidl::encoding::DynamicFlags::empty(),
2821 ___deadline,
2822 )?;
2823 Ok(_response.map(|x| x))
2824 }
2825}
2826
2827#[cfg(target_os = "fuchsia")]
2828impl From<DisplayDeviceSynchronousProxy> for zx::NullableHandle {
2829 fn from(value: DisplayDeviceSynchronousProxy) -> Self {
2830 value.into_channel().into()
2831 }
2832}
2833
2834#[cfg(target_os = "fuchsia")]
2835impl From<fidl::Channel> for DisplayDeviceSynchronousProxy {
2836 fn from(value: fidl::Channel) -> Self {
2837 Self::new(value)
2838 }
2839}
2840
2841#[cfg(target_os = "fuchsia")]
2842impl fidl::endpoints::FromClient for DisplayDeviceSynchronousProxy {
2843 type Protocol = DisplayDeviceMarker;
2844
2845 fn from_client(value: fidl::endpoints::ClientEnd<DisplayDeviceMarker>) -> Self {
2846 Self::new(value.into_channel())
2847 }
2848}
2849
2850#[derive(Debug, Clone)]
2851pub struct DisplayDeviceProxy {
2852 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2853}
2854
2855impl fidl::endpoints::Proxy for DisplayDeviceProxy {
2856 type Protocol = DisplayDeviceMarker;
2857
2858 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2859 Self::new(inner)
2860 }
2861
2862 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2863 self.client.into_channel().map_err(|client| Self { client })
2864 }
2865
2866 fn as_channel(&self) -> &::fidl::AsyncChannel {
2867 self.client.as_channel()
2868 }
2869}
2870
2871impl DisplayDeviceProxy {
2872 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2874 let protocol_name = <DisplayDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2875 Self { client: fidl::client::Client::new(channel, protocol_name) }
2876 }
2877
2878 pub fn take_event_stream(&self) -> DisplayDeviceEventStream {
2884 DisplayDeviceEventStream { event_receiver: self.client.take_event_receiver() }
2885 }
2886
2887 pub fn r#get_display_state(
2889 &self,
2890 ) -> fidl::client::QueryResponseFut<
2891 DisplayDeviceGetDisplayStateResult,
2892 fidl::encoding::DefaultFuchsiaResourceDialect,
2893 > {
2894 DisplayDeviceProxyInterface::r#get_display_state(self)
2895 }
2896
2897 pub fn r#get_display_info(
2900 &self,
2901 ) -> fidl::client::QueryResponseFut<
2902 DisplayDeviceGetDisplayInfoResult,
2903 fidl::encoding::DefaultFuchsiaResourceDialect,
2904 > {
2905 DisplayDeviceProxyInterface::r#get_display_info(self)
2906 }
2907
2908 pub fn r#get_display_select(
2911 &self,
2912 ) -> fidl::client::QueryResponseFut<
2913 DisplayDeviceGetDisplaySelectResult,
2914 fidl::encoding::DefaultFuchsiaResourceDialect,
2915 > {
2916 DisplayDeviceProxyInterface::r#get_display_select(self)
2917 }
2918
2919 pub fn r#set_display_select(
2922 &self,
2923 mut payload: &DisplayDeviceSetDisplaySelectRequest,
2924 ) -> fidl::client::QueryResponseFut<
2925 DisplayDeviceSetDisplaySelectResult,
2926 fidl::encoding::DefaultFuchsiaResourceDialect,
2927 > {
2928 DisplayDeviceProxyInterface::r#set_display_select(self, payload)
2929 }
2930}
2931
2932impl DisplayDeviceProxyInterface for DisplayDeviceProxy {
2933 type GetDisplayStateResponseFut = fidl::client::QueryResponseFut<
2934 DisplayDeviceGetDisplayStateResult,
2935 fidl::encoding::DefaultFuchsiaResourceDialect,
2936 >;
2937 fn r#get_display_state(&self) -> Self::GetDisplayStateResponseFut {
2938 fn _decode(
2939 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2940 ) -> Result<DisplayDeviceGetDisplayStateResult, fidl::Error> {
2941 let _response = fidl::client::decode_transaction_body::<
2942 fidl::encoding::ResultType<DisplayState, i32>,
2943 fidl::encoding::DefaultFuchsiaResourceDialect,
2944 0x1648924f6e003444,
2945 >(_buf?)?;
2946 Ok(_response.map(|x| x))
2947 }
2948 self.client.send_query_and_decode::<
2949 fidl::encoding::EmptyPayload,
2950 DisplayDeviceGetDisplayStateResult,
2951 >(
2952 (),
2953 0x1648924f6e003444,
2954 fidl::encoding::DynamicFlags::empty(),
2955 _decode,
2956 )
2957 }
2958
2959 type GetDisplayInfoResponseFut = fidl::client::QueryResponseFut<
2960 DisplayDeviceGetDisplayInfoResult,
2961 fidl::encoding::DefaultFuchsiaResourceDialect,
2962 >;
2963 fn r#get_display_info(&self) -> Self::GetDisplayInfoResponseFut {
2964 fn _decode(
2965 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2966 ) -> Result<DisplayDeviceGetDisplayInfoResult, fidl::Error> {
2967 let _response = fidl::client::decode_transaction_body::<
2968 fidl::encoding::ResultType<DisplaySyncInfo, i32>,
2969 fidl::encoding::DefaultFuchsiaResourceDialect,
2970 0x311c8e4cb6b1b4d1,
2971 >(_buf?)?;
2972 Ok(_response.map(|x| x))
2973 }
2974 self.client.send_query_and_decode::<
2975 fidl::encoding::EmptyPayload,
2976 DisplayDeviceGetDisplayInfoResult,
2977 >(
2978 (),
2979 0x311c8e4cb6b1b4d1,
2980 fidl::encoding::DynamicFlags::empty(),
2981 _decode,
2982 )
2983 }
2984
2985 type GetDisplaySelectResponseFut = fidl::client::QueryResponseFut<
2986 DisplayDeviceGetDisplaySelectResult,
2987 fidl::encoding::DefaultFuchsiaResourceDialect,
2988 >;
2989 fn r#get_display_select(&self) -> Self::GetDisplaySelectResponseFut {
2990 fn _decode(
2991 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2992 ) -> Result<DisplayDeviceGetDisplaySelectResult, fidl::Error> {
2993 let _response = fidl::client::decode_transaction_body::<
2994 fidl::encoding::ResultType<DisplayDeviceGetDisplaySelectResponse, i32>,
2995 fidl::encoding::DefaultFuchsiaResourceDialect,
2996 0x6191c86cffd6323,
2997 >(_buf?)?;
2998 Ok(_response.map(|x| x))
2999 }
3000 self.client.send_query_and_decode::<
3001 fidl::encoding::EmptyPayload,
3002 DisplayDeviceGetDisplaySelectResult,
3003 >(
3004 (),
3005 0x6191c86cffd6323,
3006 fidl::encoding::DynamicFlags::empty(),
3007 _decode,
3008 )
3009 }
3010
3011 type SetDisplaySelectResponseFut = fidl::client::QueryResponseFut<
3012 DisplayDeviceSetDisplaySelectResult,
3013 fidl::encoding::DefaultFuchsiaResourceDialect,
3014 >;
3015 fn r#set_display_select(
3016 &self,
3017 mut payload: &DisplayDeviceSetDisplaySelectRequest,
3018 ) -> Self::SetDisplaySelectResponseFut {
3019 fn _decode(
3020 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3021 ) -> Result<DisplayDeviceSetDisplaySelectResult, fidl::Error> {
3022 let _response = fidl::client::decode_transaction_body::<
3023 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
3024 fidl::encoding::DefaultFuchsiaResourceDialect,
3025 0x2b07f6ba12e7a412,
3026 >(_buf?)?;
3027 Ok(_response.map(|x| x))
3028 }
3029 self.client.send_query_and_decode::<
3030 DisplayDeviceSetDisplaySelectRequest,
3031 DisplayDeviceSetDisplaySelectResult,
3032 >(
3033 payload,
3034 0x2b07f6ba12e7a412,
3035 fidl::encoding::DynamicFlags::empty(),
3036 _decode,
3037 )
3038 }
3039}
3040
3041pub struct DisplayDeviceEventStream {
3042 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3043}
3044
3045impl std::marker::Unpin for DisplayDeviceEventStream {}
3046
3047impl futures::stream::FusedStream for DisplayDeviceEventStream {
3048 fn is_terminated(&self) -> bool {
3049 self.event_receiver.is_terminated()
3050 }
3051}
3052
3053impl futures::Stream for DisplayDeviceEventStream {
3054 type Item = Result<DisplayDeviceEvent, fidl::Error>;
3055
3056 fn poll_next(
3057 mut self: std::pin::Pin<&mut Self>,
3058 cx: &mut std::task::Context<'_>,
3059 ) -> std::task::Poll<Option<Self::Item>> {
3060 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3061 &mut self.event_receiver,
3062 cx
3063 )?) {
3064 Some(buf) => std::task::Poll::Ready(Some(DisplayDeviceEvent::decode(buf))),
3065 None => std::task::Poll::Ready(None),
3066 }
3067 }
3068}
3069
3070#[derive(Debug)]
3071pub enum DisplayDeviceEvent {}
3072
3073impl DisplayDeviceEvent {
3074 fn decode(
3076 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3077 ) -> Result<DisplayDeviceEvent, fidl::Error> {
3078 let (bytes, _handles) = buf.split_mut();
3079 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3080 debug_assert_eq!(tx_header.tx_id, 0);
3081 match tx_header.ordinal {
3082 _ => Err(fidl::Error::UnknownOrdinal {
3083 ordinal: tx_header.ordinal,
3084 protocol_name: <DisplayDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3085 }),
3086 }
3087 }
3088}
3089
3090pub struct DisplayDeviceRequestStream {
3092 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3093 is_terminated: bool,
3094}
3095
3096impl std::marker::Unpin for DisplayDeviceRequestStream {}
3097
3098impl futures::stream::FusedStream for DisplayDeviceRequestStream {
3099 fn is_terminated(&self) -> bool {
3100 self.is_terminated
3101 }
3102}
3103
3104impl fidl::endpoints::RequestStream for DisplayDeviceRequestStream {
3105 type Protocol = DisplayDeviceMarker;
3106 type ControlHandle = DisplayDeviceControlHandle;
3107
3108 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3109 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3110 }
3111
3112 fn control_handle(&self) -> Self::ControlHandle {
3113 DisplayDeviceControlHandle { inner: self.inner.clone() }
3114 }
3115
3116 fn into_inner(
3117 self,
3118 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3119 {
3120 (self.inner, self.is_terminated)
3121 }
3122
3123 fn from_inner(
3124 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3125 is_terminated: bool,
3126 ) -> Self {
3127 Self { inner, is_terminated }
3128 }
3129}
3130
3131impl futures::Stream for DisplayDeviceRequestStream {
3132 type Item = Result<DisplayDeviceRequest, fidl::Error>;
3133
3134 fn poll_next(
3135 mut self: std::pin::Pin<&mut Self>,
3136 cx: &mut std::task::Context<'_>,
3137 ) -> std::task::Poll<Option<Self::Item>> {
3138 let this = &mut *self;
3139 if this.inner.check_shutdown(cx) {
3140 this.is_terminated = true;
3141 return std::task::Poll::Ready(None);
3142 }
3143 if this.is_terminated {
3144 panic!("polled DisplayDeviceRequestStream after completion");
3145 }
3146 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3147 |bytes, handles| {
3148 match this.inner.channel().read_etc(cx, bytes, handles) {
3149 std::task::Poll::Ready(Ok(())) => {}
3150 std::task::Poll::Pending => return std::task::Poll::Pending,
3151 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3152 this.is_terminated = true;
3153 return std::task::Poll::Ready(None);
3154 }
3155 std::task::Poll::Ready(Err(e)) => {
3156 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3157 e.into(),
3158 ))));
3159 }
3160 }
3161
3162 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3164
3165 std::task::Poll::Ready(Some(match header.ordinal {
3166 0x1648924f6e003444 => {
3167 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3168 let mut req = fidl::new_empty!(
3169 fidl::encoding::EmptyPayload,
3170 fidl::encoding::DefaultFuchsiaResourceDialect
3171 );
3172 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3173 let control_handle =
3174 DisplayDeviceControlHandle { inner: this.inner.clone() };
3175 Ok(DisplayDeviceRequest::GetDisplayState {
3176 responder: DisplayDeviceGetDisplayStateResponder {
3177 control_handle: std::mem::ManuallyDrop::new(control_handle),
3178 tx_id: header.tx_id,
3179 },
3180 })
3181 }
3182 0x311c8e4cb6b1b4d1 => {
3183 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3184 let mut req = fidl::new_empty!(
3185 fidl::encoding::EmptyPayload,
3186 fidl::encoding::DefaultFuchsiaResourceDialect
3187 );
3188 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3189 let control_handle =
3190 DisplayDeviceControlHandle { inner: this.inner.clone() };
3191 Ok(DisplayDeviceRequest::GetDisplayInfo {
3192 responder: DisplayDeviceGetDisplayInfoResponder {
3193 control_handle: std::mem::ManuallyDrop::new(control_handle),
3194 tx_id: header.tx_id,
3195 },
3196 })
3197 }
3198 0x6191c86cffd6323 => {
3199 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3200 let mut req = fidl::new_empty!(
3201 fidl::encoding::EmptyPayload,
3202 fidl::encoding::DefaultFuchsiaResourceDialect
3203 );
3204 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3205 let control_handle =
3206 DisplayDeviceControlHandle { inner: this.inner.clone() };
3207 Ok(DisplayDeviceRequest::GetDisplaySelect {
3208 responder: DisplayDeviceGetDisplaySelectResponder {
3209 control_handle: std::mem::ManuallyDrop::new(control_handle),
3210 tx_id: header.tx_id,
3211 },
3212 })
3213 }
3214 0x2b07f6ba12e7a412 => {
3215 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3216 let mut req = fidl::new_empty!(
3217 DisplayDeviceSetDisplaySelectRequest,
3218 fidl::encoding::DefaultFuchsiaResourceDialect
3219 );
3220 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DisplayDeviceSetDisplaySelectRequest>(&header, _body_bytes, handles, &mut req)?;
3221 let control_handle =
3222 DisplayDeviceControlHandle { inner: this.inner.clone() };
3223 Ok(DisplayDeviceRequest::SetDisplaySelect {
3224 payload: req,
3225 responder: DisplayDeviceSetDisplaySelectResponder {
3226 control_handle: std::mem::ManuallyDrop::new(control_handle),
3227 tx_id: header.tx_id,
3228 },
3229 })
3230 }
3231 _ => Err(fidl::Error::UnknownOrdinal {
3232 ordinal: header.ordinal,
3233 protocol_name:
3234 <DisplayDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3235 }),
3236 }))
3237 },
3238 )
3239 }
3240}
3241
3242#[derive(Debug)]
3244pub enum DisplayDeviceRequest {
3245 GetDisplayState { responder: DisplayDeviceGetDisplayStateResponder },
3247 GetDisplayInfo { responder: DisplayDeviceGetDisplayInfoResponder },
3250 GetDisplaySelect { responder: DisplayDeviceGetDisplaySelectResponder },
3253 SetDisplaySelect {
3256 payload: DisplayDeviceSetDisplaySelectRequest,
3257 responder: DisplayDeviceSetDisplaySelectResponder,
3258 },
3259}
3260
3261impl DisplayDeviceRequest {
3262 #[allow(irrefutable_let_patterns)]
3263 pub fn into_get_display_state(self) -> Option<(DisplayDeviceGetDisplayStateResponder)> {
3264 if let DisplayDeviceRequest::GetDisplayState { responder } = self {
3265 Some((responder))
3266 } else {
3267 None
3268 }
3269 }
3270
3271 #[allow(irrefutable_let_patterns)]
3272 pub fn into_get_display_info(self) -> Option<(DisplayDeviceGetDisplayInfoResponder)> {
3273 if let DisplayDeviceRequest::GetDisplayInfo { responder } = self {
3274 Some((responder))
3275 } else {
3276 None
3277 }
3278 }
3279
3280 #[allow(irrefutable_let_patterns)]
3281 pub fn into_get_display_select(self) -> Option<(DisplayDeviceGetDisplaySelectResponder)> {
3282 if let DisplayDeviceRequest::GetDisplaySelect { responder } = self {
3283 Some((responder))
3284 } else {
3285 None
3286 }
3287 }
3288
3289 #[allow(irrefutable_let_patterns)]
3290 pub fn into_set_display_select(
3291 self,
3292 ) -> Option<(DisplayDeviceSetDisplaySelectRequest, DisplayDeviceSetDisplaySelectResponder)>
3293 {
3294 if let DisplayDeviceRequest::SetDisplaySelect { payload, responder } = self {
3295 Some((payload, responder))
3296 } else {
3297 None
3298 }
3299 }
3300
3301 pub fn method_name(&self) -> &'static str {
3303 match *self {
3304 DisplayDeviceRequest::GetDisplayState { .. } => "get_display_state",
3305 DisplayDeviceRequest::GetDisplayInfo { .. } => "get_display_info",
3306 DisplayDeviceRequest::GetDisplaySelect { .. } => "get_display_select",
3307 DisplayDeviceRequest::SetDisplaySelect { .. } => "set_display_select",
3308 }
3309 }
3310}
3311
3312#[derive(Debug, Clone)]
3313pub struct DisplayDeviceControlHandle {
3314 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3315}
3316
3317impl fidl::endpoints::ControlHandle for DisplayDeviceControlHandle {
3318 fn shutdown(&self) {
3319 self.inner.shutdown()
3320 }
3321
3322 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3323 self.inner.shutdown_with_epitaph(status)
3324 }
3325
3326 fn is_closed(&self) -> bool {
3327 self.inner.channel().is_closed()
3328 }
3329 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3330 self.inner.channel().on_closed()
3331 }
3332
3333 #[cfg(target_os = "fuchsia")]
3334 fn signal_peer(
3335 &self,
3336 clear_mask: zx::Signals,
3337 set_mask: zx::Signals,
3338 ) -> Result<(), zx_status::Status> {
3339 use fidl::Peered;
3340 self.inner.channel().signal_peer(clear_mask, set_mask)
3341 }
3342}
3343
3344impl DisplayDeviceControlHandle {}
3345
3346#[must_use = "FIDL methods require a response to be sent"]
3347#[derive(Debug)]
3348pub struct DisplayDeviceGetDisplayStateResponder {
3349 control_handle: std::mem::ManuallyDrop<DisplayDeviceControlHandle>,
3350 tx_id: u32,
3351}
3352
3353impl std::ops::Drop for DisplayDeviceGetDisplayStateResponder {
3357 fn drop(&mut self) {
3358 self.control_handle.shutdown();
3359 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3361 }
3362}
3363
3364impl fidl::endpoints::Responder for DisplayDeviceGetDisplayStateResponder {
3365 type ControlHandle = DisplayDeviceControlHandle;
3366
3367 fn control_handle(&self) -> &DisplayDeviceControlHandle {
3368 &self.control_handle
3369 }
3370
3371 fn drop_without_shutdown(mut self) {
3372 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3374 std::mem::forget(self);
3376 }
3377}
3378
3379impl DisplayDeviceGetDisplayStateResponder {
3380 pub fn send(self, mut result: Result<&DisplayState, i32>) -> Result<(), fidl::Error> {
3384 let _result = self.send_raw(result);
3385 if _result.is_err() {
3386 self.control_handle.shutdown();
3387 }
3388 self.drop_without_shutdown();
3389 _result
3390 }
3391
3392 pub fn send_no_shutdown_on_err(
3394 self,
3395 mut result: Result<&DisplayState, i32>,
3396 ) -> Result<(), fidl::Error> {
3397 let _result = self.send_raw(result);
3398 self.drop_without_shutdown();
3399 _result
3400 }
3401
3402 fn send_raw(&self, mut result: Result<&DisplayState, i32>) -> Result<(), fidl::Error> {
3403 self.control_handle.inner.send::<fidl::encoding::ResultType<DisplayState, i32>>(
3404 result,
3405 self.tx_id,
3406 0x1648924f6e003444,
3407 fidl::encoding::DynamicFlags::empty(),
3408 )
3409 }
3410}
3411
3412#[must_use = "FIDL methods require a response to be sent"]
3413#[derive(Debug)]
3414pub struct DisplayDeviceGetDisplayInfoResponder {
3415 control_handle: std::mem::ManuallyDrop<DisplayDeviceControlHandle>,
3416 tx_id: u32,
3417}
3418
3419impl std::ops::Drop for DisplayDeviceGetDisplayInfoResponder {
3423 fn drop(&mut self) {
3424 self.control_handle.shutdown();
3425 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3427 }
3428}
3429
3430impl fidl::endpoints::Responder for DisplayDeviceGetDisplayInfoResponder {
3431 type ControlHandle = DisplayDeviceControlHandle;
3432
3433 fn control_handle(&self) -> &DisplayDeviceControlHandle {
3434 &self.control_handle
3435 }
3436
3437 fn drop_without_shutdown(mut self) {
3438 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3440 std::mem::forget(self);
3442 }
3443}
3444
3445impl DisplayDeviceGetDisplayInfoResponder {
3446 pub fn send(self, mut result: Result<&DisplaySyncInfo, i32>) -> Result<(), fidl::Error> {
3450 let _result = self.send_raw(result);
3451 if _result.is_err() {
3452 self.control_handle.shutdown();
3453 }
3454 self.drop_without_shutdown();
3455 _result
3456 }
3457
3458 pub fn send_no_shutdown_on_err(
3460 self,
3461 mut result: Result<&DisplaySyncInfo, i32>,
3462 ) -> Result<(), fidl::Error> {
3463 let _result = self.send_raw(result);
3464 self.drop_without_shutdown();
3465 _result
3466 }
3467
3468 fn send_raw(&self, mut result: Result<&DisplaySyncInfo, i32>) -> Result<(), fidl::Error> {
3469 self.control_handle.inner.send::<fidl::encoding::ResultType<DisplaySyncInfo, i32>>(
3470 result,
3471 self.tx_id,
3472 0x311c8e4cb6b1b4d1,
3473 fidl::encoding::DynamicFlags::empty(),
3474 )
3475 }
3476}
3477
3478#[must_use = "FIDL methods require a response to be sent"]
3479#[derive(Debug)]
3480pub struct DisplayDeviceGetDisplaySelectResponder {
3481 control_handle: std::mem::ManuallyDrop<DisplayDeviceControlHandle>,
3482 tx_id: u32,
3483}
3484
3485impl std::ops::Drop for DisplayDeviceGetDisplaySelectResponder {
3489 fn drop(&mut self) {
3490 self.control_handle.shutdown();
3491 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3493 }
3494}
3495
3496impl fidl::endpoints::Responder for DisplayDeviceGetDisplaySelectResponder {
3497 type ControlHandle = DisplayDeviceControlHandle;
3498
3499 fn control_handle(&self) -> &DisplayDeviceControlHandle {
3500 &self.control_handle
3501 }
3502
3503 fn drop_without_shutdown(mut self) {
3504 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3506 std::mem::forget(self);
3508 }
3509}
3510
3511impl DisplayDeviceGetDisplaySelectResponder {
3512 pub fn send(
3516 self,
3517 mut result: Result<&DisplayDeviceGetDisplaySelectResponse, i32>,
3518 ) -> Result<(), fidl::Error> {
3519 let _result = self.send_raw(result);
3520 if _result.is_err() {
3521 self.control_handle.shutdown();
3522 }
3523 self.drop_without_shutdown();
3524 _result
3525 }
3526
3527 pub fn send_no_shutdown_on_err(
3529 self,
3530 mut result: Result<&DisplayDeviceGetDisplaySelectResponse, i32>,
3531 ) -> Result<(), fidl::Error> {
3532 let _result = self.send_raw(result);
3533 self.drop_without_shutdown();
3534 _result
3535 }
3536
3537 fn send_raw(
3538 &self,
3539 mut result: Result<&DisplayDeviceGetDisplaySelectResponse, i32>,
3540 ) -> Result<(), fidl::Error> {
3541 self.control_handle.inner.send::<fidl::encoding::ResultType<
3542 DisplayDeviceGetDisplaySelectResponse,
3543 i32,
3544 >>(
3545 result,
3546 self.tx_id,
3547 0x6191c86cffd6323,
3548 fidl::encoding::DynamicFlags::empty(),
3549 )
3550 }
3551}
3552
3553#[must_use = "FIDL methods require a response to be sent"]
3554#[derive(Debug)]
3555pub struct DisplayDeviceSetDisplaySelectResponder {
3556 control_handle: std::mem::ManuallyDrop<DisplayDeviceControlHandle>,
3557 tx_id: u32,
3558}
3559
3560impl std::ops::Drop for DisplayDeviceSetDisplaySelectResponder {
3564 fn drop(&mut self) {
3565 self.control_handle.shutdown();
3566 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3568 }
3569}
3570
3571impl fidl::endpoints::Responder for DisplayDeviceSetDisplaySelectResponder {
3572 type ControlHandle = DisplayDeviceControlHandle;
3573
3574 fn control_handle(&self) -> &DisplayDeviceControlHandle {
3575 &self.control_handle
3576 }
3577
3578 fn drop_without_shutdown(mut self) {
3579 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3581 std::mem::forget(self);
3583 }
3584}
3585
3586impl DisplayDeviceSetDisplaySelectResponder {
3587 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3591 let _result = self.send_raw(result);
3592 if _result.is_err() {
3593 self.control_handle.shutdown();
3594 }
3595 self.drop_without_shutdown();
3596 _result
3597 }
3598
3599 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3601 let _result = self.send_raw(result);
3602 self.drop_without_shutdown();
3603 _result
3604 }
3605
3606 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3607 self.control_handle
3608 .inner
3609 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3610 result,
3611 self.tx_id,
3612 0x2b07f6ba12e7a412,
3613 fidl::encoding::DynamicFlags::empty(),
3614 )
3615 }
3616}
3617
3618#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3619pub struct HangingDataChannelMarker;
3620
3621impl fidl::endpoints::ProtocolMarker for HangingDataChannelMarker {
3622 type Proxy = HangingDataChannelProxy;
3623 type RequestStream = HangingDataChannelRequestStream;
3624 #[cfg(target_os = "fuchsia")]
3625 type SynchronousProxy = HangingDataChannelSynchronousProxy;
3626
3627 const DEBUG_NAME: &'static str = "(anonymous) HangingDataChannel";
3628}
3629pub type HangingDataChannelReadResult = Result<HangingDataChannelReadResponse, i32>;
3630pub type HangingDataChannelWriteResult = Result<(), i32>;
3631
3632pub trait HangingDataChannelProxyInterface: Send + Sync {
3633 type ReadResponseFut: std::future::Future<Output = Result<HangingDataChannelReadResult, fidl::Error>>
3634 + Send;
3635 fn r#read(&self) -> Self::ReadResponseFut;
3636 type WriteResponseFut: std::future::Future<Output = Result<HangingDataChannelWriteResult, fidl::Error>>
3637 + Send;
3638 fn r#write(&self, payload: &HangingDataChannelWriteRequest) -> Self::WriteResponseFut;
3639}
3640#[derive(Debug)]
3641#[cfg(target_os = "fuchsia")]
3642pub struct HangingDataChannelSynchronousProxy {
3643 client: fidl::client::sync::Client,
3644}
3645
3646#[cfg(target_os = "fuchsia")]
3647impl fidl::endpoints::SynchronousProxy for HangingDataChannelSynchronousProxy {
3648 type Proxy = HangingDataChannelProxy;
3649 type Protocol = HangingDataChannelMarker;
3650
3651 fn from_channel(inner: fidl::Channel) -> Self {
3652 Self::new(inner)
3653 }
3654
3655 fn into_channel(self) -> fidl::Channel {
3656 self.client.into_channel()
3657 }
3658
3659 fn as_channel(&self) -> &fidl::Channel {
3660 self.client.as_channel()
3661 }
3662}
3663
3664#[cfg(target_os = "fuchsia")]
3665impl HangingDataChannelSynchronousProxy {
3666 pub fn new(channel: fidl::Channel) -> Self {
3667 let protocol_name =
3668 <HangingDataChannelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3669 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3670 }
3671
3672 pub fn into_channel(self) -> fidl::Channel {
3673 self.client.into_channel()
3674 }
3675
3676 pub fn wait_for_event(
3679 &self,
3680 deadline: zx::MonotonicInstant,
3681 ) -> Result<HangingDataChannelEvent, fidl::Error> {
3682 HangingDataChannelEvent::decode(self.client.wait_for_event(deadline)?)
3683 }
3684
3685 pub fn r#read(
3688 &self,
3689 ___deadline: zx::MonotonicInstant,
3690 ) -> Result<HangingDataChannelReadResult, fidl::Error> {
3691 let _response = self.client.send_query::<
3692 fidl::encoding::EmptyPayload,
3693 fidl::encoding::FlexibleResultType<HangingDataChannelReadResponse, i32>,
3694 >(
3695 (),
3696 0x160be10337c2484f,
3697 fidl::encoding::DynamicFlags::FLEXIBLE,
3698 ___deadline,
3699 )?
3700 .into_result::<HangingDataChannelMarker>("read")?;
3701 Ok(_response.map(|x| x))
3702 }
3703
3704 pub fn r#write(
3709 &self,
3710 mut payload: &HangingDataChannelWriteRequest,
3711 ___deadline: zx::MonotonicInstant,
3712 ) -> Result<HangingDataChannelWriteResult, fidl::Error> {
3713 let _response = self.client.send_query::<
3714 HangingDataChannelWriteRequest,
3715 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
3716 >(
3717 payload,
3718 0x6addfd084eb16746,
3719 fidl::encoding::DynamicFlags::FLEXIBLE,
3720 ___deadline,
3721 )?
3722 .into_result::<HangingDataChannelMarker>("write")?;
3723 Ok(_response.map(|x| x))
3724 }
3725}
3726
3727#[cfg(target_os = "fuchsia")]
3728impl From<HangingDataChannelSynchronousProxy> for zx::NullableHandle {
3729 fn from(value: HangingDataChannelSynchronousProxy) -> Self {
3730 value.into_channel().into()
3731 }
3732}
3733
3734#[cfg(target_os = "fuchsia")]
3735impl From<fidl::Channel> for HangingDataChannelSynchronousProxy {
3736 fn from(value: fidl::Channel) -> Self {
3737 Self::new(value)
3738 }
3739}
3740
3741#[cfg(target_os = "fuchsia")]
3742impl fidl::endpoints::FromClient for HangingDataChannelSynchronousProxy {
3743 type Protocol = HangingDataChannelMarker;
3744
3745 fn from_client(value: fidl::endpoints::ClientEnd<HangingDataChannelMarker>) -> Self {
3746 Self::new(value.into_channel())
3747 }
3748}
3749
3750#[derive(Debug, Clone)]
3751pub struct HangingDataChannelProxy {
3752 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3753}
3754
3755impl fidl::endpoints::Proxy for HangingDataChannelProxy {
3756 type Protocol = HangingDataChannelMarker;
3757
3758 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3759 Self::new(inner)
3760 }
3761
3762 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3763 self.client.into_channel().map_err(|client| Self { client })
3764 }
3765
3766 fn as_channel(&self) -> &::fidl::AsyncChannel {
3767 self.client.as_channel()
3768 }
3769}
3770
3771impl HangingDataChannelProxy {
3772 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3774 let protocol_name =
3775 <HangingDataChannelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3776 Self { client: fidl::client::Client::new(channel, protocol_name) }
3777 }
3778
3779 pub fn take_event_stream(&self) -> HangingDataChannelEventStream {
3785 HangingDataChannelEventStream { event_receiver: self.client.take_event_receiver() }
3786 }
3787
3788 pub fn r#read(
3791 &self,
3792 ) -> fidl::client::QueryResponseFut<
3793 HangingDataChannelReadResult,
3794 fidl::encoding::DefaultFuchsiaResourceDialect,
3795 > {
3796 HangingDataChannelProxyInterface::r#read(self)
3797 }
3798
3799 pub fn r#write(
3804 &self,
3805 mut payload: &HangingDataChannelWriteRequest,
3806 ) -> fidl::client::QueryResponseFut<
3807 HangingDataChannelWriteResult,
3808 fidl::encoding::DefaultFuchsiaResourceDialect,
3809 > {
3810 HangingDataChannelProxyInterface::r#write(self, payload)
3811 }
3812}
3813
3814impl HangingDataChannelProxyInterface for HangingDataChannelProxy {
3815 type ReadResponseFut = fidl::client::QueryResponseFut<
3816 HangingDataChannelReadResult,
3817 fidl::encoding::DefaultFuchsiaResourceDialect,
3818 >;
3819 fn r#read(&self) -> Self::ReadResponseFut {
3820 fn _decode(
3821 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3822 ) -> Result<HangingDataChannelReadResult, fidl::Error> {
3823 let _response = fidl::client::decode_transaction_body::<
3824 fidl::encoding::FlexibleResultType<HangingDataChannelReadResponse, i32>,
3825 fidl::encoding::DefaultFuchsiaResourceDialect,
3826 0x160be10337c2484f,
3827 >(_buf?)?
3828 .into_result::<HangingDataChannelMarker>("read")?;
3829 Ok(_response.map(|x| x))
3830 }
3831 self.client
3832 .send_query_and_decode::<fidl::encoding::EmptyPayload, HangingDataChannelReadResult>(
3833 (),
3834 0x160be10337c2484f,
3835 fidl::encoding::DynamicFlags::FLEXIBLE,
3836 _decode,
3837 )
3838 }
3839
3840 type WriteResponseFut = fidl::client::QueryResponseFut<
3841 HangingDataChannelWriteResult,
3842 fidl::encoding::DefaultFuchsiaResourceDialect,
3843 >;
3844 fn r#write(&self, mut payload: &HangingDataChannelWriteRequest) -> Self::WriteResponseFut {
3845 fn _decode(
3846 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3847 ) -> Result<HangingDataChannelWriteResult, fidl::Error> {
3848 let _response = fidl::client::decode_transaction_body::<
3849 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
3850 fidl::encoding::DefaultFuchsiaResourceDialect,
3851 0x6addfd084eb16746,
3852 >(_buf?)?
3853 .into_result::<HangingDataChannelMarker>("write")?;
3854 Ok(_response.map(|x| x))
3855 }
3856 self.client
3857 .send_query_and_decode::<HangingDataChannelWriteRequest, HangingDataChannelWriteResult>(
3858 payload,
3859 0x6addfd084eb16746,
3860 fidl::encoding::DynamicFlags::FLEXIBLE,
3861 _decode,
3862 )
3863 }
3864}
3865
3866pub struct HangingDataChannelEventStream {
3867 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3868}
3869
3870impl std::marker::Unpin for HangingDataChannelEventStream {}
3871
3872impl futures::stream::FusedStream for HangingDataChannelEventStream {
3873 fn is_terminated(&self) -> bool {
3874 self.event_receiver.is_terminated()
3875 }
3876}
3877
3878impl futures::Stream for HangingDataChannelEventStream {
3879 type Item = Result<HangingDataChannelEvent, fidl::Error>;
3880
3881 fn poll_next(
3882 mut self: std::pin::Pin<&mut Self>,
3883 cx: &mut std::task::Context<'_>,
3884 ) -> std::task::Poll<Option<Self::Item>> {
3885 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3886 &mut self.event_receiver,
3887 cx
3888 )?) {
3889 Some(buf) => std::task::Poll::Ready(Some(HangingDataChannelEvent::decode(buf))),
3890 None => std::task::Poll::Ready(None),
3891 }
3892 }
3893}
3894
3895#[derive(Debug)]
3896pub enum HangingDataChannelEvent {
3897 #[non_exhaustive]
3898 _UnknownEvent {
3899 ordinal: u64,
3901 },
3902}
3903
3904impl HangingDataChannelEvent {
3905 fn decode(
3907 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3908 ) -> Result<HangingDataChannelEvent, fidl::Error> {
3909 let (bytes, _handles) = buf.split_mut();
3910 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3911 debug_assert_eq!(tx_header.tx_id, 0);
3912 match tx_header.ordinal {
3913 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3914 Ok(HangingDataChannelEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3915 }
3916 _ => Err(fidl::Error::UnknownOrdinal {
3917 ordinal: tx_header.ordinal,
3918 protocol_name:
3919 <HangingDataChannelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3920 }),
3921 }
3922 }
3923}
3924
3925pub struct HangingDataChannelRequestStream {
3927 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3928 is_terminated: bool,
3929}
3930
3931impl std::marker::Unpin for HangingDataChannelRequestStream {}
3932
3933impl futures::stream::FusedStream for HangingDataChannelRequestStream {
3934 fn is_terminated(&self) -> bool {
3935 self.is_terminated
3936 }
3937}
3938
3939impl fidl::endpoints::RequestStream for HangingDataChannelRequestStream {
3940 type Protocol = HangingDataChannelMarker;
3941 type ControlHandle = HangingDataChannelControlHandle;
3942
3943 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3944 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3945 }
3946
3947 fn control_handle(&self) -> Self::ControlHandle {
3948 HangingDataChannelControlHandle { inner: self.inner.clone() }
3949 }
3950
3951 fn into_inner(
3952 self,
3953 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3954 {
3955 (self.inner, self.is_terminated)
3956 }
3957
3958 fn from_inner(
3959 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3960 is_terminated: bool,
3961 ) -> Self {
3962 Self { inner, is_terminated }
3963 }
3964}
3965
3966impl futures::Stream for HangingDataChannelRequestStream {
3967 type Item = Result<HangingDataChannelRequest, fidl::Error>;
3968
3969 fn poll_next(
3970 mut self: std::pin::Pin<&mut Self>,
3971 cx: &mut std::task::Context<'_>,
3972 ) -> std::task::Poll<Option<Self::Item>> {
3973 let this = &mut *self;
3974 if this.inner.check_shutdown(cx) {
3975 this.is_terminated = true;
3976 return std::task::Poll::Ready(None);
3977 }
3978 if this.is_terminated {
3979 panic!("polled HangingDataChannelRequestStream after completion");
3980 }
3981 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3982 |bytes, handles| {
3983 match this.inner.channel().read_etc(cx, bytes, handles) {
3984 std::task::Poll::Ready(Ok(())) => {}
3985 std::task::Poll::Pending => return std::task::Poll::Pending,
3986 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3987 this.is_terminated = true;
3988 return std::task::Poll::Ready(None);
3989 }
3990 std::task::Poll::Ready(Err(e)) => {
3991 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3992 e.into(),
3993 ))));
3994 }
3995 }
3996
3997 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3999
4000 std::task::Poll::Ready(Some(match header.ordinal {
4001 0x160be10337c2484f => {
4002 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4003 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
4004 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4005 let control_handle = HangingDataChannelControlHandle {
4006 inner: this.inner.clone(),
4007 };
4008 Ok(HangingDataChannelRequest::Read {
4009 responder: HangingDataChannelReadResponder {
4010 control_handle: std::mem::ManuallyDrop::new(control_handle),
4011 tx_id: header.tx_id,
4012 },
4013 })
4014 }
4015 0x6addfd084eb16746 => {
4016 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4017 let mut req = fidl::new_empty!(HangingDataChannelWriteRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4018 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HangingDataChannelWriteRequest>(&header, _body_bytes, handles, &mut req)?;
4019 let control_handle = HangingDataChannelControlHandle {
4020 inner: this.inner.clone(),
4021 };
4022 Ok(HangingDataChannelRequest::Write {payload: req,
4023 responder: HangingDataChannelWriteResponder {
4024 control_handle: std::mem::ManuallyDrop::new(control_handle),
4025 tx_id: header.tx_id,
4026 },
4027 })
4028 }
4029 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4030 Ok(HangingDataChannelRequest::_UnknownMethod {
4031 ordinal: header.ordinal,
4032 control_handle: HangingDataChannelControlHandle { inner: this.inner.clone() },
4033 method_type: fidl::MethodType::OneWay,
4034 })
4035 }
4036 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4037 this.inner.send_framework_err(
4038 fidl::encoding::FrameworkErr::UnknownMethod,
4039 header.tx_id,
4040 header.ordinal,
4041 header.dynamic_flags(),
4042 (bytes, handles),
4043 )?;
4044 Ok(HangingDataChannelRequest::_UnknownMethod {
4045 ordinal: header.ordinal,
4046 control_handle: HangingDataChannelControlHandle { inner: this.inner.clone() },
4047 method_type: fidl::MethodType::TwoWay,
4048 })
4049 }
4050 _ => Err(fidl::Error::UnknownOrdinal {
4051 ordinal: header.ordinal,
4052 protocol_name: <HangingDataChannelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4053 }),
4054 }))
4055 },
4056 )
4057 }
4058}
4059
4060#[derive(Debug)]
4065pub enum HangingDataChannelRequest {
4066 Read { responder: HangingDataChannelReadResponder },
4069 Write { payload: HangingDataChannelWriteRequest, responder: HangingDataChannelWriteResponder },
4074 #[non_exhaustive]
4076 _UnknownMethod {
4077 ordinal: u64,
4079 control_handle: HangingDataChannelControlHandle,
4080 method_type: fidl::MethodType,
4081 },
4082}
4083
4084impl HangingDataChannelRequest {
4085 #[allow(irrefutable_let_patterns)]
4086 pub fn into_read(self) -> Option<(HangingDataChannelReadResponder)> {
4087 if let HangingDataChannelRequest::Read { responder } = self {
4088 Some((responder))
4089 } else {
4090 None
4091 }
4092 }
4093
4094 #[allow(irrefutable_let_patterns)]
4095 pub fn into_write(
4096 self,
4097 ) -> Option<(HangingDataChannelWriteRequest, HangingDataChannelWriteResponder)> {
4098 if let HangingDataChannelRequest::Write { payload, responder } = self {
4099 Some((payload, responder))
4100 } else {
4101 None
4102 }
4103 }
4104
4105 pub fn method_name(&self) -> &'static str {
4107 match *self {
4108 HangingDataChannelRequest::Read { .. } => "read",
4109 HangingDataChannelRequest::Write { .. } => "write",
4110 HangingDataChannelRequest::_UnknownMethod {
4111 method_type: fidl::MethodType::OneWay,
4112 ..
4113 } => "unknown one-way method",
4114 HangingDataChannelRequest::_UnknownMethod {
4115 method_type: fidl::MethodType::TwoWay,
4116 ..
4117 } => "unknown two-way method",
4118 }
4119 }
4120}
4121
4122#[derive(Debug, Clone)]
4123pub struct HangingDataChannelControlHandle {
4124 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4125}
4126
4127impl fidl::endpoints::ControlHandle for HangingDataChannelControlHandle {
4128 fn shutdown(&self) {
4129 self.inner.shutdown()
4130 }
4131
4132 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4133 self.inner.shutdown_with_epitaph(status)
4134 }
4135
4136 fn is_closed(&self) -> bool {
4137 self.inner.channel().is_closed()
4138 }
4139 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4140 self.inner.channel().on_closed()
4141 }
4142
4143 #[cfg(target_os = "fuchsia")]
4144 fn signal_peer(
4145 &self,
4146 clear_mask: zx::Signals,
4147 set_mask: zx::Signals,
4148 ) -> Result<(), zx_status::Status> {
4149 use fidl::Peered;
4150 self.inner.channel().signal_peer(clear_mask, set_mask)
4151 }
4152}
4153
4154impl HangingDataChannelControlHandle {}
4155
4156#[must_use = "FIDL methods require a response to be sent"]
4157#[derive(Debug)]
4158pub struct HangingDataChannelReadResponder {
4159 control_handle: std::mem::ManuallyDrop<HangingDataChannelControlHandle>,
4160 tx_id: u32,
4161}
4162
4163impl std::ops::Drop for HangingDataChannelReadResponder {
4167 fn drop(&mut self) {
4168 self.control_handle.shutdown();
4169 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4171 }
4172}
4173
4174impl fidl::endpoints::Responder for HangingDataChannelReadResponder {
4175 type ControlHandle = HangingDataChannelControlHandle;
4176
4177 fn control_handle(&self) -> &HangingDataChannelControlHandle {
4178 &self.control_handle
4179 }
4180
4181 fn drop_without_shutdown(mut self) {
4182 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4184 std::mem::forget(self);
4186 }
4187}
4188
4189impl HangingDataChannelReadResponder {
4190 pub fn send(
4194 self,
4195 mut result: Result<HangingDataChannelReadResponse, i32>,
4196 ) -> Result<(), fidl::Error> {
4197 let _result = self.send_raw(result);
4198 if _result.is_err() {
4199 self.control_handle.shutdown();
4200 }
4201 self.drop_without_shutdown();
4202 _result
4203 }
4204
4205 pub fn send_no_shutdown_on_err(
4207 self,
4208 mut result: Result<HangingDataChannelReadResponse, i32>,
4209 ) -> Result<(), fidl::Error> {
4210 let _result = self.send_raw(result);
4211 self.drop_without_shutdown();
4212 _result
4213 }
4214
4215 fn send_raw(
4216 &self,
4217 mut result: Result<HangingDataChannelReadResponse, i32>,
4218 ) -> Result<(), fidl::Error> {
4219 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4220 HangingDataChannelReadResponse,
4221 i32,
4222 >>(
4223 fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
4224 self.tx_id,
4225 0x160be10337c2484f,
4226 fidl::encoding::DynamicFlags::FLEXIBLE,
4227 )
4228 }
4229}
4230
4231#[must_use = "FIDL methods require a response to be sent"]
4232#[derive(Debug)]
4233pub struct HangingDataChannelWriteResponder {
4234 control_handle: std::mem::ManuallyDrop<HangingDataChannelControlHandle>,
4235 tx_id: u32,
4236}
4237
4238impl std::ops::Drop for HangingDataChannelWriteResponder {
4242 fn drop(&mut self) {
4243 self.control_handle.shutdown();
4244 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4246 }
4247}
4248
4249impl fidl::endpoints::Responder for HangingDataChannelWriteResponder {
4250 type ControlHandle = HangingDataChannelControlHandle;
4251
4252 fn control_handle(&self) -> &HangingDataChannelControlHandle {
4253 &self.control_handle
4254 }
4255
4256 fn drop_without_shutdown(mut self) {
4257 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4259 std::mem::forget(self);
4261 }
4262}
4263
4264impl HangingDataChannelWriteResponder {
4265 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4269 let _result = self.send_raw(result);
4270 if _result.is_err() {
4271 self.control_handle.shutdown();
4272 }
4273 self.drop_without_shutdown();
4274 _result
4275 }
4276
4277 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4279 let _result = self.send_raw(result);
4280 self.drop_without_shutdown();
4281 _result
4282 }
4283
4284 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4285 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4286 fidl::encoding::EmptyStruct,
4287 i32,
4288 >>(
4289 fidl::encoding::FlexibleResult::new(result),
4290 self.tx_id,
4291 0x6addfd084eb16746,
4292 fidl::encoding::DynamicFlags::FLEXIBLE,
4293 )
4294 }
4295}
4296
4297#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4298pub struct LifecycleObserverMarker;
4299
4300impl fidl::endpoints::ProtocolMarker for LifecycleObserverMarker {
4301 type Proxy = LifecycleObserverProxy;
4302 type RequestStream = LifecycleObserverRequestStream;
4303 #[cfg(target_os = "fuchsia")]
4304 type SynchronousProxy = LifecycleObserverSynchronousProxy;
4305
4306 const DEBUG_NAME: &'static str = "(anonymous) LifecycleObserver";
4307}
4308
4309pub trait LifecycleObserverProxyInterface: Send + Sync {}
4310#[derive(Debug)]
4311#[cfg(target_os = "fuchsia")]
4312pub struct LifecycleObserverSynchronousProxy {
4313 client: fidl::client::sync::Client,
4314}
4315
4316#[cfg(target_os = "fuchsia")]
4317impl fidl::endpoints::SynchronousProxy for LifecycleObserverSynchronousProxy {
4318 type Proxy = LifecycleObserverProxy;
4319 type Protocol = LifecycleObserverMarker;
4320
4321 fn from_channel(inner: fidl::Channel) -> Self {
4322 Self::new(inner)
4323 }
4324
4325 fn into_channel(self) -> fidl::Channel {
4326 self.client.into_channel()
4327 }
4328
4329 fn as_channel(&self) -> &fidl::Channel {
4330 self.client.as_channel()
4331 }
4332}
4333
4334#[cfg(target_os = "fuchsia")]
4335impl LifecycleObserverSynchronousProxy {
4336 pub fn new(channel: fidl::Channel) -> Self {
4337 let protocol_name =
4338 <LifecycleObserverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4339 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4340 }
4341
4342 pub fn into_channel(self) -> fidl::Channel {
4343 self.client.into_channel()
4344 }
4345
4346 pub fn wait_for_event(
4349 &self,
4350 deadline: zx::MonotonicInstant,
4351 ) -> Result<LifecycleObserverEvent, fidl::Error> {
4352 LifecycleObserverEvent::decode(self.client.wait_for_event(deadline)?)
4353 }
4354}
4355
4356#[cfg(target_os = "fuchsia")]
4357impl From<LifecycleObserverSynchronousProxy> for zx::NullableHandle {
4358 fn from(value: LifecycleObserverSynchronousProxy) -> Self {
4359 value.into_channel().into()
4360 }
4361}
4362
4363#[cfg(target_os = "fuchsia")]
4364impl From<fidl::Channel> for LifecycleObserverSynchronousProxy {
4365 fn from(value: fidl::Channel) -> Self {
4366 Self::new(value)
4367 }
4368}
4369
4370#[cfg(target_os = "fuchsia")]
4371impl fidl::endpoints::FromClient for LifecycleObserverSynchronousProxy {
4372 type Protocol = LifecycleObserverMarker;
4373
4374 fn from_client(value: fidl::endpoints::ClientEnd<LifecycleObserverMarker>) -> Self {
4375 Self::new(value.into_channel())
4376 }
4377}
4378
4379#[derive(Debug, Clone)]
4380pub struct LifecycleObserverProxy {
4381 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4382}
4383
4384impl fidl::endpoints::Proxy for LifecycleObserverProxy {
4385 type Protocol = LifecycleObserverMarker;
4386
4387 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4388 Self::new(inner)
4389 }
4390
4391 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4392 self.client.into_channel().map_err(|client| Self { client })
4393 }
4394
4395 fn as_channel(&self) -> &::fidl::AsyncChannel {
4396 self.client.as_channel()
4397 }
4398}
4399
4400impl LifecycleObserverProxy {
4401 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4403 let protocol_name =
4404 <LifecycleObserverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4405 Self { client: fidl::client::Client::new(channel, protocol_name) }
4406 }
4407
4408 pub fn take_event_stream(&self) -> LifecycleObserverEventStream {
4414 LifecycleObserverEventStream { event_receiver: self.client.take_event_receiver() }
4415 }
4416}
4417
4418impl LifecycleObserverProxyInterface for LifecycleObserverProxy {}
4419
4420pub struct LifecycleObserverEventStream {
4421 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4422}
4423
4424impl std::marker::Unpin for LifecycleObserverEventStream {}
4425
4426impl futures::stream::FusedStream for LifecycleObserverEventStream {
4427 fn is_terminated(&self) -> bool {
4428 self.event_receiver.is_terminated()
4429 }
4430}
4431
4432impl futures::Stream for LifecycleObserverEventStream {
4433 type Item = Result<LifecycleObserverEvent, fidl::Error>;
4434
4435 fn poll_next(
4436 mut self: std::pin::Pin<&mut Self>,
4437 cx: &mut std::task::Context<'_>,
4438 ) -> std::task::Poll<Option<Self::Item>> {
4439 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4440 &mut self.event_receiver,
4441 cx
4442 )?) {
4443 Some(buf) => std::task::Poll::Ready(Some(LifecycleObserverEvent::decode(buf))),
4444 None => std::task::Poll::Ready(None),
4445 }
4446 }
4447}
4448
4449#[derive(Debug)]
4450pub enum LifecycleObserverEvent {
4451 OnLifecycleChange { event: LifecycleEvent },
4452}
4453
4454impl LifecycleObserverEvent {
4455 #[allow(irrefutable_let_patterns)]
4456 pub fn into_on_lifecycle_change(self) -> Option<LifecycleEvent> {
4457 if let LifecycleObserverEvent::OnLifecycleChange { event } = self {
4458 Some((event))
4459 } else {
4460 None
4461 }
4462 }
4463
4464 fn decode(
4466 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4467 ) -> Result<LifecycleObserverEvent, fidl::Error> {
4468 let (bytes, _handles) = buf.split_mut();
4469 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4470 debug_assert_eq!(tx_header.tx_id, 0);
4471 match tx_header.ordinal {
4472 0x7034eb94979bd8de => {
4473 let mut out = fidl::new_empty!(
4474 LifecycleObserverOnLifecycleChangeRequest,
4475 fidl::encoding::DefaultFuchsiaResourceDialect
4476 );
4477 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LifecycleObserverOnLifecycleChangeRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
4478 Ok((LifecycleObserverEvent::OnLifecycleChange { event: out.event }))
4479 }
4480 _ => Err(fidl::Error::UnknownOrdinal {
4481 ordinal: tx_header.ordinal,
4482 protocol_name:
4483 <LifecycleObserverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4484 }),
4485 }
4486 }
4487}
4488
4489pub struct LifecycleObserverRequestStream {
4491 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4492 is_terminated: bool,
4493}
4494
4495impl std::marker::Unpin for LifecycleObserverRequestStream {}
4496
4497impl futures::stream::FusedStream for LifecycleObserverRequestStream {
4498 fn is_terminated(&self) -> bool {
4499 self.is_terminated
4500 }
4501}
4502
4503impl fidl::endpoints::RequestStream for LifecycleObserverRequestStream {
4504 type Protocol = LifecycleObserverMarker;
4505 type ControlHandle = LifecycleObserverControlHandle;
4506
4507 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4508 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4509 }
4510
4511 fn control_handle(&self) -> Self::ControlHandle {
4512 LifecycleObserverControlHandle { inner: self.inner.clone() }
4513 }
4514
4515 fn into_inner(
4516 self,
4517 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4518 {
4519 (self.inner, self.is_terminated)
4520 }
4521
4522 fn from_inner(
4523 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4524 is_terminated: bool,
4525 ) -> Self {
4526 Self { inner, is_terminated }
4527 }
4528}
4529
4530impl futures::Stream for LifecycleObserverRequestStream {
4531 type Item = Result<LifecycleObserverRequest, fidl::Error>;
4532
4533 fn poll_next(
4534 mut self: std::pin::Pin<&mut Self>,
4535 cx: &mut std::task::Context<'_>,
4536 ) -> std::task::Poll<Option<Self::Item>> {
4537 let this = &mut *self;
4538 if this.inner.check_shutdown(cx) {
4539 this.is_terminated = true;
4540 return std::task::Poll::Ready(None);
4541 }
4542 if this.is_terminated {
4543 panic!("polled LifecycleObserverRequestStream after completion");
4544 }
4545 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4546 |bytes, handles| {
4547 match this.inner.channel().read_etc(cx, bytes, handles) {
4548 std::task::Poll::Ready(Ok(())) => {}
4549 std::task::Poll::Pending => return std::task::Poll::Pending,
4550 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4551 this.is_terminated = true;
4552 return std::task::Poll::Ready(None);
4553 }
4554 std::task::Poll::Ready(Err(e)) => {
4555 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4556 e.into(),
4557 ))));
4558 }
4559 }
4560
4561 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4563
4564 std::task::Poll::Ready(Some(match header.ordinal {
4565 _ => Err(fidl::Error::UnknownOrdinal {
4566 ordinal: header.ordinal,
4567 protocol_name:
4568 <LifecycleObserverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4569 }),
4570 }))
4571 },
4572 )
4573 }
4574}
4575
4576#[derive(Debug)]
4578pub enum LifecycleObserverRequest {}
4579
4580impl LifecycleObserverRequest {
4581 pub fn method_name(&self) -> &'static str {
4583 match *self {}
4584 }
4585}
4586
4587#[derive(Debug, Clone)]
4588pub struct LifecycleObserverControlHandle {
4589 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4590}
4591
4592impl fidl::endpoints::ControlHandle for LifecycleObserverControlHandle {
4593 fn shutdown(&self) {
4594 self.inner.shutdown()
4595 }
4596
4597 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4598 self.inner.shutdown_with_epitaph(status)
4599 }
4600
4601 fn is_closed(&self) -> bool {
4602 self.inner.channel().is_closed()
4603 }
4604 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4605 self.inner.channel().on_closed()
4606 }
4607
4608 #[cfg(target_os = "fuchsia")]
4609 fn signal_peer(
4610 &self,
4611 clear_mask: zx::Signals,
4612 set_mask: zx::Signals,
4613 ) -> Result<(), zx_status::Status> {
4614 use fidl::Peered;
4615 self.inner.channel().signal_peer(clear_mask, set_mask)
4616 }
4617}
4618
4619impl LifecycleObserverControlHandle {
4620 pub fn send_on_lifecycle_change(&self, mut event: LifecycleEvent) -> Result<(), fidl::Error> {
4621 self.inner.send::<LifecycleObserverOnLifecycleChangeRequest>(
4622 (event,),
4623 0,
4624 0x7034eb94979bd8de,
4625 fidl::encoding::DynamicFlags::empty(),
4626 )
4627 }
4628}
4629
4630#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4631pub struct UnboundHangingDataChannelMarker;
4632
4633impl fidl::endpoints::ProtocolMarker for UnboundHangingDataChannelMarker {
4634 type Proxy = UnboundHangingDataChannelProxy;
4635 type RequestStream = UnboundHangingDataChannelRequestStream;
4636 #[cfg(target_os = "fuchsia")]
4637 type SynchronousProxy = UnboundHangingDataChannelSynchronousProxy;
4638
4639 const DEBUG_NAME: &'static str = "(anonymous) UnboundHangingDataChannel";
4640}
4641pub type UnboundHangingDataChannelBindResult = Result<(), i32>;
4642
4643pub trait UnboundHangingDataChannelProxyInterface: Send + Sync {
4644 type BindResponseFut: std::future::Future<Output = Result<UnboundHangingDataChannelBindResult, fidl::Error>>
4645 + Send;
4646 fn r#bind(&self, payload: UnboundHangingDataChannelBindRequest) -> Self::BindResponseFut;
4647 type GetIdentifierResponseFut: std::future::Future<
4648 Output = Result<UnboundHangingDataChannelGetIdentifierResponse, fidl::Error>,
4649 > + Send;
4650 fn r#get_identifier(&self) -> Self::GetIdentifierResponseFut;
4651}
4652#[derive(Debug)]
4653#[cfg(target_os = "fuchsia")]
4654pub struct UnboundHangingDataChannelSynchronousProxy {
4655 client: fidl::client::sync::Client,
4656}
4657
4658#[cfg(target_os = "fuchsia")]
4659impl fidl::endpoints::SynchronousProxy for UnboundHangingDataChannelSynchronousProxy {
4660 type Proxy = UnboundHangingDataChannelProxy;
4661 type Protocol = UnboundHangingDataChannelMarker;
4662
4663 fn from_channel(inner: fidl::Channel) -> Self {
4664 Self::new(inner)
4665 }
4666
4667 fn into_channel(self) -> fidl::Channel {
4668 self.client.into_channel()
4669 }
4670
4671 fn as_channel(&self) -> &fidl::Channel {
4672 self.client.as_channel()
4673 }
4674}
4675
4676#[cfg(target_os = "fuchsia")]
4677impl UnboundHangingDataChannelSynchronousProxy {
4678 pub fn new(channel: fidl::Channel) -> Self {
4679 let protocol_name =
4680 <UnboundHangingDataChannelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4681 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4682 }
4683
4684 pub fn into_channel(self) -> fidl::Channel {
4685 self.client.into_channel()
4686 }
4687
4688 pub fn wait_for_event(
4691 &self,
4692 deadline: zx::MonotonicInstant,
4693 ) -> Result<UnboundHangingDataChannelEvent, fidl::Error> {
4694 UnboundHangingDataChannelEvent::decode(self.client.wait_for_event(deadline)?)
4695 }
4696
4697 pub fn r#bind(
4700 &self,
4701 mut payload: UnboundHangingDataChannelBindRequest,
4702 ___deadline: zx::MonotonicInstant,
4703 ) -> Result<UnboundHangingDataChannelBindResult, fidl::Error> {
4704 let _response = self.client.send_query::<
4705 UnboundHangingDataChannelBindRequest,
4706 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
4707 >(
4708 &mut payload,
4709 0x62be1ffca6ea4090,
4710 fidl::encoding::DynamicFlags::FLEXIBLE,
4711 ___deadline,
4712 )?
4713 .into_result::<UnboundHangingDataChannelMarker>("bind")?;
4714 Ok(_response.map(|x| x))
4715 }
4716
4717 pub fn r#get_identifier(
4719 &self,
4720 ___deadline: zx::MonotonicInstant,
4721 ) -> Result<UnboundHangingDataChannelGetIdentifierResponse, fidl::Error> {
4722 let _response = self.client.send_query::<
4723 fidl::encoding::EmptyPayload,
4724 fidl::encoding::FlexibleType<UnboundHangingDataChannelGetIdentifierResponse>,
4725 >(
4726 (),
4727 0x63d3f258532f3b0,
4728 fidl::encoding::DynamicFlags::FLEXIBLE,
4729 ___deadline,
4730 )?
4731 .into_result::<UnboundHangingDataChannelMarker>("get_identifier")?;
4732 Ok(_response)
4733 }
4734}
4735
4736#[cfg(target_os = "fuchsia")]
4737impl From<UnboundHangingDataChannelSynchronousProxy> for zx::NullableHandle {
4738 fn from(value: UnboundHangingDataChannelSynchronousProxy) -> Self {
4739 value.into_channel().into()
4740 }
4741}
4742
4743#[cfg(target_os = "fuchsia")]
4744impl From<fidl::Channel> for UnboundHangingDataChannelSynchronousProxy {
4745 fn from(value: fidl::Channel) -> Self {
4746 Self::new(value)
4747 }
4748}
4749
4750#[cfg(target_os = "fuchsia")]
4751impl fidl::endpoints::FromClient for UnboundHangingDataChannelSynchronousProxy {
4752 type Protocol = UnboundHangingDataChannelMarker;
4753
4754 fn from_client(value: fidl::endpoints::ClientEnd<UnboundHangingDataChannelMarker>) -> Self {
4755 Self::new(value.into_channel())
4756 }
4757}
4758
4759#[derive(Debug, Clone)]
4760pub struct UnboundHangingDataChannelProxy {
4761 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4762}
4763
4764impl fidl::endpoints::Proxy for UnboundHangingDataChannelProxy {
4765 type Protocol = UnboundHangingDataChannelMarker;
4766
4767 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4768 Self::new(inner)
4769 }
4770
4771 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4772 self.client.into_channel().map_err(|client| Self { client })
4773 }
4774
4775 fn as_channel(&self) -> &::fidl::AsyncChannel {
4776 self.client.as_channel()
4777 }
4778}
4779
4780impl UnboundHangingDataChannelProxy {
4781 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4783 let protocol_name =
4784 <UnboundHangingDataChannelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4785 Self { client: fidl::client::Client::new(channel, protocol_name) }
4786 }
4787
4788 pub fn take_event_stream(&self) -> UnboundHangingDataChannelEventStream {
4794 UnboundHangingDataChannelEventStream { event_receiver: self.client.take_event_receiver() }
4795 }
4796
4797 pub fn r#bind(
4800 &self,
4801 mut payload: UnboundHangingDataChannelBindRequest,
4802 ) -> fidl::client::QueryResponseFut<
4803 UnboundHangingDataChannelBindResult,
4804 fidl::encoding::DefaultFuchsiaResourceDialect,
4805 > {
4806 UnboundHangingDataChannelProxyInterface::r#bind(self, payload)
4807 }
4808
4809 pub fn r#get_identifier(
4811 &self,
4812 ) -> fidl::client::QueryResponseFut<
4813 UnboundHangingDataChannelGetIdentifierResponse,
4814 fidl::encoding::DefaultFuchsiaResourceDialect,
4815 > {
4816 UnboundHangingDataChannelProxyInterface::r#get_identifier(self)
4817 }
4818}
4819
4820impl UnboundHangingDataChannelProxyInterface for UnboundHangingDataChannelProxy {
4821 type BindResponseFut = fidl::client::QueryResponseFut<
4822 UnboundHangingDataChannelBindResult,
4823 fidl::encoding::DefaultFuchsiaResourceDialect,
4824 >;
4825 fn r#bind(&self, mut payload: UnboundHangingDataChannelBindRequest) -> Self::BindResponseFut {
4826 fn _decode(
4827 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4828 ) -> Result<UnboundHangingDataChannelBindResult, fidl::Error> {
4829 let _response = fidl::client::decode_transaction_body::<
4830 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
4831 fidl::encoding::DefaultFuchsiaResourceDialect,
4832 0x62be1ffca6ea4090,
4833 >(_buf?)?
4834 .into_result::<UnboundHangingDataChannelMarker>("bind")?;
4835 Ok(_response.map(|x| x))
4836 }
4837 self.client.send_query_and_decode::<
4838 UnboundHangingDataChannelBindRequest,
4839 UnboundHangingDataChannelBindResult,
4840 >(
4841 &mut payload,
4842 0x62be1ffca6ea4090,
4843 fidl::encoding::DynamicFlags::FLEXIBLE,
4844 _decode,
4845 )
4846 }
4847
4848 type GetIdentifierResponseFut = fidl::client::QueryResponseFut<
4849 UnboundHangingDataChannelGetIdentifierResponse,
4850 fidl::encoding::DefaultFuchsiaResourceDialect,
4851 >;
4852 fn r#get_identifier(&self) -> Self::GetIdentifierResponseFut {
4853 fn _decode(
4854 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4855 ) -> Result<UnboundHangingDataChannelGetIdentifierResponse, fidl::Error> {
4856 let _response = fidl::client::decode_transaction_body::<
4857 fidl::encoding::FlexibleType<UnboundHangingDataChannelGetIdentifierResponse>,
4858 fidl::encoding::DefaultFuchsiaResourceDialect,
4859 0x63d3f258532f3b0,
4860 >(_buf?)?
4861 .into_result::<UnboundHangingDataChannelMarker>("get_identifier")?;
4862 Ok(_response)
4863 }
4864 self.client.send_query_and_decode::<
4865 fidl::encoding::EmptyPayload,
4866 UnboundHangingDataChannelGetIdentifierResponse,
4867 >(
4868 (),
4869 0x63d3f258532f3b0,
4870 fidl::encoding::DynamicFlags::FLEXIBLE,
4871 _decode,
4872 )
4873 }
4874}
4875
4876pub struct UnboundHangingDataChannelEventStream {
4877 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4878}
4879
4880impl std::marker::Unpin for UnboundHangingDataChannelEventStream {}
4881
4882impl futures::stream::FusedStream for UnboundHangingDataChannelEventStream {
4883 fn is_terminated(&self) -> bool {
4884 self.event_receiver.is_terminated()
4885 }
4886}
4887
4888impl futures::Stream for UnboundHangingDataChannelEventStream {
4889 type Item = Result<UnboundHangingDataChannelEvent, fidl::Error>;
4890
4891 fn poll_next(
4892 mut self: std::pin::Pin<&mut Self>,
4893 cx: &mut std::task::Context<'_>,
4894 ) -> std::task::Poll<Option<Self::Item>> {
4895 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4896 &mut self.event_receiver,
4897 cx
4898 )?) {
4899 Some(buf) => std::task::Poll::Ready(Some(UnboundHangingDataChannelEvent::decode(buf))),
4900 None => std::task::Poll::Ready(None),
4901 }
4902 }
4903}
4904
4905#[derive(Debug)]
4906pub enum UnboundHangingDataChannelEvent {
4907 #[non_exhaustive]
4908 _UnknownEvent {
4909 ordinal: u64,
4911 },
4912}
4913
4914impl UnboundHangingDataChannelEvent {
4915 fn decode(
4917 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4918 ) -> Result<UnboundHangingDataChannelEvent, fidl::Error> {
4919 let (bytes, _handles) = buf.split_mut();
4920 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4921 debug_assert_eq!(tx_header.tx_id, 0);
4922 match tx_header.ordinal {
4923 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4924 Ok(UnboundHangingDataChannelEvent::_UnknownEvent { ordinal: tx_header.ordinal })
4925 }
4926 _ => Err(fidl::Error::UnknownOrdinal {
4927 ordinal: tx_header.ordinal,
4928 protocol_name:
4929 <UnboundHangingDataChannelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4930 }),
4931 }
4932 }
4933}
4934
4935pub struct UnboundHangingDataChannelRequestStream {
4937 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4938 is_terminated: bool,
4939}
4940
4941impl std::marker::Unpin for UnboundHangingDataChannelRequestStream {}
4942
4943impl futures::stream::FusedStream for UnboundHangingDataChannelRequestStream {
4944 fn is_terminated(&self) -> bool {
4945 self.is_terminated
4946 }
4947}
4948
4949impl fidl::endpoints::RequestStream for UnboundHangingDataChannelRequestStream {
4950 type Protocol = UnboundHangingDataChannelMarker;
4951 type ControlHandle = UnboundHangingDataChannelControlHandle;
4952
4953 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4954 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4955 }
4956
4957 fn control_handle(&self) -> Self::ControlHandle {
4958 UnboundHangingDataChannelControlHandle { inner: self.inner.clone() }
4959 }
4960
4961 fn into_inner(
4962 self,
4963 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4964 {
4965 (self.inner, self.is_terminated)
4966 }
4967
4968 fn from_inner(
4969 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4970 is_terminated: bool,
4971 ) -> Self {
4972 Self { inner, is_terminated }
4973 }
4974}
4975
4976impl futures::Stream for UnboundHangingDataChannelRequestStream {
4977 type Item = Result<UnboundHangingDataChannelRequest, fidl::Error>;
4978
4979 fn poll_next(
4980 mut self: std::pin::Pin<&mut Self>,
4981 cx: &mut std::task::Context<'_>,
4982 ) -> std::task::Poll<Option<Self::Item>> {
4983 let this = &mut *self;
4984 if this.inner.check_shutdown(cx) {
4985 this.is_terminated = true;
4986 return std::task::Poll::Ready(None);
4987 }
4988 if this.is_terminated {
4989 panic!("polled UnboundHangingDataChannelRequestStream after completion");
4990 }
4991 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4992 |bytes, handles| {
4993 match this.inner.channel().read_etc(cx, bytes, handles) {
4994 std::task::Poll::Ready(Ok(())) => {}
4995 std::task::Poll::Pending => return std::task::Poll::Pending,
4996 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4997 this.is_terminated = true;
4998 return std::task::Poll::Ready(None);
4999 }
5000 std::task::Poll::Ready(Err(e)) => {
5001 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5002 e.into(),
5003 ))));
5004 }
5005 }
5006
5007 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5009
5010 std::task::Poll::Ready(Some(match header.ordinal {
5011 0x62be1ffca6ea4090 => {
5012 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5013 let mut req = fidl::new_empty!(UnboundHangingDataChannelBindRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
5014 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UnboundHangingDataChannelBindRequest>(&header, _body_bytes, handles, &mut req)?;
5015 let control_handle = UnboundHangingDataChannelControlHandle {
5016 inner: this.inner.clone(),
5017 };
5018 Ok(UnboundHangingDataChannelRequest::Bind {payload: req,
5019 responder: UnboundHangingDataChannelBindResponder {
5020 control_handle: std::mem::ManuallyDrop::new(control_handle),
5021 tx_id: header.tx_id,
5022 },
5023 })
5024 }
5025 0x63d3f258532f3b0 => {
5026 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5027 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
5028 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5029 let control_handle = UnboundHangingDataChannelControlHandle {
5030 inner: this.inner.clone(),
5031 };
5032 Ok(UnboundHangingDataChannelRequest::GetIdentifier {
5033 responder: UnboundHangingDataChannelGetIdentifierResponder {
5034 control_handle: std::mem::ManuallyDrop::new(control_handle),
5035 tx_id: header.tx_id,
5036 },
5037 })
5038 }
5039 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
5040 Ok(UnboundHangingDataChannelRequest::_UnknownMethod {
5041 ordinal: header.ordinal,
5042 control_handle: UnboundHangingDataChannelControlHandle { inner: this.inner.clone() },
5043 method_type: fidl::MethodType::OneWay,
5044 })
5045 }
5046 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
5047 this.inner.send_framework_err(
5048 fidl::encoding::FrameworkErr::UnknownMethod,
5049 header.tx_id,
5050 header.ordinal,
5051 header.dynamic_flags(),
5052 (bytes, handles),
5053 )?;
5054 Ok(UnboundHangingDataChannelRequest::_UnknownMethod {
5055 ordinal: header.ordinal,
5056 control_handle: UnboundHangingDataChannelControlHandle { inner: this.inner.clone() },
5057 method_type: fidl::MethodType::TwoWay,
5058 })
5059 }
5060 _ => Err(fidl::Error::UnknownOrdinal {
5061 ordinal: header.ordinal,
5062 protocol_name: <UnboundHangingDataChannelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5063 }),
5064 }))
5065 },
5066 )
5067 }
5068}
5069
5070#[derive(Debug)]
5071pub enum UnboundHangingDataChannelRequest {
5072 Bind {
5075 payload: UnboundHangingDataChannelBindRequest,
5076 responder: UnboundHangingDataChannelBindResponder,
5077 },
5078 GetIdentifier { responder: UnboundHangingDataChannelGetIdentifierResponder },
5080 #[non_exhaustive]
5082 _UnknownMethod {
5083 ordinal: u64,
5085 control_handle: UnboundHangingDataChannelControlHandle,
5086 method_type: fidl::MethodType,
5087 },
5088}
5089
5090impl UnboundHangingDataChannelRequest {
5091 #[allow(irrefutable_let_patterns)]
5092 pub fn into_bind(
5093 self,
5094 ) -> Option<(UnboundHangingDataChannelBindRequest, UnboundHangingDataChannelBindResponder)>
5095 {
5096 if let UnboundHangingDataChannelRequest::Bind { payload, responder } = self {
5097 Some((payload, responder))
5098 } else {
5099 None
5100 }
5101 }
5102
5103 #[allow(irrefutable_let_patterns)]
5104 pub fn into_get_identifier(self) -> Option<(UnboundHangingDataChannelGetIdentifierResponder)> {
5105 if let UnboundHangingDataChannelRequest::GetIdentifier { responder } = self {
5106 Some((responder))
5107 } else {
5108 None
5109 }
5110 }
5111
5112 pub fn method_name(&self) -> &'static str {
5114 match *self {
5115 UnboundHangingDataChannelRequest::Bind { .. } => "bind",
5116 UnboundHangingDataChannelRequest::GetIdentifier { .. } => "get_identifier",
5117 UnboundHangingDataChannelRequest::_UnknownMethod {
5118 method_type: fidl::MethodType::OneWay,
5119 ..
5120 } => "unknown one-way method",
5121 UnboundHangingDataChannelRequest::_UnknownMethod {
5122 method_type: fidl::MethodType::TwoWay,
5123 ..
5124 } => "unknown two-way method",
5125 }
5126 }
5127}
5128
5129#[derive(Debug, Clone)]
5130pub struct UnboundHangingDataChannelControlHandle {
5131 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5132}
5133
5134impl fidl::endpoints::ControlHandle for UnboundHangingDataChannelControlHandle {
5135 fn shutdown(&self) {
5136 self.inner.shutdown()
5137 }
5138
5139 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5140 self.inner.shutdown_with_epitaph(status)
5141 }
5142
5143 fn is_closed(&self) -> bool {
5144 self.inner.channel().is_closed()
5145 }
5146 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5147 self.inner.channel().on_closed()
5148 }
5149
5150 #[cfg(target_os = "fuchsia")]
5151 fn signal_peer(
5152 &self,
5153 clear_mask: zx::Signals,
5154 set_mask: zx::Signals,
5155 ) -> Result<(), zx_status::Status> {
5156 use fidl::Peered;
5157 self.inner.channel().signal_peer(clear_mask, set_mask)
5158 }
5159}
5160
5161impl UnboundHangingDataChannelControlHandle {}
5162
5163#[must_use = "FIDL methods require a response to be sent"]
5164#[derive(Debug)]
5165pub struct UnboundHangingDataChannelBindResponder {
5166 control_handle: std::mem::ManuallyDrop<UnboundHangingDataChannelControlHandle>,
5167 tx_id: u32,
5168}
5169
5170impl std::ops::Drop for UnboundHangingDataChannelBindResponder {
5174 fn drop(&mut self) {
5175 self.control_handle.shutdown();
5176 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5178 }
5179}
5180
5181impl fidl::endpoints::Responder for UnboundHangingDataChannelBindResponder {
5182 type ControlHandle = UnboundHangingDataChannelControlHandle;
5183
5184 fn control_handle(&self) -> &UnboundHangingDataChannelControlHandle {
5185 &self.control_handle
5186 }
5187
5188 fn drop_without_shutdown(mut self) {
5189 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5191 std::mem::forget(self);
5193 }
5194}
5195
5196impl UnboundHangingDataChannelBindResponder {
5197 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5201 let _result = self.send_raw(result);
5202 if _result.is_err() {
5203 self.control_handle.shutdown();
5204 }
5205 self.drop_without_shutdown();
5206 _result
5207 }
5208
5209 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5211 let _result = self.send_raw(result);
5212 self.drop_without_shutdown();
5213 _result
5214 }
5215
5216 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5217 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5218 fidl::encoding::EmptyStruct,
5219 i32,
5220 >>(
5221 fidl::encoding::FlexibleResult::new(result),
5222 self.tx_id,
5223 0x62be1ffca6ea4090,
5224 fidl::encoding::DynamicFlags::FLEXIBLE,
5225 )
5226 }
5227}
5228
5229#[must_use = "FIDL methods require a response to be sent"]
5230#[derive(Debug)]
5231pub struct UnboundHangingDataChannelGetIdentifierResponder {
5232 control_handle: std::mem::ManuallyDrop<UnboundHangingDataChannelControlHandle>,
5233 tx_id: u32,
5234}
5235
5236impl std::ops::Drop for UnboundHangingDataChannelGetIdentifierResponder {
5240 fn drop(&mut self) {
5241 self.control_handle.shutdown();
5242 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5244 }
5245}
5246
5247impl fidl::endpoints::Responder for UnboundHangingDataChannelGetIdentifierResponder {
5248 type ControlHandle = UnboundHangingDataChannelControlHandle;
5249
5250 fn control_handle(&self) -> &UnboundHangingDataChannelControlHandle {
5251 &self.control_handle
5252 }
5253
5254 fn drop_without_shutdown(mut self) {
5255 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5257 std::mem::forget(self);
5259 }
5260}
5261
5262impl UnboundHangingDataChannelGetIdentifierResponder {
5263 pub fn send(
5267 self,
5268 mut payload: &UnboundHangingDataChannelGetIdentifierResponse,
5269 ) -> Result<(), fidl::Error> {
5270 let _result = self.send_raw(payload);
5271 if _result.is_err() {
5272 self.control_handle.shutdown();
5273 }
5274 self.drop_without_shutdown();
5275 _result
5276 }
5277
5278 pub fn send_no_shutdown_on_err(
5280 self,
5281 mut payload: &UnboundHangingDataChannelGetIdentifierResponse,
5282 ) -> Result<(), fidl::Error> {
5283 let _result = self.send_raw(payload);
5284 self.drop_without_shutdown();
5285 _result
5286 }
5287
5288 fn send_raw(
5289 &self,
5290 mut payload: &UnboundHangingDataChannelGetIdentifierResponse,
5291 ) -> Result<(), fidl::Error> {
5292 self.control_handle.inner.send::<fidl::encoding::FlexibleType<
5293 UnboundHangingDataChannelGetIdentifierResponse,
5294 >>(
5295 fidl::encoding::Flexible::new(payload),
5296 self.tx_id,
5297 0x63d3f258532f3b0,
5298 fidl::encoding::DynamicFlags::FLEXIBLE,
5299 )
5300 }
5301}
5302
5303#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5304pub struct UnboundWaitableDataChannelMarker;
5305
5306impl fidl::endpoints::ProtocolMarker for UnboundWaitableDataChannelMarker {
5307 type Proxy = UnboundWaitableDataChannelProxy;
5308 type RequestStream = UnboundWaitableDataChannelRequestStream;
5309 #[cfg(target_os = "fuchsia")]
5310 type SynchronousProxy = UnboundWaitableDataChannelSynchronousProxy;
5311
5312 const DEBUG_NAME: &'static str = "(anonymous) UnboundWaitableDataChannel";
5313}
5314pub type UnboundWaitableDataChannelBindResult = Result<(), i32>;
5315
5316pub trait UnboundWaitableDataChannelProxyInterface: Send + Sync {
5317 type BindResponseFut: std::future::Future<Output = Result<UnboundWaitableDataChannelBindResult, fidl::Error>>
5318 + Send;
5319 fn r#bind(&self, payload: UnboundWaitableDataChannelBindRequest) -> Self::BindResponseFut;
5320 type GetIdentifierResponseFut: std::future::Future<
5321 Output = Result<UnboundWaitableDataChannelGetIdentifierResponse, fidl::Error>,
5322 > + Send;
5323 fn r#get_identifier(&self) -> Self::GetIdentifierResponseFut;
5324}
5325#[derive(Debug)]
5326#[cfg(target_os = "fuchsia")]
5327pub struct UnboundWaitableDataChannelSynchronousProxy {
5328 client: fidl::client::sync::Client,
5329}
5330
5331#[cfg(target_os = "fuchsia")]
5332impl fidl::endpoints::SynchronousProxy for UnboundWaitableDataChannelSynchronousProxy {
5333 type Proxy = UnboundWaitableDataChannelProxy;
5334 type Protocol = UnboundWaitableDataChannelMarker;
5335
5336 fn from_channel(inner: fidl::Channel) -> Self {
5337 Self::new(inner)
5338 }
5339
5340 fn into_channel(self) -> fidl::Channel {
5341 self.client.into_channel()
5342 }
5343
5344 fn as_channel(&self) -> &fidl::Channel {
5345 self.client.as_channel()
5346 }
5347}
5348
5349#[cfg(target_os = "fuchsia")]
5350impl UnboundWaitableDataChannelSynchronousProxy {
5351 pub fn new(channel: fidl::Channel) -> Self {
5352 let protocol_name =
5353 <UnboundWaitableDataChannelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5354 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5355 }
5356
5357 pub fn into_channel(self) -> fidl::Channel {
5358 self.client.into_channel()
5359 }
5360
5361 pub fn wait_for_event(
5364 &self,
5365 deadline: zx::MonotonicInstant,
5366 ) -> Result<UnboundWaitableDataChannelEvent, fidl::Error> {
5367 UnboundWaitableDataChannelEvent::decode(self.client.wait_for_event(deadline)?)
5368 }
5369
5370 pub fn r#bind(
5374 &self,
5375 mut payload: UnboundWaitableDataChannelBindRequest,
5376 ___deadline: zx::MonotonicInstant,
5377 ) -> Result<UnboundWaitableDataChannelBindResult, fidl::Error> {
5378 let _response = self.client.send_query::<
5379 UnboundWaitableDataChannelBindRequest,
5380 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
5381 >(
5382 &mut payload,
5383 0x135713194412491e,
5384 fidl::encoding::DynamicFlags::FLEXIBLE,
5385 ___deadline,
5386 )?
5387 .into_result::<UnboundWaitableDataChannelMarker>("bind")?;
5388 Ok(_response.map(|x| x))
5389 }
5390
5391 pub fn r#get_identifier(
5393 &self,
5394 ___deadline: zx::MonotonicInstant,
5395 ) -> Result<UnboundWaitableDataChannelGetIdentifierResponse, fidl::Error> {
5396 let _response = self.client.send_query::<
5397 fidl::encoding::EmptyPayload,
5398 fidl::encoding::FlexibleType<UnboundWaitableDataChannelGetIdentifierResponse>,
5399 >(
5400 (),
5401 0x6a36e55ac6beb9d6,
5402 fidl::encoding::DynamicFlags::FLEXIBLE,
5403 ___deadline,
5404 )?
5405 .into_result::<UnboundWaitableDataChannelMarker>("get_identifier")?;
5406 Ok(_response)
5407 }
5408}
5409
5410#[cfg(target_os = "fuchsia")]
5411impl From<UnboundWaitableDataChannelSynchronousProxy> for zx::NullableHandle {
5412 fn from(value: UnboundWaitableDataChannelSynchronousProxy) -> Self {
5413 value.into_channel().into()
5414 }
5415}
5416
5417#[cfg(target_os = "fuchsia")]
5418impl From<fidl::Channel> for UnboundWaitableDataChannelSynchronousProxy {
5419 fn from(value: fidl::Channel) -> Self {
5420 Self::new(value)
5421 }
5422}
5423
5424#[cfg(target_os = "fuchsia")]
5425impl fidl::endpoints::FromClient for UnboundWaitableDataChannelSynchronousProxy {
5426 type Protocol = UnboundWaitableDataChannelMarker;
5427
5428 fn from_client(value: fidl::endpoints::ClientEnd<UnboundWaitableDataChannelMarker>) -> Self {
5429 Self::new(value.into_channel())
5430 }
5431}
5432
5433#[derive(Debug, Clone)]
5434pub struct UnboundWaitableDataChannelProxy {
5435 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5436}
5437
5438impl fidl::endpoints::Proxy for UnboundWaitableDataChannelProxy {
5439 type Protocol = UnboundWaitableDataChannelMarker;
5440
5441 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5442 Self::new(inner)
5443 }
5444
5445 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5446 self.client.into_channel().map_err(|client| Self { client })
5447 }
5448
5449 fn as_channel(&self) -> &::fidl::AsyncChannel {
5450 self.client.as_channel()
5451 }
5452}
5453
5454impl UnboundWaitableDataChannelProxy {
5455 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5457 let protocol_name =
5458 <UnboundWaitableDataChannelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5459 Self { client: fidl::client::Client::new(channel, protocol_name) }
5460 }
5461
5462 pub fn take_event_stream(&self) -> UnboundWaitableDataChannelEventStream {
5468 UnboundWaitableDataChannelEventStream { event_receiver: self.client.take_event_receiver() }
5469 }
5470
5471 pub fn r#bind(
5475 &self,
5476 mut payload: UnboundWaitableDataChannelBindRequest,
5477 ) -> fidl::client::QueryResponseFut<
5478 UnboundWaitableDataChannelBindResult,
5479 fidl::encoding::DefaultFuchsiaResourceDialect,
5480 > {
5481 UnboundWaitableDataChannelProxyInterface::r#bind(self, payload)
5482 }
5483
5484 pub fn r#get_identifier(
5486 &self,
5487 ) -> fidl::client::QueryResponseFut<
5488 UnboundWaitableDataChannelGetIdentifierResponse,
5489 fidl::encoding::DefaultFuchsiaResourceDialect,
5490 > {
5491 UnboundWaitableDataChannelProxyInterface::r#get_identifier(self)
5492 }
5493}
5494
5495impl UnboundWaitableDataChannelProxyInterface for UnboundWaitableDataChannelProxy {
5496 type BindResponseFut = fidl::client::QueryResponseFut<
5497 UnboundWaitableDataChannelBindResult,
5498 fidl::encoding::DefaultFuchsiaResourceDialect,
5499 >;
5500 fn r#bind(&self, mut payload: UnboundWaitableDataChannelBindRequest) -> Self::BindResponseFut {
5501 fn _decode(
5502 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5503 ) -> Result<UnboundWaitableDataChannelBindResult, fidl::Error> {
5504 let _response = fidl::client::decode_transaction_body::<
5505 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
5506 fidl::encoding::DefaultFuchsiaResourceDialect,
5507 0x135713194412491e,
5508 >(_buf?)?
5509 .into_result::<UnboundWaitableDataChannelMarker>("bind")?;
5510 Ok(_response.map(|x| x))
5511 }
5512 self.client.send_query_and_decode::<
5513 UnboundWaitableDataChannelBindRequest,
5514 UnboundWaitableDataChannelBindResult,
5515 >(
5516 &mut payload,
5517 0x135713194412491e,
5518 fidl::encoding::DynamicFlags::FLEXIBLE,
5519 _decode,
5520 )
5521 }
5522
5523 type GetIdentifierResponseFut = fidl::client::QueryResponseFut<
5524 UnboundWaitableDataChannelGetIdentifierResponse,
5525 fidl::encoding::DefaultFuchsiaResourceDialect,
5526 >;
5527 fn r#get_identifier(&self) -> Self::GetIdentifierResponseFut {
5528 fn _decode(
5529 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5530 ) -> Result<UnboundWaitableDataChannelGetIdentifierResponse, fidl::Error> {
5531 let _response = fidl::client::decode_transaction_body::<
5532 fidl::encoding::FlexibleType<UnboundWaitableDataChannelGetIdentifierResponse>,
5533 fidl::encoding::DefaultFuchsiaResourceDialect,
5534 0x6a36e55ac6beb9d6,
5535 >(_buf?)?
5536 .into_result::<UnboundWaitableDataChannelMarker>("get_identifier")?;
5537 Ok(_response)
5538 }
5539 self.client.send_query_and_decode::<
5540 fidl::encoding::EmptyPayload,
5541 UnboundWaitableDataChannelGetIdentifierResponse,
5542 >(
5543 (),
5544 0x6a36e55ac6beb9d6,
5545 fidl::encoding::DynamicFlags::FLEXIBLE,
5546 _decode,
5547 )
5548 }
5549}
5550
5551pub struct UnboundWaitableDataChannelEventStream {
5552 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5553}
5554
5555impl std::marker::Unpin for UnboundWaitableDataChannelEventStream {}
5556
5557impl futures::stream::FusedStream for UnboundWaitableDataChannelEventStream {
5558 fn is_terminated(&self) -> bool {
5559 self.event_receiver.is_terminated()
5560 }
5561}
5562
5563impl futures::Stream for UnboundWaitableDataChannelEventStream {
5564 type Item = Result<UnboundWaitableDataChannelEvent, fidl::Error>;
5565
5566 fn poll_next(
5567 mut self: std::pin::Pin<&mut Self>,
5568 cx: &mut std::task::Context<'_>,
5569 ) -> std::task::Poll<Option<Self::Item>> {
5570 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5571 &mut self.event_receiver,
5572 cx
5573 )?) {
5574 Some(buf) => std::task::Poll::Ready(Some(UnboundWaitableDataChannelEvent::decode(buf))),
5575 None => std::task::Poll::Ready(None),
5576 }
5577 }
5578}
5579
5580#[derive(Debug)]
5581pub enum UnboundWaitableDataChannelEvent {
5582 #[non_exhaustive]
5583 _UnknownEvent {
5584 ordinal: u64,
5586 },
5587}
5588
5589impl UnboundWaitableDataChannelEvent {
5590 fn decode(
5592 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5593 ) -> Result<UnboundWaitableDataChannelEvent, fidl::Error> {
5594 let (bytes, _handles) = buf.split_mut();
5595 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5596 debug_assert_eq!(tx_header.tx_id, 0);
5597 match tx_header.ordinal {
5598 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
5599 Ok(UnboundWaitableDataChannelEvent::_UnknownEvent {
5600 ordinal: tx_header.ordinal,
5601 })
5602 }
5603 _ => Err(fidl::Error::UnknownOrdinal {
5604 ordinal: tx_header.ordinal,
5605 protocol_name: <UnboundWaitableDataChannelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5606 })
5607 }
5608 }
5609}
5610
5611pub struct UnboundWaitableDataChannelRequestStream {
5613 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5614 is_terminated: bool,
5615}
5616
5617impl std::marker::Unpin for UnboundWaitableDataChannelRequestStream {}
5618
5619impl futures::stream::FusedStream for UnboundWaitableDataChannelRequestStream {
5620 fn is_terminated(&self) -> bool {
5621 self.is_terminated
5622 }
5623}
5624
5625impl fidl::endpoints::RequestStream for UnboundWaitableDataChannelRequestStream {
5626 type Protocol = UnboundWaitableDataChannelMarker;
5627 type ControlHandle = UnboundWaitableDataChannelControlHandle;
5628
5629 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5630 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5631 }
5632
5633 fn control_handle(&self) -> Self::ControlHandle {
5634 UnboundWaitableDataChannelControlHandle { inner: self.inner.clone() }
5635 }
5636
5637 fn into_inner(
5638 self,
5639 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5640 {
5641 (self.inner, self.is_terminated)
5642 }
5643
5644 fn from_inner(
5645 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5646 is_terminated: bool,
5647 ) -> Self {
5648 Self { inner, is_terminated }
5649 }
5650}
5651
5652impl futures::Stream for UnboundWaitableDataChannelRequestStream {
5653 type Item = Result<UnboundWaitableDataChannelRequest, fidl::Error>;
5654
5655 fn poll_next(
5656 mut self: std::pin::Pin<&mut Self>,
5657 cx: &mut std::task::Context<'_>,
5658 ) -> std::task::Poll<Option<Self::Item>> {
5659 let this = &mut *self;
5660 if this.inner.check_shutdown(cx) {
5661 this.is_terminated = true;
5662 return std::task::Poll::Ready(None);
5663 }
5664 if this.is_terminated {
5665 panic!("polled UnboundWaitableDataChannelRequestStream after completion");
5666 }
5667 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5668 |bytes, handles| {
5669 match this.inner.channel().read_etc(cx, bytes, handles) {
5670 std::task::Poll::Ready(Ok(())) => {}
5671 std::task::Poll::Pending => return std::task::Poll::Pending,
5672 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5673 this.is_terminated = true;
5674 return std::task::Poll::Ready(None);
5675 }
5676 std::task::Poll::Ready(Err(e)) => {
5677 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5678 e.into(),
5679 ))));
5680 }
5681 }
5682
5683 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5685
5686 std::task::Poll::Ready(Some(match header.ordinal {
5687 0x135713194412491e => {
5688 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5689 let mut req = fidl::new_empty!(UnboundWaitableDataChannelBindRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
5690 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UnboundWaitableDataChannelBindRequest>(&header, _body_bytes, handles, &mut req)?;
5691 let control_handle = UnboundWaitableDataChannelControlHandle {
5692 inner: this.inner.clone(),
5693 };
5694 Ok(UnboundWaitableDataChannelRequest::Bind {payload: req,
5695 responder: UnboundWaitableDataChannelBindResponder {
5696 control_handle: std::mem::ManuallyDrop::new(control_handle),
5697 tx_id: header.tx_id,
5698 },
5699 })
5700 }
5701 0x6a36e55ac6beb9d6 => {
5702 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5703 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
5704 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5705 let control_handle = UnboundWaitableDataChannelControlHandle {
5706 inner: this.inner.clone(),
5707 };
5708 Ok(UnboundWaitableDataChannelRequest::GetIdentifier {
5709 responder: UnboundWaitableDataChannelGetIdentifierResponder {
5710 control_handle: std::mem::ManuallyDrop::new(control_handle),
5711 tx_id: header.tx_id,
5712 },
5713 })
5714 }
5715 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
5716 Ok(UnboundWaitableDataChannelRequest::_UnknownMethod {
5717 ordinal: header.ordinal,
5718 control_handle: UnboundWaitableDataChannelControlHandle { inner: this.inner.clone() },
5719 method_type: fidl::MethodType::OneWay,
5720 })
5721 }
5722 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
5723 this.inner.send_framework_err(
5724 fidl::encoding::FrameworkErr::UnknownMethod,
5725 header.tx_id,
5726 header.ordinal,
5727 header.dynamic_flags(),
5728 (bytes, handles),
5729 )?;
5730 Ok(UnboundWaitableDataChannelRequest::_UnknownMethod {
5731 ordinal: header.ordinal,
5732 control_handle: UnboundWaitableDataChannelControlHandle { inner: this.inner.clone() },
5733 method_type: fidl::MethodType::TwoWay,
5734 })
5735 }
5736 _ => Err(fidl::Error::UnknownOrdinal {
5737 ordinal: header.ordinal,
5738 protocol_name: <UnboundWaitableDataChannelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5739 }),
5740 }))
5741 },
5742 )
5743 }
5744}
5745
5746#[derive(Debug)]
5749pub enum UnboundWaitableDataChannelRequest {
5750 Bind {
5754 payload: UnboundWaitableDataChannelBindRequest,
5755 responder: UnboundWaitableDataChannelBindResponder,
5756 },
5757 GetIdentifier { responder: UnboundWaitableDataChannelGetIdentifierResponder },
5759 #[non_exhaustive]
5761 _UnknownMethod {
5762 ordinal: u64,
5764 control_handle: UnboundWaitableDataChannelControlHandle,
5765 method_type: fidl::MethodType,
5766 },
5767}
5768
5769impl UnboundWaitableDataChannelRequest {
5770 #[allow(irrefutable_let_patterns)]
5771 pub fn into_bind(
5772 self,
5773 ) -> Option<(UnboundWaitableDataChannelBindRequest, UnboundWaitableDataChannelBindResponder)>
5774 {
5775 if let UnboundWaitableDataChannelRequest::Bind { payload, responder } = self {
5776 Some((payload, responder))
5777 } else {
5778 None
5779 }
5780 }
5781
5782 #[allow(irrefutable_let_patterns)]
5783 pub fn into_get_identifier(self) -> Option<(UnboundWaitableDataChannelGetIdentifierResponder)> {
5784 if let UnboundWaitableDataChannelRequest::GetIdentifier { responder } = self {
5785 Some((responder))
5786 } else {
5787 None
5788 }
5789 }
5790
5791 pub fn method_name(&self) -> &'static str {
5793 match *self {
5794 UnboundWaitableDataChannelRequest::Bind { .. } => "bind",
5795 UnboundWaitableDataChannelRequest::GetIdentifier { .. } => "get_identifier",
5796 UnboundWaitableDataChannelRequest::_UnknownMethod {
5797 method_type: fidl::MethodType::OneWay,
5798 ..
5799 } => "unknown one-way method",
5800 UnboundWaitableDataChannelRequest::_UnknownMethod {
5801 method_type: fidl::MethodType::TwoWay,
5802 ..
5803 } => "unknown two-way method",
5804 }
5805 }
5806}
5807
5808#[derive(Debug, Clone)]
5809pub struct UnboundWaitableDataChannelControlHandle {
5810 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5811}
5812
5813impl fidl::endpoints::ControlHandle for UnboundWaitableDataChannelControlHandle {
5814 fn shutdown(&self) {
5815 self.inner.shutdown()
5816 }
5817
5818 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5819 self.inner.shutdown_with_epitaph(status)
5820 }
5821
5822 fn is_closed(&self) -> bool {
5823 self.inner.channel().is_closed()
5824 }
5825 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5826 self.inner.channel().on_closed()
5827 }
5828
5829 #[cfg(target_os = "fuchsia")]
5830 fn signal_peer(
5831 &self,
5832 clear_mask: zx::Signals,
5833 set_mask: zx::Signals,
5834 ) -> Result<(), zx_status::Status> {
5835 use fidl::Peered;
5836 self.inner.channel().signal_peer(clear_mask, set_mask)
5837 }
5838}
5839
5840impl UnboundWaitableDataChannelControlHandle {}
5841
5842#[must_use = "FIDL methods require a response to be sent"]
5843#[derive(Debug)]
5844pub struct UnboundWaitableDataChannelBindResponder {
5845 control_handle: std::mem::ManuallyDrop<UnboundWaitableDataChannelControlHandle>,
5846 tx_id: u32,
5847}
5848
5849impl std::ops::Drop for UnboundWaitableDataChannelBindResponder {
5853 fn drop(&mut self) {
5854 self.control_handle.shutdown();
5855 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5857 }
5858}
5859
5860impl fidl::endpoints::Responder for UnboundWaitableDataChannelBindResponder {
5861 type ControlHandle = UnboundWaitableDataChannelControlHandle;
5862
5863 fn control_handle(&self) -> &UnboundWaitableDataChannelControlHandle {
5864 &self.control_handle
5865 }
5866
5867 fn drop_without_shutdown(mut self) {
5868 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5870 std::mem::forget(self);
5872 }
5873}
5874
5875impl UnboundWaitableDataChannelBindResponder {
5876 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5880 let _result = self.send_raw(result);
5881 if _result.is_err() {
5882 self.control_handle.shutdown();
5883 }
5884 self.drop_without_shutdown();
5885 _result
5886 }
5887
5888 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5890 let _result = self.send_raw(result);
5891 self.drop_without_shutdown();
5892 _result
5893 }
5894
5895 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5896 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5897 fidl::encoding::EmptyStruct,
5898 i32,
5899 >>(
5900 fidl::encoding::FlexibleResult::new(result),
5901 self.tx_id,
5902 0x135713194412491e,
5903 fidl::encoding::DynamicFlags::FLEXIBLE,
5904 )
5905 }
5906}
5907
5908#[must_use = "FIDL methods require a response to be sent"]
5909#[derive(Debug)]
5910pub struct UnboundWaitableDataChannelGetIdentifierResponder {
5911 control_handle: std::mem::ManuallyDrop<UnboundWaitableDataChannelControlHandle>,
5912 tx_id: u32,
5913}
5914
5915impl std::ops::Drop for UnboundWaitableDataChannelGetIdentifierResponder {
5919 fn drop(&mut self) {
5920 self.control_handle.shutdown();
5921 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5923 }
5924}
5925
5926impl fidl::endpoints::Responder for UnboundWaitableDataChannelGetIdentifierResponder {
5927 type ControlHandle = UnboundWaitableDataChannelControlHandle;
5928
5929 fn control_handle(&self) -> &UnboundWaitableDataChannelControlHandle {
5930 &self.control_handle
5931 }
5932
5933 fn drop_without_shutdown(mut self) {
5934 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5936 std::mem::forget(self);
5938 }
5939}
5940
5941impl UnboundWaitableDataChannelGetIdentifierResponder {
5942 pub fn send(
5946 self,
5947 mut payload: &UnboundWaitableDataChannelGetIdentifierResponse,
5948 ) -> Result<(), fidl::Error> {
5949 let _result = self.send_raw(payload);
5950 if _result.is_err() {
5951 self.control_handle.shutdown();
5952 }
5953 self.drop_without_shutdown();
5954 _result
5955 }
5956
5957 pub fn send_no_shutdown_on_err(
5959 self,
5960 mut payload: &UnboundWaitableDataChannelGetIdentifierResponse,
5961 ) -> Result<(), fidl::Error> {
5962 let _result = self.send_raw(payload);
5963 self.drop_without_shutdown();
5964 _result
5965 }
5966
5967 fn send_raw(
5968 &self,
5969 mut payload: &UnboundWaitableDataChannelGetIdentifierResponse,
5970 ) -> Result<(), fidl::Error> {
5971 self.control_handle.inner.send::<fidl::encoding::FlexibleType<
5972 UnboundWaitableDataChannelGetIdentifierResponse,
5973 >>(
5974 fidl::encoding::Flexible::new(payload),
5975 self.tx_id,
5976 0x6a36e55ac6beb9d6,
5977 fidl::encoding::DynamicFlags::FLEXIBLE,
5978 )
5979 }
5980}
5981
5982#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5983pub struct WaitableDataChannelMarker;
5984
5985impl fidl::endpoints::ProtocolMarker for WaitableDataChannelMarker {
5986 type Proxy = WaitableDataChannelProxy;
5987 type RequestStream = WaitableDataChannelRequestStream;
5988 #[cfg(target_os = "fuchsia")]
5989 type SynchronousProxy = WaitableDataChannelSynchronousProxy;
5990
5991 const DEBUG_NAME: &'static str = "(anonymous) WaitableDataChannel";
5992}
5993pub type WaitableDataChannelReadResult = Result<WaitableDataChannelReadResponse, i32>;
5994pub type WaitableDataChannelWriteResult = Result<(), i32>;
5995
5996pub trait WaitableDataChannelProxyInterface: Send + Sync {
5997 type ReadResponseFut: std::future::Future<Output = Result<WaitableDataChannelReadResult, fidl::Error>>
5998 + Send;
5999 fn r#read(&self) -> Self::ReadResponseFut;
6000 type WriteResponseFut: std::future::Future<Output = Result<WaitableDataChannelWriteResult, fidl::Error>>
6001 + Send;
6002 fn r#write(&self, payload: &WaitableDataChannelWriteRequest) -> Self::WriteResponseFut;
6003}
6004#[derive(Debug)]
6005#[cfg(target_os = "fuchsia")]
6006pub struct WaitableDataChannelSynchronousProxy {
6007 client: fidl::client::sync::Client,
6008}
6009
6010#[cfg(target_os = "fuchsia")]
6011impl fidl::endpoints::SynchronousProxy for WaitableDataChannelSynchronousProxy {
6012 type Proxy = WaitableDataChannelProxy;
6013 type Protocol = WaitableDataChannelMarker;
6014
6015 fn from_channel(inner: fidl::Channel) -> Self {
6016 Self::new(inner)
6017 }
6018
6019 fn into_channel(self) -> fidl::Channel {
6020 self.client.into_channel()
6021 }
6022
6023 fn as_channel(&self) -> &fidl::Channel {
6024 self.client.as_channel()
6025 }
6026}
6027
6028#[cfg(target_os = "fuchsia")]
6029impl WaitableDataChannelSynchronousProxy {
6030 pub fn new(channel: fidl::Channel) -> Self {
6031 let protocol_name =
6032 <WaitableDataChannelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6033 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6034 }
6035
6036 pub fn into_channel(self) -> fidl::Channel {
6037 self.client.into_channel()
6038 }
6039
6040 pub fn wait_for_event(
6043 &self,
6044 deadline: zx::MonotonicInstant,
6045 ) -> Result<WaitableDataChannelEvent, fidl::Error> {
6046 WaitableDataChannelEvent::decode(self.client.wait_for_event(deadline)?)
6047 }
6048
6049 pub fn r#read(
6054 &self,
6055 ___deadline: zx::MonotonicInstant,
6056 ) -> Result<WaitableDataChannelReadResult, fidl::Error> {
6057 let _response = self.client.send_query::<
6058 fidl::encoding::EmptyPayload,
6059 fidl::encoding::FlexibleResultType<WaitableDataChannelReadResponse, i32>,
6060 >(
6061 (),
6062 0x48f55df455309245,
6063 fidl::encoding::DynamicFlags::FLEXIBLE,
6064 ___deadline,
6065 )?
6066 .into_result::<WaitableDataChannelMarker>("read")?;
6067 Ok(_response.map(|x| x))
6068 }
6069
6070 pub fn r#write(
6076 &self,
6077 mut payload: &WaitableDataChannelWriteRequest,
6078 ___deadline: zx::MonotonicInstant,
6079 ) -> Result<WaitableDataChannelWriteResult, fidl::Error> {
6080 let _response = self.client.send_query::<
6081 WaitableDataChannelWriteRequest,
6082 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6083 >(
6084 payload,
6085 0x6d9b754b0e3122f2,
6086 fidl::encoding::DynamicFlags::FLEXIBLE,
6087 ___deadline,
6088 )?
6089 .into_result::<WaitableDataChannelMarker>("write")?;
6090 Ok(_response.map(|x| x))
6091 }
6092}
6093
6094#[cfg(target_os = "fuchsia")]
6095impl From<WaitableDataChannelSynchronousProxy> for zx::NullableHandle {
6096 fn from(value: WaitableDataChannelSynchronousProxy) -> Self {
6097 value.into_channel().into()
6098 }
6099}
6100
6101#[cfg(target_os = "fuchsia")]
6102impl From<fidl::Channel> for WaitableDataChannelSynchronousProxy {
6103 fn from(value: fidl::Channel) -> Self {
6104 Self::new(value)
6105 }
6106}
6107
6108#[cfg(target_os = "fuchsia")]
6109impl fidl::endpoints::FromClient for WaitableDataChannelSynchronousProxy {
6110 type Protocol = WaitableDataChannelMarker;
6111
6112 fn from_client(value: fidl::endpoints::ClientEnd<WaitableDataChannelMarker>) -> Self {
6113 Self::new(value.into_channel())
6114 }
6115}
6116
6117#[derive(Debug, Clone)]
6118pub struct WaitableDataChannelProxy {
6119 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6120}
6121
6122impl fidl::endpoints::Proxy for WaitableDataChannelProxy {
6123 type Protocol = WaitableDataChannelMarker;
6124
6125 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6126 Self::new(inner)
6127 }
6128
6129 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6130 self.client.into_channel().map_err(|client| Self { client })
6131 }
6132
6133 fn as_channel(&self) -> &::fidl::AsyncChannel {
6134 self.client.as_channel()
6135 }
6136}
6137
6138impl WaitableDataChannelProxy {
6139 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6141 let protocol_name =
6142 <WaitableDataChannelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6143 Self { client: fidl::client::Client::new(channel, protocol_name) }
6144 }
6145
6146 pub fn take_event_stream(&self) -> WaitableDataChannelEventStream {
6152 WaitableDataChannelEventStream { event_receiver: self.client.take_event_receiver() }
6153 }
6154
6155 pub fn r#read(
6160 &self,
6161 ) -> fidl::client::QueryResponseFut<
6162 WaitableDataChannelReadResult,
6163 fidl::encoding::DefaultFuchsiaResourceDialect,
6164 > {
6165 WaitableDataChannelProxyInterface::r#read(self)
6166 }
6167
6168 pub fn r#write(
6174 &self,
6175 mut payload: &WaitableDataChannelWriteRequest,
6176 ) -> fidl::client::QueryResponseFut<
6177 WaitableDataChannelWriteResult,
6178 fidl::encoding::DefaultFuchsiaResourceDialect,
6179 > {
6180 WaitableDataChannelProxyInterface::r#write(self, payload)
6181 }
6182}
6183
6184impl WaitableDataChannelProxyInterface for WaitableDataChannelProxy {
6185 type ReadResponseFut = fidl::client::QueryResponseFut<
6186 WaitableDataChannelReadResult,
6187 fidl::encoding::DefaultFuchsiaResourceDialect,
6188 >;
6189 fn r#read(&self) -> Self::ReadResponseFut {
6190 fn _decode(
6191 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6192 ) -> Result<WaitableDataChannelReadResult, fidl::Error> {
6193 let _response = fidl::client::decode_transaction_body::<
6194 fidl::encoding::FlexibleResultType<WaitableDataChannelReadResponse, i32>,
6195 fidl::encoding::DefaultFuchsiaResourceDialect,
6196 0x48f55df455309245,
6197 >(_buf?)?
6198 .into_result::<WaitableDataChannelMarker>("read")?;
6199 Ok(_response.map(|x| x))
6200 }
6201 self.client
6202 .send_query_and_decode::<fidl::encoding::EmptyPayload, WaitableDataChannelReadResult>(
6203 (),
6204 0x48f55df455309245,
6205 fidl::encoding::DynamicFlags::FLEXIBLE,
6206 _decode,
6207 )
6208 }
6209
6210 type WriteResponseFut = fidl::client::QueryResponseFut<
6211 WaitableDataChannelWriteResult,
6212 fidl::encoding::DefaultFuchsiaResourceDialect,
6213 >;
6214 fn r#write(&self, mut payload: &WaitableDataChannelWriteRequest) -> Self::WriteResponseFut {
6215 fn _decode(
6216 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6217 ) -> Result<WaitableDataChannelWriteResult, fidl::Error> {
6218 let _response = fidl::client::decode_transaction_body::<
6219 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6220 fidl::encoding::DefaultFuchsiaResourceDialect,
6221 0x6d9b754b0e3122f2,
6222 >(_buf?)?
6223 .into_result::<WaitableDataChannelMarker>("write")?;
6224 Ok(_response.map(|x| x))
6225 }
6226 self.client.send_query_and_decode::<
6227 WaitableDataChannelWriteRequest,
6228 WaitableDataChannelWriteResult,
6229 >(
6230 payload,
6231 0x6d9b754b0e3122f2,
6232 fidl::encoding::DynamicFlags::FLEXIBLE,
6233 _decode,
6234 )
6235 }
6236}
6237
6238pub struct WaitableDataChannelEventStream {
6239 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6240}
6241
6242impl std::marker::Unpin for WaitableDataChannelEventStream {}
6243
6244impl futures::stream::FusedStream for WaitableDataChannelEventStream {
6245 fn is_terminated(&self) -> bool {
6246 self.event_receiver.is_terminated()
6247 }
6248}
6249
6250impl futures::Stream for WaitableDataChannelEventStream {
6251 type Item = Result<WaitableDataChannelEvent, fidl::Error>;
6252
6253 fn poll_next(
6254 mut self: std::pin::Pin<&mut Self>,
6255 cx: &mut std::task::Context<'_>,
6256 ) -> std::task::Poll<Option<Self::Item>> {
6257 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6258 &mut self.event_receiver,
6259 cx
6260 )?) {
6261 Some(buf) => std::task::Poll::Ready(Some(WaitableDataChannelEvent::decode(buf))),
6262 None => std::task::Poll::Ready(None),
6263 }
6264 }
6265}
6266
6267#[derive(Debug)]
6268pub enum WaitableDataChannelEvent {
6269 #[non_exhaustive]
6270 _UnknownEvent {
6271 ordinal: u64,
6273 },
6274}
6275
6276impl WaitableDataChannelEvent {
6277 fn decode(
6279 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6280 ) -> Result<WaitableDataChannelEvent, fidl::Error> {
6281 let (bytes, _handles) = buf.split_mut();
6282 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6283 debug_assert_eq!(tx_header.tx_id, 0);
6284 match tx_header.ordinal {
6285 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
6286 Ok(WaitableDataChannelEvent::_UnknownEvent { ordinal: tx_header.ordinal })
6287 }
6288 _ => Err(fidl::Error::UnknownOrdinal {
6289 ordinal: tx_header.ordinal,
6290 protocol_name:
6291 <WaitableDataChannelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6292 }),
6293 }
6294 }
6295}
6296
6297pub struct WaitableDataChannelRequestStream {
6299 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6300 is_terminated: bool,
6301}
6302
6303impl std::marker::Unpin for WaitableDataChannelRequestStream {}
6304
6305impl futures::stream::FusedStream for WaitableDataChannelRequestStream {
6306 fn is_terminated(&self) -> bool {
6307 self.is_terminated
6308 }
6309}
6310
6311impl fidl::endpoints::RequestStream for WaitableDataChannelRequestStream {
6312 type Protocol = WaitableDataChannelMarker;
6313 type ControlHandle = WaitableDataChannelControlHandle;
6314
6315 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6316 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6317 }
6318
6319 fn control_handle(&self) -> Self::ControlHandle {
6320 WaitableDataChannelControlHandle { inner: self.inner.clone() }
6321 }
6322
6323 fn into_inner(
6324 self,
6325 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6326 {
6327 (self.inner, self.is_terminated)
6328 }
6329
6330 fn from_inner(
6331 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6332 is_terminated: bool,
6333 ) -> Self {
6334 Self { inner, is_terminated }
6335 }
6336}
6337
6338impl futures::Stream for WaitableDataChannelRequestStream {
6339 type Item = Result<WaitableDataChannelRequest, fidl::Error>;
6340
6341 fn poll_next(
6342 mut self: std::pin::Pin<&mut Self>,
6343 cx: &mut std::task::Context<'_>,
6344 ) -> std::task::Poll<Option<Self::Item>> {
6345 let this = &mut *self;
6346 if this.inner.check_shutdown(cx) {
6347 this.is_terminated = true;
6348 return std::task::Poll::Ready(None);
6349 }
6350 if this.is_terminated {
6351 panic!("polled WaitableDataChannelRequestStream after completion");
6352 }
6353 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6354 |bytes, handles| {
6355 match this.inner.channel().read_etc(cx, bytes, handles) {
6356 std::task::Poll::Ready(Ok(())) => {}
6357 std::task::Poll::Pending => return std::task::Poll::Pending,
6358 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6359 this.is_terminated = true;
6360 return std::task::Poll::Ready(None);
6361 }
6362 std::task::Poll::Ready(Err(e)) => {
6363 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6364 e.into(),
6365 ))));
6366 }
6367 }
6368
6369 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6371
6372 std::task::Poll::Ready(Some(match header.ordinal {
6373 0x48f55df455309245 => {
6374 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6375 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
6376 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6377 let control_handle = WaitableDataChannelControlHandle {
6378 inner: this.inner.clone(),
6379 };
6380 Ok(WaitableDataChannelRequest::Read {
6381 responder: WaitableDataChannelReadResponder {
6382 control_handle: std::mem::ManuallyDrop::new(control_handle),
6383 tx_id: header.tx_id,
6384 },
6385 })
6386 }
6387 0x6d9b754b0e3122f2 => {
6388 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6389 let mut req = fidl::new_empty!(WaitableDataChannelWriteRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
6390 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WaitableDataChannelWriteRequest>(&header, _body_bytes, handles, &mut req)?;
6391 let control_handle = WaitableDataChannelControlHandle {
6392 inner: this.inner.clone(),
6393 };
6394 Ok(WaitableDataChannelRequest::Write {payload: req,
6395 responder: WaitableDataChannelWriteResponder {
6396 control_handle: std::mem::ManuallyDrop::new(control_handle),
6397 tx_id: header.tx_id,
6398 },
6399 })
6400 }
6401 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
6402 Ok(WaitableDataChannelRequest::_UnknownMethod {
6403 ordinal: header.ordinal,
6404 control_handle: WaitableDataChannelControlHandle { inner: this.inner.clone() },
6405 method_type: fidl::MethodType::OneWay,
6406 })
6407 }
6408 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
6409 this.inner.send_framework_err(
6410 fidl::encoding::FrameworkErr::UnknownMethod,
6411 header.tx_id,
6412 header.ordinal,
6413 header.dynamic_flags(),
6414 (bytes, handles),
6415 )?;
6416 Ok(WaitableDataChannelRequest::_UnknownMethod {
6417 ordinal: header.ordinal,
6418 control_handle: WaitableDataChannelControlHandle { inner: this.inner.clone() },
6419 method_type: fidl::MethodType::TwoWay,
6420 })
6421 }
6422 _ => Err(fidl::Error::UnknownOrdinal {
6423 ordinal: header.ordinal,
6424 protocol_name: <WaitableDataChannelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6425 }),
6426 }))
6427 },
6428 )
6429 }
6430}
6431
6432#[derive(Debug)]
6437pub enum WaitableDataChannelRequest {
6438 Read { responder: WaitableDataChannelReadResponder },
6443 Write { payload: WaitableDataChannelWriteRequest, responder: WaitableDataChannelWriteResponder },
6449 #[non_exhaustive]
6451 _UnknownMethod {
6452 ordinal: u64,
6454 control_handle: WaitableDataChannelControlHandle,
6455 method_type: fidl::MethodType,
6456 },
6457}
6458
6459impl WaitableDataChannelRequest {
6460 #[allow(irrefutable_let_patterns)]
6461 pub fn into_read(self) -> Option<(WaitableDataChannelReadResponder)> {
6462 if let WaitableDataChannelRequest::Read { responder } = self {
6463 Some((responder))
6464 } else {
6465 None
6466 }
6467 }
6468
6469 #[allow(irrefutable_let_patterns)]
6470 pub fn into_write(
6471 self,
6472 ) -> Option<(WaitableDataChannelWriteRequest, WaitableDataChannelWriteResponder)> {
6473 if let WaitableDataChannelRequest::Write { payload, responder } = self {
6474 Some((payload, responder))
6475 } else {
6476 None
6477 }
6478 }
6479
6480 pub fn method_name(&self) -> &'static str {
6482 match *self {
6483 WaitableDataChannelRequest::Read { .. } => "read",
6484 WaitableDataChannelRequest::Write { .. } => "write",
6485 WaitableDataChannelRequest::_UnknownMethod {
6486 method_type: fidl::MethodType::OneWay,
6487 ..
6488 } => "unknown one-way method",
6489 WaitableDataChannelRequest::_UnknownMethod {
6490 method_type: fidl::MethodType::TwoWay,
6491 ..
6492 } => "unknown two-way method",
6493 }
6494 }
6495}
6496
6497#[derive(Debug, Clone)]
6498pub struct WaitableDataChannelControlHandle {
6499 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6500}
6501
6502impl fidl::endpoints::ControlHandle for WaitableDataChannelControlHandle {
6503 fn shutdown(&self) {
6504 self.inner.shutdown()
6505 }
6506
6507 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6508 self.inner.shutdown_with_epitaph(status)
6509 }
6510
6511 fn is_closed(&self) -> bool {
6512 self.inner.channel().is_closed()
6513 }
6514 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6515 self.inner.channel().on_closed()
6516 }
6517
6518 #[cfg(target_os = "fuchsia")]
6519 fn signal_peer(
6520 &self,
6521 clear_mask: zx::Signals,
6522 set_mask: zx::Signals,
6523 ) -> Result<(), zx_status::Status> {
6524 use fidl::Peered;
6525 self.inner.channel().signal_peer(clear_mask, set_mask)
6526 }
6527}
6528
6529impl WaitableDataChannelControlHandle {}
6530
6531#[must_use = "FIDL methods require a response to be sent"]
6532#[derive(Debug)]
6533pub struct WaitableDataChannelReadResponder {
6534 control_handle: std::mem::ManuallyDrop<WaitableDataChannelControlHandle>,
6535 tx_id: u32,
6536}
6537
6538impl std::ops::Drop for WaitableDataChannelReadResponder {
6542 fn drop(&mut self) {
6543 self.control_handle.shutdown();
6544 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6546 }
6547}
6548
6549impl fidl::endpoints::Responder for WaitableDataChannelReadResponder {
6550 type ControlHandle = WaitableDataChannelControlHandle;
6551
6552 fn control_handle(&self) -> &WaitableDataChannelControlHandle {
6553 &self.control_handle
6554 }
6555
6556 fn drop_without_shutdown(mut self) {
6557 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6559 std::mem::forget(self);
6561 }
6562}
6563
6564impl WaitableDataChannelReadResponder {
6565 pub fn send(
6569 self,
6570 mut result: Result<WaitableDataChannelReadResponse, i32>,
6571 ) -> Result<(), fidl::Error> {
6572 let _result = self.send_raw(result);
6573 if _result.is_err() {
6574 self.control_handle.shutdown();
6575 }
6576 self.drop_without_shutdown();
6577 _result
6578 }
6579
6580 pub fn send_no_shutdown_on_err(
6582 self,
6583 mut result: Result<WaitableDataChannelReadResponse, i32>,
6584 ) -> Result<(), fidl::Error> {
6585 let _result = self.send_raw(result);
6586 self.drop_without_shutdown();
6587 _result
6588 }
6589
6590 fn send_raw(
6591 &self,
6592 mut result: Result<WaitableDataChannelReadResponse, i32>,
6593 ) -> Result<(), fidl::Error> {
6594 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6595 WaitableDataChannelReadResponse,
6596 i32,
6597 >>(
6598 fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
6599 self.tx_id,
6600 0x48f55df455309245,
6601 fidl::encoding::DynamicFlags::FLEXIBLE,
6602 )
6603 }
6604}
6605
6606#[must_use = "FIDL methods require a response to be sent"]
6607#[derive(Debug)]
6608pub struct WaitableDataChannelWriteResponder {
6609 control_handle: std::mem::ManuallyDrop<WaitableDataChannelControlHandle>,
6610 tx_id: u32,
6611}
6612
6613impl std::ops::Drop for WaitableDataChannelWriteResponder {
6617 fn drop(&mut self) {
6618 self.control_handle.shutdown();
6619 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6621 }
6622}
6623
6624impl fidl::endpoints::Responder for WaitableDataChannelWriteResponder {
6625 type ControlHandle = WaitableDataChannelControlHandle;
6626
6627 fn control_handle(&self) -> &WaitableDataChannelControlHandle {
6628 &self.control_handle
6629 }
6630
6631 fn drop_without_shutdown(mut self) {
6632 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6634 std::mem::forget(self);
6636 }
6637}
6638
6639impl WaitableDataChannelWriteResponder {
6640 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6644 let _result = self.send_raw(result);
6645 if _result.is_err() {
6646 self.control_handle.shutdown();
6647 }
6648 self.drop_without_shutdown();
6649 _result
6650 }
6651
6652 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6654 let _result = self.send_raw(result);
6655 self.drop_without_shutdown();
6656 _result
6657 }
6658
6659 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6660 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6661 fidl::encoding::EmptyStruct,
6662 i32,
6663 >>(
6664 fidl::encoding::FlexibleResult::new(result),
6665 self.tx_id,
6666 0x6d9b754b0e3122f2,
6667 fidl::encoding::DynamicFlags::FLEXIBLE,
6668 )
6669 }
6670}
6671
6672#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6673pub struct DataChannelServiceMarker;
6674
6675#[cfg(target_os = "fuchsia")]
6676impl fidl::endpoints::ServiceMarker for DataChannelServiceMarker {
6677 type Proxy = DataChannelServiceProxy;
6678 type Request = DataChannelServiceRequest;
6679 const SERVICE_NAME: &'static str = "fuchsia.hardware.google.nanohub.DataChannelService";
6680}
6681
6682#[cfg(target_os = "fuchsia")]
6688pub enum DataChannelServiceRequest {
6689 Device(DataChannelRequestStream),
6690 Lifecycle(LifecycleObserverRequestStream),
6691}
6692
6693#[cfg(target_os = "fuchsia")]
6694impl fidl::endpoints::ServiceRequest for DataChannelServiceRequest {
6695 type Service = DataChannelServiceMarker;
6696
6697 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
6698 match name {
6699 "device" => Self::Device(
6700 <DataChannelRequestStream as fidl::endpoints::RequestStream>::from_channel(
6701 _channel,
6702 ),
6703 ),
6704 "lifecycle" => Self::Lifecycle(
6705 <LifecycleObserverRequestStream as fidl::endpoints::RequestStream>::from_channel(
6706 _channel,
6707 ),
6708 ),
6709 _ => panic!("no such member protocol name for service DataChannelService"),
6710 }
6711 }
6712
6713 fn member_names() -> &'static [&'static str] {
6714 &["device", "lifecycle"]
6715 }
6716}
6717#[cfg(target_os = "fuchsia")]
6721pub struct DataChannelServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
6722
6723#[cfg(target_os = "fuchsia")]
6724impl fidl::endpoints::ServiceProxy for DataChannelServiceProxy {
6725 type Service = DataChannelServiceMarker;
6726
6727 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
6728 Self(opener)
6729 }
6730}
6731
6732#[cfg(target_os = "fuchsia")]
6733impl DataChannelServiceProxy {
6734 pub fn connect_to_device(&self) -> Result<DataChannelProxy, fidl::Error> {
6735 let (proxy, server_end) = fidl::endpoints::create_proxy::<DataChannelMarker>();
6736 self.connect_channel_to_device(server_end)?;
6737 Ok(proxy)
6738 }
6739
6740 pub fn connect_to_device_sync(&self) -> Result<DataChannelSynchronousProxy, fidl::Error> {
6743 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DataChannelMarker>();
6744 self.connect_channel_to_device(server_end)?;
6745 Ok(proxy)
6746 }
6747
6748 pub fn connect_channel_to_device(
6751 &self,
6752 server_end: fidl::endpoints::ServerEnd<DataChannelMarker>,
6753 ) -> Result<(), fidl::Error> {
6754 self.0.open_member("device", server_end.into_channel())
6755 }
6756 pub fn connect_to_lifecycle(&self) -> Result<LifecycleObserverProxy, fidl::Error> {
6757 let (proxy, server_end) = fidl::endpoints::create_proxy::<LifecycleObserverMarker>();
6758 self.connect_channel_to_lifecycle(server_end)?;
6759 Ok(proxy)
6760 }
6761
6762 pub fn connect_to_lifecycle_sync(
6765 &self,
6766 ) -> Result<LifecycleObserverSynchronousProxy, fidl::Error> {
6767 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<LifecycleObserverMarker>();
6768 self.connect_channel_to_lifecycle(server_end)?;
6769 Ok(proxy)
6770 }
6771
6772 pub fn connect_channel_to_lifecycle(
6775 &self,
6776 server_end: fidl::endpoints::ServerEnd<LifecycleObserverMarker>,
6777 ) -> Result<(), fidl::Error> {
6778 self.0.open_member("lifecycle", server_end.into_channel())
6779 }
6780
6781 pub fn instance_name(&self) -> &str {
6782 self.0.instance_name()
6783 }
6784}
6785
6786#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6787pub struct DisplayServiceMarker;
6788
6789#[cfg(target_os = "fuchsia")]
6790impl fidl::endpoints::ServiceMarker for DisplayServiceMarker {
6791 type Proxy = DisplayServiceProxy;
6792 type Request = DisplayServiceRequest;
6793 const SERVICE_NAME: &'static str = "fuchsia.hardware.google.nanohub.DisplayService";
6794}
6795
6796#[cfg(target_os = "fuchsia")]
6800pub enum DisplayServiceRequest {
6801 Mcudisplay(DisplayDeviceRequestStream),
6803}
6804
6805#[cfg(target_os = "fuchsia")]
6806impl fidl::endpoints::ServiceRequest for DisplayServiceRequest {
6807 type Service = DisplayServiceMarker;
6808
6809 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
6810 match name {
6811 "mcudisplay" => Self::Mcudisplay(
6812 <DisplayDeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(
6813 _channel,
6814 ),
6815 ),
6816 _ => panic!("no such member protocol name for service DisplayService"),
6817 }
6818 }
6819
6820 fn member_names() -> &'static [&'static str] {
6821 &["mcudisplay"]
6822 }
6823}
6824#[cfg(target_os = "fuchsia")]
6826pub struct DisplayServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
6827
6828#[cfg(target_os = "fuchsia")]
6829impl fidl::endpoints::ServiceProxy for DisplayServiceProxy {
6830 type Service = DisplayServiceMarker;
6831
6832 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
6833 Self(opener)
6834 }
6835}
6836
6837#[cfg(target_os = "fuchsia")]
6838impl DisplayServiceProxy {
6839 pub fn connect_to_mcudisplay(&self) -> Result<DisplayDeviceProxy, fidl::Error> {
6841 let (proxy, server_end) = fidl::endpoints::create_proxy::<DisplayDeviceMarker>();
6842 self.connect_channel_to_mcudisplay(server_end)?;
6843 Ok(proxy)
6844 }
6845
6846 pub fn connect_to_mcudisplay_sync(&self) -> Result<DisplayDeviceSynchronousProxy, fidl::Error> {
6849 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DisplayDeviceMarker>();
6850 self.connect_channel_to_mcudisplay(server_end)?;
6851 Ok(proxy)
6852 }
6853
6854 pub fn connect_channel_to_mcudisplay(
6857 &self,
6858 server_end: fidl::endpoints::ServerEnd<DisplayDeviceMarker>,
6859 ) -> Result<(), fidl::Error> {
6860 self.0.open_member("mcudisplay", server_end.into_channel())
6861 }
6862
6863 pub fn instance_name(&self) -> &str {
6864 self.0.instance_name()
6865 }
6866}
6867
6868#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6869pub struct DriverDataChannelServiceMarker;
6870
6871#[cfg(target_os = "fuchsia")]
6872impl fidl::endpoints::ServiceMarker for DriverDataChannelServiceMarker {
6873 type Proxy = DriverDataChannelServiceProxy;
6874 type Request = DriverDataChannelServiceRequest;
6875 const SERVICE_NAME: &'static str = "fuchsia.hardware.google.nanohub.DriverDataChannelService";
6876}
6877
6878#[cfg(target_os = "fuchsia")]
6882pub enum DriverDataChannelServiceRequest {
6883 Hanging(UnboundHangingDataChannelRequestStream),
6884 Waitable(UnboundWaitableDataChannelRequestStream),
6885 Lifecycle(LifecycleObserverRequestStream),
6886}
6887
6888#[cfg(target_os = "fuchsia")]
6889impl fidl::endpoints::ServiceRequest for DriverDataChannelServiceRequest {
6890 type Service = DriverDataChannelServiceMarker;
6891
6892 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
6893 match name {
6894 "hanging" => Self::Hanging(
6895 <UnboundHangingDataChannelRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
6896 ),
6897 "waitable" => Self::Waitable(
6898 <UnboundWaitableDataChannelRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
6899 ),
6900 "lifecycle" => Self::Lifecycle(
6901 <LifecycleObserverRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
6902 ),
6903 _ => panic!("no such member protocol name for service DriverDataChannelService"),
6904 }
6905 }
6906
6907 fn member_names() -> &'static [&'static str] {
6908 &["hanging", "waitable", "lifecycle"]
6909 }
6910}
6911#[cfg(target_os = "fuchsia")]
6913pub struct DriverDataChannelServiceProxy(
6914 #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
6915);
6916
6917#[cfg(target_os = "fuchsia")]
6918impl fidl::endpoints::ServiceProxy for DriverDataChannelServiceProxy {
6919 type Service = DriverDataChannelServiceMarker;
6920
6921 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
6922 Self(opener)
6923 }
6924}
6925
6926#[cfg(target_os = "fuchsia")]
6927impl DriverDataChannelServiceProxy {
6928 pub fn connect_to_hanging(&self) -> Result<UnboundHangingDataChannelProxy, fidl::Error> {
6929 let (proxy, server_end) =
6930 fidl::endpoints::create_proxy::<UnboundHangingDataChannelMarker>();
6931 self.connect_channel_to_hanging(server_end)?;
6932 Ok(proxy)
6933 }
6934
6935 pub fn connect_to_hanging_sync(
6938 &self,
6939 ) -> Result<UnboundHangingDataChannelSynchronousProxy, fidl::Error> {
6940 let (proxy, server_end) =
6941 fidl::endpoints::create_sync_proxy::<UnboundHangingDataChannelMarker>();
6942 self.connect_channel_to_hanging(server_end)?;
6943 Ok(proxy)
6944 }
6945
6946 pub fn connect_channel_to_hanging(
6949 &self,
6950 server_end: fidl::endpoints::ServerEnd<UnboundHangingDataChannelMarker>,
6951 ) -> Result<(), fidl::Error> {
6952 self.0.open_member("hanging", server_end.into_channel())
6953 }
6954 pub fn connect_to_waitable(&self) -> Result<UnboundWaitableDataChannelProxy, fidl::Error> {
6955 let (proxy, server_end) =
6956 fidl::endpoints::create_proxy::<UnboundWaitableDataChannelMarker>();
6957 self.connect_channel_to_waitable(server_end)?;
6958 Ok(proxy)
6959 }
6960
6961 pub fn connect_to_waitable_sync(
6964 &self,
6965 ) -> Result<UnboundWaitableDataChannelSynchronousProxy, fidl::Error> {
6966 let (proxy, server_end) =
6967 fidl::endpoints::create_sync_proxy::<UnboundWaitableDataChannelMarker>();
6968 self.connect_channel_to_waitable(server_end)?;
6969 Ok(proxy)
6970 }
6971
6972 pub fn connect_channel_to_waitable(
6975 &self,
6976 server_end: fidl::endpoints::ServerEnd<UnboundWaitableDataChannelMarker>,
6977 ) -> Result<(), fidl::Error> {
6978 self.0.open_member("waitable", server_end.into_channel())
6979 }
6980 pub fn connect_to_lifecycle(&self) -> Result<LifecycleObserverProxy, fidl::Error> {
6981 let (proxy, server_end) = fidl::endpoints::create_proxy::<LifecycleObserverMarker>();
6982 self.connect_channel_to_lifecycle(server_end)?;
6983 Ok(proxy)
6984 }
6985
6986 pub fn connect_to_lifecycle_sync(
6989 &self,
6990 ) -> Result<LifecycleObserverSynchronousProxy, fidl::Error> {
6991 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<LifecycleObserverMarker>();
6992 self.connect_channel_to_lifecycle(server_end)?;
6993 Ok(proxy)
6994 }
6995
6996 pub fn connect_channel_to_lifecycle(
6999 &self,
7000 server_end: fidl::endpoints::ServerEnd<LifecycleObserverMarker>,
7001 ) -> Result<(), fidl::Error> {
7002 self.0.open_member("lifecycle", server_end.into_channel())
7003 }
7004
7005 pub fn instance_name(&self) -> &str {
7006 self.0.instance_name()
7007 }
7008}
7009
7010#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7011pub struct ServiceMarker;
7012
7013#[cfg(target_os = "fuchsia")]
7014impl fidl::endpoints::ServiceMarker for ServiceMarker {
7015 type Proxy = ServiceProxy;
7016 type Request = ServiceRequest;
7017 const SERVICE_NAME: &'static str = "fuchsia.hardware.google.nanohub.Service";
7018}
7019
7020#[cfg(target_os = "fuchsia")]
7023pub enum ServiceRequest {
7024 Nanohub(DeviceRequestStream),
7025}
7026
7027#[cfg(target_os = "fuchsia")]
7028impl fidl::endpoints::ServiceRequest for ServiceRequest {
7029 type Service = ServiceMarker;
7030
7031 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
7032 match name {
7033 "nanohub" => Self::Nanohub(
7034 <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
7035 ),
7036 _ => panic!("no such member protocol name for service Service"),
7037 }
7038 }
7039
7040 fn member_names() -> &'static [&'static str] {
7041 &["nanohub"]
7042 }
7043}
7044#[cfg(target_os = "fuchsia")]
7045pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
7046
7047#[cfg(target_os = "fuchsia")]
7048impl fidl::endpoints::ServiceProxy for ServiceProxy {
7049 type Service = ServiceMarker;
7050
7051 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
7052 Self(opener)
7053 }
7054}
7055
7056#[cfg(target_os = "fuchsia")]
7057impl ServiceProxy {
7058 pub fn connect_to_nanohub(&self) -> Result<DeviceProxy, fidl::Error> {
7059 let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
7060 self.connect_channel_to_nanohub(server_end)?;
7061 Ok(proxy)
7062 }
7063
7064 pub fn connect_to_nanohub_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
7067 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
7068 self.connect_channel_to_nanohub(server_end)?;
7069 Ok(proxy)
7070 }
7071
7072 pub fn connect_channel_to_nanohub(
7075 &self,
7076 server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
7077 ) -> Result<(), fidl::Error> {
7078 self.0.open_member("nanohub", server_end.into_channel())
7079 }
7080
7081 pub fn instance_name(&self) -> &str {
7082 self.0.instance_name()
7083 }
7084}
7085
7086#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7087pub struct StarnixDataChannelServiceMarker;
7088
7089#[cfg(target_os = "fuchsia")]
7090impl fidl::endpoints::ServiceMarker for StarnixDataChannelServiceMarker {
7091 type Proxy = StarnixDataChannelServiceProxy;
7092 type Request = StarnixDataChannelServiceRequest;
7093 const SERVICE_NAME: &'static str = "fuchsia.hardware.google.nanohub.StarnixDataChannelService";
7094}
7095
7096#[cfg(target_os = "fuchsia")]
7101pub enum StarnixDataChannelServiceRequest {
7102 Hanging(UnboundHangingDataChannelRequestStream),
7103 Waitable(UnboundWaitableDataChannelRequestStream),
7104 Lifecycle(LifecycleObserverRequestStream),
7105}
7106
7107#[cfg(target_os = "fuchsia")]
7108impl fidl::endpoints::ServiceRequest for StarnixDataChannelServiceRequest {
7109 type Service = StarnixDataChannelServiceMarker;
7110
7111 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
7112 match name {
7113 "hanging" => Self::Hanging(
7114 <UnboundHangingDataChannelRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
7115 ),
7116 "waitable" => Self::Waitable(
7117 <UnboundWaitableDataChannelRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
7118 ),
7119 "lifecycle" => Self::Lifecycle(
7120 <LifecycleObserverRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
7121 ),
7122 _ => panic!("no such member protocol name for service StarnixDataChannelService"),
7123 }
7124 }
7125
7126 fn member_names() -> &'static [&'static str] {
7127 &["hanging", "waitable", "lifecycle"]
7128 }
7129}
7130#[cfg(target_os = "fuchsia")]
7133pub struct StarnixDataChannelServiceProxy(
7134 #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
7135);
7136
7137#[cfg(target_os = "fuchsia")]
7138impl fidl::endpoints::ServiceProxy for StarnixDataChannelServiceProxy {
7139 type Service = StarnixDataChannelServiceMarker;
7140
7141 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
7142 Self(opener)
7143 }
7144}
7145
7146#[cfg(target_os = "fuchsia")]
7147impl StarnixDataChannelServiceProxy {
7148 pub fn connect_to_hanging(&self) -> Result<UnboundHangingDataChannelProxy, fidl::Error> {
7149 let (proxy, server_end) =
7150 fidl::endpoints::create_proxy::<UnboundHangingDataChannelMarker>();
7151 self.connect_channel_to_hanging(server_end)?;
7152 Ok(proxy)
7153 }
7154
7155 pub fn connect_to_hanging_sync(
7158 &self,
7159 ) -> Result<UnboundHangingDataChannelSynchronousProxy, fidl::Error> {
7160 let (proxy, server_end) =
7161 fidl::endpoints::create_sync_proxy::<UnboundHangingDataChannelMarker>();
7162 self.connect_channel_to_hanging(server_end)?;
7163 Ok(proxy)
7164 }
7165
7166 pub fn connect_channel_to_hanging(
7169 &self,
7170 server_end: fidl::endpoints::ServerEnd<UnboundHangingDataChannelMarker>,
7171 ) -> Result<(), fidl::Error> {
7172 self.0.open_member("hanging", server_end.into_channel())
7173 }
7174 pub fn connect_to_waitable(&self) -> Result<UnboundWaitableDataChannelProxy, fidl::Error> {
7175 let (proxy, server_end) =
7176 fidl::endpoints::create_proxy::<UnboundWaitableDataChannelMarker>();
7177 self.connect_channel_to_waitable(server_end)?;
7178 Ok(proxy)
7179 }
7180
7181 pub fn connect_to_waitable_sync(
7184 &self,
7185 ) -> Result<UnboundWaitableDataChannelSynchronousProxy, fidl::Error> {
7186 let (proxy, server_end) =
7187 fidl::endpoints::create_sync_proxy::<UnboundWaitableDataChannelMarker>();
7188 self.connect_channel_to_waitable(server_end)?;
7189 Ok(proxy)
7190 }
7191
7192 pub fn connect_channel_to_waitable(
7195 &self,
7196 server_end: fidl::endpoints::ServerEnd<UnboundWaitableDataChannelMarker>,
7197 ) -> Result<(), fidl::Error> {
7198 self.0.open_member("waitable", server_end.into_channel())
7199 }
7200 pub fn connect_to_lifecycle(&self) -> Result<LifecycleObserverProxy, fidl::Error> {
7201 let (proxy, server_end) = fidl::endpoints::create_proxy::<LifecycleObserverMarker>();
7202 self.connect_channel_to_lifecycle(server_end)?;
7203 Ok(proxy)
7204 }
7205
7206 pub fn connect_to_lifecycle_sync(
7209 &self,
7210 ) -> Result<LifecycleObserverSynchronousProxy, fidl::Error> {
7211 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<LifecycleObserverMarker>();
7212 self.connect_channel_to_lifecycle(server_end)?;
7213 Ok(proxy)
7214 }
7215
7216 pub fn connect_channel_to_lifecycle(
7219 &self,
7220 server_end: fidl::endpoints::ServerEnd<LifecycleObserverMarker>,
7221 ) -> Result<(), fidl::Error> {
7222 self.0.open_member("lifecycle", server_end.into_channel())
7223 }
7224
7225 pub fn instance_name(&self) -> &str {
7226 self.0.instance_name()
7227 }
7228}
7229
7230mod internal {
7231 use super::*;
7232
7233 impl fidl::encoding::ResourceTypeMarker for DataChannelRegisterRequest {
7234 type Borrowed<'a> = &'a mut Self;
7235 fn take_or_borrow<'a>(
7236 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7237 ) -> Self::Borrowed<'a> {
7238 value
7239 }
7240 }
7241
7242 unsafe impl fidl::encoding::TypeMarker for DataChannelRegisterRequest {
7243 type Owned = Self;
7244
7245 #[inline(always)]
7246 fn inline_align(_context: fidl::encoding::Context) -> usize {
7247 4
7248 }
7249
7250 #[inline(always)]
7251 fn inline_size(_context: fidl::encoding::Context) -> usize {
7252 4
7253 }
7254 }
7255
7256 unsafe impl
7257 fidl::encoding::Encode<
7258 DataChannelRegisterRequest,
7259 fidl::encoding::DefaultFuchsiaResourceDialect,
7260 > for &mut DataChannelRegisterRequest
7261 {
7262 #[inline]
7263 unsafe fn encode(
7264 self,
7265 encoder: &mut fidl::encoding::Encoder<
7266 '_,
7267 fidl::encoding::DefaultFuchsiaResourceDialect,
7268 >,
7269 offset: usize,
7270 _depth: fidl::encoding::Depth,
7271 ) -> fidl::Result<()> {
7272 encoder.debug_check_bounds::<DataChannelRegisterRequest>(offset);
7273 fidl::encoding::Encode::<
7275 DataChannelRegisterRequest,
7276 fidl::encoding::DefaultFuchsiaResourceDialect,
7277 >::encode(
7278 (<fidl::encoding::HandleType<
7279 fidl::Event,
7280 { fidl::ObjectType::EVENT.into_raw() },
7281 2147483648,
7282 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
7283 &mut self.event
7284 ),),
7285 encoder,
7286 offset,
7287 _depth,
7288 )
7289 }
7290 }
7291 unsafe impl<
7292 T0: fidl::encoding::Encode<
7293 fidl::encoding::HandleType<
7294 fidl::Event,
7295 { fidl::ObjectType::EVENT.into_raw() },
7296 2147483648,
7297 >,
7298 fidl::encoding::DefaultFuchsiaResourceDialect,
7299 >,
7300 >
7301 fidl::encoding::Encode<
7302 DataChannelRegisterRequest,
7303 fidl::encoding::DefaultFuchsiaResourceDialect,
7304 > for (T0,)
7305 {
7306 #[inline]
7307 unsafe fn encode(
7308 self,
7309 encoder: &mut fidl::encoding::Encoder<
7310 '_,
7311 fidl::encoding::DefaultFuchsiaResourceDialect,
7312 >,
7313 offset: usize,
7314 depth: fidl::encoding::Depth,
7315 ) -> fidl::Result<()> {
7316 encoder.debug_check_bounds::<DataChannelRegisterRequest>(offset);
7317 self.0.encode(encoder, offset + 0, depth)?;
7321 Ok(())
7322 }
7323 }
7324
7325 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7326 for DataChannelRegisterRequest
7327 {
7328 #[inline(always)]
7329 fn new_empty() -> Self {
7330 Self {
7331 event: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
7332 }
7333 }
7334
7335 #[inline]
7336 unsafe fn decode(
7337 &mut self,
7338 decoder: &mut fidl::encoding::Decoder<
7339 '_,
7340 fidl::encoding::DefaultFuchsiaResourceDialect,
7341 >,
7342 offset: usize,
7343 _depth: fidl::encoding::Depth,
7344 ) -> fidl::Result<()> {
7345 decoder.debug_check_bounds::<Self>(offset);
7346 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.event, decoder, offset + 0, _depth)?;
7348 Ok(())
7349 }
7350 }
7351
7352 impl fidl::encoding::ResourceTypeMarker for DeviceDownloadFirmwareRequest {
7353 type Borrowed<'a> = &'a mut Self;
7354 fn take_or_borrow<'a>(
7355 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7356 ) -> Self::Borrowed<'a> {
7357 value
7358 }
7359 }
7360
7361 unsafe impl fidl::encoding::TypeMarker for DeviceDownloadFirmwareRequest {
7362 type Owned = Self;
7363
7364 #[inline(always)]
7365 fn inline_align(_context: fidl::encoding::Context) -> usize {
7366 8
7367 }
7368
7369 #[inline(always)]
7370 fn inline_size(_context: fidl::encoding::Context) -> usize {
7371 16
7372 }
7373 }
7374
7375 unsafe impl
7376 fidl::encoding::Encode<
7377 DeviceDownloadFirmwareRequest,
7378 fidl::encoding::DefaultFuchsiaResourceDialect,
7379 > for &mut DeviceDownloadFirmwareRequest
7380 {
7381 #[inline]
7382 unsafe fn encode(
7383 self,
7384 encoder: &mut fidl::encoding::Encoder<
7385 '_,
7386 fidl::encoding::DefaultFuchsiaResourceDialect,
7387 >,
7388 offset: usize,
7389 _depth: fidl::encoding::Depth,
7390 ) -> fidl::Result<()> {
7391 encoder.debug_check_bounds::<DeviceDownloadFirmwareRequest>(offset);
7392 fidl::encoding::Encode::<
7394 DeviceDownloadFirmwareRequest,
7395 fidl::encoding::DefaultFuchsiaResourceDialect,
7396 >::encode(
7397 (
7398 <fidl::encoding::HandleType<
7399 fidl::Vmo,
7400 { fidl::ObjectType::VMO.into_raw() },
7401 49271,
7402 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
7403 &mut self.firmware
7404 ),
7405 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.offset),
7406 ),
7407 encoder,
7408 offset,
7409 _depth,
7410 )
7411 }
7412 }
7413 unsafe impl<
7414 T0: fidl::encoding::Encode<
7415 fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49271>,
7416 fidl::encoding::DefaultFuchsiaResourceDialect,
7417 >,
7418 T1: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
7419 >
7420 fidl::encoding::Encode<
7421 DeviceDownloadFirmwareRequest,
7422 fidl::encoding::DefaultFuchsiaResourceDialect,
7423 > for (T0, T1)
7424 {
7425 #[inline]
7426 unsafe fn encode(
7427 self,
7428 encoder: &mut fidl::encoding::Encoder<
7429 '_,
7430 fidl::encoding::DefaultFuchsiaResourceDialect,
7431 >,
7432 offset: usize,
7433 depth: fidl::encoding::Depth,
7434 ) -> fidl::Result<()> {
7435 encoder.debug_check_bounds::<DeviceDownloadFirmwareRequest>(offset);
7436 unsafe {
7439 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
7440 (ptr as *mut u64).write_unaligned(0);
7441 }
7442 self.0.encode(encoder, offset + 0, depth)?;
7444 self.1.encode(encoder, offset + 8, depth)?;
7445 Ok(())
7446 }
7447 }
7448
7449 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7450 for DeviceDownloadFirmwareRequest
7451 {
7452 #[inline(always)]
7453 fn new_empty() -> Self {
7454 Self {
7455 firmware: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49271>, fidl::encoding::DefaultFuchsiaResourceDialect),
7456 offset: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
7457 }
7458 }
7459
7460 #[inline]
7461 unsafe fn decode(
7462 &mut self,
7463 decoder: &mut fidl::encoding::Decoder<
7464 '_,
7465 fidl::encoding::DefaultFuchsiaResourceDialect,
7466 >,
7467 offset: usize,
7468 _depth: fidl::encoding::Depth,
7469 ) -> fidl::Result<()> {
7470 decoder.debug_check_bounds::<Self>(offset);
7471 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
7473 let padval = unsafe { (ptr as *const u64).read_unaligned() };
7474 let mask = 0xffffffff00000000u64;
7475 let maskedval = padval & mask;
7476 if maskedval != 0 {
7477 return Err(fidl::Error::NonZeroPadding {
7478 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
7479 });
7480 }
7481 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49271>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.firmware, decoder, offset + 0, _depth)?;
7482 fidl::decode!(
7483 u64,
7484 fidl::encoding::DefaultFuchsiaResourceDialect,
7485 &mut self.offset,
7486 decoder,
7487 offset + 8,
7488 _depth
7489 )?;
7490 Ok(())
7491 }
7492 }
7493
7494 impl DataChannelReadResponse {
7495 #[inline(always)]
7496 fn max_ordinal_present(&self) -> u64 {
7497 if let Some(_) = self.wake_lease {
7498 return 2;
7499 }
7500 if let Some(_) = self.data {
7501 return 1;
7502 }
7503 0
7504 }
7505 }
7506
7507 impl fidl::encoding::ResourceTypeMarker for DataChannelReadResponse {
7508 type Borrowed<'a> = &'a mut Self;
7509 fn take_or_borrow<'a>(
7510 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7511 ) -> Self::Borrowed<'a> {
7512 value
7513 }
7514 }
7515
7516 unsafe impl fidl::encoding::TypeMarker for DataChannelReadResponse {
7517 type Owned = Self;
7518
7519 #[inline(always)]
7520 fn inline_align(_context: fidl::encoding::Context) -> usize {
7521 8
7522 }
7523
7524 #[inline(always)]
7525 fn inline_size(_context: fidl::encoding::Context) -> usize {
7526 16
7527 }
7528 }
7529
7530 unsafe impl
7531 fidl::encoding::Encode<
7532 DataChannelReadResponse,
7533 fidl::encoding::DefaultFuchsiaResourceDialect,
7534 > for &mut DataChannelReadResponse
7535 {
7536 unsafe fn encode(
7537 self,
7538 encoder: &mut fidl::encoding::Encoder<
7539 '_,
7540 fidl::encoding::DefaultFuchsiaResourceDialect,
7541 >,
7542 offset: usize,
7543 mut depth: fidl::encoding::Depth,
7544 ) -> fidl::Result<()> {
7545 encoder.debug_check_bounds::<DataChannelReadResponse>(offset);
7546 let max_ordinal: u64 = self.max_ordinal_present();
7548 encoder.write_num(max_ordinal, offset);
7549 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7550 if max_ordinal == 0 {
7552 return Ok(());
7553 }
7554 depth.increment()?;
7555 let envelope_size = 8;
7556 let bytes_len = max_ordinal as usize * envelope_size;
7557 #[allow(unused_variables)]
7558 let offset = encoder.out_of_line_offset(bytes_len);
7559 let mut _prev_end_offset: usize = 0;
7560 if 1 > max_ordinal {
7561 return Ok(());
7562 }
7563
7564 let cur_offset: usize = (1 - 1) * envelope_size;
7567
7568 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7570
7571 fidl::encoding::encode_in_envelope_optional::<
7576 fidl::encoding::Vector<u8, 255>,
7577 fidl::encoding::DefaultFuchsiaResourceDialect,
7578 >(
7579 self.data.as_ref().map(
7580 <fidl::encoding::Vector<u8, 255> as fidl::encoding::ValueTypeMarker>::borrow,
7581 ),
7582 encoder,
7583 offset + cur_offset,
7584 depth,
7585 )?;
7586
7587 _prev_end_offset = cur_offset + envelope_size;
7588 if 2 > max_ordinal {
7589 return Ok(());
7590 }
7591
7592 let cur_offset: usize = (2 - 1) * envelope_size;
7595
7596 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7598
7599 fidl::encoding::encode_in_envelope_optional::<
7604 fidl::encoding::HandleType<
7605 fidl::EventPair,
7606 { fidl::ObjectType::EVENTPAIR.into_raw() },
7607 2147483648,
7608 >,
7609 fidl::encoding::DefaultFuchsiaResourceDialect,
7610 >(
7611 self.wake_lease.as_mut().map(
7612 <fidl::encoding::HandleType<
7613 fidl::EventPair,
7614 { fidl::ObjectType::EVENTPAIR.into_raw() },
7615 2147483648,
7616 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
7617 ),
7618 encoder,
7619 offset + cur_offset,
7620 depth,
7621 )?;
7622
7623 _prev_end_offset = cur_offset + envelope_size;
7624
7625 Ok(())
7626 }
7627 }
7628
7629 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7630 for DataChannelReadResponse
7631 {
7632 #[inline(always)]
7633 fn new_empty() -> Self {
7634 Self::default()
7635 }
7636
7637 unsafe fn decode(
7638 &mut self,
7639 decoder: &mut fidl::encoding::Decoder<
7640 '_,
7641 fidl::encoding::DefaultFuchsiaResourceDialect,
7642 >,
7643 offset: usize,
7644 mut depth: fidl::encoding::Depth,
7645 ) -> fidl::Result<()> {
7646 decoder.debug_check_bounds::<Self>(offset);
7647 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7648 None => return Err(fidl::Error::NotNullable),
7649 Some(len) => len,
7650 };
7651 if len == 0 {
7653 return Ok(());
7654 };
7655 depth.increment()?;
7656 let envelope_size = 8;
7657 let bytes_len = len * envelope_size;
7658 let offset = decoder.out_of_line_offset(bytes_len)?;
7659 let mut _next_ordinal_to_read = 0;
7661 let mut next_offset = offset;
7662 let end_offset = offset + bytes_len;
7663 _next_ordinal_to_read += 1;
7664 if next_offset >= end_offset {
7665 return Ok(());
7666 }
7667
7668 while _next_ordinal_to_read < 1 {
7670 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7671 _next_ordinal_to_read += 1;
7672 next_offset += envelope_size;
7673 }
7674
7675 let next_out_of_line = decoder.next_out_of_line();
7676 let handles_before = decoder.remaining_handles();
7677 if let Some((inlined, num_bytes, num_handles)) =
7678 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7679 {
7680 let member_inline_size =
7681 <fidl::encoding::Vector<u8, 255> as fidl::encoding::TypeMarker>::inline_size(
7682 decoder.context,
7683 );
7684 if inlined != (member_inline_size <= 4) {
7685 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7686 }
7687 let inner_offset;
7688 let mut inner_depth = depth.clone();
7689 if inlined {
7690 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7691 inner_offset = next_offset;
7692 } else {
7693 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7694 inner_depth.increment()?;
7695 }
7696 let val_ref =
7697 self.data.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 255>, fidl::encoding::DefaultFuchsiaResourceDialect));
7698 fidl::decode!(fidl::encoding::Vector<u8, 255>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
7699 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7700 {
7701 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7702 }
7703 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7704 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7705 }
7706 }
7707
7708 next_offset += envelope_size;
7709 _next_ordinal_to_read += 1;
7710 if next_offset >= end_offset {
7711 return Ok(());
7712 }
7713
7714 while _next_ordinal_to_read < 2 {
7716 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7717 _next_ordinal_to_read += 1;
7718 next_offset += envelope_size;
7719 }
7720
7721 let next_out_of_line = decoder.next_out_of_line();
7722 let handles_before = decoder.remaining_handles();
7723 if let Some((inlined, num_bytes, num_handles)) =
7724 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7725 {
7726 let member_inline_size = <fidl::encoding::HandleType<
7727 fidl::EventPair,
7728 { fidl::ObjectType::EVENTPAIR.into_raw() },
7729 2147483648,
7730 > as fidl::encoding::TypeMarker>::inline_size(
7731 decoder.context
7732 );
7733 if inlined != (member_inline_size <= 4) {
7734 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7735 }
7736 let inner_offset;
7737 let mut inner_depth = depth.clone();
7738 if inlined {
7739 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7740 inner_offset = next_offset;
7741 } else {
7742 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7743 inner_depth.increment()?;
7744 }
7745 let val_ref =
7746 self.wake_lease.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
7747 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
7748 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7749 {
7750 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7751 }
7752 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7753 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7754 }
7755 }
7756
7757 next_offset += envelope_size;
7758
7759 while next_offset < end_offset {
7761 _next_ordinal_to_read += 1;
7762 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7763 next_offset += envelope_size;
7764 }
7765
7766 Ok(())
7767 }
7768 }
7769
7770 impl HangingDataChannelReadResponse {
7771 #[inline(always)]
7772 fn max_ordinal_present(&self) -> u64 {
7773 if let Some(_) = self.wake_lease {
7774 return 2;
7775 }
7776 if let Some(_) = self.data {
7777 return 1;
7778 }
7779 0
7780 }
7781 }
7782
7783 impl fidl::encoding::ResourceTypeMarker for HangingDataChannelReadResponse {
7784 type Borrowed<'a> = &'a mut Self;
7785 fn take_or_borrow<'a>(
7786 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7787 ) -> Self::Borrowed<'a> {
7788 value
7789 }
7790 }
7791
7792 unsafe impl fidl::encoding::TypeMarker for HangingDataChannelReadResponse {
7793 type Owned = Self;
7794
7795 #[inline(always)]
7796 fn inline_align(_context: fidl::encoding::Context) -> usize {
7797 8
7798 }
7799
7800 #[inline(always)]
7801 fn inline_size(_context: fidl::encoding::Context) -> usize {
7802 16
7803 }
7804 }
7805
7806 unsafe impl
7807 fidl::encoding::Encode<
7808 HangingDataChannelReadResponse,
7809 fidl::encoding::DefaultFuchsiaResourceDialect,
7810 > for &mut HangingDataChannelReadResponse
7811 {
7812 unsafe fn encode(
7813 self,
7814 encoder: &mut fidl::encoding::Encoder<
7815 '_,
7816 fidl::encoding::DefaultFuchsiaResourceDialect,
7817 >,
7818 offset: usize,
7819 mut depth: fidl::encoding::Depth,
7820 ) -> fidl::Result<()> {
7821 encoder.debug_check_bounds::<HangingDataChannelReadResponse>(offset);
7822 let max_ordinal: u64 = self.max_ordinal_present();
7824 encoder.write_num(max_ordinal, offset);
7825 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7826 if max_ordinal == 0 {
7828 return Ok(());
7829 }
7830 depth.increment()?;
7831 let envelope_size = 8;
7832 let bytes_len = max_ordinal as usize * envelope_size;
7833 #[allow(unused_variables)]
7834 let offset = encoder.out_of_line_offset(bytes_len);
7835 let mut _prev_end_offset: usize = 0;
7836 if 1 > max_ordinal {
7837 return Ok(());
7838 }
7839
7840 let cur_offset: usize = (1 - 1) * envelope_size;
7843
7844 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7846
7847 fidl::encoding::encode_in_envelope_optional::<
7852 fidl::encoding::Vector<u8, 255>,
7853 fidl::encoding::DefaultFuchsiaResourceDialect,
7854 >(
7855 self.data.as_ref().map(
7856 <fidl::encoding::Vector<u8, 255> as fidl::encoding::ValueTypeMarker>::borrow,
7857 ),
7858 encoder,
7859 offset + cur_offset,
7860 depth,
7861 )?;
7862
7863 _prev_end_offset = cur_offset + envelope_size;
7864 if 2 > max_ordinal {
7865 return Ok(());
7866 }
7867
7868 let cur_offset: usize = (2 - 1) * envelope_size;
7871
7872 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7874
7875 fidl::encoding::encode_in_envelope_optional::<
7880 fidl::encoding::HandleType<
7881 fidl::EventPair,
7882 { fidl::ObjectType::EVENTPAIR.into_raw() },
7883 2147483648,
7884 >,
7885 fidl::encoding::DefaultFuchsiaResourceDialect,
7886 >(
7887 self.wake_lease.as_mut().map(
7888 <fidl::encoding::HandleType<
7889 fidl::EventPair,
7890 { fidl::ObjectType::EVENTPAIR.into_raw() },
7891 2147483648,
7892 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
7893 ),
7894 encoder,
7895 offset + cur_offset,
7896 depth,
7897 )?;
7898
7899 _prev_end_offset = cur_offset + envelope_size;
7900
7901 Ok(())
7902 }
7903 }
7904
7905 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7906 for HangingDataChannelReadResponse
7907 {
7908 #[inline(always)]
7909 fn new_empty() -> Self {
7910 Self::default()
7911 }
7912
7913 unsafe fn decode(
7914 &mut self,
7915 decoder: &mut fidl::encoding::Decoder<
7916 '_,
7917 fidl::encoding::DefaultFuchsiaResourceDialect,
7918 >,
7919 offset: usize,
7920 mut depth: fidl::encoding::Depth,
7921 ) -> fidl::Result<()> {
7922 decoder.debug_check_bounds::<Self>(offset);
7923 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7924 None => return Err(fidl::Error::NotNullable),
7925 Some(len) => len,
7926 };
7927 if len == 0 {
7929 return Ok(());
7930 };
7931 depth.increment()?;
7932 let envelope_size = 8;
7933 let bytes_len = len * envelope_size;
7934 let offset = decoder.out_of_line_offset(bytes_len)?;
7935 let mut _next_ordinal_to_read = 0;
7937 let mut next_offset = offset;
7938 let end_offset = offset + bytes_len;
7939 _next_ordinal_to_read += 1;
7940 if next_offset >= end_offset {
7941 return Ok(());
7942 }
7943
7944 while _next_ordinal_to_read < 1 {
7946 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7947 _next_ordinal_to_read += 1;
7948 next_offset += envelope_size;
7949 }
7950
7951 let next_out_of_line = decoder.next_out_of_line();
7952 let handles_before = decoder.remaining_handles();
7953 if let Some((inlined, num_bytes, num_handles)) =
7954 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7955 {
7956 let member_inline_size =
7957 <fidl::encoding::Vector<u8, 255> as fidl::encoding::TypeMarker>::inline_size(
7958 decoder.context,
7959 );
7960 if inlined != (member_inline_size <= 4) {
7961 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7962 }
7963 let inner_offset;
7964 let mut inner_depth = depth.clone();
7965 if inlined {
7966 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7967 inner_offset = next_offset;
7968 } else {
7969 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7970 inner_depth.increment()?;
7971 }
7972 let val_ref =
7973 self.data.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 255>, fidl::encoding::DefaultFuchsiaResourceDialect));
7974 fidl::decode!(fidl::encoding::Vector<u8, 255>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
7975 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7976 {
7977 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7978 }
7979 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7980 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7981 }
7982 }
7983
7984 next_offset += envelope_size;
7985 _next_ordinal_to_read += 1;
7986 if next_offset >= end_offset {
7987 return Ok(());
7988 }
7989
7990 while _next_ordinal_to_read < 2 {
7992 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7993 _next_ordinal_to_read += 1;
7994 next_offset += envelope_size;
7995 }
7996
7997 let next_out_of_line = decoder.next_out_of_line();
7998 let handles_before = decoder.remaining_handles();
7999 if let Some((inlined, num_bytes, num_handles)) =
8000 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8001 {
8002 let member_inline_size = <fidl::encoding::HandleType<
8003 fidl::EventPair,
8004 { fidl::ObjectType::EVENTPAIR.into_raw() },
8005 2147483648,
8006 > as fidl::encoding::TypeMarker>::inline_size(
8007 decoder.context
8008 );
8009 if inlined != (member_inline_size <= 4) {
8010 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8011 }
8012 let inner_offset;
8013 let mut inner_depth = depth.clone();
8014 if inlined {
8015 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8016 inner_offset = next_offset;
8017 } else {
8018 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8019 inner_depth.increment()?;
8020 }
8021 let val_ref =
8022 self.wake_lease.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
8023 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
8024 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8025 {
8026 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8027 }
8028 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8029 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8030 }
8031 }
8032
8033 next_offset += envelope_size;
8034
8035 while next_offset < end_offset {
8037 _next_ordinal_to_read += 1;
8038 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8039 next_offset += envelope_size;
8040 }
8041
8042 Ok(())
8043 }
8044 }
8045
8046 impl UnboundHangingDataChannelBindRequest {
8047 #[inline(always)]
8048 fn max_ordinal_present(&self) -> u64 {
8049 if let Some(_) = self.server {
8050 return 1;
8051 }
8052 0
8053 }
8054 }
8055
8056 impl fidl::encoding::ResourceTypeMarker for UnboundHangingDataChannelBindRequest {
8057 type Borrowed<'a> = &'a mut Self;
8058 fn take_or_borrow<'a>(
8059 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8060 ) -> Self::Borrowed<'a> {
8061 value
8062 }
8063 }
8064
8065 unsafe impl fidl::encoding::TypeMarker for UnboundHangingDataChannelBindRequest {
8066 type Owned = Self;
8067
8068 #[inline(always)]
8069 fn inline_align(_context: fidl::encoding::Context) -> usize {
8070 8
8071 }
8072
8073 #[inline(always)]
8074 fn inline_size(_context: fidl::encoding::Context) -> usize {
8075 16
8076 }
8077 }
8078
8079 unsafe impl
8080 fidl::encoding::Encode<
8081 UnboundHangingDataChannelBindRequest,
8082 fidl::encoding::DefaultFuchsiaResourceDialect,
8083 > for &mut UnboundHangingDataChannelBindRequest
8084 {
8085 unsafe fn encode(
8086 self,
8087 encoder: &mut fidl::encoding::Encoder<
8088 '_,
8089 fidl::encoding::DefaultFuchsiaResourceDialect,
8090 >,
8091 offset: usize,
8092 mut depth: fidl::encoding::Depth,
8093 ) -> fidl::Result<()> {
8094 encoder.debug_check_bounds::<UnboundHangingDataChannelBindRequest>(offset);
8095 let max_ordinal: u64 = self.max_ordinal_present();
8097 encoder.write_num(max_ordinal, offset);
8098 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8099 if max_ordinal == 0 {
8101 return Ok(());
8102 }
8103 depth.increment()?;
8104 let envelope_size = 8;
8105 let bytes_len = max_ordinal as usize * envelope_size;
8106 #[allow(unused_variables)]
8107 let offset = encoder.out_of_line_offset(bytes_len);
8108 let mut _prev_end_offset: usize = 0;
8109 if 1 > max_ordinal {
8110 return Ok(());
8111 }
8112
8113 let cur_offset: usize = (1 - 1) * envelope_size;
8116
8117 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8119
8120 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<HangingDataChannelMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
8125 self.server.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<HangingDataChannelMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
8126 encoder, offset + cur_offset, depth
8127 )?;
8128
8129 _prev_end_offset = cur_offset + envelope_size;
8130
8131 Ok(())
8132 }
8133 }
8134
8135 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8136 for UnboundHangingDataChannelBindRequest
8137 {
8138 #[inline(always)]
8139 fn new_empty() -> Self {
8140 Self::default()
8141 }
8142
8143 unsafe fn decode(
8144 &mut self,
8145 decoder: &mut fidl::encoding::Decoder<
8146 '_,
8147 fidl::encoding::DefaultFuchsiaResourceDialect,
8148 >,
8149 offset: usize,
8150 mut depth: fidl::encoding::Depth,
8151 ) -> fidl::Result<()> {
8152 decoder.debug_check_bounds::<Self>(offset);
8153 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8154 None => return Err(fidl::Error::NotNullable),
8155 Some(len) => len,
8156 };
8157 if len == 0 {
8159 return Ok(());
8160 };
8161 depth.increment()?;
8162 let envelope_size = 8;
8163 let bytes_len = len * envelope_size;
8164 let offset = decoder.out_of_line_offset(bytes_len)?;
8165 let mut _next_ordinal_to_read = 0;
8167 let mut next_offset = offset;
8168 let end_offset = offset + bytes_len;
8169 _next_ordinal_to_read += 1;
8170 if next_offset >= end_offset {
8171 return Ok(());
8172 }
8173
8174 while _next_ordinal_to_read < 1 {
8176 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8177 _next_ordinal_to_read += 1;
8178 next_offset += envelope_size;
8179 }
8180
8181 let next_out_of_line = decoder.next_out_of_line();
8182 let handles_before = decoder.remaining_handles();
8183 if let Some((inlined, num_bytes, num_handles)) =
8184 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8185 {
8186 let member_inline_size = <fidl::encoding::Endpoint<
8187 fidl::endpoints::ServerEnd<HangingDataChannelMarker>,
8188 > as fidl::encoding::TypeMarker>::inline_size(
8189 decoder.context
8190 );
8191 if inlined != (member_inline_size <= 4) {
8192 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8193 }
8194 let inner_offset;
8195 let mut inner_depth = depth.clone();
8196 if inlined {
8197 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8198 inner_offset = next_offset;
8199 } else {
8200 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8201 inner_depth.increment()?;
8202 }
8203 let val_ref = self.server.get_or_insert_with(|| {
8204 fidl::new_empty!(
8205 fidl::encoding::Endpoint<
8206 fidl::endpoints::ServerEnd<HangingDataChannelMarker>,
8207 >,
8208 fidl::encoding::DefaultFuchsiaResourceDialect
8209 )
8210 });
8211 fidl::decode!(
8212 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<HangingDataChannelMarker>>,
8213 fidl::encoding::DefaultFuchsiaResourceDialect,
8214 val_ref,
8215 decoder,
8216 inner_offset,
8217 inner_depth
8218 )?;
8219 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8220 {
8221 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8222 }
8223 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8224 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8225 }
8226 }
8227
8228 next_offset += envelope_size;
8229
8230 while next_offset < end_offset {
8232 _next_ordinal_to_read += 1;
8233 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8234 next_offset += envelope_size;
8235 }
8236
8237 Ok(())
8238 }
8239 }
8240
8241 impl UnboundWaitableDataChannelBindRequest {
8242 #[inline(always)]
8243 fn max_ordinal_present(&self) -> u64 {
8244 if let Some(_) = self.server {
8245 return 2;
8246 }
8247 if let Some(_) = self.event {
8248 return 1;
8249 }
8250 0
8251 }
8252 }
8253
8254 impl fidl::encoding::ResourceTypeMarker for UnboundWaitableDataChannelBindRequest {
8255 type Borrowed<'a> = &'a mut Self;
8256 fn take_or_borrow<'a>(
8257 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8258 ) -> Self::Borrowed<'a> {
8259 value
8260 }
8261 }
8262
8263 unsafe impl fidl::encoding::TypeMarker for UnboundWaitableDataChannelBindRequest {
8264 type Owned = Self;
8265
8266 #[inline(always)]
8267 fn inline_align(_context: fidl::encoding::Context) -> usize {
8268 8
8269 }
8270
8271 #[inline(always)]
8272 fn inline_size(_context: fidl::encoding::Context) -> usize {
8273 16
8274 }
8275 }
8276
8277 unsafe impl
8278 fidl::encoding::Encode<
8279 UnboundWaitableDataChannelBindRequest,
8280 fidl::encoding::DefaultFuchsiaResourceDialect,
8281 > for &mut UnboundWaitableDataChannelBindRequest
8282 {
8283 unsafe fn encode(
8284 self,
8285 encoder: &mut fidl::encoding::Encoder<
8286 '_,
8287 fidl::encoding::DefaultFuchsiaResourceDialect,
8288 >,
8289 offset: usize,
8290 mut depth: fidl::encoding::Depth,
8291 ) -> fidl::Result<()> {
8292 encoder.debug_check_bounds::<UnboundWaitableDataChannelBindRequest>(offset);
8293 let max_ordinal: u64 = self.max_ordinal_present();
8295 encoder.write_num(max_ordinal, offset);
8296 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8297 if max_ordinal == 0 {
8299 return Ok(());
8300 }
8301 depth.increment()?;
8302 let envelope_size = 8;
8303 let bytes_len = max_ordinal as usize * envelope_size;
8304 #[allow(unused_variables)]
8305 let offset = encoder.out_of_line_offset(bytes_len);
8306 let mut _prev_end_offset: usize = 0;
8307 if 1 > max_ordinal {
8308 return Ok(());
8309 }
8310
8311 let cur_offset: usize = (1 - 1) * envelope_size;
8314
8315 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8317
8318 fidl::encoding::encode_in_envelope_optional::<
8323 fidl::encoding::HandleType<
8324 fidl::Event,
8325 { fidl::ObjectType::EVENT.into_raw() },
8326 2147483648,
8327 >,
8328 fidl::encoding::DefaultFuchsiaResourceDialect,
8329 >(
8330 self.event.as_mut().map(
8331 <fidl::encoding::HandleType<
8332 fidl::Event,
8333 { fidl::ObjectType::EVENT.into_raw() },
8334 2147483648,
8335 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
8336 ),
8337 encoder,
8338 offset + cur_offset,
8339 depth,
8340 )?;
8341
8342 _prev_end_offset = cur_offset + envelope_size;
8343 if 2 > max_ordinal {
8344 return Ok(());
8345 }
8346
8347 let cur_offset: usize = (2 - 1) * envelope_size;
8350
8351 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8353
8354 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WaitableDataChannelMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
8359 self.server.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WaitableDataChannelMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
8360 encoder, offset + cur_offset, depth
8361 )?;
8362
8363 _prev_end_offset = cur_offset + envelope_size;
8364
8365 Ok(())
8366 }
8367 }
8368
8369 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8370 for UnboundWaitableDataChannelBindRequest
8371 {
8372 #[inline(always)]
8373 fn new_empty() -> Self {
8374 Self::default()
8375 }
8376
8377 unsafe fn decode(
8378 &mut self,
8379 decoder: &mut fidl::encoding::Decoder<
8380 '_,
8381 fidl::encoding::DefaultFuchsiaResourceDialect,
8382 >,
8383 offset: usize,
8384 mut depth: fidl::encoding::Depth,
8385 ) -> fidl::Result<()> {
8386 decoder.debug_check_bounds::<Self>(offset);
8387 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8388 None => return Err(fidl::Error::NotNullable),
8389 Some(len) => len,
8390 };
8391 if len == 0 {
8393 return Ok(());
8394 };
8395 depth.increment()?;
8396 let envelope_size = 8;
8397 let bytes_len = len * envelope_size;
8398 let offset = decoder.out_of_line_offset(bytes_len)?;
8399 let mut _next_ordinal_to_read = 0;
8401 let mut next_offset = offset;
8402 let end_offset = offset + bytes_len;
8403 _next_ordinal_to_read += 1;
8404 if next_offset >= end_offset {
8405 return Ok(());
8406 }
8407
8408 while _next_ordinal_to_read < 1 {
8410 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8411 _next_ordinal_to_read += 1;
8412 next_offset += envelope_size;
8413 }
8414
8415 let next_out_of_line = decoder.next_out_of_line();
8416 let handles_before = decoder.remaining_handles();
8417 if let Some((inlined, num_bytes, num_handles)) =
8418 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8419 {
8420 let member_inline_size = <fidl::encoding::HandleType<
8421 fidl::Event,
8422 { fidl::ObjectType::EVENT.into_raw() },
8423 2147483648,
8424 > as fidl::encoding::TypeMarker>::inline_size(
8425 decoder.context
8426 );
8427 if inlined != (member_inline_size <= 4) {
8428 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8429 }
8430 let inner_offset;
8431 let mut inner_depth = depth.clone();
8432 if inlined {
8433 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8434 inner_offset = next_offset;
8435 } else {
8436 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8437 inner_depth.increment()?;
8438 }
8439 let val_ref =
8440 self.event.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
8441 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
8442 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8443 {
8444 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8445 }
8446 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8447 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8448 }
8449 }
8450
8451 next_offset += envelope_size;
8452 _next_ordinal_to_read += 1;
8453 if next_offset >= end_offset {
8454 return Ok(());
8455 }
8456
8457 while _next_ordinal_to_read < 2 {
8459 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8460 _next_ordinal_to_read += 1;
8461 next_offset += envelope_size;
8462 }
8463
8464 let next_out_of_line = decoder.next_out_of_line();
8465 let handles_before = decoder.remaining_handles();
8466 if let Some((inlined, num_bytes, num_handles)) =
8467 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8468 {
8469 let member_inline_size = <fidl::encoding::Endpoint<
8470 fidl::endpoints::ServerEnd<WaitableDataChannelMarker>,
8471 > as fidl::encoding::TypeMarker>::inline_size(
8472 decoder.context
8473 );
8474 if inlined != (member_inline_size <= 4) {
8475 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8476 }
8477 let inner_offset;
8478 let mut inner_depth = depth.clone();
8479 if inlined {
8480 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8481 inner_offset = next_offset;
8482 } else {
8483 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8484 inner_depth.increment()?;
8485 }
8486 let val_ref = self.server.get_or_insert_with(|| {
8487 fidl::new_empty!(
8488 fidl::encoding::Endpoint<
8489 fidl::endpoints::ServerEnd<WaitableDataChannelMarker>,
8490 >,
8491 fidl::encoding::DefaultFuchsiaResourceDialect
8492 )
8493 });
8494 fidl::decode!(
8495 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WaitableDataChannelMarker>>,
8496 fidl::encoding::DefaultFuchsiaResourceDialect,
8497 val_ref,
8498 decoder,
8499 inner_offset,
8500 inner_depth
8501 )?;
8502 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8503 {
8504 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8505 }
8506 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8507 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8508 }
8509 }
8510
8511 next_offset += envelope_size;
8512
8513 while next_offset < end_offset {
8515 _next_ordinal_to_read += 1;
8516 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8517 next_offset += envelope_size;
8518 }
8519
8520 Ok(())
8521 }
8522 }
8523
8524 impl WaitableDataChannelReadResponse {
8525 #[inline(always)]
8526 fn max_ordinal_present(&self) -> u64 {
8527 if let Some(_) = self.data {
8528 return 1;
8529 }
8530 0
8531 }
8532 }
8533
8534 impl fidl::encoding::ResourceTypeMarker for WaitableDataChannelReadResponse {
8535 type Borrowed<'a> = &'a mut Self;
8536 fn take_or_borrow<'a>(
8537 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8538 ) -> Self::Borrowed<'a> {
8539 value
8540 }
8541 }
8542
8543 unsafe impl fidl::encoding::TypeMarker for WaitableDataChannelReadResponse {
8544 type Owned = Self;
8545
8546 #[inline(always)]
8547 fn inline_align(_context: fidl::encoding::Context) -> usize {
8548 8
8549 }
8550
8551 #[inline(always)]
8552 fn inline_size(_context: fidl::encoding::Context) -> usize {
8553 16
8554 }
8555 }
8556
8557 unsafe impl
8558 fidl::encoding::Encode<
8559 WaitableDataChannelReadResponse,
8560 fidl::encoding::DefaultFuchsiaResourceDialect,
8561 > for &mut WaitableDataChannelReadResponse
8562 {
8563 unsafe fn encode(
8564 self,
8565 encoder: &mut fidl::encoding::Encoder<
8566 '_,
8567 fidl::encoding::DefaultFuchsiaResourceDialect,
8568 >,
8569 offset: usize,
8570 mut depth: fidl::encoding::Depth,
8571 ) -> fidl::Result<()> {
8572 encoder.debug_check_bounds::<WaitableDataChannelReadResponse>(offset);
8573 let max_ordinal: u64 = self.max_ordinal_present();
8575 encoder.write_num(max_ordinal, offset);
8576 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8577 if max_ordinal == 0 {
8579 return Ok(());
8580 }
8581 depth.increment()?;
8582 let envelope_size = 8;
8583 let bytes_len = max_ordinal as usize * envelope_size;
8584 #[allow(unused_variables)]
8585 let offset = encoder.out_of_line_offset(bytes_len);
8586 let mut _prev_end_offset: usize = 0;
8587 if 1 > max_ordinal {
8588 return Ok(());
8589 }
8590
8591 let cur_offset: usize = (1 - 1) * envelope_size;
8594
8595 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8597
8598 fidl::encoding::encode_in_envelope_optional::<
8603 fidl::encoding::Vector<u8, 255>,
8604 fidl::encoding::DefaultFuchsiaResourceDialect,
8605 >(
8606 self.data.as_ref().map(
8607 <fidl::encoding::Vector<u8, 255> as fidl::encoding::ValueTypeMarker>::borrow,
8608 ),
8609 encoder,
8610 offset + cur_offset,
8611 depth,
8612 )?;
8613
8614 _prev_end_offset = cur_offset + envelope_size;
8615
8616 Ok(())
8617 }
8618 }
8619
8620 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8621 for WaitableDataChannelReadResponse
8622 {
8623 #[inline(always)]
8624 fn new_empty() -> Self {
8625 Self::default()
8626 }
8627
8628 unsafe fn decode(
8629 &mut self,
8630 decoder: &mut fidl::encoding::Decoder<
8631 '_,
8632 fidl::encoding::DefaultFuchsiaResourceDialect,
8633 >,
8634 offset: usize,
8635 mut depth: fidl::encoding::Depth,
8636 ) -> fidl::Result<()> {
8637 decoder.debug_check_bounds::<Self>(offset);
8638 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8639 None => return Err(fidl::Error::NotNullable),
8640 Some(len) => len,
8641 };
8642 if len == 0 {
8644 return Ok(());
8645 };
8646 depth.increment()?;
8647 let envelope_size = 8;
8648 let bytes_len = len * envelope_size;
8649 let offset = decoder.out_of_line_offset(bytes_len)?;
8650 let mut _next_ordinal_to_read = 0;
8652 let mut next_offset = offset;
8653 let end_offset = offset + bytes_len;
8654 _next_ordinal_to_read += 1;
8655 if next_offset >= end_offset {
8656 return Ok(());
8657 }
8658
8659 while _next_ordinal_to_read < 1 {
8661 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8662 _next_ordinal_to_read += 1;
8663 next_offset += envelope_size;
8664 }
8665
8666 let next_out_of_line = decoder.next_out_of_line();
8667 let handles_before = decoder.remaining_handles();
8668 if let Some((inlined, num_bytes, num_handles)) =
8669 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8670 {
8671 let member_inline_size =
8672 <fidl::encoding::Vector<u8, 255> as fidl::encoding::TypeMarker>::inline_size(
8673 decoder.context,
8674 );
8675 if inlined != (member_inline_size <= 4) {
8676 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8677 }
8678 let inner_offset;
8679 let mut inner_depth = depth.clone();
8680 if inlined {
8681 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8682 inner_offset = next_offset;
8683 } else {
8684 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8685 inner_depth.increment()?;
8686 }
8687 let val_ref =
8688 self.data.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 255>, fidl::encoding::DefaultFuchsiaResourceDialect));
8689 fidl::decode!(fidl::encoding::Vector<u8, 255>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
8690 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8691 {
8692 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8693 }
8694 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8695 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8696 }
8697 }
8698
8699 next_offset += envelope_size;
8700
8701 while next_offset < end_offset {
8703 _next_ordinal_to_read += 1;
8704 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8705 next_offset += envelope_size;
8706 }
8707
8708 Ok(())
8709 }
8710 }
8711}