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_pty_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct DeviceOpenClientRequest {
16 pub id: u32,
17 pub client: fidl::endpoints::ServerEnd<DeviceMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DeviceOpenClientRequest {}
21
22#[derive(Debug, Default, PartialEq)]
23pub struct DeviceDescribeResponse {
24 pub event: Option<fidl::EventPair>,
28 #[doc(hidden)]
29 pub __source_breaking: fidl::marker::SourceBreaking,
30}
31
32impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DeviceDescribeResponse {}
33
34#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
35pub struct DeviceMarker;
36
37impl fidl::endpoints::ProtocolMarker for DeviceMarker {
38 type Proxy = DeviceProxy;
39 type RequestStream = DeviceRequestStream;
40 #[cfg(target_os = "fuchsia")]
41 type SynchronousProxy = DeviceSynchronousProxy;
42
43 const DEBUG_NAME: &'static str = "fuchsia.hardware.pty.Device";
44}
45impl fidl::endpoints::DiscoverableProtocolMarker for DeviceMarker {}
46
47pub trait DeviceProxyInterface: Send + Sync {
48 fn r#clone(
49 &self,
50 request: fidl::endpoints::ServerEnd<fidl_fuchsia_unknown::CloneableMarker>,
51 ) -> Result<(), fidl::Error>;
52 type CloseResponseFut: std::future::Future<
53 Output = Result<fidl_fuchsia_unknown::CloseableCloseResult, fidl::Error>,
54 > + Send;
55 fn r#close(&self) -> Self::CloseResponseFut;
56 type QueryResponseFut: std::future::Future<Output = Result<Vec<u8>, fidl::Error>> + Send;
57 fn r#query(&self) -> Self::QueryResponseFut;
58 type ReadResponseFut: std::future::Future<Output = Result<fidl_fuchsia_io::ReadableReadResult, fidl::Error>>
59 + Send;
60 fn r#read(&self, count: u64) -> Self::ReadResponseFut;
61 type WriteResponseFut: std::future::Future<Output = Result<fidl_fuchsia_io::WritableWriteResult, fidl::Error>>
62 + Send;
63 fn r#write(&self, data: &[u8]) -> Self::WriteResponseFut;
64 type DescribeResponseFut: std::future::Future<Output = Result<DeviceDescribeResponse, fidl::Error>>
65 + Send;
66 fn r#describe(&self) -> Self::DescribeResponseFut;
67 type OpenClientResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
68 fn r#open_client(
69 &self,
70 id: u32,
71 client: fidl::endpoints::ServerEnd<DeviceMarker>,
72 ) -> Self::OpenClientResponseFut;
73 type ClrSetFeatureResponseFut: std::future::Future<Output = Result<(i32, u32), fidl::Error>>
74 + Send;
75 fn r#clr_set_feature(&self, clr: u32, set: u32) -> Self::ClrSetFeatureResponseFut;
76 type GetWindowSizeResponseFut: std::future::Future<Output = Result<(i32, WindowSize), fidl::Error>>
77 + Send;
78 fn r#get_window_size(&self) -> Self::GetWindowSizeResponseFut;
79 type MakeActiveResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
80 fn r#make_active(&self, client_pty_id: u32) -> Self::MakeActiveResponseFut;
81 type ReadEventsResponseFut: std::future::Future<Output = Result<(i32, u32), fidl::Error>> + Send;
82 fn r#read_events(&self) -> Self::ReadEventsResponseFut;
83 type SetWindowSizeResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
84 fn r#set_window_size(&self, size: &WindowSize) -> Self::SetWindowSizeResponseFut;
85}
86#[derive(Debug)]
87#[cfg(target_os = "fuchsia")]
88pub struct DeviceSynchronousProxy {
89 client: fidl::client::sync::Client,
90}
91
92#[cfg(target_os = "fuchsia")]
93impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
94 type Proxy = DeviceProxy;
95 type Protocol = DeviceMarker;
96
97 fn from_channel(inner: fidl::Channel) -> Self {
98 Self::new(inner)
99 }
100
101 fn into_channel(self) -> fidl::Channel {
102 self.client.into_channel()
103 }
104
105 fn as_channel(&self) -> &fidl::Channel {
106 self.client.as_channel()
107 }
108}
109
110#[cfg(target_os = "fuchsia")]
111impl DeviceSynchronousProxy {
112 pub fn new(channel: fidl::Channel) -> Self {
113 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
114 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
115 }
116
117 pub fn into_channel(self) -> fidl::Channel {
118 self.client.into_channel()
119 }
120
121 pub fn wait_for_event(
124 &self,
125 deadline: zx::MonotonicInstant,
126 ) -> Result<DeviceEvent, fidl::Error> {
127 DeviceEvent::decode(self.client.wait_for_event(deadline)?)
128 }
129
130 pub fn r#clone(
131 &self,
132 mut request: fidl::endpoints::ServerEnd<fidl_fuchsia_unknown::CloneableMarker>,
133 ) -> Result<(), fidl::Error> {
134 self.client.send::<fidl_fuchsia_unknown::CloneableCloneRequest>(
135 (request,),
136 0x20d8a7aba2168a79,
137 fidl::encoding::DynamicFlags::empty(),
138 )
139 }
140
141 pub fn r#close(
152 &self,
153 ___deadline: zx::MonotonicInstant,
154 ) -> Result<fidl_fuchsia_unknown::CloseableCloseResult, fidl::Error> {
155 let _response = self.client.send_query::<
156 fidl::encoding::EmptyPayload,
157 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
158 >(
159 (),
160 0x5ac5d459ad7f657e,
161 fidl::encoding::DynamicFlags::empty(),
162 ___deadline,
163 )?;
164 Ok(_response.map(|x| x))
165 }
166
167 pub fn r#query(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<u8>, fidl::Error> {
168 let _response = self.client.send_query::<
169 fidl::encoding::EmptyPayload,
170 fidl_fuchsia_unknown::QueryableQueryResponse,
171 >(
172 (),
173 0x2658edee9decfc06,
174 fidl::encoding::DynamicFlags::empty(),
175 ___deadline,
176 )?;
177 Ok(_response.protocol)
178 }
179
180 pub fn r#read(
199 &self,
200 mut count: u64,
201 ___deadline: zx::MonotonicInstant,
202 ) -> Result<fidl_fuchsia_io::ReadableReadResult, fidl::Error> {
203 let _response = self.client.send_query::<
204 fidl_fuchsia_io::ReadableReadRequest,
205 fidl::encoding::ResultType<fidl_fuchsia_io::ReadableReadResponse, i32>,
206 >(
207 (count,),
208 0x57e419a298c8ede,
209 fidl::encoding::DynamicFlags::empty(),
210 ___deadline,
211 )?;
212 Ok(_response.map(|x| x.data))
213 }
214
215 pub fn r#write(
239 &self,
240 mut data: &[u8],
241 ___deadline: zx::MonotonicInstant,
242 ) -> Result<fidl_fuchsia_io::WritableWriteResult, fidl::Error> {
243 let _response = self.client.send_query::<
244 fidl_fuchsia_io::WritableWriteRequest,
245 fidl::encoding::ResultType<fidl_fuchsia_io::WritableWriteResponse, i32>,
246 >(
247 (data,),
248 0x6a31437832469f82,
249 fidl::encoding::DynamicFlags::empty(),
250 ___deadline,
251 )?;
252 Ok(_response.map(|x| x.actual_count))
253 }
254
255 pub fn r#describe(
256 &self,
257 ___deadline: zx::MonotonicInstant,
258 ) -> Result<DeviceDescribeResponse, fidl::Error> {
259 let _response =
260 self.client.send_query::<fidl::encoding::EmptyPayload, DeviceDescribeResponse>(
261 (),
262 0x585d4b390fe996f5,
263 fidl::encoding::DynamicFlags::empty(),
264 ___deadline,
265 )?;
266 Ok(_response)
267 }
268
269 pub fn r#open_client(
279 &self,
280 mut id: u32,
281 mut client: fidl::endpoints::ServerEnd<DeviceMarker>,
282 ___deadline: zx::MonotonicInstant,
283 ) -> Result<i32, fidl::Error> {
284 let _response =
285 self.client.send_query::<DeviceOpenClientRequest, DeviceOpenClientResponse>(
286 (id, client),
287 0x78f040fe6a1ebb3,
288 fidl::encoding::DynamicFlags::empty(),
289 ___deadline,
290 )?;
291 Ok(_response.s)
292 }
293
294 pub fn r#clr_set_feature(
298 &self,
299 mut clr: u32,
300 mut set: u32,
301 ___deadline: zx::MonotonicInstant,
302 ) -> Result<(i32, u32), fidl::Error> {
303 let _response =
304 self.client.send_query::<DeviceClrSetFeatureRequest, DeviceClrSetFeatureResponse>(
305 (clr, set),
306 0x6367986e6053a15e,
307 fidl::encoding::DynamicFlags::empty(),
308 ___deadline,
309 )?;
310 Ok((_response.status, _response.features))
311 }
312
313 pub fn r#get_window_size(
315 &self,
316 ___deadline: zx::MonotonicInstant,
317 ) -> Result<(i32, WindowSize), fidl::Error> {
318 let _response =
319 self.client.send_query::<fidl::encoding::EmptyPayload, DeviceGetWindowSizeResponse>(
320 (),
321 0x747bed0460f5f9f7,
322 fidl::encoding::DynamicFlags::empty(),
323 ___deadline,
324 )?;
325 Ok((_response.status, _response.size))
326 }
327
328 pub fn r#make_active(
333 &self,
334 mut client_pty_id: u32,
335 ___deadline: zx::MonotonicInstant,
336 ) -> Result<i32, fidl::Error> {
337 let _response =
338 self.client.send_query::<DeviceMakeActiveRequest, DeviceMakeActiveResponse>(
339 (client_pty_id,),
340 0x2763944f30ee2a62,
341 fidl::encoding::DynamicFlags::empty(),
342 ___deadline,
343 )?;
344 Ok(_response.status)
345 }
346
347 pub fn r#read_events(
349 &self,
350 ___deadline: zx::MonotonicInstant,
351 ) -> Result<(i32, u32), fidl::Error> {
352 let _response =
353 self.client.send_query::<fidl::encoding::EmptyPayload, DeviceReadEventsResponse>(
354 (),
355 0xede96f3e3258f62,
356 fidl::encoding::DynamicFlags::empty(),
357 ___deadline,
358 )?;
359 Ok((_response.status, _response.events))
360 }
361
362 pub fn r#set_window_size(
366 &self,
367 mut size: &WindowSize,
368 ___deadline: zx::MonotonicInstant,
369 ) -> Result<i32, fidl::Error> {
370 let _response =
371 self.client.send_query::<DeviceSetWindowSizeRequest, DeviceSetWindowSizeResponse>(
372 (size,),
373 0x17d1cb37377e7928,
374 fidl::encoding::DynamicFlags::empty(),
375 ___deadline,
376 )?;
377 Ok(_response.status)
378 }
379}
380
381#[cfg(target_os = "fuchsia")]
382impl From<DeviceSynchronousProxy> for zx::Handle {
383 fn from(value: DeviceSynchronousProxy) -> Self {
384 value.into_channel().into()
385 }
386}
387
388#[cfg(target_os = "fuchsia")]
389impl From<fidl::Channel> for DeviceSynchronousProxy {
390 fn from(value: fidl::Channel) -> Self {
391 Self::new(value)
392 }
393}
394
395#[derive(Debug, Clone)]
396pub struct DeviceProxy {
397 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
398}
399
400impl fidl::endpoints::Proxy for DeviceProxy {
401 type Protocol = DeviceMarker;
402
403 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
404 Self::new(inner)
405 }
406
407 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
408 self.client.into_channel().map_err(|client| Self { client })
409 }
410
411 fn as_channel(&self) -> &::fidl::AsyncChannel {
412 self.client.as_channel()
413 }
414}
415
416impl DeviceProxy {
417 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
419 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
420 Self { client: fidl::client::Client::new(channel, protocol_name) }
421 }
422
423 pub fn take_event_stream(&self) -> DeviceEventStream {
429 DeviceEventStream { event_receiver: self.client.take_event_receiver() }
430 }
431
432 pub fn r#clone(
433 &self,
434 mut request: fidl::endpoints::ServerEnd<fidl_fuchsia_unknown::CloneableMarker>,
435 ) -> Result<(), fidl::Error> {
436 DeviceProxyInterface::r#clone(self, request)
437 }
438
439 pub fn r#close(
450 &self,
451 ) -> fidl::client::QueryResponseFut<
452 fidl_fuchsia_unknown::CloseableCloseResult,
453 fidl::encoding::DefaultFuchsiaResourceDialect,
454 > {
455 DeviceProxyInterface::r#close(self)
456 }
457
458 pub fn r#query(
459 &self,
460 ) -> fidl::client::QueryResponseFut<Vec<u8>, fidl::encoding::DefaultFuchsiaResourceDialect>
461 {
462 DeviceProxyInterface::r#query(self)
463 }
464
465 pub fn r#read(
484 &self,
485 mut count: u64,
486 ) -> fidl::client::QueryResponseFut<
487 fidl_fuchsia_io::ReadableReadResult,
488 fidl::encoding::DefaultFuchsiaResourceDialect,
489 > {
490 DeviceProxyInterface::r#read(self, count)
491 }
492
493 pub fn r#write(
517 &self,
518 mut data: &[u8],
519 ) -> fidl::client::QueryResponseFut<
520 fidl_fuchsia_io::WritableWriteResult,
521 fidl::encoding::DefaultFuchsiaResourceDialect,
522 > {
523 DeviceProxyInterface::r#write(self, data)
524 }
525
526 pub fn r#describe(
527 &self,
528 ) -> fidl::client::QueryResponseFut<
529 DeviceDescribeResponse,
530 fidl::encoding::DefaultFuchsiaResourceDialect,
531 > {
532 DeviceProxyInterface::r#describe(self)
533 }
534
535 pub fn r#open_client(
545 &self,
546 mut id: u32,
547 mut client: fidl::endpoints::ServerEnd<DeviceMarker>,
548 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
549 DeviceProxyInterface::r#open_client(self, id, client)
550 }
551
552 pub fn r#clr_set_feature(
556 &self,
557 mut clr: u32,
558 mut set: u32,
559 ) -> fidl::client::QueryResponseFut<(i32, u32), fidl::encoding::DefaultFuchsiaResourceDialect>
560 {
561 DeviceProxyInterface::r#clr_set_feature(self, clr, set)
562 }
563
564 pub fn r#get_window_size(
566 &self,
567 ) -> fidl::client::QueryResponseFut<
568 (i32, WindowSize),
569 fidl::encoding::DefaultFuchsiaResourceDialect,
570 > {
571 DeviceProxyInterface::r#get_window_size(self)
572 }
573
574 pub fn r#make_active(
579 &self,
580 mut client_pty_id: u32,
581 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
582 DeviceProxyInterface::r#make_active(self, client_pty_id)
583 }
584
585 pub fn r#read_events(
587 &self,
588 ) -> fidl::client::QueryResponseFut<(i32, u32), fidl::encoding::DefaultFuchsiaResourceDialect>
589 {
590 DeviceProxyInterface::r#read_events(self)
591 }
592
593 pub fn r#set_window_size(
597 &self,
598 mut size: &WindowSize,
599 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
600 DeviceProxyInterface::r#set_window_size(self, size)
601 }
602}
603
604impl DeviceProxyInterface for DeviceProxy {
605 fn r#clone(
606 &self,
607 mut request: fidl::endpoints::ServerEnd<fidl_fuchsia_unknown::CloneableMarker>,
608 ) -> Result<(), fidl::Error> {
609 self.client.send::<fidl_fuchsia_unknown::CloneableCloneRequest>(
610 (request,),
611 0x20d8a7aba2168a79,
612 fidl::encoding::DynamicFlags::empty(),
613 )
614 }
615
616 type CloseResponseFut = fidl::client::QueryResponseFut<
617 fidl_fuchsia_unknown::CloseableCloseResult,
618 fidl::encoding::DefaultFuchsiaResourceDialect,
619 >;
620 fn r#close(&self) -> Self::CloseResponseFut {
621 fn _decode(
622 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
623 ) -> Result<fidl_fuchsia_unknown::CloseableCloseResult, fidl::Error> {
624 let _response = fidl::client::decode_transaction_body::<
625 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
626 fidl::encoding::DefaultFuchsiaResourceDialect,
627 0x5ac5d459ad7f657e,
628 >(_buf?)?;
629 Ok(_response.map(|x| x))
630 }
631 self.client.send_query_and_decode::<
632 fidl::encoding::EmptyPayload,
633 fidl_fuchsia_unknown::CloseableCloseResult,
634 >(
635 (),
636 0x5ac5d459ad7f657e,
637 fidl::encoding::DynamicFlags::empty(),
638 _decode,
639 )
640 }
641
642 type QueryResponseFut =
643 fidl::client::QueryResponseFut<Vec<u8>, fidl::encoding::DefaultFuchsiaResourceDialect>;
644 fn r#query(&self) -> Self::QueryResponseFut {
645 fn _decode(
646 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
647 ) -> Result<Vec<u8>, fidl::Error> {
648 let _response = fidl::client::decode_transaction_body::<
649 fidl_fuchsia_unknown::QueryableQueryResponse,
650 fidl::encoding::DefaultFuchsiaResourceDialect,
651 0x2658edee9decfc06,
652 >(_buf?)?;
653 Ok(_response.protocol)
654 }
655 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<u8>>(
656 (),
657 0x2658edee9decfc06,
658 fidl::encoding::DynamicFlags::empty(),
659 _decode,
660 )
661 }
662
663 type ReadResponseFut = fidl::client::QueryResponseFut<
664 fidl_fuchsia_io::ReadableReadResult,
665 fidl::encoding::DefaultFuchsiaResourceDialect,
666 >;
667 fn r#read(&self, mut count: u64) -> Self::ReadResponseFut {
668 fn _decode(
669 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
670 ) -> Result<fidl_fuchsia_io::ReadableReadResult, fidl::Error> {
671 let _response = fidl::client::decode_transaction_body::<
672 fidl::encoding::ResultType<fidl_fuchsia_io::ReadableReadResponse, i32>,
673 fidl::encoding::DefaultFuchsiaResourceDialect,
674 0x57e419a298c8ede,
675 >(_buf?)?;
676 Ok(_response.map(|x| x.data))
677 }
678 self.client.send_query_and_decode::<
679 fidl_fuchsia_io::ReadableReadRequest,
680 fidl_fuchsia_io::ReadableReadResult,
681 >(
682 (count,),
683 0x57e419a298c8ede,
684 fidl::encoding::DynamicFlags::empty(),
685 _decode,
686 )
687 }
688
689 type WriteResponseFut = fidl::client::QueryResponseFut<
690 fidl_fuchsia_io::WritableWriteResult,
691 fidl::encoding::DefaultFuchsiaResourceDialect,
692 >;
693 fn r#write(&self, mut data: &[u8]) -> Self::WriteResponseFut {
694 fn _decode(
695 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
696 ) -> Result<fidl_fuchsia_io::WritableWriteResult, fidl::Error> {
697 let _response = fidl::client::decode_transaction_body::<
698 fidl::encoding::ResultType<fidl_fuchsia_io::WritableWriteResponse, i32>,
699 fidl::encoding::DefaultFuchsiaResourceDialect,
700 0x6a31437832469f82,
701 >(_buf?)?;
702 Ok(_response.map(|x| x.actual_count))
703 }
704 self.client.send_query_and_decode::<
705 fidl_fuchsia_io::WritableWriteRequest,
706 fidl_fuchsia_io::WritableWriteResult,
707 >(
708 (data,),
709 0x6a31437832469f82,
710 fidl::encoding::DynamicFlags::empty(),
711 _decode,
712 )
713 }
714
715 type DescribeResponseFut = fidl::client::QueryResponseFut<
716 DeviceDescribeResponse,
717 fidl::encoding::DefaultFuchsiaResourceDialect,
718 >;
719 fn r#describe(&self) -> Self::DescribeResponseFut {
720 fn _decode(
721 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
722 ) -> Result<DeviceDescribeResponse, fidl::Error> {
723 let _response = fidl::client::decode_transaction_body::<
724 DeviceDescribeResponse,
725 fidl::encoding::DefaultFuchsiaResourceDialect,
726 0x585d4b390fe996f5,
727 >(_buf?)?;
728 Ok(_response)
729 }
730 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceDescribeResponse>(
731 (),
732 0x585d4b390fe996f5,
733 fidl::encoding::DynamicFlags::empty(),
734 _decode,
735 )
736 }
737
738 type OpenClientResponseFut =
739 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
740 fn r#open_client(
741 &self,
742 mut id: u32,
743 mut client: fidl::endpoints::ServerEnd<DeviceMarker>,
744 ) -> Self::OpenClientResponseFut {
745 fn _decode(
746 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
747 ) -> Result<i32, fidl::Error> {
748 let _response = fidl::client::decode_transaction_body::<
749 DeviceOpenClientResponse,
750 fidl::encoding::DefaultFuchsiaResourceDialect,
751 0x78f040fe6a1ebb3,
752 >(_buf?)?;
753 Ok(_response.s)
754 }
755 self.client.send_query_and_decode::<DeviceOpenClientRequest, i32>(
756 (id, client),
757 0x78f040fe6a1ebb3,
758 fidl::encoding::DynamicFlags::empty(),
759 _decode,
760 )
761 }
762
763 type ClrSetFeatureResponseFut =
764 fidl::client::QueryResponseFut<(i32, u32), fidl::encoding::DefaultFuchsiaResourceDialect>;
765 fn r#clr_set_feature(&self, mut clr: u32, mut set: u32) -> Self::ClrSetFeatureResponseFut {
766 fn _decode(
767 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
768 ) -> Result<(i32, u32), fidl::Error> {
769 let _response = fidl::client::decode_transaction_body::<
770 DeviceClrSetFeatureResponse,
771 fidl::encoding::DefaultFuchsiaResourceDialect,
772 0x6367986e6053a15e,
773 >(_buf?)?;
774 Ok((_response.status, _response.features))
775 }
776 self.client.send_query_and_decode::<DeviceClrSetFeatureRequest, (i32, u32)>(
777 (clr, set),
778 0x6367986e6053a15e,
779 fidl::encoding::DynamicFlags::empty(),
780 _decode,
781 )
782 }
783
784 type GetWindowSizeResponseFut = fidl::client::QueryResponseFut<
785 (i32, WindowSize),
786 fidl::encoding::DefaultFuchsiaResourceDialect,
787 >;
788 fn r#get_window_size(&self) -> Self::GetWindowSizeResponseFut {
789 fn _decode(
790 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
791 ) -> Result<(i32, WindowSize), fidl::Error> {
792 let _response = fidl::client::decode_transaction_body::<
793 DeviceGetWindowSizeResponse,
794 fidl::encoding::DefaultFuchsiaResourceDialect,
795 0x747bed0460f5f9f7,
796 >(_buf?)?;
797 Ok((_response.status, _response.size))
798 }
799 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, WindowSize)>(
800 (),
801 0x747bed0460f5f9f7,
802 fidl::encoding::DynamicFlags::empty(),
803 _decode,
804 )
805 }
806
807 type MakeActiveResponseFut =
808 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
809 fn r#make_active(&self, mut client_pty_id: u32) -> Self::MakeActiveResponseFut {
810 fn _decode(
811 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
812 ) -> Result<i32, fidl::Error> {
813 let _response = fidl::client::decode_transaction_body::<
814 DeviceMakeActiveResponse,
815 fidl::encoding::DefaultFuchsiaResourceDialect,
816 0x2763944f30ee2a62,
817 >(_buf?)?;
818 Ok(_response.status)
819 }
820 self.client.send_query_and_decode::<DeviceMakeActiveRequest, i32>(
821 (client_pty_id,),
822 0x2763944f30ee2a62,
823 fidl::encoding::DynamicFlags::empty(),
824 _decode,
825 )
826 }
827
828 type ReadEventsResponseFut =
829 fidl::client::QueryResponseFut<(i32, u32), fidl::encoding::DefaultFuchsiaResourceDialect>;
830 fn r#read_events(&self) -> Self::ReadEventsResponseFut {
831 fn _decode(
832 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
833 ) -> Result<(i32, u32), fidl::Error> {
834 let _response = fidl::client::decode_transaction_body::<
835 DeviceReadEventsResponse,
836 fidl::encoding::DefaultFuchsiaResourceDialect,
837 0xede96f3e3258f62,
838 >(_buf?)?;
839 Ok((_response.status, _response.events))
840 }
841 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, u32)>(
842 (),
843 0xede96f3e3258f62,
844 fidl::encoding::DynamicFlags::empty(),
845 _decode,
846 )
847 }
848
849 type SetWindowSizeResponseFut =
850 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
851 fn r#set_window_size(&self, mut size: &WindowSize) -> Self::SetWindowSizeResponseFut {
852 fn _decode(
853 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
854 ) -> Result<i32, fidl::Error> {
855 let _response = fidl::client::decode_transaction_body::<
856 DeviceSetWindowSizeResponse,
857 fidl::encoding::DefaultFuchsiaResourceDialect,
858 0x17d1cb37377e7928,
859 >(_buf?)?;
860 Ok(_response.status)
861 }
862 self.client.send_query_and_decode::<DeviceSetWindowSizeRequest, i32>(
863 (size,),
864 0x17d1cb37377e7928,
865 fidl::encoding::DynamicFlags::empty(),
866 _decode,
867 )
868 }
869}
870
871pub struct DeviceEventStream {
872 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
873}
874
875impl std::marker::Unpin for DeviceEventStream {}
876
877impl futures::stream::FusedStream for DeviceEventStream {
878 fn is_terminated(&self) -> bool {
879 self.event_receiver.is_terminated()
880 }
881}
882
883impl futures::Stream for DeviceEventStream {
884 type Item = Result<DeviceEvent, fidl::Error>;
885
886 fn poll_next(
887 mut self: std::pin::Pin<&mut Self>,
888 cx: &mut std::task::Context<'_>,
889 ) -> std::task::Poll<Option<Self::Item>> {
890 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
891 &mut self.event_receiver,
892 cx
893 )?) {
894 Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
895 None => std::task::Poll::Ready(None),
896 }
897 }
898}
899
900#[derive(Debug)]
901pub enum DeviceEvent {}
902
903impl DeviceEvent {
904 fn decode(
906 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
907 ) -> Result<DeviceEvent, fidl::Error> {
908 let (bytes, _handles) = buf.split_mut();
909 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
910 debug_assert_eq!(tx_header.tx_id, 0);
911 match tx_header.ordinal {
912 _ => Err(fidl::Error::UnknownOrdinal {
913 ordinal: tx_header.ordinal,
914 protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
915 }),
916 }
917 }
918}
919
920pub struct DeviceRequestStream {
922 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
923 is_terminated: bool,
924}
925
926impl std::marker::Unpin for DeviceRequestStream {}
927
928impl futures::stream::FusedStream for DeviceRequestStream {
929 fn is_terminated(&self) -> bool {
930 self.is_terminated
931 }
932}
933
934impl fidl::endpoints::RequestStream for DeviceRequestStream {
935 type Protocol = DeviceMarker;
936 type ControlHandle = DeviceControlHandle;
937
938 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
939 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
940 }
941
942 fn control_handle(&self) -> Self::ControlHandle {
943 DeviceControlHandle { inner: self.inner.clone() }
944 }
945
946 fn into_inner(
947 self,
948 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
949 {
950 (self.inner, self.is_terminated)
951 }
952
953 fn from_inner(
954 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
955 is_terminated: bool,
956 ) -> Self {
957 Self { inner, is_terminated }
958 }
959}
960
961impl futures::Stream for DeviceRequestStream {
962 type Item = Result<DeviceRequest, fidl::Error>;
963
964 fn poll_next(
965 mut self: std::pin::Pin<&mut Self>,
966 cx: &mut std::task::Context<'_>,
967 ) -> std::task::Poll<Option<Self::Item>> {
968 let this = &mut *self;
969 if this.inner.check_shutdown(cx) {
970 this.is_terminated = true;
971 return std::task::Poll::Ready(None);
972 }
973 if this.is_terminated {
974 panic!("polled DeviceRequestStream after completion");
975 }
976 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
977 |bytes, handles| {
978 match this.inner.channel().read_etc(cx, bytes, handles) {
979 std::task::Poll::Ready(Ok(())) => {}
980 std::task::Poll::Pending => return std::task::Poll::Pending,
981 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
982 this.is_terminated = true;
983 return std::task::Poll::Ready(None);
984 }
985 std::task::Poll::Ready(Err(e)) => {
986 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
987 e.into(),
988 ))))
989 }
990 }
991
992 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
994
995 std::task::Poll::Ready(Some(match header.ordinal {
996 0x20d8a7aba2168a79 => {
997 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
998 let mut req = fidl::new_empty!(
999 fidl_fuchsia_unknown::CloneableCloneRequest,
1000 fidl::encoding::DefaultFuchsiaResourceDialect
1001 );
1002 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_unknown::CloneableCloneRequest>(&header, _body_bytes, handles, &mut req)?;
1003 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1004 Ok(DeviceRequest::Clone { request: req.request, control_handle })
1005 }
1006 0x5ac5d459ad7f657e => {
1007 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1008 let mut req = fidl::new_empty!(
1009 fidl::encoding::EmptyPayload,
1010 fidl::encoding::DefaultFuchsiaResourceDialect
1011 );
1012 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1013 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1014 Ok(DeviceRequest::Close {
1015 responder: DeviceCloseResponder {
1016 control_handle: std::mem::ManuallyDrop::new(control_handle),
1017 tx_id: header.tx_id,
1018 },
1019 })
1020 }
1021 0x2658edee9decfc06 => {
1022 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1023 let mut req = fidl::new_empty!(
1024 fidl::encoding::EmptyPayload,
1025 fidl::encoding::DefaultFuchsiaResourceDialect
1026 );
1027 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1028 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1029 Ok(DeviceRequest::Query {
1030 responder: DeviceQueryResponder {
1031 control_handle: std::mem::ManuallyDrop::new(control_handle),
1032 tx_id: header.tx_id,
1033 },
1034 })
1035 }
1036 0x57e419a298c8ede => {
1037 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1038 let mut req = fidl::new_empty!(
1039 fidl_fuchsia_io::ReadableReadRequest,
1040 fidl::encoding::DefaultFuchsiaResourceDialect
1041 );
1042 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_io::ReadableReadRequest>(&header, _body_bytes, handles, &mut req)?;
1043 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1044 Ok(DeviceRequest::Read {
1045 count: req.count,
1046
1047 responder: DeviceReadResponder {
1048 control_handle: std::mem::ManuallyDrop::new(control_handle),
1049 tx_id: header.tx_id,
1050 },
1051 })
1052 }
1053 0x6a31437832469f82 => {
1054 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1055 let mut req = fidl::new_empty!(
1056 fidl_fuchsia_io::WritableWriteRequest,
1057 fidl::encoding::DefaultFuchsiaResourceDialect
1058 );
1059 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_io::WritableWriteRequest>(&header, _body_bytes, handles, &mut req)?;
1060 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1061 Ok(DeviceRequest::Write {
1062 data: req.data,
1063
1064 responder: DeviceWriteResponder {
1065 control_handle: std::mem::ManuallyDrop::new(control_handle),
1066 tx_id: header.tx_id,
1067 },
1068 })
1069 }
1070 0x585d4b390fe996f5 => {
1071 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1072 let mut req = fidl::new_empty!(
1073 fidl::encoding::EmptyPayload,
1074 fidl::encoding::DefaultFuchsiaResourceDialect
1075 );
1076 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1077 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1078 Ok(DeviceRequest::Describe {
1079 responder: DeviceDescribeResponder {
1080 control_handle: std::mem::ManuallyDrop::new(control_handle),
1081 tx_id: header.tx_id,
1082 },
1083 })
1084 }
1085 0x78f040fe6a1ebb3 => {
1086 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1087 let mut req = fidl::new_empty!(
1088 DeviceOpenClientRequest,
1089 fidl::encoding::DefaultFuchsiaResourceDialect
1090 );
1091 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceOpenClientRequest>(&header, _body_bytes, handles, &mut req)?;
1092 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1093 Ok(DeviceRequest::OpenClient {
1094 id: req.id,
1095 client: req.client,
1096
1097 responder: DeviceOpenClientResponder {
1098 control_handle: std::mem::ManuallyDrop::new(control_handle),
1099 tx_id: header.tx_id,
1100 },
1101 })
1102 }
1103 0x6367986e6053a15e => {
1104 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1105 let mut req = fidl::new_empty!(
1106 DeviceClrSetFeatureRequest,
1107 fidl::encoding::DefaultFuchsiaResourceDialect
1108 );
1109 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceClrSetFeatureRequest>(&header, _body_bytes, handles, &mut req)?;
1110 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1111 Ok(DeviceRequest::ClrSetFeature {
1112 clr: req.clr,
1113 set: req.set,
1114
1115 responder: DeviceClrSetFeatureResponder {
1116 control_handle: std::mem::ManuallyDrop::new(control_handle),
1117 tx_id: header.tx_id,
1118 },
1119 })
1120 }
1121 0x747bed0460f5f9f7 => {
1122 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1123 let mut req = fidl::new_empty!(
1124 fidl::encoding::EmptyPayload,
1125 fidl::encoding::DefaultFuchsiaResourceDialect
1126 );
1127 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1128 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1129 Ok(DeviceRequest::GetWindowSize {
1130 responder: DeviceGetWindowSizeResponder {
1131 control_handle: std::mem::ManuallyDrop::new(control_handle),
1132 tx_id: header.tx_id,
1133 },
1134 })
1135 }
1136 0x2763944f30ee2a62 => {
1137 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1138 let mut req = fidl::new_empty!(
1139 DeviceMakeActiveRequest,
1140 fidl::encoding::DefaultFuchsiaResourceDialect
1141 );
1142 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceMakeActiveRequest>(&header, _body_bytes, handles, &mut req)?;
1143 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1144 Ok(DeviceRequest::MakeActive {
1145 client_pty_id: req.client_pty_id,
1146
1147 responder: DeviceMakeActiveResponder {
1148 control_handle: std::mem::ManuallyDrop::new(control_handle),
1149 tx_id: header.tx_id,
1150 },
1151 })
1152 }
1153 0xede96f3e3258f62 => {
1154 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1155 let mut req = fidl::new_empty!(
1156 fidl::encoding::EmptyPayload,
1157 fidl::encoding::DefaultFuchsiaResourceDialect
1158 );
1159 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1160 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1161 Ok(DeviceRequest::ReadEvents {
1162 responder: DeviceReadEventsResponder {
1163 control_handle: std::mem::ManuallyDrop::new(control_handle),
1164 tx_id: header.tx_id,
1165 },
1166 })
1167 }
1168 0x17d1cb37377e7928 => {
1169 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1170 let mut req = fidl::new_empty!(
1171 DeviceSetWindowSizeRequest,
1172 fidl::encoding::DefaultFuchsiaResourceDialect
1173 );
1174 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetWindowSizeRequest>(&header, _body_bytes, handles, &mut req)?;
1175 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1176 Ok(DeviceRequest::SetWindowSize {
1177 size: req.size,
1178
1179 responder: DeviceSetWindowSizeResponder {
1180 control_handle: std::mem::ManuallyDrop::new(control_handle),
1181 tx_id: header.tx_id,
1182 },
1183 })
1184 }
1185 _ => Err(fidl::Error::UnknownOrdinal {
1186 ordinal: header.ordinal,
1187 protocol_name:
1188 <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1189 }),
1190 }))
1191 },
1192 )
1193 }
1194}
1195
1196#[derive(Debug)]
1197pub enum DeviceRequest {
1198 Clone {
1199 request: fidl::endpoints::ServerEnd<fidl_fuchsia_unknown::CloneableMarker>,
1200 control_handle: DeviceControlHandle,
1201 },
1202 Close {
1213 responder: DeviceCloseResponder,
1214 },
1215 Query {
1216 responder: DeviceQueryResponder,
1217 },
1218 Read {
1237 count: u64,
1238 responder: DeviceReadResponder,
1239 },
1240 Write {
1264 data: Vec<u8>,
1265 responder: DeviceWriteResponder,
1266 },
1267 Describe {
1268 responder: DeviceDescribeResponder,
1269 },
1270 OpenClient {
1280 id: u32,
1281 client: fidl::endpoints::ServerEnd<DeviceMarker>,
1282 responder: DeviceOpenClientResponder,
1283 },
1284 ClrSetFeature {
1288 clr: u32,
1289 set: u32,
1290 responder: DeviceClrSetFeatureResponder,
1291 },
1292 GetWindowSize {
1294 responder: DeviceGetWindowSizeResponder,
1295 },
1296 MakeActive {
1301 client_pty_id: u32,
1302 responder: DeviceMakeActiveResponder,
1303 },
1304 ReadEvents {
1306 responder: DeviceReadEventsResponder,
1307 },
1308 SetWindowSize {
1312 size: WindowSize,
1313 responder: DeviceSetWindowSizeResponder,
1314 },
1315}
1316
1317impl DeviceRequest {
1318 #[allow(irrefutable_let_patterns)]
1319 pub fn into_clone(
1320 self,
1321 ) -> Option<(
1322 fidl::endpoints::ServerEnd<fidl_fuchsia_unknown::CloneableMarker>,
1323 DeviceControlHandle,
1324 )> {
1325 if let DeviceRequest::Clone { request, control_handle } = self {
1326 Some((request, control_handle))
1327 } else {
1328 None
1329 }
1330 }
1331
1332 #[allow(irrefutable_let_patterns)]
1333 pub fn into_close(self) -> Option<(DeviceCloseResponder)> {
1334 if let DeviceRequest::Close { responder } = self {
1335 Some((responder))
1336 } else {
1337 None
1338 }
1339 }
1340
1341 #[allow(irrefutable_let_patterns)]
1342 pub fn into_query(self) -> Option<(DeviceQueryResponder)> {
1343 if let DeviceRequest::Query { responder } = self {
1344 Some((responder))
1345 } else {
1346 None
1347 }
1348 }
1349
1350 #[allow(irrefutable_let_patterns)]
1351 pub fn into_read(self) -> Option<(u64, DeviceReadResponder)> {
1352 if let DeviceRequest::Read { count, responder } = self {
1353 Some((count, responder))
1354 } else {
1355 None
1356 }
1357 }
1358
1359 #[allow(irrefutable_let_patterns)]
1360 pub fn into_write(self) -> Option<(Vec<u8>, DeviceWriteResponder)> {
1361 if let DeviceRequest::Write { data, responder } = self {
1362 Some((data, responder))
1363 } else {
1364 None
1365 }
1366 }
1367
1368 #[allow(irrefutable_let_patterns)]
1369 pub fn into_describe(self) -> Option<(DeviceDescribeResponder)> {
1370 if let DeviceRequest::Describe { responder } = self {
1371 Some((responder))
1372 } else {
1373 None
1374 }
1375 }
1376
1377 #[allow(irrefutable_let_patterns)]
1378 pub fn into_open_client(
1379 self,
1380 ) -> Option<(u32, fidl::endpoints::ServerEnd<DeviceMarker>, DeviceOpenClientResponder)> {
1381 if let DeviceRequest::OpenClient { id, client, responder } = self {
1382 Some((id, client, responder))
1383 } else {
1384 None
1385 }
1386 }
1387
1388 #[allow(irrefutable_let_patterns)]
1389 pub fn into_clr_set_feature(self) -> Option<(u32, u32, DeviceClrSetFeatureResponder)> {
1390 if let DeviceRequest::ClrSetFeature { clr, set, responder } = self {
1391 Some((clr, set, responder))
1392 } else {
1393 None
1394 }
1395 }
1396
1397 #[allow(irrefutable_let_patterns)]
1398 pub fn into_get_window_size(self) -> Option<(DeviceGetWindowSizeResponder)> {
1399 if let DeviceRequest::GetWindowSize { responder } = self {
1400 Some((responder))
1401 } else {
1402 None
1403 }
1404 }
1405
1406 #[allow(irrefutable_let_patterns)]
1407 pub fn into_make_active(self) -> Option<(u32, DeviceMakeActiveResponder)> {
1408 if let DeviceRequest::MakeActive { client_pty_id, responder } = self {
1409 Some((client_pty_id, responder))
1410 } else {
1411 None
1412 }
1413 }
1414
1415 #[allow(irrefutable_let_patterns)]
1416 pub fn into_read_events(self) -> Option<(DeviceReadEventsResponder)> {
1417 if let DeviceRequest::ReadEvents { responder } = self {
1418 Some((responder))
1419 } else {
1420 None
1421 }
1422 }
1423
1424 #[allow(irrefutable_let_patterns)]
1425 pub fn into_set_window_size(self) -> Option<(WindowSize, DeviceSetWindowSizeResponder)> {
1426 if let DeviceRequest::SetWindowSize { size, responder } = self {
1427 Some((size, responder))
1428 } else {
1429 None
1430 }
1431 }
1432
1433 pub fn method_name(&self) -> &'static str {
1435 match *self {
1436 DeviceRequest::Clone { .. } => "clone",
1437 DeviceRequest::Close { .. } => "close",
1438 DeviceRequest::Query { .. } => "query",
1439 DeviceRequest::Read { .. } => "read",
1440 DeviceRequest::Write { .. } => "write",
1441 DeviceRequest::Describe { .. } => "describe",
1442 DeviceRequest::OpenClient { .. } => "open_client",
1443 DeviceRequest::ClrSetFeature { .. } => "clr_set_feature",
1444 DeviceRequest::GetWindowSize { .. } => "get_window_size",
1445 DeviceRequest::MakeActive { .. } => "make_active",
1446 DeviceRequest::ReadEvents { .. } => "read_events",
1447 DeviceRequest::SetWindowSize { .. } => "set_window_size",
1448 }
1449 }
1450}
1451
1452#[derive(Debug, Clone)]
1453pub struct DeviceControlHandle {
1454 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1455}
1456
1457impl fidl::endpoints::ControlHandle for DeviceControlHandle {
1458 fn shutdown(&self) {
1459 self.inner.shutdown()
1460 }
1461 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1462 self.inner.shutdown_with_epitaph(status)
1463 }
1464
1465 fn is_closed(&self) -> bool {
1466 self.inner.channel().is_closed()
1467 }
1468 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1469 self.inner.channel().on_closed()
1470 }
1471
1472 #[cfg(target_os = "fuchsia")]
1473 fn signal_peer(
1474 &self,
1475 clear_mask: zx::Signals,
1476 set_mask: zx::Signals,
1477 ) -> Result<(), zx_status::Status> {
1478 use fidl::Peered;
1479 self.inner.channel().signal_peer(clear_mask, set_mask)
1480 }
1481}
1482
1483impl DeviceControlHandle {}
1484
1485#[must_use = "FIDL methods require a response to be sent"]
1486#[derive(Debug)]
1487pub struct DeviceCloseResponder {
1488 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1489 tx_id: u32,
1490}
1491
1492impl std::ops::Drop for DeviceCloseResponder {
1496 fn drop(&mut self) {
1497 self.control_handle.shutdown();
1498 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1500 }
1501}
1502
1503impl fidl::endpoints::Responder for DeviceCloseResponder {
1504 type ControlHandle = DeviceControlHandle;
1505
1506 fn control_handle(&self) -> &DeviceControlHandle {
1507 &self.control_handle
1508 }
1509
1510 fn drop_without_shutdown(mut self) {
1511 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1513 std::mem::forget(self);
1515 }
1516}
1517
1518impl DeviceCloseResponder {
1519 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1523 let _result = self.send_raw(result);
1524 if _result.is_err() {
1525 self.control_handle.shutdown();
1526 }
1527 self.drop_without_shutdown();
1528 _result
1529 }
1530
1531 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1533 let _result = self.send_raw(result);
1534 self.drop_without_shutdown();
1535 _result
1536 }
1537
1538 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1539 self.control_handle
1540 .inner
1541 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1542 result,
1543 self.tx_id,
1544 0x5ac5d459ad7f657e,
1545 fidl::encoding::DynamicFlags::empty(),
1546 )
1547 }
1548}
1549
1550#[must_use = "FIDL methods require a response to be sent"]
1551#[derive(Debug)]
1552pub struct DeviceQueryResponder {
1553 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1554 tx_id: u32,
1555}
1556
1557impl std::ops::Drop for DeviceQueryResponder {
1561 fn drop(&mut self) {
1562 self.control_handle.shutdown();
1563 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1565 }
1566}
1567
1568impl fidl::endpoints::Responder for DeviceQueryResponder {
1569 type ControlHandle = DeviceControlHandle;
1570
1571 fn control_handle(&self) -> &DeviceControlHandle {
1572 &self.control_handle
1573 }
1574
1575 fn drop_without_shutdown(mut self) {
1576 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1578 std::mem::forget(self);
1580 }
1581}
1582
1583impl DeviceQueryResponder {
1584 pub fn send(self, mut protocol: &[u8]) -> Result<(), fidl::Error> {
1588 let _result = self.send_raw(protocol);
1589 if _result.is_err() {
1590 self.control_handle.shutdown();
1591 }
1592 self.drop_without_shutdown();
1593 _result
1594 }
1595
1596 pub fn send_no_shutdown_on_err(self, mut protocol: &[u8]) -> Result<(), fidl::Error> {
1598 let _result = self.send_raw(protocol);
1599 self.drop_without_shutdown();
1600 _result
1601 }
1602
1603 fn send_raw(&self, mut protocol: &[u8]) -> Result<(), fidl::Error> {
1604 self.control_handle.inner.send::<fidl_fuchsia_unknown::QueryableQueryResponse>(
1605 (protocol,),
1606 self.tx_id,
1607 0x2658edee9decfc06,
1608 fidl::encoding::DynamicFlags::empty(),
1609 )
1610 }
1611}
1612
1613#[must_use = "FIDL methods require a response to be sent"]
1614#[derive(Debug)]
1615pub struct DeviceReadResponder {
1616 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1617 tx_id: u32,
1618}
1619
1620impl std::ops::Drop for DeviceReadResponder {
1624 fn drop(&mut self) {
1625 self.control_handle.shutdown();
1626 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1628 }
1629}
1630
1631impl fidl::endpoints::Responder for DeviceReadResponder {
1632 type ControlHandle = DeviceControlHandle;
1633
1634 fn control_handle(&self) -> &DeviceControlHandle {
1635 &self.control_handle
1636 }
1637
1638 fn drop_without_shutdown(mut self) {
1639 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1641 std::mem::forget(self);
1643 }
1644}
1645
1646impl DeviceReadResponder {
1647 pub fn send(self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
1651 let _result = self.send_raw(result);
1652 if _result.is_err() {
1653 self.control_handle.shutdown();
1654 }
1655 self.drop_without_shutdown();
1656 _result
1657 }
1658
1659 pub fn send_no_shutdown_on_err(
1661 self,
1662 mut result: Result<&[u8], i32>,
1663 ) -> Result<(), fidl::Error> {
1664 let _result = self.send_raw(result);
1665 self.drop_without_shutdown();
1666 _result
1667 }
1668
1669 fn send_raw(&self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
1670 self.control_handle.inner.send::<fidl::encoding::ResultType<
1671 fidl_fuchsia_io::ReadableReadResponse,
1672 i32,
1673 >>(
1674 result.map(|data| (data,)),
1675 self.tx_id,
1676 0x57e419a298c8ede,
1677 fidl::encoding::DynamicFlags::empty(),
1678 )
1679 }
1680}
1681
1682#[must_use = "FIDL methods require a response to be sent"]
1683#[derive(Debug)]
1684pub struct DeviceWriteResponder {
1685 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1686 tx_id: u32,
1687}
1688
1689impl std::ops::Drop for DeviceWriteResponder {
1693 fn drop(&mut self) {
1694 self.control_handle.shutdown();
1695 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1697 }
1698}
1699
1700impl fidl::endpoints::Responder for DeviceWriteResponder {
1701 type ControlHandle = DeviceControlHandle;
1702
1703 fn control_handle(&self) -> &DeviceControlHandle {
1704 &self.control_handle
1705 }
1706
1707 fn drop_without_shutdown(mut self) {
1708 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1710 std::mem::forget(self);
1712 }
1713}
1714
1715impl DeviceWriteResponder {
1716 pub fn send(self, mut result: Result<u64, i32>) -> Result<(), fidl::Error> {
1720 let _result = self.send_raw(result);
1721 if _result.is_err() {
1722 self.control_handle.shutdown();
1723 }
1724 self.drop_without_shutdown();
1725 _result
1726 }
1727
1728 pub fn send_no_shutdown_on_err(self, mut result: Result<u64, i32>) -> Result<(), fidl::Error> {
1730 let _result = self.send_raw(result);
1731 self.drop_without_shutdown();
1732 _result
1733 }
1734
1735 fn send_raw(&self, mut result: Result<u64, i32>) -> Result<(), fidl::Error> {
1736 self.control_handle.inner.send::<fidl::encoding::ResultType<
1737 fidl_fuchsia_io::WritableWriteResponse,
1738 i32,
1739 >>(
1740 result.map(|actual_count| (actual_count,)),
1741 self.tx_id,
1742 0x6a31437832469f82,
1743 fidl::encoding::DynamicFlags::empty(),
1744 )
1745 }
1746}
1747
1748#[must_use = "FIDL methods require a response to be sent"]
1749#[derive(Debug)]
1750pub struct DeviceDescribeResponder {
1751 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1752 tx_id: u32,
1753}
1754
1755impl std::ops::Drop for DeviceDescribeResponder {
1759 fn drop(&mut self) {
1760 self.control_handle.shutdown();
1761 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1763 }
1764}
1765
1766impl fidl::endpoints::Responder for DeviceDescribeResponder {
1767 type ControlHandle = DeviceControlHandle;
1768
1769 fn control_handle(&self) -> &DeviceControlHandle {
1770 &self.control_handle
1771 }
1772
1773 fn drop_without_shutdown(mut self) {
1774 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1776 std::mem::forget(self);
1778 }
1779}
1780
1781impl DeviceDescribeResponder {
1782 pub fn send(self, mut payload: DeviceDescribeResponse) -> Result<(), fidl::Error> {
1786 let _result = self.send_raw(payload);
1787 if _result.is_err() {
1788 self.control_handle.shutdown();
1789 }
1790 self.drop_without_shutdown();
1791 _result
1792 }
1793
1794 pub fn send_no_shutdown_on_err(
1796 self,
1797 mut payload: DeviceDescribeResponse,
1798 ) -> Result<(), fidl::Error> {
1799 let _result = self.send_raw(payload);
1800 self.drop_without_shutdown();
1801 _result
1802 }
1803
1804 fn send_raw(&self, mut payload: DeviceDescribeResponse) -> Result<(), fidl::Error> {
1805 self.control_handle.inner.send::<DeviceDescribeResponse>(
1806 &mut payload,
1807 self.tx_id,
1808 0x585d4b390fe996f5,
1809 fidl::encoding::DynamicFlags::empty(),
1810 )
1811 }
1812}
1813
1814#[must_use = "FIDL methods require a response to be sent"]
1815#[derive(Debug)]
1816pub struct DeviceOpenClientResponder {
1817 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1818 tx_id: u32,
1819}
1820
1821impl std::ops::Drop for DeviceOpenClientResponder {
1825 fn drop(&mut self) {
1826 self.control_handle.shutdown();
1827 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1829 }
1830}
1831
1832impl fidl::endpoints::Responder for DeviceOpenClientResponder {
1833 type ControlHandle = DeviceControlHandle;
1834
1835 fn control_handle(&self) -> &DeviceControlHandle {
1836 &self.control_handle
1837 }
1838
1839 fn drop_without_shutdown(mut self) {
1840 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1842 std::mem::forget(self);
1844 }
1845}
1846
1847impl DeviceOpenClientResponder {
1848 pub fn send(self, mut s: i32) -> Result<(), fidl::Error> {
1852 let _result = self.send_raw(s);
1853 if _result.is_err() {
1854 self.control_handle.shutdown();
1855 }
1856 self.drop_without_shutdown();
1857 _result
1858 }
1859
1860 pub fn send_no_shutdown_on_err(self, mut s: i32) -> Result<(), fidl::Error> {
1862 let _result = self.send_raw(s);
1863 self.drop_without_shutdown();
1864 _result
1865 }
1866
1867 fn send_raw(&self, mut s: i32) -> Result<(), fidl::Error> {
1868 self.control_handle.inner.send::<DeviceOpenClientResponse>(
1869 (s,),
1870 self.tx_id,
1871 0x78f040fe6a1ebb3,
1872 fidl::encoding::DynamicFlags::empty(),
1873 )
1874 }
1875}
1876
1877#[must_use = "FIDL methods require a response to be sent"]
1878#[derive(Debug)]
1879pub struct DeviceClrSetFeatureResponder {
1880 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1881 tx_id: u32,
1882}
1883
1884impl std::ops::Drop for DeviceClrSetFeatureResponder {
1888 fn drop(&mut self) {
1889 self.control_handle.shutdown();
1890 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1892 }
1893}
1894
1895impl fidl::endpoints::Responder for DeviceClrSetFeatureResponder {
1896 type ControlHandle = DeviceControlHandle;
1897
1898 fn control_handle(&self) -> &DeviceControlHandle {
1899 &self.control_handle
1900 }
1901
1902 fn drop_without_shutdown(mut self) {
1903 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1905 std::mem::forget(self);
1907 }
1908}
1909
1910impl DeviceClrSetFeatureResponder {
1911 pub fn send(self, mut status: i32, mut features: u32) -> Result<(), fidl::Error> {
1915 let _result = self.send_raw(status, features);
1916 if _result.is_err() {
1917 self.control_handle.shutdown();
1918 }
1919 self.drop_without_shutdown();
1920 _result
1921 }
1922
1923 pub fn send_no_shutdown_on_err(
1925 self,
1926 mut status: i32,
1927 mut features: u32,
1928 ) -> Result<(), fidl::Error> {
1929 let _result = self.send_raw(status, features);
1930 self.drop_without_shutdown();
1931 _result
1932 }
1933
1934 fn send_raw(&self, mut status: i32, mut features: u32) -> Result<(), fidl::Error> {
1935 self.control_handle.inner.send::<DeviceClrSetFeatureResponse>(
1936 (status, features),
1937 self.tx_id,
1938 0x6367986e6053a15e,
1939 fidl::encoding::DynamicFlags::empty(),
1940 )
1941 }
1942}
1943
1944#[must_use = "FIDL methods require a response to be sent"]
1945#[derive(Debug)]
1946pub struct DeviceGetWindowSizeResponder {
1947 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1948 tx_id: u32,
1949}
1950
1951impl std::ops::Drop for DeviceGetWindowSizeResponder {
1955 fn drop(&mut self) {
1956 self.control_handle.shutdown();
1957 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1959 }
1960}
1961
1962impl fidl::endpoints::Responder for DeviceGetWindowSizeResponder {
1963 type ControlHandle = DeviceControlHandle;
1964
1965 fn control_handle(&self) -> &DeviceControlHandle {
1966 &self.control_handle
1967 }
1968
1969 fn drop_without_shutdown(mut self) {
1970 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1972 std::mem::forget(self);
1974 }
1975}
1976
1977impl DeviceGetWindowSizeResponder {
1978 pub fn send(self, mut status: i32, mut size: &WindowSize) -> Result<(), fidl::Error> {
1982 let _result = self.send_raw(status, size);
1983 if _result.is_err() {
1984 self.control_handle.shutdown();
1985 }
1986 self.drop_without_shutdown();
1987 _result
1988 }
1989
1990 pub fn send_no_shutdown_on_err(
1992 self,
1993 mut status: i32,
1994 mut size: &WindowSize,
1995 ) -> Result<(), fidl::Error> {
1996 let _result = self.send_raw(status, size);
1997 self.drop_without_shutdown();
1998 _result
1999 }
2000
2001 fn send_raw(&self, mut status: i32, mut size: &WindowSize) -> Result<(), fidl::Error> {
2002 self.control_handle.inner.send::<DeviceGetWindowSizeResponse>(
2003 (status, size),
2004 self.tx_id,
2005 0x747bed0460f5f9f7,
2006 fidl::encoding::DynamicFlags::empty(),
2007 )
2008 }
2009}
2010
2011#[must_use = "FIDL methods require a response to be sent"]
2012#[derive(Debug)]
2013pub struct DeviceMakeActiveResponder {
2014 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2015 tx_id: u32,
2016}
2017
2018impl std::ops::Drop for DeviceMakeActiveResponder {
2022 fn drop(&mut self) {
2023 self.control_handle.shutdown();
2024 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2026 }
2027}
2028
2029impl fidl::endpoints::Responder for DeviceMakeActiveResponder {
2030 type ControlHandle = DeviceControlHandle;
2031
2032 fn control_handle(&self) -> &DeviceControlHandle {
2033 &self.control_handle
2034 }
2035
2036 fn drop_without_shutdown(mut self) {
2037 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2039 std::mem::forget(self);
2041 }
2042}
2043
2044impl DeviceMakeActiveResponder {
2045 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
2049 let _result = self.send_raw(status);
2050 if _result.is_err() {
2051 self.control_handle.shutdown();
2052 }
2053 self.drop_without_shutdown();
2054 _result
2055 }
2056
2057 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
2059 let _result = self.send_raw(status);
2060 self.drop_without_shutdown();
2061 _result
2062 }
2063
2064 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
2065 self.control_handle.inner.send::<DeviceMakeActiveResponse>(
2066 (status,),
2067 self.tx_id,
2068 0x2763944f30ee2a62,
2069 fidl::encoding::DynamicFlags::empty(),
2070 )
2071 }
2072}
2073
2074#[must_use = "FIDL methods require a response to be sent"]
2075#[derive(Debug)]
2076pub struct DeviceReadEventsResponder {
2077 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2078 tx_id: u32,
2079}
2080
2081impl std::ops::Drop for DeviceReadEventsResponder {
2085 fn drop(&mut self) {
2086 self.control_handle.shutdown();
2087 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2089 }
2090}
2091
2092impl fidl::endpoints::Responder for DeviceReadEventsResponder {
2093 type ControlHandle = DeviceControlHandle;
2094
2095 fn control_handle(&self) -> &DeviceControlHandle {
2096 &self.control_handle
2097 }
2098
2099 fn drop_without_shutdown(mut self) {
2100 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2102 std::mem::forget(self);
2104 }
2105}
2106
2107impl DeviceReadEventsResponder {
2108 pub fn send(self, mut status: i32, mut events: u32) -> Result<(), fidl::Error> {
2112 let _result = self.send_raw(status, events);
2113 if _result.is_err() {
2114 self.control_handle.shutdown();
2115 }
2116 self.drop_without_shutdown();
2117 _result
2118 }
2119
2120 pub fn send_no_shutdown_on_err(
2122 self,
2123 mut status: i32,
2124 mut events: u32,
2125 ) -> Result<(), fidl::Error> {
2126 let _result = self.send_raw(status, events);
2127 self.drop_without_shutdown();
2128 _result
2129 }
2130
2131 fn send_raw(&self, mut status: i32, mut events: u32) -> Result<(), fidl::Error> {
2132 self.control_handle.inner.send::<DeviceReadEventsResponse>(
2133 (status, events),
2134 self.tx_id,
2135 0xede96f3e3258f62,
2136 fidl::encoding::DynamicFlags::empty(),
2137 )
2138 }
2139}
2140
2141#[must_use = "FIDL methods require a response to be sent"]
2142#[derive(Debug)]
2143pub struct DeviceSetWindowSizeResponder {
2144 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2145 tx_id: u32,
2146}
2147
2148impl std::ops::Drop for DeviceSetWindowSizeResponder {
2152 fn drop(&mut self) {
2153 self.control_handle.shutdown();
2154 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2156 }
2157}
2158
2159impl fidl::endpoints::Responder for DeviceSetWindowSizeResponder {
2160 type ControlHandle = DeviceControlHandle;
2161
2162 fn control_handle(&self) -> &DeviceControlHandle {
2163 &self.control_handle
2164 }
2165
2166 fn drop_without_shutdown(mut self) {
2167 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2169 std::mem::forget(self);
2171 }
2172}
2173
2174impl DeviceSetWindowSizeResponder {
2175 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
2179 let _result = self.send_raw(status);
2180 if _result.is_err() {
2181 self.control_handle.shutdown();
2182 }
2183 self.drop_without_shutdown();
2184 _result
2185 }
2186
2187 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
2189 let _result = self.send_raw(status);
2190 self.drop_without_shutdown();
2191 _result
2192 }
2193
2194 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
2195 self.control_handle.inner.send::<DeviceSetWindowSizeResponse>(
2196 (status,),
2197 self.tx_id,
2198 0x17d1cb37377e7928,
2199 fidl::encoding::DynamicFlags::empty(),
2200 )
2201 }
2202}
2203
2204#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2205pub struct ServiceMarker;
2206
2207#[cfg(target_os = "fuchsia")]
2208impl fidl::endpoints::ServiceMarker for ServiceMarker {
2209 type Proxy = ServiceProxy;
2210 type Request = ServiceRequest;
2211 const SERVICE_NAME: &'static str = "fuchsia.hardware.pty.Service";
2212}
2213
2214#[cfg(target_os = "fuchsia")]
2217pub enum ServiceRequest {
2218 Device(DeviceRequestStream),
2219}
2220
2221#[cfg(target_os = "fuchsia")]
2222impl fidl::endpoints::ServiceRequest for ServiceRequest {
2223 type Service = ServiceMarker;
2224
2225 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
2226 match name {
2227 "device" => Self::Device(
2228 <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
2229 ),
2230 _ => panic!("no such member protocol name for service Service"),
2231 }
2232 }
2233
2234 fn member_names() -> &'static [&'static str] {
2235 &["device"]
2236 }
2237}
2238#[cfg(target_os = "fuchsia")]
2239pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
2240
2241#[cfg(target_os = "fuchsia")]
2242impl fidl::endpoints::ServiceProxy for ServiceProxy {
2243 type Service = ServiceMarker;
2244
2245 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
2246 Self(opener)
2247 }
2248}
2249
2250#[cfg(target_os = "fuchsia")]
2251impl ServiceProxy {
2252 pub fn connect_to_device(&self) -> Result<DeviceProxy, fidl::Error> {
2253 let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
2254 self.connect_channel_to_device(server_end)?;
2255 Ok(proxy)
2256 }
2257
2258 pub fn connect_to_device_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
2261 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
2262 self.connect_channel_to_device(server_end)?;
2263 Ok(proxy)
2264 }
2265
2266 pub fn connect_channel_to_device(
2269 &self,
2270 server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
2271 ) -> Result<(), fidl::Error> {
2272 self.0.open_member("device", server_end.into_channel())
2273 }
2274
2275 pub fn instance_name(&self) -> &str {
2276 self.0.instance_name()
2277 }
2278}
2279
2280mod internal {
2281 use super::*;
2282
2283 impl fidl::encoding::ResourceTypeMarker for DeviceOpenClientRequest {
2284 type Borrowed<'a> = &'a mut Self;
2285 fn take_or_borrow<'a>(
2286 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2287 ) -> Self::Borrowed<'a> {
2288 value
2289 }
2290 }
2291
2292 unsafe impl fidl::encoding::TypeMarker for DeviceOpenClientRequest {
2293 type Owned = Self;
2294
2295 #[inline(always)]
2296 fn inline_align(_context: fidl::encoding::Context) -> usize {
2297 4
2298 }
2299
2300 #[inline(always)]
2301 fn inline_size(_context: fidl::encoding::Context) -> usize {
2302 8
2303 }
2304 }
2305
2306 unsafe impl
2307 fidl::encoding::Encode<
2308 DeviceOpenClientRequest,
2309 fidl::encoding::DefaultFuchsiaResourceDialect,
2310 > for &mut DeviceOpenClientRequest
2311 {
2312 #[inline]
2313 unsafe fn encode(
2314 self,
2315 encoder: &mut fidl::encoding::Encoder<
2316 '_,
2317 fidl::encoding::DefaultFuchsiaResourceDialect,
2318 >,
2319 offset: usize,
2320 _depth: fidl::encoding::Depth,
2321 ) -> fidl::Result<()> {
2322 encoder.debug_check_bounds::<DeviceOpenClientRequest>(offset);
2323 fidl::encoding::Encode::<DeviceOpenClientRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2325 (
2326 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
2327 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.client),
2328 ),
2329 encoder, offset, _depth
2330 )
2331 }
2332 }
2333 unsafe impl<
2334 T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
2335 T1: fidl::encoding::Encode<
2336 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
2337 fidl::encoding::DefaultFuchsiaResourceDialect,
2338 >,
2339 >
2340 fidl::encoding::Encode<
2341 DeviceOpenClientRequest,
2342 fidl::encoding::DefaultFuchsiaResourceDialect,
2343 > for (T0, T1)
2344 {
2345 #[inline]
2346 unsafe fn encode(
2347 self,
2348 encoder: &mut fidl::encoding::Encoder<
2349 '_,
2350 fidl::encoding::DefaultFuchsiaResourceDialect,
2351 >,
2352 offset: usize,
2353 depth: fidl::encoding::Depth,
2354 ) -> fidl::Result<()> {
2355 encoder.debug_check_bounds::<DeviceOpenClientRequest>(offset);
2356 self.0.encode(encoder, offset + 0, depth)?;
2360 self.1.encode(encoder, offset + 4, depth)?;
2361 Ok(())
2362 }
2363 }
2364
2365 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2366 for DeviceOpenClientRequest
2367 {
2368 #[inline(always)]
2369 fn new_empty() -> Self {
2370 Self {
2371 id: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
2372 client: fidl::new_empty!(
2373 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
2374 fidl::encoding::DefaultFuchsiaResourceDialect
2375 ),
2376 }
2377 }
2378
2379 #[inline]
2380 unsafe fn decode(
2381 &mut self,
2382 decoder: &mut fidl::encoding::Decoder<
2383 '_,
2384 fidl::encoding::DefaultFuchsiaResourceDialect,
2385 >,
2386 offset: usize,
2387 _depth: fidl::encoding::Depth,
2388 ) -> fidl::Result<()> {
2389 decoder.debug_check_bounds::<Self>(offset);
2390 fidl::decode!(
2392 u32,
2393 fidl::encoding::DefaultFuchsiaResourceDialect,
2394 &mut self.id,
2395 decoder,
2396 offset + 0,
2397 _depth
2398 )?;
2399 fidl::decode!(
2400 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
2401 fidl::encoding::DefaultFuchsiaResourceDialect,
2402 &mut self.client,
2403 decoder,
2404 offset + 4,
2405 _depth
2406 )?;
2407 Ok(())
2408 }
2409 }
2410
2411 impl DeviceDescribeResponse {
2412 #[inline(always)]
2413 fn max_ordinal_present(&self) -> u64 {
2414 if let Some(_) = self.event {
2415 return 1;
2416 }
2417 0
2418 }
2419 }
2420
2421 impl fidl::encoding::ResourceTypeMarker for DeviceDescribeResponse {
2422 type Borrowed<'a> = &'a mut Self;
2423 fn take_or_borrow<'a>(
2424 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2425 ) -> Self::Borrowed<'a> {
2426 value
2427 }
2428 }
2429
2430 unsafe impl fidl::encoding::TypeMarker for DeviceDescribeResponse {
2431 type Owned = Self;
2432
2433 #[inline(always)]
2434 fn inline_align(_context: fidl::encoding::Context) -> usize {
2435 8
2436 }
2437
2438 #[inline(always)]
2439 fn inline_size(_context: fidl::encoding::Context) -> usize {
2440 16
2441 }
2442 }
2443
2444 unsafe impl
2445 fidl::encoding::Encode<
2446 DeviceDescribeResponse,
2447 fidl::encoding::DefaultFuchsiaResourceDialect,
2448 > for &mut DeviceDescribeResponse
2449 {
2450 unsafe fn encode(
2451 self,
2452 encoder: &mut fidl::encoding::Encoder<
2453 '_,
2454 fidl::encoding::DefaultFuchsiaResourceDialect,
2455 >,
2456 offset: usize,
2457 mut depth: fidl::encoding::Depth,
2458 ) -> fidl::Result<()> {
2459 encoder.debug_check_bounds::<DeviceDescribeResponse>(offset);
2460 let max_ordinal: u64 = self.max_ordinal_present();
2462 encoder.write_num(max_ordinal, offset);
2463 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2464 if max_ordinal == 0 {
2466 return Ok(());
2467 }
2468 depth.increment()?;
2469 let envelope_size = 8;
2470 let bytes_len = max_ordinal as usize * envelope_size;
2471 #[allow(unused_variables)]
2472 let offset = encoder.out_of_line_offset(bytes_len);
2473 let mut _prev_end_offset: usize = 0;
2474 if 1 > max_ordinal {
2475 return Ok(());
2476 }
2477
2478 let cur_offset: usize = (1 - 1) * envelope_size;
2481
2482 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2484
2485 fidl::encoding::encode_in_envelope_optional::<
2490 fidl::encoding::HandleType<
2491 fidl::EventPair,
2492 { fidl::ObjectType::EVENTPAIR.into_raw() },
2493 2147483648,
2494 >,
2495 fidl::encoding::DefaultFuchsiaResourceDialect,
2496 >(
2497 self.event.as_mut().map(
2498 <fidl::encoding::HandleType<
2499 fidl::EventPair,
2500 { fidl::ObjectType::EVENTPAIR.into_raw() },
2501 2147483648,
2502 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2503 ),
2504 encoder,
2505 offset + cur_offset,
2506 depth,
2507 )?;
2508
2509 _prev_end_offset = cur_offset + envelope_size;
2510
2511 Ok(())
2512 }
2513 }
2514
2515 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2516 for DeviceDescribeResponse
2517 {
2518 #[inline(always)]
2519 fn new_empty() -> Self {
2520 Self::default()
2521 }
2522
2523 unsafe fn decode(
2524 &mut self,
2525 decoder: &mut fidl::encoding::Decoder<
2526 '_,
2527 fidl::encoding::DefaultFuchsiaResourceDialect,
2528 >,
2529 offset: usize,
2530 mut depth: fidl::encoding::Depth,
2531 ) -> fidl::Result<()> {
2532 decoder.debug_check_bounds::<Self>(offset);
2533 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2534 None => return Err(fidl::Error::NotNullable),
2535 Some(len) => len,
2536 };
2537 if len == 0 {
2539 return Ok(());
2540 };
2541 depth.increment()?;
2542 let envelope_size = 8;
2543 let bytes_len = len * envelope_size;
2544 let offset = decoder.out_of_line_offset(bytes_len)?;
2545 let mut _next_ordinal_to_read = 0;
2547 let mut next_offset = offset;
2548 let end_offset = offset + bytes_len;
2549 _next_ordinal_to_read += 1;
2550 if next_offset >= end_offset {
2551 return Ok(());
2552 }
2553
2554 while _next_ordinal_to_read < 1 {
2556 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2557 _next_ordinal_to_read += 1;
2558 next_offset += envelope_size;
2559 }
2560
2561 let next_out_of_line = decoder.next_out_of_line();
2562 let handles_before = decoder.remaining_handles();
2563 if let Some((inlined, num_bytes, num_handles)) =
2564 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2565 {
2566 let member_inline_size = <fidl::encoding::HandleType<
2567 fidl::EventPair,
2568 { fidl::ObjectType::EVENTPAIR.into_raw() },
2569 2147483648,
2570 > as fidl::encoding::TypeMarker>::inline_size(
2571 decoder.context
2572 );
2573 if inlined != (member_inline_size <= 4) {
2574 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2575 }
2576 let inner_offset;
2577 let mut inner_depth = depth.clone();
2578 if inlined {
2579 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2580 inner_offset = next_offset;
2581 } else {
2582 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2583 inner_depth.increment()?;
2584 }
2585 let val_ref =
2586 self.event.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
2587 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
2588 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2589 {
2590 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2591 }
2592 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2593 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2594 }
2595 }
2596
2597 next_offset += envelope_size;
2598
2599 while next_offset < end_offset {
2601 _next_ordinal_to_read += 1;
2602 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2603 next_offset += envelope_size;
2604 }
2605
2606 Ok(())
2607 }
2608 }
2609}