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_usb_function_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct EndpointResource {
16 pub direction: fidl_fuchsia_hardware_usb_descriptor::EndpointDirection,
17 pub endpoint: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_usb_endpoint::EndpointMarker>,
18 pub ep_info: fidl_fuchsia_hardware_usb_endpoint::EndpointInfo,
20 pub max_packet_size: u32,
22}
23
24impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for EndpointResource {}
25
26#[derive(Debug, PartialEq)]
27pub struct UsbFunctionAllocResourcesRequest {
28 pub interface_count: u8,
29 pub endpoints: Vec<EndpointResource>,
30 pub strings: Vec<String>,
31}
32
33impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
34 for UsbFunctionAllocResourcesRequest
35{
36}
37
38#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
39pub struct UsbFunctionConfigureRequest {
40 pub configuration: Vec<u8>,
41 pub iface: fidl::endpoints::ClientEnd<UsbFunctionInterfaceMarker>,
42}
43
44impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
45 for UsbFunctionConfigureRequest
46{
47}
48
49#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
50pub struct UsbFunctionConnectToEndpointRequest {
51 pub ep_addr: u8,
52 pub ep: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_usb_endpoint::EndpointMarker>,
53}
54
55impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
56 for UsbFunctionConnectToEndpointRequest
57{
58}
59
60#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
61pub struct UsbFunctionMarker;
62
63impl fidl::endpoints::ProtocolMarker for UsbFunctionMarker {
64 type Proxy = UsbFunctionProxy;
65 type RequestStream = UsbFunctionRequestStream;
66 #[cfg(target_os = "fuchsia")]
67 type SynchronousProxy = UsbFunctionSynchronousProxy;
68
69 const DEBUG_NAME: &'static str = "fuchsia.hardware.usb.function.UsbFunction";
70}
71impl fidl::endpoints::DiscoverableProtocolMarker for UsbFunctionMarker {}
72pub type UsbFunctionConnectToEndpointResult = Result<(), i32>;
73pub type UsbFunctionConfigureResult = Result<(), i32>;
74pub type UsbFunctionDeconfigureResult = Result<(), i32>;
75pub type UsbFunctionAllocResourcesResult = Result<(Vec<u8>, Vec<u8>, Vec<u8>), i32>;
76pub type UsbFunctionEndpointSetStallResult = Result<(), i32>;
77pub type UsbFunctionEndpointClearStallResult = Result<(), i32>;
78pub type UsbFunctionConfigureEndpointResult = Result<(), i32>;
79pub type UsbFunctionDisableEndpointResult = Result<(), i32>;
80
81pub trait UsbFunctionProxyInterface: Send + Sync {
82 type ConnectToEndpointResponseFut: std::future::Future<Output = Result<UsbFunctionConnectToEndpointResult, fidl::Error>>
83 + Send;
84 fn r#connect_to_endpoint(
85 &self,
86 ep_addr: u8,
87 ep: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_usb_endpoint::EndpointMarker>,
88 ) -> Self::ConnectToEndpointResponseFut;
89 type ConfigureResponseFut: std::future::Future<Output = Result<UsbFunctionConfigureResult, fidl::Error>>
90 + Send;
91 fn r#configure(
92 &self,
93 configuration: &[u8],
94 iface: fidl::endpoints::ClientEnd<UsbFunctionInterfaceMarker>,
95 ) -> Self::ConfigureResponseFut;
96 type DeconfigureResponseFut: std::future::Future<Output = Result<UsbFunctionDeconfigureResult, fidl::Error>>
97 + Send;
98 fn r#deconfigure(&self) -> Self::DeconfigureResponseFut;
99 type AllocResourcesResponseFut: std::future::Future<Output = Result<UsbFunctionAllocResourcesResult, fidl::Error>>
100 + Send;
101 fn r#alloc_resources(
102 &self,
103 interface_count: u8,
104 endpoints: Vec<EndpointResource>,
105 strings: &[String],
106 ) -> Self::AllocResourcesResponseFut;
107 type EndpointSetStallResponseFut: std::future::Future<Output = Result<UsbFunctionEndpointSetStallResult, fidl::Error>>
108 + Send;
109 fn r#endpoint_set_stall(&self, endpoint_address: u8) -> Self::EndpointSetStallResponseFut;
110 type EndpointClearStallResponseFut: std::future::Future<Output = Result<UsbFunctionEndpointClearStallResult, fidl::Error>>
111 + Send;
112 fn r#endpoint_clear_stall(&self, endpoint_address: u8) -> Self::EndpointClearStallResponseFut;
113 type ConfigureEndpointResponseFut: std::future::Future<Output = Result<UsbFunctionConfigureEndpointResult, fidl::Error>>
114 + Send;
115 fn r#configure_endpoint(
116 &self,
117 endpoint_address: u8,
118 endpoint_configuration: &EndpointConfiguration,
119 ) -> Self::ConfigureEndpointResponseFut;
120 type DisableEndpointResponseFut: std::future::Future<Output = Result<UsbFunctionDisableEndpointResult, fidl::Error>>
121 + Send;
122 fn r#disable_endpoint(&self, endpoint_address: u8) -> Self::DisableEndpointResponseFut;
123}
124#[derive(Debug)]
125#[cfg(target_os = "fuchsia")]
126pub struct UsbFunctionSynchronousProxy {
127 client: fidl::client::sync::Client,
128}
129
130#[cfg(target_os = "fuchsia")]
131impl fidl::endpoints::SynchronousProxy for UsbFunctionSynchronousProxy {
132 type Proxy = UsbFunctionProxy;
133 type Protocol = UsbFunctionMarker;
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 UsbFunctionSynchronousProxy {
150 pub fn new(channel: fidl::Channel) -> Self {
151 Self { client: fidl::client::sync::Client::new(channel) }
152 }
153
154 pub fn into_channel(self) -> fidl::Channel {
155 self.client.into_channel()
156 }
157
158 pub fn wait_for_event(
161 &self,
162 deadline: zx::MonotonicInstant,
163 ) -> Result<UsbFunctionEvent, fidl::Error> {
164 UsbFunctionEvent::decode(self.client.wait_for_event::<UsbFunctionMarker>(deadline)?)
165 }
166
167 pub fn r#connect_to_endpoint(
193 &self,
194 mut ep_addr: u8,
195 mut ep: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_usb_endpoint::EndpointMarker>,
196 ___deadline: zx::MonotonicInstant,
197 ) -> Result<UsbFunctionConnectToEndpointResult, fidl::Error> {
198 let _response = self.client.send_query::<
199 UsbFunctionConnectToEndpointRequest,
200 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
201 UsbFunctionMarker,
202 >(
203 (ep_addr, ep,),
204 0x11541c67eb1b7f8,
205 fidl::encoding::DynamicFlags::empty(),
206 ___deadline,
207 )?;
208 Ok(_response.map(|x| x))
209 }
210
211 pub fn r#configure(
255 &self,
256 mut configuration: &[u8],
257 mut iface: fidl::endpoints::ClientEnd<UsbFunctionInterfaceMarker>,
258 ___deadline: zx::MonotonicInstant,
259 ) -> Result<UsbFunctionConfigureResult, fidl::Error> {
260 let _response = self.client.send_query::<
261 UsbFunctionConfigureRequest,
262 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
263 UsbFunctionMarker,
264 >(
265 (configuration, iface,),
266 0x42a444f4abf08b89,
267 fidl::encoding::DynamicFlags::empty(),
268 ___deadline,
269 )?;
270 Ok(_response.map(|x| x))
271 }
272
273 pub fn r#deconfigure(
289 &self,
290 ___deadline: zx::MonotonicInstant,
291 ) -> Result<UsbFunctionDeconfigureResult, fidl::Error> {
292 let _response = self.client.send_query::<
293 fidl::encoding::EmptyPayload,
294 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
295 UsbFunctionMarker,
296 >(
297 (),
298 0x26ee8c8c826367b2,
299 fidl::encoding::DynamicFlags::empty(),
300 ___deadline,
301 )?;
302 Ok(_response.map(|x| x))
303 }
304
305 pub fn r#alloc_resources(
339 &self,
340 mut interface_count: u8,
341 mut endpoints: Vec<EndpointResource>,
342 mut strings: &[String],
343 ___deadline: zx::MonotonicInstant,
344 ) -> Result<UsbFunctionAllocResourcesResult, fidl::Error> {
345 let _response = self.client.send_query::<
346 UsbFunctionAllocResourcesRequest,
347 fidl::encoding::ResultType<UsbFunctionAllocResourcesResponse, i32>,
348 UsbFunctionMarker,
349 >(
350 (interface_count, endpoints.as_mut(), strings,),
351 0x5ab7133ab195daa0,
352 fidl::encoding::DynamicFlags::empty(),
353 ___deadline,
354 )?;
355 Ok(_response.map(|x| (x.interface_nums, x.endpoint_addrs, x.string_indices)))
356 }
357
358 pub fn r#endpoint_set_stall(
372 &self,
373 mut endpoint_address: u8,
374 ___deadline: zx::MonotonicInstant,
375 ) -> Result<UsbFunctionEndpointSetStallResult, fidl::Error> {
376 let _response = self.client.send_query::<
377 UsbFunctionEndpointSetStallRequest,
378 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
379 UsbFunctionMarker,
380 >(
381 (endpoint_address,),
382 0x1f32c374dac955f1,
383 fidl::encoding::DynamicFlags::empty(),
384 ___deadline,
385 )?;
386 Ok(_response.map(|x| x))
387 }
388
389 pub fn r#endpoint_clear_stall(
403 &self,
404 mut endpoint_address: u8,
405 ___deadline: zx::MonotonicInstant,
406 ) -> Result<UsbFunctionEndpointClearStallResult, fidl::Error> {
407 let _response = self.client.send_query::<
408 UsbFunctionEndpointClearStallRequest,
409 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
410 UsbFunctionMarker,
411 >(
412 (endpoint_address,),
413 0x221d9488ac58aaba,
414 fidl::encoding::DynamicFlags::empty(),
415 ___deadline,
416 )?;
417 Ok(_response.map(|x| x))
418 }
419
420 pub fn r#configure_endpoint(
441 &self,
442 mut endpoint_address: u8,
443 mut endpoint_configuration: &EndpointConfiguration,
444 ___deadline: zx::MonotonicInstant,
445 ) -> Result<UsbFunctionConfigureEndpointResult, fidl::Error> {
446 let _response = self.client.send_query::<
447 UsbFunctionConfigureEndpointRequest,
448 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
449 UsbFunctionMarker,
450 >(
451 (endpoint_address, endpoint_configuration,),
452 0x314c9dc3c37ebb7c,
453 fidl::encoding::DynamicFlags::empty(),
454 ___deadline,
455 )?;
456 Ok(_response.map(|x| x))
457 }
458
459 pub fn r#disable_endpoint(
475 &self,
476 mut endpoint_address: u8,
477 ___deadline: zx::MonotonicInstant,
478 ) -> Result<UsbFunctionDisableEndpointResult, fidl::Error> {
479 let _response = self.client.send_query::<
480 UsbFunctionDisableEndpointRequest,
481 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
482 UsbFunctionMarker,
483 >(
484 (endpoint_address,),
485 0x112a132561499b6e,
486 fidl::encoding::DynamicFlags::empty(),
487 ___deadline,
488 )?;
489 Ok(_response.map(|x| x))
490 }
491}
492
493#[cfg(target_os = "fuchsia")]
494impl From<UsbFunctionSynchronousProxy> for zx::NullableHandle {
495 fn from(value: UsbFunctionSynchronousProxy) -> Self {
496 value.into_channel().into()
497 }
498}
499
500#[cfg(target_os = "fuchsia")]
501impl From<fidl::Channel> for UsbFunctionSynchronousProxy {
502 fn from(value: fidl::Channel) -> Self {
503 Self::new(value)
504 }
505}
506
507#[cfg(target_os = "fuchsia")]
508impl fidl::endpoints::FromClient for UsbFunctionSynchronousProxy {
509 type Protocol = UsbFunctionMarker;
510
511 fn from_client(value: fidl::endpoints::ClientEnd<UsbFunctionMarker>) -> Self {
512 Self::new(value.into_channel())
513 }
514}
515
516#[derive(Debug, Clone)]
517pub struct UsbFunctionProxy {
518 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
519}
520
521impl fidl::endpoints::Proxy for UsbFunctionProxy {
522 type Protocol = UsbFunctionMarker;
523
524 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
525 Self::new(inner)
526 }
527
528 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
529 self.client.into_channel().map_err(|client| Self { client })
530 }
531
532 fn as_channel(&self) -> &::fidl::AsyncChannel {
533 self.client.as_channel()
534 }
535}
536
537impl UsbFunctionProxy {
538 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
540 let protocol_name = <UsbFunctionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
541 Self { client: fidl::client::Client::new(channel, protocol_name) }
542 }
543
544 pub fn take_event_stream(&self) -> UsbFunctionEventStream {
550 UsbFunctionEventStream { event_receiver: self.client.take_event_receiver() }
551 }
552
553 pub fn r#connect_to_endpoint(
579 &self,
580 mut ep_addr: u8,
581 mut ep: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_usb_endpoint::EndpointMarker>,
582 ) -> fidl::client::QueryResponseFut<
583 UsbFunctionConnectToEndpointResult,
584 fidl::encoding::DefaultFuchsiaResourceDialect,
585 > {
586 UsbFunctionProxyInterface::r#connect_to_endpoint(self, ep_addr, ep)
587 }
588
589 pub fn r#configure(
633 &self,
634 mut configuration: &[u8],
635 mut iface: fidl::endpoints::ClientEnd<UsbFunctionInterfaceMarker>,
636 ) -> fidl::client::QueryResponseFut<
637 UsbFunctionConfigureResult,
638 fidl::encoding::DefaultFuchsiaResourceDialect,
639 > {
640 UsbFunctionProxyInterface::r#configure(self, configuration, iface)
641 }
642
643 pub fn r#deconfigure(
659 &self,
660 ) -> fidl::client::QueryResponseFut<
661 UsbFunctionDeconfigureResult,
662 fidl::encoding::DefaultFuchsiaResourceDialect,
663 > {
664 UsbFunctionProxyInterface::r#deconfigure(self)
665 }
666
667 pub fn r#alloc_resources(
701 &self,
702 mut interface_count: u8,
703 mut endpoints: Vec<EndpointResource>,
704 mut strings: &[String],
705 ) -> fidl::client::QueryResponseFut<
706 UsbFunctionAllocResourcesResult,
707 fidl::encoding::DefaultFuchsiaResourceDialect,
708 > {
709 UsbFunctionProxyInterface::r#alloc_resources(self, interface_count, endpoints, strings)
710 }
711
712 pub fn r#endpoint_set_stall(
726 &self,
727 mut endpoint_address: u8,
728 ) -> fidl::client::QueryResponseFut<
729 UsbFunctionEndpointSetStallResult,
730 fidl::encoding::DefaultFuchsiaResourceDialect,
731 > {
732 UsbFunctionProxyInterface::r#endpoint_set_stall(self, endpoint_address)
733 }
734
735 pub fn r#endpoint_clear_stall(
749 &self,
750 mut endpoint_address: u8,
751 ) -> fidl::client::QueryResponseFut<
752 UsbFunctionEndpointClearStallResult,
753 fidl::encoding::DefaultFuchsiaResourceDialect,
754 > {
755 UsbFunctionProxyInterface::r#endpoint_clear_stall(self, endpoint_address)
756 }
757
758 pub fn r#configure_endpoint(
779 &self,
780 mut endpoint_address: u8,
781 mut endpoint_configuration: &EndpointConfiguration,
782 ) -> fidl::client::QueryResponseFut<
783 UsbFunctionConfigureEndpointResult,
784 fidl::encoding::DefaultFuchsiaResourceDialect,
785 > {
786 UsbFunctionProxyInterface::r#configure_endpoint(
787 self,
788 endpoint_address,
789 endpoint_configuration,
790 )
791 }
792
793 pub fn r#disable_endpoint(
809 &self,
810 mut endpoint_address: u8,
811 ) -> fidl::client::QueryResponseFut<
812 UsbFunctionDisableEndpointResult,
813 fidl::encoding::DefaultFuchsiaResourceDialect,
814 > {
815 UsbFunctionProxyInterface::r#disable_endpoint(self, endpoint_address)
816 }
817}
818
819impl UsbFunctionProxyInterface for UsbFunctionProxy {
820 type ConnectToEndpointResponseFut = fidl::client::QueryResponseFut<
821 UsbFunctionConnectToEndpointResult,
822 fidl::encoding::DefaultFuchsiaResourceDialect,
823 >;
824 fn r#connect_to_endpoint(
825 &self,
826 mut ep_addr: u8,
827 mut ep: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_usb_endpoint::EndpointMarker>,
828 ) -> Self::ConnectToEndpointResponseFut {
829 fn _decode(
830 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
831 ) -> Result<UsbFunctionConnectToEndpointResult, fidl::Error> {
832 let _response = fidl::client::decode_transaction_body::<
833 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
834 fidl::encoding::DefaultFuchsiaResourceDialect,
835 0x11541c67eb1b7f8,
836 >(_buf?)?;
837 Ok(_response.map(|x| x))
838 }
839 self.client.send_query_and_decode::<
840 UsbFunctionConnectToEndpointRequest,
841 UsbFunctionConnectToEndpointResult,
842 >(
843 (ep_addr, ep,),
844 0x11541c67eb1b7f8,
845 fidl::encoding::DynamicFlags::empty(),
846 _decode,
847 )
848 }
849
850 type ConfigureResponseFut = fidl::client::QueryResponseFut<
851 UsbFunctionConfigureResult,
852 fidl::encoding::DefaultFuchsiaResourceDialect,
853 >;
854 fn r#configure(
855 &self,
856 mut configuration: &[u8],
857 mut iface: fidl::endpoints::ClientEnd<UsbFunctionInterfaceMarker>,
858 ) -> Self::ConfigureResponseFut {
859 fn _decode(
860 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
861 ) -> Result<UsbFunctionConfigureResult, fidl::Error> {
862 let _response = fidl::client::decode_transaction_body::<
863 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
864 fidl::encoding::DefaultFuchsiaResourceDialect,
865 0x42a444f4abf08b89,
866 >(_buf?)?;
867 Ok(_response.map(|x| x))
868 }
869 self.client
870 .send_query_and_decode::<UsbFunctionConfigureRequest, UsbFunctionConfigureResult>(
871 (configuration, iface),
872 0x42a444f4abf08b89,
873 fidl::encoding::DynamicFlags::empty(),
874 _decode,
875 )
876 }
877
878 type DeconfigureResponseFut = fidl::client::QueryResponseFut<
879 UsbFunctionDeconfigureResult,
880 fidl::encoding::DefaultFuchsiaResourceDialect,
881 >;
882 fn r#deconfigure(&self) -> Self::DeconfigureResponseFut {
883 fn _decode(
884 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
885 ) -> Result<UsbFunctionDeconfigureResult, fidl::Error> {
886 let _response = fidl::client::decode_transaction_body::<
887 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
888 fidl::encoding::DefaultFuchsiaResourceDialect,
889 0x26ee8c8c826367b2,
890 >(_buf?)?;
891 Ok(_response.map(|x| x))
892 }
893 self.client
894 .send_query_and_decode::<fidl::encoding::EmptyPayload, UsbFunctionDeconfigureResult>(
895 (),
896 0x26ee8c8c826367b2,
897 fidl::encoding::DynamicFlags::empty(),
898 _decode,
899 )
900 }
901
902 type AllocResourcesResponseFut = fidl::client::QueryResponseFut<
903 UsbFunctionAllocResourcesResult,
904 fidl::encoding::DefaultFuchsiaResourceDialect,
905 >;
906 fn r#alloc_resources(
907 &self,
908 mut interface_count: u8,
909 mut endpoints: Vec<EndpointResource>,
910 mut strings: &[String],
911 ) -> Self::AllocResourcesResponseFut {
912 fn _decode(
913 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
914 ) -> Result<UsbFunctionAllocResourcesResult, fidl::Error> {
915 let _response = fidl::client::decode_transaction_body::<
916 fidl::encoding::ResultType<UsbFunctionAllocResourcesResponse, i32>,
917 fidl::encoding::DefaultFuchsiaResourceDialect,
918 0x5ab7133ab195daa0,
919 >(_buf?)?;
920 Ok(_response.map(|x| (x.interface_nums, x.endpoint_addrs, x.string_indices)))
921 }
922 self.client.send_query_and_decode::<
923 UsbFunctionAllocResourcesRequest,
924 UsbFunctionAllocResourcesResult,
925 >(
926 (interface_count, endpoints.as_mut(), strings,),
927 0x5ab7133ab195daa0,
928 fidl::encoding::DynamicFlags::empty(),
929 _decode,
930 )
931 }
932
933 type EndpointSetStallResponseFut = fidl::client::QueryResponseFut<
934 UsbFunctionEndpointSetStallResult,
935 fidl::encoding::DefaultFuchsiaResourceDialect,
936 >;
937 fn r#endpoint_set_stall(&self, mut endpoint_address: u8) -> Self::EndpointSetStallResponseFut {
938 fn _decode(
939 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
940 ) -> Result<UsbFunctionEndpointSetStallResult, fidl::Error> {
941 let _response = fidl::client::decode_transaction_body::<
942 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
943 fidl::encoding::DefaultFuchsiaResourceDialect,
944 0x1f32c374dac955f1,
945 >(_buf?)?;
946 Ok(_response.map(|x| x))
947 }
948 self.client.send_query_and_decode::<
949 UsbFunctionEndpointSetStallRequest,
950 UsbFunctionEndpointSetStallResult,
951 >(
952 (endpoint_address,),
953 0x1f32c374dac955f1,
954 fidl::encoding::DynamicFlags::empty(),
955 _decode,
956 )
957 }
958
959 type EndpointClearStallResponseFut = fidl::client::QueryResponseFut<
960 UsbFunctionEndpointClearStallResult,
961 fidl::encoding::DefaultFuchsiaResourceDialect,
962 >;
963 fn r#endpoint_clear_stall(
964 &self,
965 mut endpoint_address: u8,
966 ) -> Self::EndpointClearStallResponseFut {
967 fn _decode(
968 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
969 ) -> Result<UsbFunctionEndpointClearStallResult, fidl::Error> {
970 let _response = fidl::client::decode_transaction_body::<
971 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
972 fidl::encoding::DefaultFuchsiaResourceDialect,
973 0x221d9488ac58aaba,
974 >(_buf?)?;
975 Ok(_response.map(|x| x))
976 }
977 self.client.send_query_and_decode::<
978 UsbFunctionEndpointClearStallRequest,
979 UsbFunctionEndpointClearStallResult,
980 >(
981 (endpoint_address,),
982 0x221d9488ac58aaba,
983 fidl::encoding::DynamicFlags::empty(),
984 _decode,
985 )
986 }
987
988 type ConfigureEndpointResponseFut = fidl::client::QueryResponseFut<
989 UsbFunctionConfigureEndpointResult,
990 fidl::encoding::DefaultFuchsiaResourceDialect,
991 >;
992 fn r#configure_endpoint(
993 &self,
994 mut endpoint_address: u8,
995 mut endpoint_configuration: &EndpointConfiguration,
996 ) -> Self::ConfigureEndpointResponseFut {
997 fn _decode(
998 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
999 ) -> Result<UsbFunctionConfigureEndpointResult, fidl::Error> {
1000 let _response = fidl::client::decode_transaction_body::<
1001 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1002 fidl::encoding::DefaultFuchsiaResourceDialect,
1003 0x314c9dc3c37ebb7c,
1004 >(_buf?)?;
1005 Ok(_response.map(|x| x))
1006 }
1007 self.client.send_query_and_decode::<
1008 UsbFunctionConfigureEndpointRequest,
1009 UsbFunctionConfigureEndpointResult,
1010 >(
1011 (endpoint_address, endpoint_configuration,),
1012 0x314c9dc3c37ebb7c,
1013 fidl::encoding::DynamicFlags::empty(),
1014 _decode,
1015 )
1016 }
1017
1018 type DisableEndpointResponseFut = fidl::client::QueryResponseFut<
1019 UsbFunctionDisableEndpointResult,
1020 fidl::encoding::DefaultFuchsiaResourceDialect,
1021 >;
1022 fn r#disable_endpoint(&self, mut endpoint_address: u8) -> Self::DisableEndpointResponseFut {
1023 fn _decode(
1024 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1025 ) -> Result<UsbFunctionDisableEndpointResult, fidl::Error> {
1026 let _response = fidl::client::decode_transaction_body::<
1027 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1028 fidl::encoding::DefaultFuchsiaResourceDialect,
1029 0x112a132561499b6e,
1030 >(_buf?)?;
1031 Ok(_response.map(|x| x))
1032 }
1033 self.client.send_query_and_decode::<
1034 UsbFunctionDisableEndpointRequest,
1035 UsbFunctionDisableEndpointResult,
1036 >(
1037 (endpoint_address,),
1038 0x112a132561499b6e,
1039 fidl::encoding::DynamicFlags::empty(),
1040 _decode,
1041 )
1042 }
1043}
1044
1045pub struct UsbFunctionEventStream {
1046 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1047}
1048
1049impl std::marker::Unpin for UsbFunctionEventStream {}
1050
1051impl futures::stream::FusedStream for UsbFunctionEventStream {
1052 fn is_terminated(&self) -> bool {
1053 self.event_receiver.is_terminated()
1054 }
1055}
1056
1057impl futures::Stream for UsbFunctionEventStream {
1058 type Item = Result<UsbFunctionEvent, fidl::Error>;
1059
1060 fn poll_next(
1061 mut self: std::pin::Pin<&mut Self>,
1062 cx: &mut std::task::Context<'_>,
1063 ) -> std::task::Poll<Option<Self::Item>> {
1064 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1065 &mut self.event_receiver,
1066 cx
1067 )?) {
1068 Some(buf) => std::task::Poll::Ready(Some(UsbFunctionEvent::decode(buf))),
1069 None => std::task::Poll::Ready(None),
1070 }
1071 }
1072}
1073
1074#[derive(Debug)]
1075pub enum UsbFunctionEvent {}
1076
1077impl UsbFunctionEvent {
1078 fn decode(
1080 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1081 ) -> Result<UsbFunctionEvent, fidl::Error> {
1082 let (bytes, _handles) = buf.split_mut();
1083 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1084 debug_assert_eq!(tx_header.tx_id, 0);
1085 match tx_header.ordinal {
1086 _ => Err(fidl::Error::UnknownOrdinal {
1087 ordinal: tx_header.ordinal,
1088 protocol_name: <UsbFunctionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1089 }),
1090 }
1091 }
1092}
1093
1094pub struct UsbFunctionRequestStream {
1096 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1097 is_terminated: bool,
1098}
1099
1100impl std::marker::Unpin for UsbFunctionRequestStream {}
1101
1102impl futures::stream::FusedStream for UsbFunctionRequestStream {
1103 fn is_terminated(&self) -> bool {
1104 self.is_terminated
1105 }
1106}
1107
1108impl fidl::endpoints::RequestStream for UsbFunctionRequestStream {
1109 type Protocol = UsbFunctionMarker;
1110 type ControlHandle = UsbFunctionControlHandle;
1111
1112 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1113 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1114 }
1115
1116 fn control_handle(&self) -> Self::ControlHandle {
1117 UsbFunctionControlHandle { inner: self.inner.clone() }
1118 }
1119
1120 fn into_inner(
1121 self,
1122 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1123 {
1124 (self.inner, self.is_terminated)
1125 }
1126
1127 fn from_inner(
1128 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1129 is_terminated: bool,
1130 ) -> Self {
1131 Self { inner, is_terminated }
1132 }
1133}
1134
1135impl futures::Stream for UsbFunctionRequestStream {
1136 type Item = Result<UsbFunctionRequest, fidl::Error>;
1137
1138 fn poll_next(
1139 mut self: std::pin::Pin<&mut Self>,
1140 cx: &mut std::task::Context<'_>,
1141 ) -> std::task::Poll<Option<Self::Item>> {
1142 let this = &mut *self;
1143 if this.inner.check_shutdown(cx) {
1144 this.is_terminated = true;
1145 return std::task::Poll::Ready(None);
1146 }
1147 if this.is_terminated {
1148 panic!("polled UsbFunctionRequestStream after completion");
1149 }
1150 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1151 |bytes, handles| {
1152 match this.inner.channel().read_etc(cx, bytes, handles) {
1153 std::task::Poll::Ready(Ok(())) => {}
1154 std::task::Poll::Pending => return std::task::Poll::Pending,
1155 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1156 this.is_terminated = true;
1157 return std::task::Poll::Ready(None);
1158 }
1159 std::task::Poll::Ready(Err(e)) => {
1160 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1161 e.into(),
1162 ))));
1163 }
1164 }
1165
1166 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1168
1169 std::task::Poll::Ready(Some(match header.ordinal {
1170 0x11541c67eb1b7f8 => {
1171 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1172 let mut req = fidl::new_empty!(
1173 UsbFunctionConnectToEndpointRequest,
1174 fidl::encoding::DefaultFuchsiaResourceDialect
1175 );
1176 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UsbFunctionConnectToEndpointRequest>(&header, _body_bytes, handles, &mut req)?;
1177 let control_handle = UsbFunctionControlHandle { inner: this.inner.clone() };
1178 Ok(UsbFunctionRequest::ConnectToEndpoint {
1179 ep_addr: req.ep_addr,
1180 ep: req.ep,
1181
1182 responder: UsbFunctionConnectToEndpointResponder {
1183 control_handle: std::mem::ManuallyDrop::new(control_handle),
1184 tx_id: header.tx_id,
1185 },
1186 })
1187 }
1188 0x42a444f4abf08b89 => {
1189 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1190 let mut req = fidl::new_empty!(
1191 UsbFunctionConfigureRequest,
1192 fidl::encoding::DefaultFuchsiaResourceDialect
1193 );
1194 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UsbFunctionConfigureRequest>(&header, _body_bytes, handles, &mut req)?;
1195 let control_handle = UsbFunctionControlHandle { inner: this.inner.clone() };
1196 Ok(UsbFunctionRequest::Configure {
1197 configuration: req.configuration,
1198 iface: req.iface,
1199
1200 responder: UsbFunctionConfigureResponder {
1201 control_handle: std::mem::ManuallyDrop::new(control_handle),
1202 tx_id: header.tx_id,
1203 },
1204 })
1205 }
1206 0x26ee8c8c826367b2 => {
1207 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1208 let mut req = fidl::new_empty!(
1209 fidl::encoding::EmptyPayload,
1210 fidl::encoding::DefaultFuchsiaResourceDialect
1211 );
1212 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1213 let control_handle = UsbFunctionControlHandle { inner: this.inner.clone() };
1214 Ok(UsbFunctionRequest::Deconfigure {
1215 responder: UsbFunctionDeconfigureResponder {
1216 control_handle: std::mem::ManuallyDrop::new(control_handle),
1217 tx_id: header.tx_id,
1218 },
1219 })
1220 }
1221 0x5ab7133ab195daa0 => {
1222 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1223 let mut req = fidl::new_empty!(
1224 UsbFunctionAllocResourcesRequest,
1225 fidl::encoding::DefaultFuchsiaResourceDialect
1226 );
1227 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UsbFunctionAllocResourcesRequest>(&header, _body_bytes, handles, &mut req)?;
1228 let control_handle = UsbFunctionControlHandle { inner: this.inner.clone() };
1229 Ok(UsbFunctionRequest::AllocResources {
1230 interface_count: req.interface_count,
1231 endpoints: req.endpoints,
1232 strings: req.strings,
1233
1234 responder: UsbFunctionAllocResourcesResponder {
1235 control_handle: std::mem::ManuallyDrop::new(control_handle),
1236 tx_id: header.tx_id,
1237 },
1238 })
1239 }
1240 0x1f32c374dac955f1 => {
1241 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1242 let mut req = fidl::new_empty!(
1243 UsbFunctionEndpointSetStallRequest,
1244 fidl::encoding::DefaultFuchsiaResourceDialect
1245 );
1246 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UsbFunctionEndpointSetStallRequest>(&header, _body_bytes, handles, &mut req)?;
1247 let control_handle = UsbFunctionControlHandle { inner: this.inner.clone() };
1248 Ok(UsbFunctionRequest::EndpointSetStall {
1249 endpoint_address: req.endpoint_address,
1250
1251 responder: UsbFunctionEndpointSetStallResponder {
1252 control_handle: std::mem::ManuallyDrop::new(control_handle),
1253 tx_id: header.tx_id,
1254 },
1255 })
1256 }
1257 0x221d9488ac58aaba => {
1258 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1259 let mut req = fidl::new_empty!(
1260 UsbFunctionEndpointClearStallRequest,
1261 fidl::encoding::DefaultFuchsiaResourceDialect
1262 );
1263 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UsbFunctionEndpointClearStallRequest>(&header, _body_bytes, handles, &mut req)?;
1264 let control_handle = UsbFunctionControlHandle { inner: this.inner.clone() };
1265 Ok(UsbFunctionRequest::EndpointClearStall {
1266 endpoint_address: req.endpoint_address,
1267
1268 responder: UsbFunctionEndpointClearStallResponder {
1269 control_handle: std::mem::ManuallyDrop::new(control_handle),
1270 tx_id: header.tx_id,
1271 },
1272 })
1273 }
1274 0x314c9dc3c37ebb7c => {
1275 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1276 let mut req = fidl::new_empty!(
1277 UsbFunctionConfigureEndpointRequest,
1278 fidl::encoding::DefaultFuchsiaResourceDialect
1279 );
1280 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UsbFunctionConfigureEndpointRequest>(&header, _body_bytes, handles, &mut req)?;
1281 let control_handle = UsbFunctionControlHandle { inner: this.inner.clone() };
1282 Ok(UsbFunctionRequest::ConfigureEndpoint {
1283 endpoint_address: req.endpoint_address,
1284 endpoint_configuration: req.endpoint_configuration,
1285
1286 responder: UsbFunctionConfigureEndpointResponder {
1287 control_handle: std::mem::ManuallyDrop::new(control_handle),
1288 tx_id: header.tx_id,
1289 },
1290 })
1291 }
1292 0x112a132561499b6e => {
1293 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1294 let mut req = fidl::new_empty!(
1295 UsbFunctionDisableEndpointRequest,
1296 fidl::encoding::DefaultFuchsiaResourceDialect
1297 );
1298 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UsbFunctionDisableEndpointRequest>(&header, _body_bytes, handles, &mut req)?;
1299 let control_handle = UsbFunctionControlHandle { inner: this.inner.clone() };
1300 Ok(UsbFunctionRequest::DisableEndpoint {
1301 endpoint_address: req.endpoint_address,
1302
1303 responder: UsbFunctionDisableEndpointResponder {
1304 control_handle: std::mem::ManuallyDrop::new(control_handle),
1305 tx_id: header.tx_id,
1306 },
1307 })
1308 }
1309 _ => Err(fidl::Error::UnknownOrdinal {
1310 ordinal: header.ordinal,
1311 protocol_name:
1312 <UsbFunctionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1313 }),
1314 }))
1315 },
1316 )
1317 }
1318}
1319
1320#[derive(Debug)]
1328pub enum UsbFunctionRequest {
1329 ConnectToEndpoint {
1355 ep_addr: u8,
1356 ep: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_usb_endpoint::EndpointMarker>,
1357 responder: UsbFunctionConnectToEndpointResponder,
1358 },
1359 Configure {
1403 configuration: Vec<u8>,
1404 iface: fidl::endpoints::ClientEnd<UsbFunctionInterfaceMarker>,
1405 responder: UsbFunctionConfigureResponder,
1406 },
1407 Deconfigure { responder: UsbFunctionDeconfigureResponder },
1423 AllocResources {
1457 interface_count: u8,
1458 endpoints: Vec<EndpointResource>,
1459 strings: Vec<String>,
1460 responder: UsbFunctionAllocResourcesResponder,
1461 },
1462 EndpointSetStall { endpoint_address: u8, responder: UsbFunctionEndpointSetStallResponder },
1476 EndpointClearStall { endpoint_address: u8, responder: UsbFunctionEndpointClearStallResponder },
1490 ConfigureEndpoint {
1511 endpoint_address: u8,
1512 endpoint_configuration: EndpointConfiguration,
1513 responder: UsbFunctionConfigureEndpointResponder,
1514 },
1515 DisableEndpoint { endpoint_address: u8, responder: UsbFunctionDisableEndpointResponder },
1531}
1532
1533impl UsbFunctionRequest {
1534 #[allow(irrefutable_let_patterns)]
1535 pub fn into_connect_to_endpoint(
1536 self,
1537 ) -> Option<(
1538 u8,
1539 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_usb_endpoint::EndpointMarker>,
1540 UsbFunctionConnectToEndpointResponder,
1541 )> {
1542 if let UsbFunctionRequest::ConnectToEndpoint { ep_addr, ep, responder } = self {
1543 Some((ep_addr, ep, responder))
1544 } else {
1545 None
1546 }
1547 }
1548
1549 #[allow(irrefutable_let_patterns)]
1550 pub fn into_configure(
1551 self,
1552 ) -> Option<(
1553 Vec<u8>,
1554 fidl::endpoints::ClientEnd<UsbFunctionInterfaceMarker>,
1555 UsbFunctionConfigureResponder,
1556 )> {
1557 if let UsbFunctionRequest::Configure { configuration, iface, responder } = self {
1558 Some((configuration, iface, responder))
1559 } else {
1560 None
1561 }
1562 }
1563
1564 #[allow(irrefutable_let_patterns)]
1565 pub fn into_deconfigure(self) -> Option<(UsbFunctionDeconfigureResponder)> {
1566 if let UsbFunctionRequest::Deconfigure { responder } = self {
1567 Some((responder))
1568 } else {
1569 None
1570 }
1571 }
1572
1573 #[allow(irrefutable_let_patterns)]
1574 pub fn into_alloc_resources(
1575 self,
1576 ) -> Option<(u8, Vec<EndpointResource>, Vec<String>, UsbFunctionAllocResourcesResponder)> {
1577 if let UsbFunctionRequest::AllocResources {
1578 interface_count,
1579 endpoints,
1580 strings,
1581 responder,
1582 } = self
1583 {
1584 Some((interface_count, endpoints, strings, responder))
1585 } else {
1586 None
1587 }
1588 }
1589
1590 #[allow(irrefutable_let_patterns)]
1591 pub fn into_endpoint_set_stall(self) -> Option<(u8, UsbFunctionEndpointSetStallResponder)> {
1592 if let UsbFunctionRequest::EndpointSetStall { endpoint_address, responder } = self {
1593 Some((endpoint_address, responder))
1594 } else {
1595 None
1596 }
1597 }
1598
1599 #[allow(irrefutable_let_patterns)]
1600 pub fn into_endpoint_clear_stall(self) -> Option<(u8, UsbFunctionEndpointClearStallResponder)> {
1601 if let UsbFunctionRequest::EndpointClearStall { endpoint_address, responder } = self {
1602 Some((endpoint_address, responder))
1603 } else {
1604 None
1605 }
1606 }
1607
1608 #[allow(irrefutable_let_patterns)]
1609 pub fn into_configure_endpoint(
1610 self,
1611 ) -> Option<(u8, EndpointConfiguration, UsbFunctionConfigureEndpointResponder)> {
1612 if let UsbFunctionRequest::ConfigureEndpoint {
1613 endpoint_address,
1614 endpoint_configuration,
1615 responder,
1616 } = self
1617 {
1618 Some((endpoint_address, endpoint_configuration, responder))
1619 } else {
1620 None
1621 }
1622 }
1623
1624 #[allow(irrefutable_let_patterns)]
1625 pub fn into_disable_endpoint(self) -> Option<(u8, UsbFunctionDisableEndpointResponder)> {
1626 if let UsbFunctionRequest::DisableEndpoint { endpoint_address, responder } = self {
1627 Some((endpoint_address, responder))
1628 } else {
1629 None
1630 }
1631 }
1632
1633 pub fn method_name(&self) -> &'static str {
1635 match *self {
1636 UsbFunctionRequest::ConnectToEndpoint { .. } => "connect_to_endpoint",
1637 UsbFunctionRequest::Configure { .. } => "configure",
1638 UsbFunctionRequest::Deconfigure { .. } => "deconfigure",
1639 UsbFunctionRequest::AllocResources { .. } => "alloc_resources",
1640 UsbFunctionRequest::EndpointSetStall { .. } => "endpoint_set_stall",
1641 UsbFunctionRequest::EndpointClearStall { .. } => "endpoint_clear_stall",
1642 UsbFunctionRequest::ConfigureEndpoint { .. } => "configure_endpoint",
1643 UsbFunctionRequest::DisableEndpoint { .. } => "disable_endpoint",
1644 }
1645 }
1646}
1647
1648#[derive(Debug, Clone)]
1649pub struct UsbFunctionControlHandle {
1650 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1651}
1652
1653impl UsbFunctionControlHandle {
1654 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1655 self.inner.shutdown_with_epitaph(status.into())
1656 }
1657}
1658
1659impl fidl::endpoints::ControlHandle for UsbFunctionControlHandle {
1660 fn shutdown(&self) {
1661 self.inner.shutdown()
1662 }
1663
1664 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1665 self.inner.shutdown_with_epitaph(status)
1666 }
1667
1668 fn is_closed(&self) -> bool {
1669 self.inner.channel().is_closed()
1670 }
1671 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1672 self.inner.channel().on_closed()
1673 }
1674
1675 #[cfg(target_os = "fuchsia")]
1676 fn signal_peer(
1677 &self,
1678 clear_mask: zx::Signals,
1679 set_mask: zx::Signals,
1680 ) -> Result<(), zx_status::Status> {
1681 use fidl::Peered;
1682 self.inner.channel().signal_peer(clear_mask, set_mask)
1683 }
1684}
1685
1686impl UsbFunctionControlHandle {}
1687
1688#[must_use = "FIDL methods require a response to be sent"]
1689#[derive(Debug)]
1690pub struct UsbFunctionConnectToEndpointResponder {
1691 control_handle: std::mem::ManuallyDrop<UsbFunctionControlHandle>,
1692 tx_id: u32,
1693}
1694
1695impl std::ops::Drop for UsbFunctionConnectToEndpointResponder {
1699 fn drop(&mut self) {
1700 self.control_handle.shutdown();
1701 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1703 }
1704}
1705
1706impl fidl::endpoints::Responder for UsbFunctionConnectToEndpointResponder {
1707 type ControlHandle = UsbFunctionControlHandle;
1708
1709 fn control_handle(&self) -> &UsbFunctionControlHandle {
1710 &self.control_handle
1711 }
1712
1713 fn drop_without_shutdown(mut self) {
1714 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1716 std::mem::forget(self);
1718 }
1719}
1720
1721impl UsbFunctionConnectToEndpointResponder {
1722 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1726 let _result = self.send_raw(result);
1727 if _result.is_err() {
1728 self.control_handle.shutdown();
1729 }
1730 self.drop_without_shutdown();
1731 _result
1732 }
1733
1734 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1736 let _result = self.send_raw(result);
1737 self.drop_without_shutdown();
1738 _result
1739 }
1740
1741 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1742 self.control_handle
1743 .inner
1744 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1745 result,
1746 self.tx_id,
1747 0x11541c67eb1b7f8,
1748 fidl::encoding::DynamicFlags::empty(),
1749 )
1750 }
1751}
1752
1753#[must_use = "FIDL methods require a response to be sent"]
1754#[derive(Debug)]
1755pub struct UsbFunctionConfigureResponder {
1756 control_handle: std::mem::ManuallyDrop<UsbFunctionControlHandle>,
1757 tx_id: u32,
1758}
1759
1760impl std::ops::Drop for UsbFunctionConfigureResponder {
1764 fn drop(&mut self) {
1765 self.control_handle.shutdown();
1766 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1768 }
1769}
1770
1771impl fidl::endpoints::Responder for UsbFunctionConfigureResponder {
1772 type ControlHandle = UsbFunctionControlHandle;
1773
1774 fn control_handle(&self) -> &UsbFunctionControlHandle {
1775 &self.control_handle
1776 }
1777
1778 fn drop_without_shutdown(mut self) {
1779 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1781 std::mem::forget(self);
1783 }
1784}
1785
1786impl UsbFunctionConfigureResponder {
1787 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1791 let _result = self.send_raw(result);
1792 if _result.is_err() {
1793 self.control_handle.shutdown();
1794 }
1795 self.drop_without_shutdown();
1796 _result
1797 }
1798
1799 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1801 let _result = self.send_raw(result);
1802 self.drop_without_shutdown();
1803 _result
1804 }
1805
1806 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1807 self.control_handle
1808 .inner
1809 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1810 result,
1811 self.tx_id,
1812 0x42a444f4abf08b89,
1813 fidl::encoding::DynamicFlags::empty(),
1814 )
1815 }
1816}
1817
1818#[must_use = "FIDL methods require a response to be sent"]
1819#[derive(Debug)]
1820pub struct UsbFunctionDeconfigureResponder {
1821 control_handle: std::mem::ManuallyDrop<UsbFunctionControlHandle>,
1822 tx_id: u32,
1823}
1824
1825impl std::ops::Drop for UsbFunctionDeconfigureResponder {
1829 fn drop(&mut self) {
1830 self.control_handle.shutdown();
1831 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1833 }
1834}
1835
1836impl fidl::endpoints::Responder for UsbFunctionDeconfigureResponder {
1837 type ControlHandle = UsbFunctionControlHandle;
1838
1839 fn control_handle(&self) -> &UsbFunctionControlHandle {
1840 &self.control_handle
1841 }
1842
1843 fn drop_without_shutdown(mut self) {
1844 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1846 std::mem::forget(self);
1848 }
1849}
1850
1851impl UsbFunctionDeconfigureResponder {
1852 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1856 let _result = self.send_raw(result);
1857 if _result.is_err() {
1858 self.control_handle.shutdown();
1859 }
1860 self.drop_without_shutdown();
1861 _result
1862 }
1863
1864 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1866 let _result = self.send_raw(result);
1867 self.drop_without_shutdown();
1868 _result
1869 }
1870
1871 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1872 self.control_handle
1873 .inner
1874 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1875 result,
1876 self.tx_id,
1877 0x26ee8c8c826367b2,
1878 fidl::encoding::DynamicFlags::empty(),
1879 )
1880 }
1881}
1882
1883#[must_use = "FIDL methods require a response to be sent"]
1884#[derive(Debug)]
1885pub struct UsbFunctionAllocResourcesResponder {
1886 control_handle: std::mem::ManuallyDrop<UsbFunctionControlHandle>,
1887 tx_id: u32,
1888}
1889
1890impl std::ops::Drop for UsbFunctionAllocResourcesResponder {
1894 fn drop(&mut self) {
1895 self.control_handle.shutdown();
1896 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1898 }
1899}
1900
1901impl fidl::endpoints::Responder for UsbFunctionAllocResourcesResponder {
1902 type ControlHandle = UsbFunctionControlHandle;
1903
1904 fn control_handle(&self) -> &UsbFunctionControlHandle {
1905 &self.control_handle
1906 }
1907
1908 fn drop_without_shutdown(mut self) {
1909 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1911 std::mem::forget(self);
1913 }
1914}
1915
1916impl UsbFunctionAllocResourcesResponder {
1917 pub fn send(self, mut result: Result<(&[u8], &[u8], &[u8]), i32>) -> Result<(), fidl::Error> {
1921 let _result = self.send_raw(result);
1922 if _result.is_err() {
1923 self.control_handle.shutdown();
1924 }
1925 self.drop_without_shutdown();
1926 _result
1927 }
1928
1929 pub fn send_no_shutdown_on_err(
1931 self,
1932 mut result: Result<(&[u8], &[u8], &[u8]), i32>,
1933 ) -> Result<(), fidl::Error> {
1934 let _result = self.send_raw(result);
1935 self.drop_without_shutdown();
1936 _result
1937 }
1938
1939 fn send_raw(&self, mut result: Result<(&[u8], &[u8], &[u8]), i32>) -> Result<(), fidl::Error> {
1940 self.control_handle
1941 .inner
1942 .send::<fidl::encoding::ResultType<UsbFunctionAllocResourcesResponse, i32>>(
1943 result,
1944 self.tx_id,
1945 0x5ab7133ab195daa0,
1946 fidl::encoding::DynamicFlags::empty(),
1947 )
1948 }
1949}
1950
1951#[must_use = "FIDL methods require a response to be sent"]
1952#[derive(Debug)]
1953pub struct UsbFunctionEndpointSetStallResponder {
1954 control_handle: std::mem::ManuallyDrop<UsbFunctionControlHandle>,
1955 tx_id: u32,
1956}
1957
1958impl std::ops::Drop for UsbFunctionEndpointSetStallResponder {
1962 fn drop(&mut self) {
1963 self.control_handle.shutdown();
1964 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1966 }
1967}
1968
1969impl fidl::endpoints::Responder for UsbFunctionEndpointSetStallResponder {
1970 type ControlHandle = UsbFunctionControlHandle;
1971
1972 fn control_handle(&self) -> &UsbFunctionControlHandle {
1973 &self.control_handle
1974 }
1975
1976 fn drop_without_shutdown(mut self) {
1977 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1979 std::mem::forget(self);
1981 }
1982}
1983
1984impl UsbFunctionEndpointSetStallResponder {
1985 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1989 let _result = self.send_raw(result);
1990 if _result.is_err() {
1991 self.control_handle.shutdown();
1992 }
1993 self.drop_without_shutdown();
1994 _result
1995 }
1996
1997 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1999 let _result = self.send_raw(result);
2000 self.drop_without_shutdown();
2001 _result
2002 }
2003
2004 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2005 self.control_handle
2006 .inner
2007 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2008 result,
2009 self.tx_id,
2010 0x1f32c374dac955f1,
2011 fidl::encoding::DynamicFlags::empty(),
2012 )
2013 }
2014}
2015
2016#[must_use = "FIDL methods require a response to be sent"]
2017#[derive(Debug)]
2018pub struct UsbFunctionEndpointClearStallResponder {
2019 control_handle: std::mem::ManuallyDrop<UsbFunctionControlHandle>,
2020 tx_id: u32,
2021}
2022
2023impl std::ops::Drop for UsbFunctionEndpointClearStallResponder {
2027 fn drop(&mut self) {
2028 self.control_handle.shutdown();
2029 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2031 }
2032}
2033
2034impl fidl::endpoints::Responder for UsbFunctionEndpointClearStallResponder {
2035 type ControlHandle = UsbFunctionControlHandle;
2036
2037 fn control_handle(&self) -> &UsbFunctionControlHandle {
2038 &self.control_handle
2039 }
2040
2041 fn drop_without_shutdown(mut self) {
2042 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2044 std::mem::forget(self);
2046 }
2047}
2048
2049impl UsbFunctionEndpointClearStallResponder {
2050 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2054 let _result = self.send_raw(result);
2055 if _result.is_err() {
2056 self.control_handle.shutdown();
2057 }
2058 self.drop_without_shutdown();
2059 _result
2060 }
2061
2062 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2064 let _result = self.send_raw(result);
2065 self.drop_without_shutdown();
2066 _result
2067 }
2068
2069 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2070 self.control_handle
2071 .inner
2072 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2073 result,
2074 self.tx_id,
2075 0x221d9488ac58aaba,
2076 fidl::encoding::DynamicFlags::empty(),
2077 )
2078 }
2079}
2080
2081#[must_use = "FIDL methods require a response to be sent"]
2082#[derive(Debug)]
2083pub struct UsbFunctionConfigureEndpointResponder {
2084 control_handle: std::mem::ManuallyDrop<UsbFunctionControlHandle>,
2085 tx_id: u32,
2086}
2087
2088impl std::ops::Drop for UsbFunctionConfigureEndpointResponder {
2092 fn drop(&mut self) {
2093 self.control_handle.shutdown();
2094 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2096 }
2097}
2098
2099impl fidl::endpoints::Responder for UsbFunctionConfigureEndpointResponder {
2100 type ControlHandle = UsbFunctionControlHandle;
2101
2102 fn control_handle(&self) -> &UsbFunctionControlHandle {
2103 &self.control_handle
2104 }
2105
2106 fn drop_without_shutdown(mut self) {
2107 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2109 std::mem::forget(self);
2111 }
2112}
2113
2114impl UsbFunctionConfigureEndpointResponder {
2115 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2119 let _result = self.send_raw(result);
2120 if _result.is_err() {
2121 self.control_handle.shutdown();
2122 }
2123 self.drop_without_shutdown();
2124 _result
2125 }
2126
2127 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2129 let _result = self.send_raw(result);
2130 self.drop_without_shutdown();
2131 _result
2132 }
2133
2134 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2135 self.control_handle
2136 .inner
2137 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2138 result,
2139 self.tx_id,
2140 0x314c9dc3c37ebb7c,
2141 fidl::encoding::DynamicFlags::empty(),
2142 )
2143 }
2144}
2145
2146#[must_use = "FIDL methods require a response to be sent"]
2147#[derive(Debug)]
2148pub struct UsbFunctionDisableEndpointResponder {
2149 control_handle: std::mem::ManuallyDrop<UsbFunctionControlHandle>,
2150 tx_id: u32,
2151}
2152
2153impl std::ops::Drop for UsbFunctionDisableEndpointResponder {
2157 fn drop(&mut self) {
2158 self.control_handle.shutdown();
2159 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2161 }
2162}
2163
2164impl fidl::endpoints::Responder for UsbFunctionDisableEndpointResponder {
2165 type ControlHandle = UsbFunctionControlHandle;
2166
2167 fn control_handle(&self) -> &UsbFunctionControlHandle {
2168 &self.control_handle
2169 }
2170
2171 fn drop_without_shutdown(mut self) {
2172 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2174 std::mem::forget(self);
2176 }
2177}
2178
2179impl UsbFunctionDisableEndpointResponder {
2180 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2184 let _result = self.send_raw(result);
2185 if _result.is_err() {
2186 self.control_handle.shutdown();
2187 }
2188 self.drop_without_shutdown();
2189 _result
2190 }
2191
2192 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2194 let _result = self.send_raw(result);
2195 self.drop_without_shutdown();
2196 _result
2197 }
2198
2199 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2200 self.control_handle
2201 .inner
2202 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2203 result,
2204 self.tx_id,
2205 0x112a132561499b6e,
2206 fidl::encoding::DynamicFlags::empty(),
2207 )
2208 }
2209}
2210
2211#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2212pub struct UsbFunctionInterfaceMarker;
2213
2214impl fidl::endpoints::ProtocolMarker for UsbFunctionInterfaceMarker {
2215 type Proxy = UsbFunctionInterfaceProxy;
2216 type RequestStream = UsbFunctionInterfaceRequestStream;
2217 #[cfg(target_os = "fuchsia")]
2218 type SynchronousProxy = UsbFunctionInterfaceSynchronousProxy;
2219
2220 const DEBUG_NAME: &'static str = "(anonymous) UsbFunctionInterface";
2221}
2222pub type UsbFunctionInterfaceControlResult = Result<Vec<u8>, i32>;
2223pub type UsbFunctionInterfaceSetConfiguredResult = Result<(), i32>;
2224pub type UsbFunctionInterfaceSetInterfaceResult = Result<(), i32>;
2225
2226pub trait UsbFunctionInterfaceProxyInterface: Send + Sync {
2227 type ControlResponseFut: std::future::Future<Output = Result<UsbFunctionInterfaceControlResult, fidl::Error>>
2228 + Send;
2229 fn r#control(
2230 &self,
2231 setup: &fidl_fuchsia_hardware_usb_descriptor::UsbSetup,
2232 write: &[u8],
2233 ) -> Self::ControlResponseFut;
2234 type SetConfiguredResponseFut: std::future::Future<Output = Result<UsbFunctionInterfaceSetConfiguredResult, fidl::Error>>
2235 + Send;
2236 fn r#set_configured(
2237 &self,
2238 configured: bool,
2239 speed: fidl_fuchsia_hardware_usb_descriptor::UsbSpeed,
2240 ) -> Self::SetConfiguredResponseFut;
2241 type SetInterfaceResponseFut: std::future::Future<Output = Result<UsbFunctionInterfaceSetInterfaceResult, fidl::Error>>
2242 + Send;
2243 fn r#set_interface(&self, interface: u8, alt_setting: u8) -> Self::SetInterfaceResponseFut;
2244}
2245#[derive(Debug)]
2246#[cfg(target_os = "fuchsia")]
2247pub struct UsbFunctionInterfaceSynchronousProxy {
2248 client: fidl::client::sync::Client,
2249}
2250
2251#[cfg(target_os = "fuchsia")]
2252impl fidl::endpoints::SynchronousProxy for UsbFunctionInterfaceSynchronousProxy {
2253 type Proxy = UsbFunctionInterfaceProxy;
2254 type Protocol = UsbFunctionInterfaceMarker;
2255
2256 fn from_channel(inner: fidl::Channel) -> Self {
2257 Self::new(inner)
2258 }
2259
2260 fn into_channel(self) -> fidl::Channel {
2261 self.client.into_channel()
2262 }
2263
2264 fn as_channel(&self) -> &fidl::Channel {
2265 self.client.as_channel()
2266 }
2267}
2268
2269#[cfg(target_os = "fuchsia")]
2270impl UsbFunctionInterfaceSynchronousProxy {
2271 pub fn new(channel: fidl::Channel) -> Self {
2272 Self { client: fidl::client::sync::Client::new(channel) }
2273 }
2274
2275 pub fn into_channel(self) -> fidl::Channel {
2276 self.client.into_channel()
2277 }
2278
2279 pub fn wait_for_event(
2282 &self,
2283 deadline: zx::MonotonicInstant,
2284 ) -> Result<UsbFunctionInterfaceEvent, fidl::Error> {
2285 UsbFunctionInterfaceEvent::decode(
2286 self.client.wait_for_event::<UsbFunctionInterfaceMarker>(deadline)?,
2287 )
2288 }
2289
2290 pub fn r#control(
2315 &self,
2316 mut setup: &fidl_fuchsia_hardware_usb_descriptor::UsbSetup,
2317 mut write: &[u8],
2318 ___deadline: zx::MonotonicInstant,
2319 ) -> Result<UsbFunctionInterfaceControlResult, fidl::Error> {
2320 let _response = self.client.send_query::<
2321 UsbFunctionInterfaceControlRequest,
2322 fidl::encoding::FlexibleResultType<UsbFunctionInterfaceControlResponse, i32>,
2323 UsbFunctionInterfaceMarker,
2324 >(
2325 (setup, write,),
2326 0x3cce27231c012cff,
2327 fidl::encoding::DynamicFlags::FLEXIBLE,
2328 ___deadline,
2329 )?
2330 .into_result::<UsbFunctionInterfaceMarker>("control")?;
2331 Ok(_response.map(|x| x.read))
2332 }
2333
2334 pub fn r#set_configured(
2364 &self,
2365 mut configured: bool,
2366 mut speed: fidl_fuchsia_hardware_usb_descriptor::UsbSpeed,
2367 ___deadline: zx::MonotonicInstant,
2368 ) -> Result<UsbFunctionInterfaceSetConfiguredResult, fidl::Error> {
2369 let _response = self.client.send_query::<
2370 UsbFunctionInterfaceSetConfiguredRequest,
2371 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
2372 UsbFunctionInterfaceMarker,
2373 >(
2374 (configured, speed,),
2375 0x5c26cc1f53f57a72,
2376 fidl::encoding::DynamicFlags::FLEXIBLE,
2377 ___deadline,
2378 )?
2379 .into_result::<UsbFunctionInterfaceMarker>("set_configured")?;
2380 Ok(_response.map(|x| x))
2381 }
2382
2383 pub fn r#set_interface(
2409 &self,
2410 mut interface: u8,
2411 mut alt_setting: u8,
2412 ___deadline: zx::MonotonicInstant,
2413 ) -> Result<UsbFunctionInterfaceSetInterfaceResult, fidl::Error> {
2414 let _response = self.client.send_query::<
2415 UsbFunctionInterfaceSetInterfaceRequest,
2416 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
2417 UsbFunctionInterfaceMarker,
2418 >(
2419 (interface, alt_setting,),
2420 0x42ebdcefc1543f32,
2421 fidl::encoding::DynamicFlags::FLEXIBLE,
2422 ___deadline,
2423 )?
2424 .into_result::<UsbFunctionInterfaceMarker>("set_interface")?;
2425 Ok(_response.map(|x| x))
2426 }
2427}
2428
2429#[cfg(target_os = "fuchsia")]
2430impl From<UsbFunctionInterfaceSynchronousProxy> for zx::NullableHandle {
2431 fn from(value: UsbFunctionInterfaceSynchronousProxy) -> Self {
2432 value.into_channel().into()
2433 }
2434}
2435
2436#[cfg(target_os = "fuchsia")]
2437impl From<fidl::Channel> for UsbFunctionInterfaceSynchronousProxy {
2438 fn from(value: fidl::Channel) -> Self {
2439 Self::new(value)
2440 }
2441}
2442
2443#[cfg(target_os = "fuchsia")]
2444impl fidl::endpoints::FromClient for UsbFunctionInterfaceSynchronousProxy {
2445 type Protocol = UsbFunctionInterfaceMarker;
2446
2447 fn from_client(value: fidl::endpoints::ClientEnd<UsbFunctionInterfaceMarker>) -> Self {
2448 Self::new(value.into_channel())
2449 }
2450}
2451
2452#[derive(Debug, Clone)]
2453pub struct UsbFunctionInterfaceProxy {
2454 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2455}
2456
2457impl fidl::endpoints::Proxy for UsbFunctionInterfaceProxy {
2458 type Protocol = UsbFunctionInterfaceMarker;
2459
2460 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2461 Self::new(inner)
2462 }
2463
2464 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2465 self.client.into_channel().map_err(|client| Self { client })
2466 }
2467
2468 fn as_channel(&self) -> &::fidl::AsyncChannel {
2469 self.client.as_channel()
2470 }
2471}
2472
2473impl UsbFunctionInterfaceProxy {
2474 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2476 let protocol_name =
2477 <UsbFunctionInterfaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2478 Self { client: fidl::client::Client::new(channel, protocol_name) }
2479 }
2480
2481 pub fn take_event_stream(&self) -> UsbFunctionInterfaceEventStream {
2487 UsbFunctionInterfaceEventStream { event_receiver: self.client.take_event_receiver() }
2488 }
2489
2490 pub fn r#control(
2515 &self,
2516 mut setup: &fidl_fuchsia_hardware_usb_descriptor::UsbSetup,
2517 mut write: &[u8],
2518 ) -> fidl::client::QueryResponseFut<
2519 UsbFunctionInterfaceControlResult,
2520 fidl::encoding::DefaultFuchsiaResourceDialect,
2521 > {
2522 UsbFunctionInterfaceProxyInterface::r#control(self, setup, write)
2523 }
2524
2525 pub fn r#set_configured(
2555 &self,
2556 mut configured: bool,
2557 mut speed: fidl_fuchsia_hardware_usb_descriptor::UsbSpeed,
2558 ) -> fidl::client::QueryResponseFut<
2559 UsbFunctionInterfaceSetConfiguredResult,
2560 fidl::encoding::DefaultFuchsiaResourceDialect,
2561 > {
2562 UsbFunctionInterfaceProxyInterface::r#set_configured(self, configured, speed)
2563 }
2564
2565 pub fn r#set_interface(
2591 &self,
2592 mut interface: u8,
2593 mut alt_setting: u8,
2594 ) -> fidl::client::QueryResponseFut<
2595 UsbFunctionInterfaceSetInterfaceResult,
2596 fidl::encoding::DefaultFuchsiaResourceDialect,
2597 > {
2598 UsbFunctionInterfaceProxyInterface::r#set_interface(self, interface, alt_setting)
2599 }
2600}
2601
2602impl UsbFunctionInterfaceProxyInterface for UsbFunctionInterfaceProxy {
2603 type ControlResponseFut = fidl::client::QueryResponseFut<
2604 UsbFunctionInterfaceControlResult,
2605 fidl::encoding::DefaultFuchsiaResourceDialect,
2606 >;
2607 fn r#control(
2608 &self,
2609 mut setup: &fidl_fuchsia_hardware_usb_descriptor::UsbSetup,
2610 mut write: &[u8],
2611 ) -> Self::ControlResponseFut {
2612 fn _decode(
2613 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2614 ) -> Result<UsbFunctionInterfaceControlResult, fidl::Error> {
2615 let _response = fidl::client::decode_transaction_body::<
2616 fidl::encoding::FlexibleResultType<UsbFunctionInterfaceControlResponse, i32>,
2617 fidl::encoding::DefaultFuchsiaResourceDialect,
2618 0x3cce27231c012cff,
2619 >(_buf?)?
2620 .into_result::<UsbFunctionInterfaceMarker>("control")?;
2621 Ok(_response.map(|x| x.read))
2622 }
2623 self.client.send_query_and_decode::<
2624 UsbFunctionInterfaceControlRequest,
2625 UsbFunctionInterfaceControlResult,
2626 >(
2627 (setup, write,),
2628 0x3cce27231c012cff,
2629 fidl::encoding::DynamicFlags::FLEXIBLE,
2630 _decode,
2631 )
2632 }
2633
2634 type SetConfiguredResponseFut = fidl::client::QueryResponseFut<
2635 UsbFunctionInterfaceSetConfiguredResult,
2636 fidl::encoding::DefaultFuchsiaResourceDialect,
2637 >;
2638 fn r#set_configured(
2639 &self,
2640 mut configured: bool,
2641 mut speed: fidl_fuchsia_hardware_usb_descriptor::UsbSpeed,
2642 ) -> Self::SetConfiguredResponseFut {
2643 fn _decode(
2644 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2645 ) -> Result<UsbFunctionInterfaceSetConfiguredResult, fidl::Error> {
2646 let _response = fidl::client::decode_transaction_body::<
2647 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
2648 fidl::encoding::DefaultFuchsiaResourceDialect,
2649 0x5c26cc1f53f57a72,
2650 >(_buf?)?
2651 .into_result::<UsbFunctionInterfaceMarker>("set_configured")?;
2652 Ok(_response.map(|x| x))
2653 }
2654 self.client.send_query_and_decode::<
2655 UsbFunctionInterfaceSetConfiguredRequest,
2656 UsbFunctionInterfaceSetConfiguredResult,
2657 >(
2658 (configured, speed,),
2659 0x5c26cc1f53f57a72,
2660 fidl::encoding::DynamicFlags::FLEXIBLE,
2661 _decode,
2662 )
2663 }
2664
2665 type SetInterfaceResponseFut = fidl::client::QueryResponseFut<
2666 UsbFunctionInterfaceSetInterfaceResult,
2667 fidl::encoding::DefaultFuchsiaResourceDialect,
2668 >;
2669 fn r#set_interface(
2670 &self,
2671 mut interface: u8,
2672 mut alt_setting: u8,
2673 ) -> Self::SetInterfaceResponseFut {
2674 fn _decode(
2675 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2676 ) -> Result<UsbFunctionInterfaceSetInterfaceResult, fidl::Error> {
2677 let _response = fidl::client::decode_transaction_body::<
2678 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
2679 fidl::encoding::DefaultFuchsiaResourceDialect,
2680 0x42ebdcefc1543f32,
2681 >(_buf?)?
2682 .into_result::<UsbFunctionInterfaceMarker>("set_interface")?;
2683 Ok(_response.map(|x| x))
2684 }
2685 self.client.send_query_and_decode::<
2686 UsbFunctionInterfaceSetInterfaceRequest,
2687 UsbFunctionInterfaceSetInterfaceResult,
2688 >(
2689 (interface, alt_setting,),
2690 0x42ebdcefc1543f32,
2691 fidl::encoding::DynamicFlags::FLEXIBLE,
2692 _decode,
2693 )
2694 }
2695}
2696
2697pub struct UsbFunctionInterfaceEventStream {
2698 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2699}
2700
2701impl std::marker::Unpin for UsbFunctionInterfaceEventStream {}
2702
2703impl futures::stream::FusedStream for UsbFunctionInterfaceEventStream {
2704 fn is_terminated(&self) -> bool {
2705 self.event_receiver.is_terminated()
2706 }
2707}
2708
2709impl futures::Stream for UsbFunctionInterfaceEventStream {
2710 type Item = Result<UsbFunctionInterfaceEvent, fidl::Error>;
2711
2712 fn poll_next(
2713 mut self: std::pin::Pin<&mut Self>,
2714 cx: &mut std::task::Context<'_>,
2715 ) -> std::task::Poll<Option<Self::Item>> {
2716 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2717 &mut self.event_receiver,
2718 cx
2719 )?) {
2720 Some(buf) => std::task::Poll::Ready(Some(UsbFunctionInterfaceEvent::decode(buf))),
2721 None => std::task::Poll::Ready(None),
2722 }
2723 }
2724}
2725
2726#[derive(Debug)]
2727pub enum UsbFunctionInterfaceEvent {
2728 #[non_exhaustive]
2729 _UnknownEvent {
2730 ordinal: u64,
2732 },
2733}
2734
2735impl UsbFunctionInterfaceEvent {
2736 fn decode(
2738 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2739 ) -> Result<UsbFunctionInterfaceEvent, fidl::Error> {
2740 let (bytes, _handles) = buf.split_mut();
2741 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2742 debug_assert_eq!(tx_header.tx_id, 0);
2743 match tx_header.ordinal {
2744 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2745 Ok(UsbFunctionInterfaceEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2746 }
2747 _ => Err(fidl::Error::UnknownOrdinal {
2748 ordinal: tx_header.ordinal,
2749 protocol_name:
2750 <UsbFunctionInterfaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2751 }),
2752 }
2753 }
2754}
2755
2756pub struct UsbFunctionInterfaceRequestStream {
2758 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2759 is_terminated: bool,
2760}
2761
2762impl std::marker::Unpin for UsbFunctionInterfaceRequestStream {}
2763
2764impl futures::stream::FusedStream for UsbFunctionInterfaceRequestStream {
2765 fn is_terminated(&self) -> bool {
2766 self.is_terminated
2767 }
2768}
2769
2770impl fidl::endpoints::RequestStream for UsbFunctionInterfaceRequestStream {
2771 type Protocol = UsbFunctionInterfaceMarker;
2772 type ControlHandle = UsbFunctionInterfaceControlHandle;
2773
2774 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2775 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2776 }
2777
2778 fn control_handle(&self) -> Self::ControlHandle {
2779 UsbFunctionInterfaceControlHandle { inner: self.inner.clone() }
2780 }
2781
2782 fn into_inner(
2783 self,
2784 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2785 {
2786 (self.inner, self.is_terminated)
2787 }
2788
2789 fn from_inner(
2790 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2791 is_terminated: bool,
2792 ) -> Self {
2793 Self { inner, is_terminated }
2794 }
2795}
2796
2797impl futures::Stream for UsbFunctionInterfaceRequestStream {
2798 type Item = Result<UsbFunctionInterfaceRequest, fidl::Error>;
2799
2800 fn poll_next(
2801 mut self: std::pin::Pin<&mut Self>,
2802 cx: &mut std::task::Context<'_>,
2803 ) -> std::task::Poll<Option<Self::Item>> {
2804 let this = &mut *self;
2805 if this.inner.check_shutdown(cx) {
2806 this.is_terminated = true;
2807 return std::task::Poll::Ready(None);
2808 }
2809 if this.is_terminated {
2810 panic!("polled UsbFunctionInterfaceRequestStream after completion");
2811 }
2812 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2813 |bytes, handles| {
2814 match this.inner.channel().read_etc(cx, bytes, handles) {
2815 std::task::Poll::Ready(Ok(())) => {}
2816 std::task::Poll::Pending => return std::task::Poll::Pending,
2817 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2818 this.is_terminated = true;
2819 return std::task::Poll::Ready(None);
2820 }
2821 std::task::Poll::Ready(Err(e)) => {
2822 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2823 e.into(),
2824 ))));
2825 }
2826 }
2827
2828 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2830
2831 std::task::Poll::Ready(Some(match header.ordinal {
2832 0x3cce27231c012cff => {
2833 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2834 let mut req = fidl::new_empty!(UsbFunctionInterfaceControlRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2835 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UsbFunctionInterfaceControlRequest>(&header, _body_bytes, handles, &mut req)?;
2836 let control_handle = UsbFunctionInterfaceControlHandle {
2837 inner: this.inner.clone(),
2838 };
2839 Ok(UsbFunctionInterfaceRequest::Control {setup: req.setup,
2840write: req.write,
2841
2842 responder: UsbFunctionInterfaceControlResponder {
2843 control_handle: std::mem::ManuallyDrop::new(control_handle),
2844 tx_id: header.tx_id,
2845 },
2846 })
2847 }
2848 0x5c26cc1f53f57a72 => {
2849 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2850 let mut req = fidl::new_empty!(UsbFunctionInterfaceSetConfiguredRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2851 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UsbFunctionInterfaceSetConfiguredRequest>(&header, _body_bytes, handles, &mut req)?;
2852 let control_handle = UsbFunctionInterfaceControlHandle {
2853 inner: this.inner.clone(),
2854 };
2855 Ok(UsbFunctionInterfaceRequest::SetConfigured {configured: req.configured,
2856speed: req.speed,
2857
2858 responder: UsbFunctionInterfaceSetConfiguredResponder {
2859 control_handle: std::mem::ManuallyDrop::new(control_handle),
2860 tx_id: header.tx_id,
2861 },
2862 })
2863 }
2864 0x42ebdcefc1543f32 => {
2865 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2866 let mut req = fidl::new_empty!(UsbFunctionInterfaceSetInterfaceRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2867 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UsbFunctionInterfaceSetInterfaceRequest>(&header, _body_bytes, handles, &mut req)?;
2868 let control_handle = UsbFunctionInterfaceControlHandle {
2869 inner: this.inner.clone(),
2870 };
2871 Ok(UsbFunctionInterfaceRequest::SetInterface {interface: req.interface,
2872alt_setting: req.alt_setting,
2873
2874 responder: UsbFunctionInterfaceSetInterfaceResponder {
2875 control_handle: std::mem::ManuallyDrop::new(control_handle),
2876 tx_id: header.tx_id,
2877 },
2878 })
2879 }
2880 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2881 Ok(UsbFunctionInterfaceRequest::_UnknownMethod {
2882 ordinal: header.ordinal,
2883 control_handle: UsbFunctionInterfaceControlHandle { inner: this.inner.clone() },
2884 method_type: fidl::MethodType::OneWay,
2885 })
2886 }
2887 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2888 this.inner.send_framework_err(
2889 fidl::encoding::FrameworkErr::UnknownMethod,
2890 header.tx_id,
2891 header.ordinal,
2892 header.dynamic_flags(),
2893 (bytes, handles),
2894 )?;
2895 Ok(UsbFunctionInterfaceRequest::_UnknownMethod {
2896 ordinal: header.ordinal,
2897 control_handle: UsbFunctionInterfaceControlHandle { inner: this.inner.clone() },
2898 method_type: fidl::MethodType::TwoWay,
2899 })
2900 }
2901 _ => Err(fidl::Error::UnknownOrdinal {
2902 ordinal: header.ordinal,
2903 protocol_name: <UsbFunctionInterfaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2904 }),
2905 }))
2906 },
2907 )
2908 }
2909}
2910
2911#[derive(Debug)]
2917pub enum UsbFunctionInterfaceRequest {
2918 Control {
2943 setup: fidl_fuchsia_hardware_usb_descriptor::UsbSetup,
2944 write: Vec<u8>,
2945 responder: UsbFunctionInterfaceControlResponder,
2946 },
2947 SetConfigured {
2977 configured: bool,
2978 speed: fidl_fuchsia_hardware_usb_descriptor::UsbSpeed,
2979 responder: UsbFunctionInterfaceSetConfiguredResponder,
2980 },
2981 SetInterface {
3007 interface: u8,
3008 alt_setting: u8,
3009 responder: UsbFunctionInterfaceSetInterfaceResponder,
3010 },
3011 #[non_exhaustive]
3013 _UnknownMethod {
3014 ordinal: u64,
3016 control_handle: UsbFunctionInterfaceControlHandle,
3017 method_type: fidl::MethodType,
3018 },
3019}
3020
3021impl UsbFunctionInterfaceRequest {
3022 #[allow(irrefutable_let_patterns)]
3023 pub fn into_control(
3024 self,
3025 ) -> Option<(
3026 fidl_fuchsia_hardware_usb_descriptor::UsbSetup,
3027 Vec<u8>,
3028 UsbFunctionInterfaceControlResponder,
3029 )> {
3030 if let UsbFunctionInterfaceRequest::Control { setup, write, responder } = self {
3031 Some((setup, write, responder))
3032 } else {
3033 None
3034 }
3035 }
3036
3037 #[allow(irrefutable_let_patterns)]
3038 pub fn into_set_configured(
3039 self,
3040 ) -> Option<(
3041 bool,
3042 fidl_fuchsia_hardware_usb_descriptor::UsbSpeed,
3043 UsbFunctionInterfaceSetConfiguredResponder,
3044 )> {
3045 if let UsbFunctionInterfaceRequest::SetConfigured { configured, speed, responder } = self {
3046 Some((configured, speed, responder))
3047 } else {
3048 None
3049 }
3050 }
3051
3052 #[allow(irrefutable_let_patterns)]
3053 pub fn into_set_interface(self) -> Option<(u8, u8, UsbFunctionInterfaceSetInterfaceResponder)> {
3054 if let UsbFunctionInterfaceRequest::SetInterface { interface, alt_setting, responder } =
3055 self
3056 {
3057 Some((interface, alt_setting, responder))
3058 } else {
3059 None
3060 }
3061 }
3062
3063 pub fn method_name(&self) -> &'static str {
3065 match *self {
3066 UsbFunctionInterfaceRequest::Control { .. } => "control",
3067 UsbFunctionInterfaceRequest::SetConfigured { .. } => "set_configured",
3068 UsbFunctionInterfaceRequest::SetInterface { .. } => "set_interface",
3069 UsbFunctionInterfaceRequest::_UnknownMethod {
3070 method_type: fidl::MethodType::OneWay,
3071 ..
3072 } => "unknown one-way method",
3073 UsbFunctionInterfaceRequest::_UnknownMethod {
3074 method_type: fidl::MethodType::TwoWay,
3075 ..
3076 } => "unknown two-way method",
3077 }
3078 }
3079}
3080
3081#[derive(Debug, Clone)]
3082pub struct UsbFunctionInterfaceControlHandle {
3083 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3084}
3085
3086impl UsbFunctionInterfaceControlHandle {
3087 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
3088 self.inner.shutdown_with_epitaph(status.into())
3089 }
3090}
3091
3092impl fidl::endpoints::ControlHandle for UsbFunctionInterfaceControlHandle {
3093 fn shutdown(&self) {
3094 self.inner.shutdown()
3095 }
3096
3097 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
3098 self.inner.shutdown_with_epitaph(status)
3099 }
3100
3101 fn is_closed(&self) -> bool {
3102 self.inner.channel().is_closed()
3103 }
3104 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3105 self.inner.channel().on_closed()
3106 }
3107
3108 #[cfg(target_os = "fuchsia")]
3109 fn signal_peer(
3110 &self,
3111 clear_mask: zx::Signals,
3112 set_mask: zx::Signals,
3113 ) -> Result<(), zx_status::Status> {
3114 use fidl::Peered;
3115 self.inner.channel().signal_peer(clear_mask, set_mask)
3116 }
3117}
3118
3119impl UsbFunctionInterfaceControlHandle {}
3120
3121#[must_use = "FIDL methods require a response to be sent"]
3122#[derive(Debug)]
3123pub struct UsbFunctionInterfaceControlResponder {
3124 control_handle: std::mem::ManuallyDrop<UsbFunctionInterfaceControlHandle>,
3125 tx_id: u32,
3126}
3127
3128impl std::ops::Drop for UsbFunctionInterfaceControlResponder {
3132 fn drop(&mut self) {
3133 self.control_handle.shutdown();
3134 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3136 }
3137}
3138
3139impl fidl::endpoints::Responder for UsbFunctionInterfaceControlResponder {
3140 type ControlHandle = UsbFunctionInterfaceControlHandle;
3141
3142 fn control_handle(&self) -> &UsbFunctionInterfaceControlHandle {
3143 &self.control_handle
3144 }
3145
3146 fn drop_without_shutdown(mut self) {
3147 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3149 std::mem::forget(self);
3151 }
3152}
3153
3154impl UsbFunctionInterfaceControlResponder {
3155 pub fn send(self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
3159 let _result = self.send_raw(result);
3160 if _result.is_err() {
3161 self.control_handle.shutdown();
3162 }
3163 self.drop_without_shutdown();
3164 _result
3165 }
3166
3167 pub fn send_no_shutdown_on_err(
3169 self,
3170 mut result: Result<&[u8], i32>,
3171 ) -> Result<(), fidl::Error> {
3172 let _result = self.send_raw(result);
3173 self.drop_without_shutdown();
3174 _result
3175 }
3176
3177 fn send_raw(&self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
3178 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3179 UsbFunctionInterfaceControlResponse,
3180 i32,
3181 >>(
3182 fidl::encoding::FlexibleResult::new(result.map(|read| (read,))),
3183 self.tx_id,
3184 0x3cce27231c012cff,
3185 fidl::encoding::DynamicFlags::FLEXIBLE,
3186 )
3187 }
3188}
3189
3190#[must_use = "FIDL methods require a response to be sent"]
3191#[derive(Debug)]
3192pub struct UsbFunctionInterfaceSetConfiguredResponder {
3193 control_handle: std::mem::ManuallyDrop<UsbFunctionInterfaceControlHandle>,
3194 tx_id: u32,
3195}
3196
3197impl std::ops::Drop for UsbFunctionInterfaceSetConfiguredResponder {
3201 fn drop(&mut self) {
3202 self.control_handle.shutdown();
3203 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3205 }
3206}
3207
3208impl fidl::endpoints::Responder for UsbFunctionInterfaceSetConfiguredResponder {
3209 type ControlHandle = UsbFunctionInterfaceControlHandle;
3210
3211 fn control_handle(&self) -> &UsbFunctionInterfaceControlHandle {
3212 &self.control_handle
3213 }
3214
3215 fn drop_without_shutdown(mut self) {
3216 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3218 std::mem::forget(self);
3220 }
3221}
3222
3223impl UsbFunctionInterfaceSetConfiguredResponder {
3224 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3228 let _result = self.send_raw(result);
3229 if _result.is_err() {
3230 self.control_handle.shutdown();
3231 }
3232 self.drop_without_shutdown();
3233 _result
3234 }
3235
3236 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3238 let _result = self.send_raw(result);
3239 self.drop_without_shutdown();
3240 _result
3241 }
3242
3243 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3244 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3245 fidl::encoding::EmptyStruct,
3246 i32,
3247 >>(
3248 fidl::encoding::FlexibleResult::new(result),
3249 self.tx_id,
3250 0x5c26cc1f53f57a72,
3251 fidl::encoding::DynamicFlags::FLEXIBLE,
3252 )
3253 }
3254}
3255
3256#[must_use = "FIDL methods require a response to be sent"]
3257#[derive(Debug)]
3258pub struct UsbFunctionInterfaceSetInterfaceResponder {
3259 control_handle: std::mem::ManuallyDrop<UsbFunctionInterfaceControlHandle>,
3260 tx_id: u32,
3261}
3262
3263impl std::ops::Drop for UsbFunctionInterfaceSetInterfaceResponder {
3267 fn drop(&mut self) {
3268 self.control_handle.shutdown();
3269 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3271 }
3272}
3273
3274impl fidl::endpoints::Responder for UsbFunctionInterfaceSetInterfaceResponder {
3275 type ControlHandle = UsbFunctionInterfaceControlHandle;
3276
3277 fn control_handle(&self) -> &UsbFunctionInterfaceControlHandle {
3278 &self.control_handle
3279 }
3280
3281 fn drop_without_shutdown(mut self) {
3282 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3284 std::mem::forget(self);
3286 }
3287}
3288
3289impl UsbFunctionInterfaceSetInterfaceResponder {
3290 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3294 let _result = self.send_raw(result);
3295 if _result.is_err() {
3296 self.control_handle.shutdown();
3297 }
3298 self.drop_without_shutdown();
3299 _result
3300 }
3301
3302 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3304 let _result = self.send_raw(result);
3305 self.drop_without_shutdown();
3306 _result
3307 }
3308
3309 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3310 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3311 fidl::encoding::EmptyStruct,
3312 i32,
3313 >>(
3314 fidl::encoding::FlexibleResult::new(result),
3315 self.tx_id,
3316 0x42ebdcefc1543f32,
3317 fidl::encoding::DynamicFlags::FLEXIBLE,
3318 )
3319 }
3320}
3321
3322#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3323pub struct UsbFunctionServiceMarker;
3324
3325#[cfg(target_os = "fuchsia")]
3326impl fidl::endpoints::ServiceMarker for UsbFunctionServiceMarker {
3327 type Proxy = UsbFunctionServiceProxy;
3328 type Request = UsbFunctionServiceRequest;
3329 const SERVICE_NAME: &'static str = "fuchsia.hardware.usb.function.UsbFunctionService";
3330}
3331
3332#[cfg(target_os = "fuchsia")]
3335pub enum UsbFunctionServiceRequest {
3336 Device(UsbFunctionRequestStream),
3337}
3338
3339#[cfg(target_os = "fuchsia")]
3340impl fidl::endpoints::ServiceRequest for UsbFunctionServiceRequest {
3341 type Service = UsbFunctionServiceMarker;
3342
3343 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
3344 match name {
3345 "device" => Self::Device(
3346 <UsbFunctionRequestStream as fidl::endpoints::RequestStream>::from_channel(
3347 _channel,
3348 ),
3349 ),
3350 _ => panic!("no such member protocol name for service UsbFunctionService"),
3351 }
3352 }
3353
3354 fn member_names() -> &'static [&'static str] {
3355 &["device"]
3356 }
3357}
3358#[cfg(target_os = "fuchsia")]
3359pub struct UsbFunctionServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
3360
3361#[cfg(target_os = "fuchsia")]
3362impl fidl::endpoints::ServiceProxy for UsbFunctionServiceProxy {
3363 type Service = UsbFunctionServiceMarker;
3364
3365 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
3366 Self(opener)
3367 }
3368}
3369
3370#[cfg(target_os = "fuchsia")]
3371impl UsbFunctionServiceProxy {
3372 pub fn connect_to_device(&self) -> Result<UsbFunctionProxy, fidl::Error> {
3373 let (proxy, server_end) = fidl::endpoints::create_proxy::<UsbFunctionMarker>();
3374 self.connect_channel_to_device(server_end)?;
3375 Ok(proxy)
3376 }
3377
3378 pub fn connect_to_device_sync(&self) -> Result<UsbFunctionSynchronousProxy, fidl::Error> {
3381 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<UsbFunctionMarker>();
3382 self.connect_channel_to_device(server_end)?;
3383 Ok(proxy)
3384 }
3385
3386 pub fn connect_channel_to_device(
3389 &self,
3390 server_end: fidl::endpoints::ServerEnd<UsbFunctionMarker>,
3391 ) -> Result<(), fidl::Error> {
3392 self.0.open_member("device", server_end.into_channel())
3393 }
3394
3395 pub fn instance_name(&self) -> &str {
3396 self.0.instance_name()
3397 }
3398}
3399
3400mod internal {
3401 use super::*;
3402
3403 impl fidl::encoding::ResourceTypeMarker for EndpointResource {
3404 type Borrowed<'a> = &'a mut Self;
3405 fn take_or_borrow<'a>(
3406 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3407 ) -> Self::Borrowed<'a> {
3408 value
3409 }
3410 }
3411
3412 unsafe impl fidl::encoding::TypeMarker for EndpointResource {
3413 type Owned = Self;
3414
3415 #[inline(always)]
3416 fn inline_align(_context: fidl::encoding::Context) -> usize {
3417 8
3418 }
3419
3420 #[inline(always)]
3421 fn inline_size(_context: fidl::encoding::Context) -> usize {
3422 32
3423 }
3424 }
3425
3426 unsafe impl
3427 fidl::encoding::Encode<EndpointResource, fidl::encoding::DefaultFuchsiaResourceDialect>
3428 for &mut EndpointResource
3429 {
3430 #[inline]
3431 unsafe fn encode(
3432 self,
3433 encoder: &mut fidl::encoding::Encoder<
3434 '_,
3435 fidl::encoding::DefaultFuchsiaResourceDialect,
3436 >,
3437 offset: usize,
3438 _depth: fidl::encoding::Depth,
3439 ) -> fidl::Result<()> {
3440 encoder.debug_check_bounds::<EndpointResource>(offset);
3441 fidl::encoding::Encode::<EndpointResource, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3443 (
3444 <fidl_fuchsia_hardware_usb_descriptor::EndpointDirection as fidl::encoding::ValueTypeMarker>::borrow(&self.direction),
3445 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_usb_endpoint::EndpointMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.endpoint),
3446 <fidl_fuchsia_hardware_usb_endpoint::EndpointInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.ep_info),
3447 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.max_packet_size),
3448 ),
3449 encoder, offset, _depth
3450 )
3451 }
3452 }
3453 unsafe impl<
3454 T0: fidl::encoding::Encode<
3455 fidl_fuchsia_hardware_usb_descriptor::EndpointDirection,
3456 fidl::encoding::DefaultFuchsiaResourceDialect,
3457 >,
3458 T1: fidl::encoding::Encode<
3459 fidl::encoding::Endpoint<
3460 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_usb_endpoint::EndpointMarker>,
3461 >,
3462 fidl::encoding::DefaultFuchsiaResourceDialect,
3463 >,
3464 T2: fidl::encoding::Encode<
3465 fidl_fuchsia_hardware_usb_endpoint::EndpointInfo,
3466 fidl::encoding::DefaultFuchsiaResourceDialect,
3467 >,
3468 T3: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
3469 > fidl::encoding::Encode<EndpointResource, fidl::encoding::DefaultFuchsiaResourceDialect>
3470 for (T0, T1, T2, T3)
3471 {
3472 #[inline]
3473 unsafe fn encode(
3474 self,
3475 encoder: &mut fidl::encoding::Encoder<
3476 '_,
3477 fidl::encoding::DefaultFuchsiaResourceDialect,
3478 >,
3479 offset: usize,
3480 depth: fidl::encoding::Depth,
3481 ) -> fidl::Result<()> {
3482 encoder.debug_check_bounds::<EndpointResource>(offset);
3483 unsafe {
3486 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3487 (ptr as *mut u64).write_unaligned(0);
3488 }
3489 unsafe {
3490 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
3491 (ptr as *mut u64).write_unaligned(0);
3492 }
3493 self.0.encode(encoder, offset + 0, depth)?;
3495 self.1.encode(encoder, offset + 4, depth)?;
3496 self.2.encode(encoder, offset + 8, depth)?;
3497 self.3.encode(encoder, offset + 24, depth)?;
3498 Ok(())
3499 }
3500 }
3501
3502 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3503 for EndpointResource
3504 {
3505 #[inline(always)]
3506 fn new_empty() -> Self {
3507 Self {
3508 direction: fidl::new_empty!(
3509 fidl_fuchsia_hardware_usb_descriptor::EndpointDirection,
3510 fidl::encoding::DefaultFuchsiaResourceDialect
3511 ),
3512 endpoint: fidl::new_empty!(
3513 fidl::encoding::Endpoint<
3514 fidl::endpoints::ServerEnd<
3515 fidl_fuchsia_hardware_usb_endpoint::EndpointMarker,
3516 >,
3517 >,
3518 fidl::encoding::DefaultFuchsiaResourceDialect
3519 ),
3520 ep_info: fidl::new_empty!(
3521 fidl_fuchsia_hardware_usb_endpoint::EndpointInfo,
3522 fidl::encoding::DefaultFuchsiaResourceDialect
3523 ),
3524 max_packet_size: fidl::new_empty!(
3525 u32,
3526 fidl::encoding::DefaultFuchsiaResourceDialect
3527 ),
3528 }
3529 }
3530
3531 #[inline]
3532 unsafe fn decode(
3533 &mut self,
3534 decoder: &mut fidl::encoding::Decoder<
3535 '_,
3536 fidl::encoding::DefaultFuchsiaResourceDialect,
3537 >,
3538 offset: usize,
3539 _depth: fidl::encoding::Depth,
3540 ) -> fidl::Result<()> {
3541 decoder.debug_check_bounds::<Self>(offset);
3542 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3544 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3545 let mask = 0xffffff00u64;
3546 let maskedval = padval & mask;
3547 if maskedval != 0 {
3548 return Err(fidl::Error::NonZeroPadding {
3549 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3550 });
3551 }
3552 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
3553 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3554 let mask = 0xffffffff00000000u64;
3555 let maskedval = padval & mask;
3556 if maskedval != 0 {
3557 return Err(fidl::Error::NonZeroPadding {
3558 padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
3559 });
3560 }
3561 fidl::decode!(
3562 fidl_fuchsia_hardware_usb_descriptor::EndpointDirection,
3563 fidl::encoding::DefaultFuchsiaResourceDialect,
3564 &mut self.direction,
3565 decoder,
3566 offset + 0,
3567 _depth
3568 )?;
3569 fidl::decode!(
3570 fidl::encoding::Endpoint<
3571 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_usb_endpoint::EndpointMarker>,
3572 >,
3573 fidl::encoding::DefaultFuchsiaResourceDialect,
3574 &mut self.endpoint,
3575 decoder,
3576 offset + 4,
3577 _depth
3578 )?;
3579 fidl::decode!(
3580 fidl_fuchsia_hardware_usb_endpoint::EndpointInfo,
3581 fidl::encoding::DefaultFuchsiaResourceDialect,
3582 &mut self.ep_info,
3583 decoder,
3584 offset + 8,
3585 _depth
3586 )?;
3587 fidl::decode!(
3588 u32,
3589 fidl::encoding::DefaultFuchsiaResourceDialect,
3590 &mut self.max_packet_size,
3591 decoder,
3592 offset + 24,
3593 _depth
3594 )?;
3595 Ok(())
3596 }
3597 }
3598
3599 impl fidl::encoding::ResourceTypeMarker for UsbFunctionAllocResourcesRequest {
3600 type Borrowed<'a> = &'a mut Self;
3601 fn take_or_borrow<'a>(
3602 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3603 ) -> Self::Borrowed<'a> {
3604 value
3605 }
3606 }
3607
3608 unsafe impl fidl::encoding::TypeMarker for UsbFunctionAllocResourcesRequest {
3609 type Owned = Self;
3610
3611 #[inline(always)]
3612 fn inline_align(_context: fidl::encoding::Context) -> usize {
3613 8
3614 }
3615
3616 #[inline(always)]
3617 fn inline_size(_context: fidl::encoding::Context) -> usize {
3618 40
3619 }
3620 }
3621
3622 unsafe impl
3623 fidl::encoding::Encode<
3624 UsbFunctionAllocResourcesRequest,
3625 fidl::encoding::DefaultFuchsiaResourceDialect,
3626 > for &mut UsbFunctionAllocResourcesRequest
3627 {
3628 #[inline]
3629 unsafe fn encode(
3630 self,
3631 encoder: &mut fidl::encoding::Encoder<
3632 '_,
3633 fidl::encoding::DefaultFuchsiaResourceDialect,
3634 >,
3635 offset: usize,
3636 _depth: fidl::encoding::Depth,
3637 ) -> fidl::Result<()> {
3638 encoder.debug_check_bounds::<UsbFunctionAllocResourcesRequest>(offset);
3639 fidl::encoding::Encode::<UsbFunctionAllocResourcesRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3641 (
3642 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.interface_count),
3643 <fidl::encoding::Vector<EndpointResource, 255> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.endpoints),
3644 <fidl::encoding::Vector<fidl::encoding::BoundedString<126>, 255> as fidl::encoding::ValueTypeMarker>::borrow(&self.strings),
3645 ),
3646 encoder, offset, _depth
3647 )
3648 }
3649 }
3650 unsafe impl<
3651 T0: fidl::encoding::Encode<u8, fidl::encoding::DefaultFuchsiaResourceDialect>,
3652 T1: fidl::encoding::Encode<
3653 fidl::encoding::Vector<EndpointResource, 255>,
3654 fidl::encoding::DefaultFuchsiaResourceDialect,
3655 >,
3656 T2: fidl::encoding::Encode<
3657 fidl::encoding::Vector<fidl::encoding::BoundedString<126>, 255>,
3658 fidl::encoding::DefaultFuchsiaResourceDialect,
3659 >,
3660 >
3661 fidl::encoding::Encode<
3662 UsbFunctionAllocResourcesRequest,
3663 fidl::encoding::DefaultFuchsiaResourceDialect,
3664 > for (T0, T1, T2)
3665 {
3666 #[inline]
3667 unsafe fn encode(
3668 self,
3669 encoder: &mut fidl::encoding::Encoder<
3670 '_,
3671 fidl::encoding::DefaultFuchsiaResourceDialect,
3672 >,
3673 offset: usize,
3674 depth: fidl::encoding::Depth,
3675 ) -> fidl::Result<()> {
3676 encoder.debug_check_bounds::<UsbFunctionAllocResourcesRequest>(offset);
3677 unsafe {
3680 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3681 (ptr as *mut u64).write_unaligned(0);
3682 }
3683 self.0.encode(encoder, offset + 0, depth)?;
3685 self.1.encode(encoder, offset + 8, depth)?;
3686 self.2.encode(encoder, offset + 24, depth)?;
3687 Ok(())
3688 }
3689 }
3690
3691 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3692 for UsbFunctionAllocResourcesRequest
3693 {
3694 #[inline(always)]
3695 fn new_empty() -> Self {
3696 Self {
3697 interface_count: fidl::new_empty!(
3698 u8,
3699 fidl::encoding::DefaultFuchsiaResourceDialect
3700 ),
3701 endpoints: fidl::new_empty!(fidl::encoding::Vector<EndpointResource, 255>, fidl::encoding::DefaultFuchsiaResourceDialect),
3702 strings: fidl::new_empty!(
3703 fidl::encoding::Vector<fidl::encoding::BoundedString<126>, 255>,
3704 fidl::encoding::DefaultFuchsiaResourceDialect
3705 ),
3706 }
3707 }
3708
3709 #[inline]
3710 unsafe fn decode(
3711 &mut self,
3712 decoder: &mut fidl::encoding::Decoder<
3713 '_,
3714 fidl::encoding::DefaultFuchsiaResourceDialect,
3715 >,
3716 offset: usize,
3717 _depth: fidl::encoding::Depth,
3718 ) -> fidl::Result<()> {
3719 decoder.debug_check_bounds::<Self>(offset);
3720 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3722 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3723 let mask = 0xffffffffffffff00u64;
3724 let maskedval = padval & mask;
3725 if maskedval != 0 {
3726 return Err(fidl::Error::NonZeroPadding {
3727 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3728 });
3729 }
3730 fidl::decode!(
3731 u8,
3732 fidl::encoding::DefaultFuchsiaResourceDialect,
3733 &mut self.interface_count,
3734 decoder,
3735 offset + 0,
3736 _depth
3737 )?;
3738 fidl::decode!(fidl::encoding::Vector<EndpointResource, 255>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.endpoints, decoder, offset + 8, _depth)?;
3739 fidl::decode!(
3740 fidl::encoding::Vector<fidl::encoding::BoundedString<126>, 255>,
3741 fidl::encoding::DefaultFuchsiaResourceDialect,
3742 &mut self.strings,
3743 decoder,
3744 offset + 24,
3745 _depth
3746 )?;
3747 Ok(())
3748 }
3749 }
3750
3751 impl fidl::encoding::ResourceTypeMarker for UsbFunctionConfigureRequest {
3752 type Borrowed<'a> = &'a mut Self;
3753 fn take_or_borrow<'a>(
3754 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3755 ) -> Self::Borrowed<'a> {
3756 value
3757 }
3758 }
3759
3760 unsafe impl fidl::encoding::TypeMarker for UsbFunctionConfigureRequest {
3761 type Owned = Self;
3762
3763 #[inline(always)]
3764 fn inline_align(_context: fidl::encoding::Context) -> usize {
3765 8
3766 }
3767
3768 #[inline(always)]
3769 fn inline_size(_context: fidl::encoding::Context) -> usize {
3770 24
3771 }
3772 }
3773
3774 unsafe impl
3775 fidl::encoding::Encode<
3776 UsbFunctionConfigureRequest,
3777 fidl::encoding::DefaultFuchsiaResourceDialect,
3778 > for &mut UsbFunctionConfigureRequest
3779 {
3780 #[inline]
3781 unsafe fn encode(
3782 self,
3783 encoder: &mut fidl::encoding::Encoder<
3784 '_,
3785 fidl::encoding::DefaultFuchsiaResourceDialect,
3786 >,
3787 offset: usize,
3788 _depth: fidl::encoding::Depth,
3789 ) -> fidl::Result<()> {
3790 encoder.debug_check_bounds::<UsbFunctionConfigureRequest>(offset);
3791 fidl::encoding::Encode::<
3793 UsbFunctionConfigureRequest,
3794 fidl::encoding::DefaultFuchsiaResourceDialect,
3795 >::encode(
3796 (
3797 <fidl::encoding::Vector<u8, 32768> as fidl::encoding::ValueTypeMarker>::borrow(
3798 &self.configuration,
3799 ),
3800 <fidl::encoding::Endpoint<
3801 fidl::endpoints::ClientEnd<UsbFunctionInterfaceMarker>,
3802 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3803 &mut self.iface
3804 ),
3805 ),
3806 encoder,
3807 offset,
3808 _depth,
3809 )
3810 }
3811 }
3812 unsafe impl<
3813 T0: fidl::encoding::Encode<
3814 fidl::encoding::Vector<u8, 32768>,
3815 fidl::encoding::DefaultFuchsiaResourceDialect,
3816 >,
3817 T1: fidl::encoding::Encode<
3818 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<UsbFunctionInterfaceMarker>>,
3819 fidl::encoding::DefaultFuchsiaResourceDialect,
3820 >,
3821 >
3822 fidl::encoding::Encode<
3823 UsbFunctionConfigureRequest,
3824 fidl::encoding::DefaultFuchsiaResourceDialect,
3825 > for (T0, T1)
3826 {
3827 #[inline]
3828 unsafe fn encode(
3829 self,
3830 encoder: &mut fidl::encoding::Encoder<
3831 '_,
3832 fidl::encoding::DefaultFuchsiaResourceDialect,
3833 >,
3834 offset: usize,
3835 depth: fidl::encoding::Depth,
3836 ) -> fidl::Result<()> {
3837 encoder.debug_check_bounds::<UsbFunctionConfigureRequest>(offset);
3838 unsafe {
3841 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
3842 (ptr as *mut u64).write_unaligned(0);
3843 }
3844 self.0.encode(encoder, offset + 0, depth)?;
3846 self.1.encode(encoder, offset + 16, depth)?;
3847 Ok(())
3848 }
3849 }
3850
3851 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3852 for UsbFunctionConfigureRequest
3853 {
3854 #[inline(always)]
3855 fn new_empty() -> Self {
3856 Self {
3857 configuration: fidl::new_empty!(fidl::encoding::Vector<u8, 32768>, fidl::encoding::DefaultFuchsiaResourceDialect),
3858 iface: fidl::new_empty!(
3859 fidl::encoding::Endpoint<
3860 fidl::endpoints::ClientEnd<UsbFunctionInterfaceMarker>,
3861 >,
3862 fidl::encoding::DefaultFuchsiaResourceDialect
3863 ),
3864 }
3865 }
3866
3867 #[inline]
3868 unsafe fn decode(
3869 &mut self,
3870 decoder: &mut fidl::encoding::Decoder<
3871 '_,
3872 fidl::encoding::DefaultFuchsiaResourceDialect,
3873 >,
3874 offset: usize,
3875 _depth: fidl::encoding::Depth,
3876 ) -> fidl::Result<()> {
3877 decoder.debug_check_bounds::<Self>(offset);
3878 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
3880 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3881 let mask = 0xffffffff00000000u64;
3882 let maskedval = padval & mask;
3883 if maskedval != 0 {
3884 return Err(fidl::Error::NonZeroPadding {
3885 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
3886 });
3887 }
3888 fidl::decode!(fidl::encoding::Vector<u8, 32768>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.configuration, decoder, offset + 0, _depth)?;
3889 fidl::decode!(
3890 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<UsbFunctionInterfaceMarker>>,
3891 fidl::encoding::DefaultFuchsiaResourceDialect,
3892 &mut self.iface,
3893 decoder,
3894 offset + 16,
3895 _depth
3896 )?;
3897 Ok(())
3898 }
3899 }
3900
3901 impl fidl::encoding::ResourceTypeMarker for UsbFunctionConnectToEndpointRequest {
3902 type Borrowed<'a> = &'a mut Self;
3903 fn take_or_borrow<'a>(
3904 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3905 ) -> Self::Borrowed<'a> {
3906 value
3907 }
3908 }
3909
3910 unsafe impl fidl::encoding::TypeMarker for UsbFunctionConnectToEndpointRequest {
3911 type Owned = Self;
3912
3913 #[inline(always)]
3914 fn inline_align(_context: fidl::encoding::Context) -> usize {
3915 4
3916 }
3917
3918 #[inline(always)]
3919 fn inline_size(_context: fidl::encoding::Context) -> usize {
3920 8
3921 }
3922 }
3923
3924 unsafe impl
3925 fidl::encoding::Encode<
3926 UsbFunctionConnectToEndpointRequest,
3927 fidl::encoding::DefaultFuchsiaResourceDialect,
3928 > for &mut UsbFunctionConnectToEndpointRequest
3929 {
3930 #[inline]
3931 unsafe fn encode(
3932 self,
3933 encoder: &mut fidl::encoding::Encoder<
3934 '_,
3935 fidl::encoding::DefaultFuchsiaResourceDialect,
3936 >,
3937 offset: usize,
3938 _depth: fidl::encoding::Depth,
3939 ) -> fidl::Result<()> {
3940 encoder.debug_check_bounds::<UsbFunctionConnectToEndpointRequest>(offset);
3941 fidl::encoding::Encode::<
3943 UsbFunctionConnectToEndpointRequest,
3944 fidl::encoding::DefaultFuchsiaResourceDialect,
3945 >::encode(
3946 (
3947 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.ep_addr),
3948 <fidl::encoding::Endpoint<
3949 fidl::endpoints::ServerEnd<
3950 fidl_fuchsia_hardware_usb_endpoint::EndpointMarker,
3951 >,
3952 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3953 &mut self.ep
3954 ),
3955 ),
3956 encoder,
3957 offset,
3958 _depth,
3959 )
3960 }
3961 }
3962 unsafe impl<
3963 T0: fidl::encoding::Encode<u8, fidl::encoding::DefaultFuchsiaResourceDialect>,
3964 T1: fidl::encoding::Encode<
3965 fidl::encoding::Endpoint<
3966 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_usb_endpoint::EndpointMarker>,
3967 >,
3968 fidl::encoding::DefaultFuchsiaResourceDialect,
3969 >,
3970 >
3971 fidl::encoding::Encode<
3972 UsbFunctionConnectToEndpointRequest,
3973 fidl::encoding::DefaultFuchsiaResourceDialect,
3974 > for (T0, T1)
3975 {
3976 #[inline]
3977 unsafe fn encode(
3978 self,
3979 encoder: &mut fidl::encoding::Encoder<
3980 '_,
3981 fidl::encoding::DefaultFuchsiaResourceDialect,
3982 >,
3983 offset: usize,
3984 depth: fidl::encoding::Depth,
3985 ) -> fidl::Result<()> {
3986 encoder.debug_check_bounds::<UsbFunctionConnectToEndpointRequest>(offset);
3987 unsafe {
3990 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3991 (ptr as *mut u32).write_unaligned(0);
3992 }
3993 self.0.encode(encoder, offset + 0, depth)?;
3995 self.1.encode(encoder, offset + 4, depth)?;
3996 Ok(())
3997 }
3998 }
3999
4000 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4001 for UsbFunctionConnectToEndpointRequest
4002 {
4003 #[inline(always)]
4004 fn new_empty() -> Self {
4005 Self {
4006 ep_addr: fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect),
4007 ep: fidl::new_empty!(
4008 fidl::encoding::Endpoint<
4009 fidl::endpoints::ServerEnd<
4010 fidl_fuchsia_hardware_usb_endpoint::EndpointMarker,
4011 >,
4012 >,
4013 fidl::encoding::DefaultFuchsiaResourceDialect
4014 ),
4015 }
4016 }
4017
4018 #[inline]
4019 unsafe fn decode(
4020 &mut self,
4021 decoder: &mut fidl::encoding::Decoder<
4022 '_,
4023 fidl::encoding::DefaultFuchsiaResourceDialect,
4024 >,
4025 offset: usize,
4026 _depth: fidl::encoding::Depth,
4027 ) -> fidl::Result<()> {
4028 decoder.debug_check_bounds::<Self>(offset);
4029 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
4031 let padval = unsafe { (ptr as *const u32).read_unaligned() };
4032 let mask = 0xffffff00u32;
4033 let maskedval = padval & mask;
4034 if maskedval != 0 {
4035 return Err(fidl::Error::NonZeroPadding {
4036 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
4037 });
4038 }
4039 fidl::decode!(
4040 u8,
4041 fidl::encoding::DefaultFuchsiaResourceDialect,
4042 &mut self.ep_addr,
4043 decoder,
4044 offset + 0,
4045 _depth
4046 )?;
4047 fidl::decode!(
4048 fidl::encoding::Endpoint<
4049 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_usb_endpoint::EndpointMarker>,
4050 >,
4051 fidl::encoding::DefaultFuchsiaResourceDialect,
4052 &mut self.ep,
4053 decoder,
4054 offset + 4,
4055 _depth
4056 )?;
4057 Ok(())
4058 }
4059 }
4060}