fidl_fuchsia_hardware_usb_device/
fidl_fuchsia_hardware_usb_device.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![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 _};
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13/// sizeof(usb_device_descriptor_t)
14pub const DEVICE_DESC_SIZE: u32 = 18;
15
16/// UINT16_MAX
17pub const MAX_CONFIG_DESC_SIZE: u32 = 65536;
18
19/// See GetStringDescriptor description below
20pub const MAX_STRING_DESC_SIZE: u32 = 384;
21
22#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
23#[repr(C)]
24pub struct DeviceGetConfigurationDescriptorRequest {
25    pub config: u8,
26}
27
28impl fidl::Persistable for DeviceGetConfigurationDescriptorRequest {}
29
30#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
31pub struct DeviceGetConfigurationDescriptorResponse {
32    pub s: i32,
33    pub desc: Vec<u8>,
34}
35
36impl fidl::Persistable for DeviceGetConfigurationDescriptorResponse {}
37
38#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
39#[repr(C)]
40pub struct DeviceGetConfigurationDescriptorSizeRequest {
41    pub config: u8,
42}
43
44impl fidl::Persistable for DeviceGetConfigurationDescriptorSizeRequest {}
45
46#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
47#[repr(C)]
48pub struct DeviceGetConfigurationDescriptorSizeResponse {
49    pub s: i32,
50    pub size: u16,
51}
52
53impl fidl::Persistable for DeviceGetConfigurationDescriptorSizeResponse {}
54
55#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
56#[repr(C)]
57pub struct DeviceGetConfigurationResponse {
58    pub configuration: u8,
59}
60
61impl fidl::Persistable for DeviceGetConfigurationResponse {}
62
63#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
64#[repr(C)]
65pub struct DeviceGetDeviceDescriptorResponse {
66    pub desc: [u8; 18],
67}
68
69impl fidl::Persistable for DeviceGetDeviceDescriptorResponse {}
70
71#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
72#[repr(C)]
73pub struct DeviceGetDeviceIdResponse {
74    pub device_id: u32,
75}
76
77impl fidl::Persistable for DeviceGetDeviceIdResponse {}
78
79#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
80#[repr(C)]
81pub struct DeviceGetDeviceSpeedResponse {
82    pub speed: u32,
83}
84
85impl fidl::Persistable for DeviceGetDeviceSpeedResponse {}
86
87#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
88#[repr(C)]
89pub struct DeviceGetHubDeviceIdResponse {
90    pub hub_device_id: u32,
91}
92
93impl fidl::Persistable for DeviceGetHubDeviceIdResponse {}
94
95#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
96#[repr(C)]
97pub struct DeviceGetStringDescriptorRequest {
98    pub desc_id: u8,
99    pub lang_id: u16,
100}
101
102impl fidl::Persistable for DeviceGetStringDescriptorRequest {}
103
104#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
105pub struct DeviceGetStringDescriptorResponse {
106    pub s: i32,
107    pub desc: String,
108    pub actual_lang_id: u16,
109}
110
111impl fidl::Persistable for DeviceGetStringDescriptorResponse {}
112
113#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
114#[repr(C)]
115pub struct DeviceSetConfigurationRequest {
116    pub configuration: u8,
117}
118
119impl fidl::Persistable for DeviceSetConfigurationRequest {}
120
121#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
122#[repr(C)]
123pub struct DeviceSetConfigurationResponse {
124    pub s: i32,
125}
126
127impl fidl::Persistable for DeviceSetConfigurationResponse {}
128
129#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
130#[repr(C)]
131pub struct DeviceSetInterfaceRequest {
132    pub interface_number: u8,
133    pub alt_setting: u8,
134}
135
136impl fidl::Persistable for DeviceSetInterfaceRequest {}
137
138#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
139#[repr(C)]
140pub struct DeviceSetInterfaceResponse {
141    pub s: i32,
142}
143
144impl fidl::Persistable for DeviceSetInterfaceResponse {}
145
146#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
147pub struct DeviceMarker;
148
149impl fidl::endpoints::ProtocolMarker for DeviceMarker {
150    type Proxy = DeviceProxy;
151    type RequestStream = DeviceRequestStream;
152    #[cfg(target_os = "fuchsia")]
153    type SynchronousProxy = DeviceSynchronousProxy;
154
155    const DEBUG_NAME: &'static str = "(anonymous) Device";
156}
157
158pub trait DeviceProxyInterface: Send + Sync {
159    type GetDeviceSpeedResponseFut: std::future::Future<Output = Result<u32, fidl::Error>> + Send;
160    fn r#get_device_speed(&self) -> Self::GetDeviceSpeedResponseFut;
161    type GetDeviceDescriptorResponseFut: std::future::Future<Output = Result<[u8; 18], fidl::Error>>
162        + Send;
163    fn r#get_device_descriptor(&self) -> Self::GetDeviceDescriptorResponseFut;
164    type GetConfigurationDescriptorSizeResponseFut: std::future::Future<Output = Result<(i32, u16), fidl::Error>>
165        + Send;
166    fn r#get_configuration_descriptor_size(
167        &self,
168        config: u8,
169    ) -> Self::GetConfigurationDescriptorSizeResponseFut;
170    type GetConfigurationDescriptorResponseFut: std::future::Future<Output = Result<(i32, Vec<u8>), fidl::Error>>
171        + Send;
172    fn r#get_configuration_descriptor(
173        &self,
174        config: u8,
175    ) -> Self::GetConfigurationDescriptorResponseFut;
176    type GetStringDescriptorResponseFut: std::future::Future<Output = Result<(i32, String, u16), fidl::Error>>
177        + Send;
178    fn r#get_string_descriptor(
179        &self,
180        desc_id: u8,
181        lang_id: u16,
182    ) -> Self::GetStringDescriptorResponseFut;
183    type SetInterfaceResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
184    fn r#set_interface(
185        &self,
186        interface_number: u8,
187        alt_setting: u8,
188    ) -> Self::SetInterfaceResponseFut;
189    type GetDeviceIdResponseFut: std::future::Future<Output = Result<u32, fidl::Error>> + Send;
190    fn r#get_device_id(&self) -> Self::GetDeviceIdResponseFut;
191    type GetHubDeviceIdResponseFut: std::future::Future<Output = Result<u32, fidl::Error>> + Send;
192    fn r#get_hub_device_id(&self) -> Self::GetHubDeviceIdResponseFut;
193    type GetConfigurationResponseFut: std::future::Future<Output = Result<u8, fidl::Error>> + Send;
194    fn r#get_configuration(&self) -> Self::GetConfigurationResponseFut;
195    type SetConfigurationResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
196    fn r#set_configuration(&self, configuration: u8) -> Self::SetConfigurationResponseFut;
197}
198#[derive(Debug)]
199#[cfg(target_os = "fuchsia")]
200pub struct DeviceSynchronousProxy {
201    client: fidl::client::sync::Client,
202}
203
204#[cfg(target_os = "fuchsia")]
205impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
206    type Proxy = DeviceProxy;
207    type Protocol = DeviceMarker;
208
209    fn from_channel(inner: fidl::Channel) -> Self {
210        Self::new(inner)
211    }
212
213    fn into_channel(self) -> fidl::Channel {
214        self.client.into_channel()
215    }
216
217    fn as_channel(&self) -> &fidl::Channel {
218        self.client.as_channel()
219    }
220}
221
222#[cfg(target_os = "fuchsia")]
223impl DeviceSynchronousProxy {
224    pub fn new(channel: fidl::Channel) -> Self {
225        let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
226        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
227    }
228
229    pub fn into_channel(self) -> fidl::Channel {
230        self.client.into_channel()
231    }
232
233    /// Waits until an event arrives and returns it. It is safe for other
234    /// threads to make concurrent requests while waiting for an event.
235    pub fn wait_for_event(
236        &self,
237        deadline: zx::MonotonicInstant,
238    ) -> Result<DeviceEvent, fidl::Error> {
239        DeviceEvent::decode(self.client.wait_for_event(deadline)?)
240    }
241
242    /// Returns the speed of the USB device as a usb_speed_t value.
243    pub fn r#get_device_speed(
244        &self,
245        ___deadline: zx::MonotonicInstant,
246    ) -> Result<u32, fidl::Error> {
247        let _response =
248            self.client.send_query::<fidl::encoding::EmptyPayload, DeviceGetDeviceSpeedResponse>(
249                (),
250                0x623cd7927fb449de,
251                fidl::encoding::DynamicFlags::empty(),
252                ___deadline,
253            )?;
254        Ok(_response.speed)
255    }
256
257    /// Returns the device's USB device descriptor.
258    pub fn r#get_device_descriptor(
259        &self,
260        ___deadline: zx::MonotonicInstant,
261    ) -> Result<[u8; 18], fidl::Error> {
262        let _response = self
263            .client
264            .send_query::<fidl::encoding::EmptyPayload, DeviceGetDeviceDescriptorResponse>(
265                (),
266                0x5f761371f4b9f34a,
267                fidl::encoding::DynamicFlags::empty(),
268                ___deadline,
269            )?;
270        Ok(_response.desc)
271    }
272
273    /// Returns the total size of the USB configuration descriptor for the given configuration.
274    pub fn r#get_configuration_descriptor_size(
275        &self,
276        mut config: u8,
277        ___deadline: zx::MonotonicInstant,
278    ) -> Result<(i32, u16), fidl::Error> {
279        let _response = self.client.send_query::<
280            DeviceGetConfigurationDescriptorSizeRequest,
281            DeviceGetConfigurationDescriptorSizeResponse,
282        >(
283            (config,),
284            0x65912d7d5e3a07c8,
285            fidl::encoding::DynamicFlags::empty(),
286            ___deadline,
287        )?;
288        Ok((_response.s, _response.size))
289    }
290
291    /// Returns the device's USB configuration descriptor for the given configuration.
292    pub fn r#get_configuration_descriptor(
293        &self,
294        mut config: u8,
295        ___deadline: zx::MonotonicInstant,
296    ) -> Result<(i32, Vec<u8>), fidl::Error> {
297        let _response = self.client.send_query::<
298            DeviceGetConfigurationDescriptorRequest,
299            DeviceGetConfigurationDescriptorResponse,
300        >(
301            (config,),
302            0x1859a4e4421d2036,
303            fidl::encoding::DynamicFlags::empty(),
304            ___deadline,
305        )?;
306        Ok((_response.s, _response.desc))
307    }
308
309    /// Fetches a string descriptor from the USB device.
310    ///
311    /// desc_id          :   The ID of the string descriptor to fetch, or 0 to fetch
312    ///                      the language table instead.
313    ///
314    /// lang_id          :   The language ID of the string descriptor to fetch.
315    ///                      If no matching language ID is present in the device's language
316    ///                      ID table, the first entry of the language ID table will
317    ///                      be substituted.
318    /// actual_lang_id   :   The actual language ID of the string fetched, or 0 for
319    ///                      the language ID table.
320    ///
321    /// The worst case size for the payload of a language ID table should be 252
322    /// bytes, meaning that a 256 byte buffer should always be enough to hold any
323    /// language ID table.
324    ///
325    /// The worst case size for a UTF-8 encoded string descriptor payload should be
326    /// 378 bytes (126 UTF-16 code units with a worst case expansion factor of 3)
327    pub fn r#get_string_descriptor(
328        &self,
329        mut desc_id: u8,
330        mut lang_id: u16,
331        ___deadline: zx::MonotonicInstant,
332    ) -> Result<(i32, String, u16), fidl::Error> {
333        let _response = self
334            .client
335            .send_query::<DeviceGetStringDescriptorRequest, DeviceGetStringDescriptorResponse>(
336                (desc_id, lang_id),
337                0x5ff601b3b6891337,
338                fidl::encoding::DynamicFlags::empty(),
339                ___deadline,
340            )?;
341        Ok((_response.s, _response.desc, _response.actual_lang_id))
342    }
343
344    /// Selects an alternate setting for an interface on a USB device.
345    pub fn r#set_interface(
346        &self,
347        mut interface_number: u8,
348        mut alt_setting: u8,
349        ___deadline: zx::MonotonicInstant,
350    ) -> Result<i32, fidl::Error> {
351        let _response =
352            self.client.send_query::<DeviceSetInterfaceRequest, DeviceSetInterfaceResponse>(
353                (interface_number, alt_setting),
354                0x45348c50850b641d,
355                fidl::encoding::DynamicFlags::empty(),
356                ___deadline,
357            )?;
358        Ok(_response.s)
359    }
360
361    /// Returns an implementation specific device ID for a USB device.
362    /// For informational purposes only.
363    pub fn r#get_device_id(&self, ___deadline: zx::MonotonicInstant) -> Result<u32, fidl::Error> {
364        let _response =
365            self.client.send_query::<fidl::encoding::EmptyPayload, DeviceGetDeviceIdResponse>(
366                (),
367                0x34a73eef491c2ce0,
368                fidl::encoding::DynamicFlags::empty(),
369                ___deadline,
370            )?;
371        Ok(_response.device_id)
372    }
373
374    /// Returns the implementation specific device ID for the hub that a USB device is connected to.
375    /// For informational purposes only.
376    pub fn r#get_hub_device_id(
377        &self,
378        ___deadline: zx::MonotonicInstant,
379    ) -> Result<u32, fidl::Error> {
380        let _response =
381            self.client.send_query::<fidl::encoding::EmptyPayload, DeviceGetHubDeviceIdResponse>(
382                (),
383                0xce263c86f7bbbcd,
384                fidl::encoding::DynamicFlags::empty(),
385                ___deadline,
386            )?;
387        Ok(_response.hub_device_id)
388    }
389
390    /// Returns the device's current configuration.
391    pub fn r#get_configuration(
392        &self,
393        ___deadline: zx::MonotonicInstant,
394    ) -> Result<u8, fidl::Error> {
395        let _response = self
396            .client
397            .send_query::<fidl::encoding::EmptyPayload, DeviceGetConfigurationResponse>(
398                (),
399                0x73f644382a2335fd,
400                fidl::encoding::DynamicFlags::empty(),
401                ___deadline,
402            )?;
403        Ok(_response.configuration)
404    }
405
406    /// Sets the device's current configuration.
407    pub fn r#set_configuration(
408        &self,
409        mut configuration: u8,
410        ___deadline: zx::MonotonicInstant,
411    ) -> Result<i32, fidl::Error> {
412        let _response = self
413            .client
414            .send_query::<DeviceSetConfigurationRequest, DeviceSetConfigurationResponse>(
415                (configuration,),
416                0x12bf6e43b045ee9d,
417                fidl::encoding::DynamicFlags::empty(),
418                ___deadline,
419            )?;
420        Ok(_response.s)
421    }
422}
423
424#[derive(Debug, Clone)]
425pub struct DeviceProxy {
426    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
427}
428
429impl fidl::endpoints::Proxy for DeviceProxy {
430    type Protocol = DeviceMarker;
431
432    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
433        Self::new(inner)
434    }
435
436    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
437        self.client.into_channel().map_err(|client| Self { client })
438    }
439
440    fn as_channel(&self) -> &::fidl::AsyncChannel {
441        self.client.as_channel()
442    }
443}
444
445impl DeviceProxy {
446    /// Create a new Proxy for fuchsia.hardware.usb.device/Device.
447    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
448        let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
449        Self { client: fidl::client::Client::new(channel, protocol_name) }
450    }
451
452    /// Get a Stream of events from the remote end of the protocol.
453    ///
454    /// # Panics
455    ///
456    /// Panics if the event stream was already taken.
457    pub fn take_event_stream(&self) -> DeviceEventStream {
458        DeviceEventStream { event_receiver: self.client.take_event_receiver() }
459    }
460
461    /// Returns the speed of the USB device as a usb_speed_t value.
462    pub fn r#get_device_speed(
463        &self,
464    ) -> fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect> {
465        DeviceProxyInterface::r#get_device_speed(self)
466    }
467
468    /// Returns the device's USB device descriptor.
469    pub fn r#get_device_descriptor(
470        &self,
471    ) -> fidl::client::QueryResponseFut<[u8; 18], fidl::encoding::DefaultFuchsiaResourceDialect>
472    {
473        DeviceProxyInterface::r#get_device_descriptor(self)
474    }
475
476    /// Returns the total size of the USB configuration descriptor for the given configuration.
477    pub fn r#get_configuration_descriptor_size(
478        &self,
479        mut config: u8,
480    ) -> fidl::client::QueryResponseFut<(i32, u16), fidl::encoding::DefaultFuchsiaResourceDialect>
481    {
482        DeviceProxyInterface::r#get_configuration_descriptor_size(self, config)
483    }
484
485    /// Returns the device's USB configuration descriptor for the given configuration.
486    pub fn r#get_configuration_descriptor(
487        &self,
488        mut config: u8,
489    ) -> fidl::client::QueryResponseFut<(i32, Vec<u8>), fidl::encoding::DefaultFuchsiaResourceDialect>
490    {
491        DeviceProxyInterface::r#get_configuration_descriptor(self, config)
492    }
493
494    /// Fetches a string descriptor from the USB device.
495    ///
496    /// desc_id          :   The ID of the string descriptor to fetch, or 0 to fetch
497    ///                      the language table instead.
498    ///
499    /// lang_id          :   The language ID of the string descriptor to fetch.
500    ///                      If no matching language ID is present in the device's language
501    ///                      ID table, the first entry of the language ID table will
502    ///                      be substituted.
503    /// actual_lang_id   :   The actual language ID of the string fetched, or 0 for
504    ///                      the language ID table.
505    ///
506    /// The worst case size for the payload of a language ID table should be 252
507    /// bytes, meaning that a 256 byte buffer should always be enough to hold any
508    /// language ID table.
509    ///
510    /// The worst case size for a UTF-8 encoded string descriptor payload should be
511    /// 378 bytes (126 UTF-16 code units with a worst case expansion factor of 3)
512    pub fn r#get_string_descriptor(
513        &self,
514        mut desc_id: u8,
515        mut lang_id: u16,
516    ) -> fidl::client::QueryResponseFut<
517        (i32, String, u16),
518        fidl::encoding::DefaultFuchsiaResourceDialect,
519    > {
520        DeviceProxyInterface::r#get_string_descriptor(self, desc_id, lang_id)
521    }
522
523    /// Selects an alternate setting for an interface on a USB device.
524    pub fn r#set_interface(
525        &self,
526        mut interface_number: u8,
527        mut alt_setting: u8,
528    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
529        DeviceProxyInterface::r#set_interface(self, interface_number, alt_setting)
530    }
531
532    /// Returns an implementation specific device ID for a USB device.
533    /// For informational purposes only.
534    pub fn r#get_device_id(
535        &self,
536    ) -> fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect> {
537        DeviceProxyInterface::r#get_device_id(self)
538    }
539
540    /// Returns the implementation specific device ID for the hub that a USB device is connected to.
541    /// For informational purposes only.
542    pub fn r#get_hub_device_id(
543        &self,
544    ) -> fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect> {
545        DeviceProxyInterface::r#get_hub_device_id(self)
546    }
547
548    /// Returns the device's current configuration.
549    pub fn r#get_configuration(
550        &self,
551    ) -> fidl::client::QueryResponseFut<u8, fidl::encoding::DefaultFuchsiaResourceDialect> {
552        DeviceProxyInterface::r#get_configuration(self)
553    }
554
555    /// Sets the device's current configuration.
556    pub fn r#set_configuration(
557        &self,
558        mut configuration: u8,
559    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
560        DeviceProxyInterface::r#set_configuration(self, configuration)
561    }
562}
563
564impl DeviceProxyInterface for DeviceProxy {
565    type GetDeviceSpeedResponseFut =
566        fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect>;
567    fn r#get_device_speed(&self) -> Self::GetDeviceSpeedResponseFut {
568        fn _decode(
569            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
570        ) -> Result<u32, fidl::Error> {
571            let _response = fidl::client::decode_transaction_body::<
572                DeviceGetDeviceSpeedResponse,
573                fidl::encoding::DefaultFuchsiaResourceDialect,
574                0x623cd7927fb449de,
575            >(_buf?)?;
576            Ok(_response.speed)
577        }
578        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
579            (),
580            0x623cd7927fb449de,
581            fidl::encoding::DynamicFlags::empty(),
582            _decode,
583        )
584    }
585
586    type GetDeviceDescriptorResponseFut =
587        fidl::client::QueryResponseFut<[u8; 18], fidl::encoding::DefaultFuchsiaResourceDialect>;
588    fn r#get_device_descriptor(&self) -> Self::GetDeviceDescriptorResponseFut {
589        fn _decode(
590            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
591        ) -> Result<[u8; 18], fidl::Error> {
592            let _response = fidl::client::decode_transaction_body::<
593                DeviceGetDeviceDescriptorResponse,
594                fidl::encoding::DefaultFuchsiaResourceDialect,
595                0x5f761371f4b9f34a,
596            >(_buf?)?;
597            Ok(_response.desc)
598        }
599        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, [u8; 18]>(
600            (),
601            0x5f761371f4b9f34a,
602            fidl::encoding::DynamicFlags::empty(),
603            _decode,
604        )
605    }
606
607    type GetConfigurationDescriptorSizeResponseFut =
608        fidl::client::QueryResponseFut<(i32, u16), fidl::encoding::DefaultFuchsiaResourceDialect>;
609    fn r#get_configuration_descriptor_size(
610        &self,
611        mut config: u8,
612    ) -> Self::GetConfigurationDescriptorSizeResponseFut {
613        fn _decode(
614            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
615        ) -> Result<(i32, u16), fidl::Error> {
616            let _response = fidl::client::decode_transaction_body::<
617                DeviceGetConfigurationDescriptorSizeResponse,
618                fidl::encoding::DefaultFuchsiaResourceDialect,
619                0x65912d7d5e3a07c8,
620            >(_buf?)?;
621            Ok((_response.s, _response.size))
622        }
623        self.client
624            .send_query_and_decode::<DeviceGetConfigurationDescriptorSizeRequest, (i32, u16)>(
625                (config,),
626                0x65912d7d5e3a07c8,
627                fidl::encoding::DynamicFlags::empty(),
628                _decode,
629            )
630    }
631
632    type GetConfigurationDescriptorResponseFut = fidl::client::QueryResponseFut<
633        (i32, Vec<u8>),
634        fidl::encoding::DefaultFuchsiaResourceDialect,
635    >;
636    fn r#get_configuration_descriptor(
637        &self,
638        mut config: u8,
639    ) -> Self::GetConfigurationDescriptorResponseFut {
640        fn _decode(
641            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
642        ) -> Result<(i32, Vec<u8>), fidl::Error> {
643            let _response = fidl::client::decode_transaction_body::<
644                DeviceGetConfigurationDescriptorResponse,
645                fidl::encoding::DefaultFuchsiaResourceDialect,
646                0x1859a4e4421d2036,
647            >(_buf?)?;
648            Ok((_response.s, _response.desc))
649        }
650        self.client
651            .send_query_and_decode::<DeviceGetConfigurationDescriptorRequest, (i32, Vec<u8>)>(
652                (config,),
653                0x1859a4e4421d2036,
654                fidl::encoding::DynamicFlags::empty(),
655                _decode,
656            )
657    }
658
659    type GetStringDescriptorResponseFut = fidl::client::QueryResponseFut<
660        (i32, String, u16),
661        fidl::encoding::DefaultFuchsiaResourceDialect,
662    >;
663    fn r#get_string_descriptor(
664        &self,
665        mut desc_id: u8,
666        mut lang_id: u16,
667    ) -> Self::GetStringDescriptorResponseFut {
668        fn _decode(
669            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
670        ) -> Result<(i32, String, u16), fidl::Error> {
671            let _response = fidl::client::decode_transaction_body::<
672                DeviceGetStringDescriptorResponse,
673                fidl::encoding::DefaultFuchsiaResourceDialect,
674                0x5ff601b3b6891337,
675            >(_buf?)?;
676            Ok((_response.s, _response.desc, _response.actual_lang_id))
677        }
678        self.client.send_query_and_decode::<DeviceGetStringDescriptorRequest, (i32, String, u16)>(
679            (desc_id, lang_id),
680            0x5ff601b3b6891337,
681            fidl::encoding::DynamicFlags::empty(),
682            _decode,
683        )
684    }
685
686    type SetInterfaceResponseFut =
687        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
688    fn r#set_interface(
689        &self,
690        mut interface_number: u8,
691        mut alt_setting: u8,
692    ) -> Self::SetInterfaceResponseFut {
693        fn _decode(
694            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
695        ) -> Result<i32, fidl::Error> {
696            let _response = fidl::client::decode_transaction_body::<
697                DeviceSetInterfaceResponse,
698                fidl::encoding::DefaultFuchsiaResourceDialect,
699                0x45348c50850b641d,
700            >(_buf?)?;
701            Ok(_response.s)
702        }
703        self.client.send_query_and_decode::<DeviceSetInterfaceRequest, i32>(
704            (interface_number, alt_setting),
705            0x45348c50850b641d,
706            fidl::encoding::DynamicFlags::empty(),
707            _decode,
708        )
709    }
710
711    type GetDeviceIdResponseFut =
712        fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect>;
713    fn r#get_device_id(&self) -> Self::GetDeviceIdResponseFut {
714        fn _decode(
715            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
716        ) -> Result<u32, fidl::Error> {
717            let _response = fidl::client::decode_transaction_body::<
718                DeviceGetDeviceIdResponse,
719                fidl::encoding::DefaultFuchsiaResourceDialect,
720                0x34a73eef491c2ce0,
721            >(_buf?)?;
722            Ok(_response.device_id)
723        }
724        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
725            (),
726            0x34a73eef491c2ce0,
727            fidl::encoding::DynamicFlags::empty(),
728            _decode,
729        )
730    }
731
732    type GetHubDeviceIdResponseFut =
733        fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect>;
734    fn r#get_hub_device_id(&self) -> Self::GetHubDeviceIdResponseFut {
735        fn _decode(
736            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
737        ) -> Result<u32, fidl::Error> {
738            let _response = fidl::client::decode_transaction_body::<
739                DeviceGetHubDeviceIdResponse,
740                fidl::encoding::DefaultFuchsiaResourceDialect,
741                0xce263c86f7bbbcd,
742            >(_buf?)?;
743            Ok(_response.hub_device_id)
744        }
745        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
746            (),
747            0xce263c86f7bbbcd,
748            fidl::encoding::DynamicFlags::empty(),
749            _decode,
750        )
751    }
752
753    type GetConfigurationResponseFut =
754        fidl::client::QueryResponseFut<u8, fidl::encoding::DefaultFuchsiaResourceDialect>;
755    fn r#get_configuration(&self) -> Self::GetConfigurationResponseFut {
756        fn _decode(
757            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
758        ) -> Result<u8, fidl::Error> {
759            let _response = fidl::client::decode_transaction_body::<
760                DeviceGetConfigurationResponse,
761                fidl::encoding::DefaultFuchsiaResourceDialect,
762                0x73f644382a2335fd,
763            >(_buf?)?;
764            Ok(_response.configuration)
765        }
766        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u8>(
767            (),
768            0x73f644382a2335fd,
769            fidl::encoding::DynamicFlags::empty(),
770            _decode,
771        )
772    }
773
774    type SetConfigurationResponseFut =
775        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
776    fn r#set_configuration(&self, mut configuration: u8) -> Self::SetConfigurationResponseFut {
777        fn _decode(
778            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
779        ) -> Result<i32, fidl::Error> {
780            let _response = fidl::client::decode_transaction_body::<
781                DeviceSetConfigurationResponse,
782                fidl::encoding::DefaultFuchsiaResourceDialect,
783                0x12bf6e43b045ee9d,
784            >(_buf?)?;
785            Ok(_response.s)
786        }
787        self.client.send_query_and_decode::<DeviceSetConfigurationRequest, i32>(
788            (configuration,),
789            0x12bf6e43b045ee9d,
790            fidl::encoding::DynamicFlags::empty(),
791            _decode,
792        )
793    }
794}
795
796pub struct DeviceEventStream {
797    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
798}
799
800impl std::marker::Unpin for DeviceEventStream {}
801
802impl futures::stream::FusedStream for DeviceEventStream {
803    fn is_terminated(&self) -> bool {
804        self.event_receiver.is_terminated()
805    }
806}
807
808impl futures::Stream for DeviceEventStream {
809    type Item = Result<DeviceEvent, fidl::Error>;
810
811    fn poll_next(
812        mut self: std::pin::Pin<&mut Self>,
813        cx: &mut std::task::Context<'_>,
814    ) -> std::task::Poll<Option<Self::Item>> {
815        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
816            &mut self.event_receiver,
817            cx
818        )?) {
819            Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
820            None => std::task::Poll::Ready(None),
821        }
822    }
823}
824
825#[derive(Debug)]
826pub enum DeviceEvent {}
827
828impl DeviceEvent {
829    /// Decodes a message buffer as a [`DeviceEvent`].
830    fn decode(
831        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
832    ) -> Result<DeviceEvent, fidl::Error> {
833        let (bytes, _handles) = buf.split_mut();
834        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
835        debug_assert_eq!(tx_header.tx_id, 0);
836        match tx_header.ordinal {
837            _ => Err(fidl::Error::UnknownOrdinal {
838                ordinal: tx_header.ordinal,
839                protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
840            }),
841        }
842    }
843}
844
845/// A Stream of incoming requests for fuchsia.hardware.usb.device/Device.
846pub struct DeviceRequestStream {
847    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
848    is_terminated: bool,
849}
850
851impl std::marker::Unpin for DeviceRequestStream {}
852
853impl futures::stream::FusedStream for DeviceRequestStream {
854    fn is_terminated(&self) -> bool {
855        self.is_terminated
856    }
857}
858
859impl fidl::endpoints::RequestStream for DeviceRequestStream {
860    type Protocol = DeviceMarker;
861    type ControlHandle = DeviceControlHandle;
862
863    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
864        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
865    }
866
867    fn control_handle(&self) -> Self::ControlHandle {
868        DeviceControlHandle { inner: self.inner.clone() }
869    }
870
871    fn into_inner(
872        self,
873    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
874    {
875        (self.inner, self.is_terminated)
876    }
877
878    fn from_inner(
879        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
880        is_terminated: bool,
881    ) -> Self {
882        Self { inner, is_terminated }
883    }
884}
885
886impl futures::Stream for DeviceRequestStream {
887    type Item = Result<DeviceRequest, fidl::Error>;
888
889    fn poll_next(
890        mut self: std::pin::Pin<&mut Self>,
891        cx: &mut std::task::Context<'_>,
892    ) -> std::task::Poll<Option<Self::Item>> {
893        let this = &mut *self;
894        if this.inner.check_shutdown(cx) {
895            this.is_terminated = true;
896            return std::task::Poll::Ready(None);
897        }
898        if this.is_terminated {
899            panic!("polled DeviceRequestStream after completion");
900        }
901        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
902            |bytes, handles| {
903                match this.inner.channel().read_etc(cx, bytes, handles) {
904                    std::task::Poll::Ready(Ok(())) => {}
905                    std::task::Poll::Pending => return std::task::Poll::Pending,
906                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
907                        this.is_terminated = true;
908                        return std::task::Poll::Ready(None);
909                    }
910                    std::task::Poll::Ready(Err(e)) => {
911                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
912                            e.into(),
913                        ))))
914                    }
915                }
916
917                // A message has been received from the channel
918                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
919
920                std::task::Poll::Ready(Some(match header.ordinal {
921                    0x623cd7927fb449de => {
922                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
923                        let mut req = fidl::new_empty!(
924                            fidl::encoding::EmptyPayload,
925                            fidl::encoding::DefaultFuchsiaResourceDialect
926                        );
927                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
928                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
929                        Ok(DeviceRequest::GetDeviceSpeed {
930                            responder: DeviceGetDeviceSpeedResponder {
931                                control_handle: std::mem::ManuallyDrop::new(control_handle),
932                                tx_id: header.tx_id,
933                            },
934                        })
935                    }
936                    0x5f761371f4b9f34a => {
937                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
938                        let mut req = fidl::new_empty!(
939                            fidl::encoding::EmptyPayload,
940                            fidl::encoding::DefaultFuchsiaResourceDialect
941                        );
942                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
943                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
944                        Ok(DeviceRequest::GetDeviceDescriptor {
945                            responder: DeviceGetDeviceDescriptorResponder {
946                                control_handle: std::mem::ManuallyDrop::new(control_handle),
947                                tx_id: header.tx_id,
948                            },
949                        })
950                    }
951                    0x65912d7d5e3a07c8 => {
952                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
953                        let mut req = fidl::new_empty!(
954                            DeviceGetConfigurationDescriptorSizeRequest,
955                            fidl::encoding::DefaultFuchsiaResourceDialect
956                        );
957                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetConfigurationDescriptorSizeRequest>(&header, _body_bytes, handles, &mut req)?;
958                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
959                        Ok(DeviceRequest::GetConfigurationDescriptorSize {
960                            config: req.config,
961
962                            responder: DeviceGetConfigurationDescriptorSizeResponder {
963                                control_handle: std::mem::ManuallyDrop::new(control_handle),
964                                tx_id: header.tx_id,
965                            },
966                        })
967                    }
968                    0x1859a4e4421d2036 => {
969                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
970                        let mut req = fidl::new_empty!(
971                            DeviceGetConfigurationDescriptorRequest,
972                            fidl::encoding::DefaultFuchsiaResourceDialect
973                        );
974                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetConfigurationDescriptorRequest>(&header, _body_bytes, handles, &mut req)?;
975                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
976                        Ok(DeviceRequest::GetConfigurationDescriptor {
977                            config: req.config,
978
979                            responder: DeviceGetConfigurationDescriptorResponder {
980                                control_handle: std::mem::ManuallyDrop::new(control_handle),
981                                tx_id: header.tx_id,
982                            },
983                        })
984                    }
985                    0x5ff601b3b6891337 => {
986                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
987                        let mut req = fidl::new_empty!(
988                            DeviceGetStringDescriptorRequest,
989                            fidl::encoding::DefaultFuchsiaResourceDialect
990                        );
991                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetStringDescriptorRequest>(&header, _body_bytes, handles, &mut req)?;
992                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
993                        Ok(DeviceRequest::GetStringDescriptor {
994                            desc_id: req.desc_id,
995                            lang_id: req.lang_id,
996
997                            responder: DeviceGetStringDescriptorResponder {
998                                control_handle: std::mem::ManuallyDrop::new(control_handle),
999                                tx_id: header.tx_id,
1000                            },
1001                        })
1002                    }
1003                    0x45348c50850b641d => {
1004                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1005                        let mut req = fidl::new_empty!(
1006                            DeviceSetInterfaceRequest,
1007                            fidl::encoding::DefaultFuchsiaResourceDialect
1008                        );
1009                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetInterfaceRequest>(&header, _body_bytes, handles, &mut req)?;
1010                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1011                        Ok(DeviceRequest::SetInterface {
1012                            interface_number: req.interface_number,
1013                            alt_setting: req.alt_setting,
1014
1015                            responder: DeviceSetInterfaceResponder {
1016                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1017                                tx_id: header.tx_id,
1018                            },
1019                        })
1020                    }
1021                    0x34a73eef491c2ce0 => {
1022                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1023                        let mut req = fidl::new_empty!(
1024                            fidl::encoding::EmptyPayload,
1025                            fidl::encoding::DefaultFuchsiaResourceDialect
1026                        );
1027                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1028                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1029                        Ok(DeviceRequest::GetDeviceId {
1030                            responder: DeviceGetDeviceIdResponder {
1031                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1032                                tx_id: header.tx_id,
1033                            },
1034                        })
1035                    }
1036                    0xce263c86f7bbbcd => {
1037                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1038                        let mut req = fidl::new_empty!(
1039                            fidl::encoding::EmptyPayload,
1040                            fidl::encoding::DefaultFuchsiaResourceDialect
1041                        );
1042                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1043                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1044                        Ok(DeviceRequest::GetHubDeviceId {
1045                            responder: DeviceGetHubDeviceIdResponder {
1046                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1047                                tx_id: header.tx_id,
1048                            },
1049                        })
1050                    }
1051                    0x73f644382a2335fd => {
1052                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1053                        let mut req = fidl::new_empty!(
1054                            fidl::encoding::EmptyPayload,
1055                            fidl::encoding::DefaultFuchsiaResourceDialect
1056                        );
1057                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1058                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1059                        Ok(DeviceRequest::GetConfiguration {
1060                            responder: DeviceGetConfigurationResponder {
1061                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1062                                tx_id: header.tx_id,
1063                            },
1064                        })
1065                    }
1066                    0x12bf6e43b045ee9d => {
1067                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1068                        let mut req = fidl::new_empty!(
1069                            DeviceSetConfigurationRequest,
1070                            fidl::encoding::DefaultFuchsiaResourceDialect
1071                        );
1072                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetConfigurationRequest>(&header, _body_bytes, handles, &mut req)?;
1073                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1074                        Ok(DeviceRequest::SetConfiguration {
1075                            configuration: req.configuration,
1076
1077                            responder: DeviceSetConfigurationResponder {
1078                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1079                                tx_id: header.tx_id,
1080                            },
1081                        })
1082                    }
1083                    _ => Err(fidl::Error::UnknownOrdinal {
1084                        ordinal: header.ordinal,
1085                        protocol_name:
1086                            <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1087                    }),
1088                }))
1089            },
1090        )
1091    }
1092}
1093
1094#[derive(Debug)]
1095pub enum DeviceRequest {
1096    /// Returns the speed of the USB device as a usb_speed_t value.
1097    GetDeviceSpeed { responder: DeviceGetDeviceSpeedResponder },
1098    /// Returns the device's USB device descriptor.
1099    GetDeviceDescriptor { responder: DeviceGetDeviceDescriptorResponder },
1100    /// Returns the total size of the USB configuration descriptor for the given configuration.
1101    GetConfigurationDescriptorSize {
1102        config: u8,
1103        responder: DeviceGetConfigurationDescriptorSizeResponder,
1104    },
1105    /// Returns the device's USB configuration descriptor for the given configuration.
1106    GetConfigurationDescriptor { config: u8, responder: DeviceGetConfigurationDescriptorResponder },
1107    /// Fetches a string descriptor from the USB device.
1108    ///
1109    /// desc_id          :   The ID of the string descriptor to fetch, or 0 to fetch
1110    ///                      the language table instead.
1111    ///
1112    /// lang_id          :   The language ID of the string descriptor to fetch.
1113    ///                      If no matching language ID is present in the device's language
1114    ///                      ID table, the first entry of the language ID table will
1115    ///                      be substituted.
1116    /// actual_lang_id   :   The actual language ID of the string fetched, or 0 for
1117    ///                      the language ID table.
1118    ///
1119    /// The worst case size for the payload of a language ID table should be 252
1120    /// bytes, meaning that a 256 byte buffer should always be enough to hold any
1121    /// language ID table.
1122    ///
1123    /// The worst case size for a UTF-8 encoded string descriptor payload should be
1124    /// 378 bytes (126 UTF-16 code units with a worst case expansion factor of 3)
1125    GetStringDescriptor { desc_id: u8, lang_id: u16, responder: DeviceGetStringDescriptorResponder },
1126    /// Selects an alternate setting for an interface on a USB device.
1127    SetInterface { interface_number: u8, alt_setting: u8, responder: DeviceSetInterfaceResponder },
1128    /// Returns an implementation specific device ID for a USB device.
1129    /// For informational purposes only.
1130    GetDeviceId { responder: DeviceGetDeviceIdResponder },
1131    /// Returns the implementation specific device ID for the hub that a USB device is connected to.
1132    /// For informational purposes only.
1133    GetHubDeviceId { responder: DeviceGetHubDeviceIdResponder },
1134    /// Returns the device's current configuration.
1135    GetConfiguration { responder: DeviceGetConfigurationResponder },
1136    /// Sets the device's current configuration.
1137    SetConfiguration { configuration: u8, responder: DeviceSetConfigurationResponder },
1138}
1139
1140impl DeviceRequest {
1141    #[allow(irrefutable_let_patterns)]
1142    pub fn into_get_device_speed(self) -> Option<(DeviceGetDeviceSpeedResponder)> {
1143        if let DeviceRequest::GetDeviceSpeed { responder } = self {
1144            Some((responder))
1145        } else {
1146            None
1147        }
1148    }
1149
1150    #[allow(irrefutable_let_patterns)]
1151    pub fn into_get_device_descriptor(self) -> Option<(DeviceGetDeviceDescriptorResponder)> {
1152        if let DeviceRequest::GetDeviceDescriptor { responder } = self {
1153            Some((responder))
1154        } else {
1155            None
1156        }
1157    }
1158
1159    #[allow(irrefutable_let_patterns)]
1160    pub fn into_get_configuration_descriptor_size(
1161        self,
1162    ) -> Option<(u8, DeviceGetConfigurationDescriptorSizeResponder)> {
1163        if let DeviceRequest::GetConfigurationDescriptorSize { config, responder } = self {
1164            Some((config, responder))
1165        } else {
1166            None
1167        }
1168    }
1169
1170    #[allow(irrefutable_let_patterns)]
1171    pub fn into_get_configuration_descriptor(
1172        self,
1173    ) -> Option<(u8, DeviceGetConfigurationDescriptorResponder)> {
1174        if let DeviceRequest::GetConfigurationDescriptor { config, responder } = self {
1175            Some((config, responder))
1176        } else {
1177            None
1178        }
1179    }
1180
1181    #[allow(irrefutable_let_patterns)]
1182    pub fn into_get_string_descriptor(
1183        self,
1184    ) -> Option<(u8, u16, DeviceGetStringDescriptorResponder)> {
1185        if let DeviceRequest::GetStringDescriptor { desc_id, lang_id, responder } = self {
1186            Some((desc_id, lang_id, responder))
1187        } else {
1188            None
1189        }
1190    }
1191
1192    #[allow(irrefutable_let_patterns)]
1193    pub fn into_set_interface(self) -> Option<(u8, u8, DeviceSetInterfaceResponder)> {
1194        if let DeviceRequest::SetInterface { interface_number, alt_setting, responder } = self {
1195            Some((interface_number, alt_setting, responder))
1196        } else {
1197            None
1198        }
1199    }
1200
1201    #[allow(irrefutable_let_patterns)]
1202    pub fn into_get_device_id(self) -> Option<(DeviceGetDeviceIdResponder)> {
1203        if let DeviceRequest::GetDeviceId { responder } = self {
1204            Some((responder))
1205        } else {
1206            None
1207        }
1208    }
1209
1210    #[allow(irrefutable_let_patterns)]
1211    pub fn into_get_hub_device_id(self) -> Option<(DeviceGetHubDeviceIdResponder)> {
1212        if let DeviceRequest::GetHubDeviceId { responder } = self {
1213            Some((responder))
1214        } else {
1215            None
1216        }
1217    }
1218
1219    #[allow(irrefutable_let_patterns)]
1220    pub fn into_get_configuration(self) -> Option<(DeviceGetConfigurationResponder)> {
1221        if let DeviceRequest::GetConfiguration { responder } = self {
1222            Some((responder))
1223        } else {
1224            None
1225        }
1226    }
1227
1228    #[allow(irrefutable_let_patterns)]
1229    pub fn into_set_configuration(self) -> Option<(u8, DeviceSetConfigurationResponder)> {
1230        if let DeviceRequest::SetConfiguration { configuration, responder } = self {
1231            Some((configuration, responder))
1232        } else {
1233            None
1234        }
1235    }
1236
1237    /// Name of the method defined in FIDL
1238    pub fn method_name(&self) -> &'static str {
1239        match *self {
1240            DeviceRequest::GetDeviceSpeed { .. } => "get_device_speed",
1241            DeviceRequest::GetDeviceDescriptor { .. } => "get_device_descriptor",
1242            DeviceRequest::GetConfigurationDescriptorSize { .. } => {
1243                "get_configuration_descriptor_size"
1244            }
1245            DeviceRequest::GetConfigurationDescriptor { .. } => "get_configuration_descriptor",
1246            DeviceRequest::GetStringDescriptor { .. } => "get_string_descriptor",
1247            DeviceRequest::SetInterface { .. } => "set_interface",
1248            DeviceRequest::GetDeviceId { .. } => "get_device_id",
1249            DeviceRequest::GetHubDeviceId { .. } => "get_hub_device_id",
1250            DeviceRequest::GetConfiguration { .. } => "get_configuration",
1251            DeviceRequest::SetConfiguration { .. } => "set_configuration",
1252        }
1253    }
1254}
1255
1256#[derive(Debug, Clone)]
1257pub struct DeviceControlHandle {
1258    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1259}
1260
1261impl fidl::endpoints::ControlHandle for DeviceControlHandle {
1262    fn shutdown(&self) {
1263        self.inner.shutdown()
1264    }
1265    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1266        self.inner.shutdown_with_epitaph(status)
1267    }
1268
1269    fn is_closed(&self) -> bool {
1270        self.inner.channel().is_closed()
1271    }
1272    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1273        self.inner.channel().on_closed()
1274    }
1275
1276    #[cfg(target_os = "fuchsia")]
1277    fn signal_peer(
1278        &self,
1279        clear_mask: zx::Signals,
1280        set_mask: zx::Signals,
1281    ) -> Result<(), zx_status::Status> {
1282        use fidl::Peered;
1283        self.inner.channel().signal_peer(clear_mask, set_mask)
1284    }
1285}
1286
1287impl DeviceControlHandle {}
1288
1289#[must_use = "FIDL methods require a response to be sent"]
1290#[derive(Debug)]
1291pub struct DeviceGetDeviceSpeedResponder {
1292    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1293    tx_id: u32,
1294}
1295
1296/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1297/// if the responder is dropped without sending a response, so that the client
1298/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1299impl std::ops::Drop for DeviceGetDeviceSpeedResponder {
1300    fn drop(&mut self) {
1301        self.control_handle.shutdown();
1302        // Safety: drops once, never accessed again
1303        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1304    }
1305}
1306
1307impl fidl::endpoints::Responder for DeviceGetDeviceSpeedResponder {
1308    type ControlHandle = DeviceControlHandle;
1309
1310    fn control_handle(&self) -> &DeviceControlHandle {
1311        &self.control_handle
1312    }
1313
1314    fn drop_without_shutdown(mut self) {
1315        // Safety: drops once, never accessed again due to mem::forget
1316        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1317        // Prevent Drop from running (which would shut down the channel)
1318        std::mem::forget(self);
1319    }
1320}
1321
1322impl DeviceGetDeviceSpeedResponder {
1323    /// Sends a response to the FIDL transaction.
1324    ///
1325    /// Sets the channel to shutdown if an error occurs.
1326    pub fn send(self, mut speed: u32) -> Result<(), fidl::Error> {
1327        let _result = self.send_raw(speed);
1328        if _result.is_err() {
1329            self.control_handle.shutdown();
1330        }
1331        self.drop_without_shutdown();
1332        _result
1333    }
1334
1335    /// Similar to "send" but does not shutdown the channel if an error occurs.
1336    pub fn send_no_shutdown_on_err(self, mut speed: u32) -> Result<(), fidl::Error> {
1337        let _result = self.send_raw(speed);
1338        self.drop_without_shutdown();
1339        _result
1340    }
1341
1342    fn send_raw(&self, mut speed: u32) -> Result<(), fidl::Error> {
1343        self.control_handle.inner.send::<DeviceGetDeviceSpeedResponse>(
1344            (speed,),
1345            self.tx_id,
1346            0x623cd7927fb449de,
1347            fidl::encoding::DynamicFlags::empty(),
1348        )
1349    }
1350}
1351
1352#[must_use = "FIDL methods require a response to be sent"]
1353#[derive(Debug)]
1354pub struct DeviceGetDeviceDescriptorResponder {
1355    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1356    tx_id: u32,
1357}
1358
1359/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1360/// if the responder is dropped without sending a response, so that the client
1361/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1362impl std::ops::Drop for DeviceGetDeviceDescriptorResponder {
1363    fn drop(&mut self) {
1364        self.control_handle.shutdown();
1365        // Safety: drops once, never accessed again
1366        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1367    }
1368}
1369
1370impl fidl::endpoints::Responder for DeviceGetDeviceDescriptorResponder {
1371    type ControlHandle = DeviceControlHandle;
1372
1373    fn control_handle(&self) -> &DeviceControlHandle {
1374        &self.control_handle
1375    }
1376
1377    fn drop_without_shutdown(mut self) {
1378        // Safety: drops once, never accessed again due to mem::forget
1379        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1380        // Prevent Drop from running (which would shut down the channel)
1381        std::mem::forget(self);
1382    }
1383}
1384
1385impl DeviceGetDeviceDescriptorResponder {
1386    /// Sends a response to the FIDL transaction.
1387    ///
1388    /// Sets the channel to shutdown if an error occurs.
1389    pub fn send(self, mut desc: &[u8; 18]) -> Result<(), fidl::Error> {
1390        let _result = self.send_raw(desc);
1391        if _result.is_err() {
1392            self.control_handle.shutdown();
1393        }
1394        self.drop_without_shutdown();
1395        _result
1396    }
1397
1398    /// Similar to "send" but does not shutdown the channel if an error occurs.
1399    pub fn send_no_shutdown_on_err(self, mut desc: &[u8; 18]) -> Result<(), fidl::Error> {
1400        let _result = self.send_raw(desc);
1401        self.drop_without_shutdown();
1402        _result
1403    }
1404
1405    fn send_raw(&self, mut desc: &[u8; 18]) -> Result<(), fidl::Error> {
1406        self.control_handle.inner.send::<DeviceGetDeviceDescriptorResponse>(
1407            (desc,),
1408            self.tx_id,
1409            0x5f761371f4b9f34a,
1410            fidl::encoding::DynamicFlags::empty(),
1411        )
1412    }
1413}
1414
1415#[must_use = "FIDL methods require a response to be sent"]
1416#[derive(Debug)]
1417pub struct DeviceGetConfigurationDescriptorSizeResponder {
1418    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1419    tx_id: u32,
1420}
1421
1422/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1423/// if the responder is dropped without sending a response, so that the client
1424/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1425impl std::ops::Drop for DeviceGetConfigurationDescriptorSizeResponder {
1426    fn drop(&mut self) {
1427        self.control_handle.shutdown();
1428        // Safety: drops once, never accessed again
1429        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1430    }
1431}
1432
1433impl fidl::endpoints::Responder for DeviceGetConfigurationDescriptorSizeResponder {
1434    type ControlHandle = DeviceControlHandle;
1435
1436    fn control_handle(&self) -> &DeviceControlHandle {
1437        &self.control_handle
1438    }
1439
1440    fn drop_without_shutdown(mut self) {
1441        // Safety: drops once, never accessed again due to mem::forget
1442        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1443        // Prevent Drop from running (which would shut down the channel)
1444        std::mem::forget(self);
1445    }
1446}
1447
1448impl DeviceGetConfigurationDescriptorSizeResponder {
1449    /// Sends a response to the FIDL transaction.
1450    ///
1451    /// Sets the channel to shutdown if an error occurs.
1452    pub fn send(self, mut s: i32, mut size: u16) -> Result<(), fidl::Error> {
1453        let _result = self.send_raw(s, size);
1454        if _result.is_err() {
1455            self.control_handle.shutdown();
1456        }
1457        self.drop_without_shutdown();
1458        _result
1459    }
1460
1461    /// Similar to "send" but does not shutdown the channel if an error occurs.
1462    pub fn send_no_shutdown_on_err(self, mut s: i32, mut size: u16) -> Result<(), fidl::Error> {
1463        let _result = self.send_raw(s, size);
1464        self.drop_without_shutdown();
1465        _result
1466    }
1467
1468    fn send_raw(&self, mut s: i32, mut size: u16) -> Result<(), fidl::Error> {
1469        self.control_handle.inner.send::<DeviceGetConfigurationDescriptorSizeResponse>(
1470            (s, size),
1471            self.tx_id,
1472            0x65912d7d5e3a07c8,
1473            fidl::encoding::DynamicFlags::empty(),
1474        )
1475    }
1476}
1477
1478#[must_use = "FIDL methods require a response to be sent"]
1479#[derive(Debug)]
1480pub struct DeviceGetConfigurationDescriptorResponder {
1481    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1482    tx_id: u32,
1483}
1484
1485/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1486/// if the responder is dropped without sending a response, so that the client
1487/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1488impl std::ops::Drop for DeviceGetConfigurationDescriptorResponder {
1489    fn drop(&mut self) {
1490        self.control_handle.shutdown();
1491        // Safety: drops once, never accessed again
1492        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1493    }
1494}
1495
1496impl fidl::endpoints::Responder for DeviceGetConfigurationDescriptorResponder {
1497    type ControlHandle = DeviceControlHandle;
1498
1499    fn control_handle(&self) -> &DeviceControlHandle {
1500        &self.control_handle
1501    }
1502
1503    fn drop_without_shutdown(mut self) {
1504        // Safety: drops once, never accessed again due to mem::forget
1505        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1506        // Prevent Drop from running (which would shut down the channel)
1507        std::mem::forget(self);
1508    }
1509}
1510
1511impl DeviceGetConfigurationDescriptorResponder {
1512    /// Sends a response to the FIDL transaction.
1513    ///
1514    /// Sets the channel to shutdown if an error occurs.
1515    pub fn send(self, mut s: i32, mut desc: &[u8]) -> Result<(), fidl::Error> {
1516        let _result = self.send_raw(s, desc);
1517        if _result.is_err() {
1518            self.control_handle.shutdown();
1519        }
1520        self.drop_without_shutdown();
1521        _result
1522    }
1523
1524    /// Similar to "send" but does not shutdown the channel if an error occurs.
1525    pub fn send_no_shutdown_on_err(self, mut s: i32, mut desc: &[u8]) -> Result<(), fidl::Error> {
1526        let _result = self.send_raw(s, desc);
1527        self.drop_without_shutdown();
1528        _result
1529    }
1530
1531    fn send_raw(&self, mut s: i32, mut desc: &[u8]) -> Result<(), fidl::Error> {
1532        self.control_handle.inner.send::<DeviceGetConfigurationDescriptorResponse>(
1533            (s, desc),
1534            self.tx_id,
1535            0x1859a4e4421d2036,
1536            fidl::encoding::DynamicFlags::empty(),
1537        )
1538    }
1539}
1540
1541#[must_use = "FIDL methods require a response to be sent"]
1542#[derive(Debug)]
1543pub struct DeviceGetStringDescriptorResponder {
1544    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1545    tx_id: u32,
1546}
1547
1548/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1549/// if the responder is dropped without sending a response, so that the client
1550/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1551impl std::ops::Drop for DeviceGetStringDescriptorResponder {
1552    fn drop(&mut self) {
1553        self.control_handle.shutdown();
1554        // Safety: drops once, never accessed again
1555        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1556    }
1557}
1558
1559impl fidl::endpoints::Responder for DeviceGetStringDescriptorResponder {
1560    type ControlHandle = DeviceControlHandle;
1561
1562    fn control_handle(&self) -> &DeviceControlHandle {
1563        &self.control_handle
1564    }
1565
1566    fn drop_without_shutdown(mut self) {
1567        // Safety: drops once, never accessed again due to mem::forget
1568        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1569        // Prevent Drop from running (which would shut down the channel)
1570        std::mem::forget(self);
1571    }
1572}
1573
1574impl DeviceGetStringDescriptorResponder {
1575    /// Sends a response to the FIDL transaction.
1576    ///
1577    /// Sets the channel to shutdown if an error occurs.
1578    pub fn send(
1579        self,
1580        mut s: i32,
1581        mut desc: &str,
1582        mut actual_lang_id: u16,
1583    ) -> Result<(), fidl::Error> {
1584        let _result = self.send_raw(s, desc, actual_lang_id);
1585        if _result.is_err() {
1586            self.control_handle.shutdown();
1587        }
1588        self.drop_without_shutdown();
1589        _result
1590    }
1591
1592    /// Similar to "send" but does not shutdown the channel if an error occurs.
1593    pub fn send_no_shutdown_on_err(
1594        self,
1595        mut s: i32,
1596        mut desc: &str,
1597        mut actual_lang_id: u16,
1598    ) -> Result<(), fidl::Error> {
1599        let _result = self.send_raw(s, desc, actual_lang_id);
1600        self.drop_without_shutdown();
1601        _result
1602    }
1603
1604    fn send_raw(
1605        &self,
1606        mut s: i32,
1607        mut desc: &str,
1608        mut actual_lang_id: u16,
1609    ) -> Result<(), fidl::Error> {
1610        self.control_handle.inner.send::<DeviceGetStringDescriptorResponse>(
1611            (s, desc, actual_lang_id),
1612            self.tx_id,
1613            0x5ff601b3b6891337,
1614            fidl::encoding::DynamicFlags::empty(),
1615        )
1616    }
1617}
1618
1619#[must_use = "FIDL methods require a response to be sent"]
1620#[derive(Debug)]
1621pub struct DeviceSetInterfaceResponder {
1622    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1623    tx_id: u32,
1624}
1625
1626/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1627/// if the responder is dropped without sending a response, so that the client
1628/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1629impl std::ops::Drop for DeviceSetInterfaceResponder {
1630    fn drop(&mut self) {
1631        self.control_handle.shutdown();
1632        // Safety: drops once, never accessed again
1633        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1634    }
1635}
1636
1637impl fidl::endpoints::Responder for DeviceSetInterfaceResponder {
1638    type ControlHandle = DeviceControlHandle;
1639
1640    fn control_handle(&self) -> &DeviceControlHandle {
1641        &self.control_handle
1642    }
1643
1644    fn drop_without_shutdown(mut self) {
1645        // Safety: drops once, never accessed again due to mem::forget
1646        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1647        // Prevent Drop from running (which would shut down the channel)
1648        std::mem::forget(self);
1649    }
1650}
1651
1652impl DeviceSetInterfaceResponder {
1653    /// Sends a response to the FIDL transaction.
1654    ///
1655    /// Sets the channel to shutdown if an error occurs.
1656    pub fn send(self, mut s: i32) -> Result<(), fidl::Error> {
1657        let _result = self.send_raw(s);
1658        if _result.is_err() {
1659            self.control_handle.shutdown();
1660        }
1661        self.drop_without_shutdown();
1662        _result
1663    }
1664
1665    /// Similar to "send" but does not shutdown the channel if an error occurs.
1666    pub fn send_no_shutdown_on_err(self, mut s: i32) -> Result<(), fidl::Error> {
1667        let _result = self.send_raw(s);
1668        self.drop_without_shutdown();
1669        _result
1670    }
1671
1672    fn send_raw(&self, mut s: i32) -> Result<(), fidl::Error> {
1673        self.control_handle.inner.send::<DeviceSetInterfaceResponse>(
1674            (s,),
1675            self.tx_id,
1676            0x45348c50850b641d,
1677            fidl::encoding::DynamicFlags::empty(),
1678        )
1679    }
1680}
1681
1682#[must_use = "FIDL methods require a response to be sent"]
1683#[derive(Debug)]
1684pub struct DeviceGetDeviceIdResponder {
1685    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1686    tx_id: u32,
1687}
1688
1689/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1690/// if the responder is dropped without sending a response, so that the client
1691/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1692impl std::ops::Drop for DeviceGetDeviceIdResponder {
1693    fn drop(&mut self) {
1694        self.control_handle.shutdown();
1695        // Safety: drops once, never accessed again
1696        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1697    }
1698}
1699
1700impl fidl::endpoints::Responder for DeviceGetDeviceIdResponder {
1701    type ControlHandle = DeviceControlHandle;
1702
1703    fn control_handle(&self) -> &DeviceControlHandle {
1704        &self.control_handle
1705    }
1706
1707    fn drop_without_shutdown(mut self) {
1708        // Safety: drops once, never accessed again due to mem::forget
1709        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1710        // Prevent Drop from running (which would shut down the channel)
1711        std::mem::forget(self);
1712    }
1713}
1714
1715impl DeviceGetDeviceIdResponder {
1716    /// Sends a response to the FIDL transaction.
1717    ///
1718    /// Sets the channel to shutdown if an error occurs.
1719    pub fn send(self, mut device_id: u32) -> Result<(), fidl::Error> {
1720        let _result = self.send_raw(device_id);
1721        if _result.is_err() {
1722            self.control_handle.shutdown();
1723        }
1724        self.drop_without_shutdown();
1725        _result
1726    }
1727
1728    /// Similar to "send" but does not shutdown the channel if an error occurs.
1729    pub fn send_no_shutdown_on_err(self, mut device_id: u32) -> Result<(), fidl::Error> {
1730        let _result = self.send_raw(device_id);
1731        self.drop_without_shutdown();
1732        _result
1733    }
1734
1735    fn send_raw(&self, mut device_id: u32) -> Result<(), fidl::Error> {
1736        self.control_handle.inner.send::<DeviceGetDeviceIdResponse>(
1737            (device_id,),
1738            self.tx_id,
1739            0x34a73eef491c2ce0,
1740            fidl::encoding::DynamicFlags::empty(),
1741        )
1742    }
1743}
1744
1745#[must_use = "FIDL methods require a response to be sent"]
1746#[derive(Debug)]
1747pub struct DeviceGetHubDeviceIdResponder {
1748    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1749    tx_id: u32,
1750}
1751
1752/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1753/// if the responder is dropped without sending a response, so that the client
1754/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1755impl std::ops::Drop for DeviceGetHubDeviceIdResponder {
1756    fn drop(&mut self) {
1757        self.control_handle.shutdown();
1758        // Safety: drops once, never accessed again
1759        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1760    }
1761}
1762
1763impl fidl::endpoints::Responder for DeviceGetHubDeviceIdResponder {
1764    type ControlHandle = DeviceControlHandle;
1765
1766    fn control_handle(&self) -> &DeviceControlHandle {
1767        &self.control_handle
1768    }
1769
1770    fn drop_without_shutdown(mut self) {
1771        // Safety: drops once, never accessed again due to mem::forget
1772        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1773        // Prevent Drop from running (which would shut down the channel)
1774        std::mem::forget(self);
1775    }
1776}
1777
1778impl DeviceGetHubDeviceIdResponder {
1779    /// Sends a response to the FIDL transaction.
1780    ///
1781    /// Sets the channel to shutdown if an error occurs.
1782    pub fn send(self, mut hub_device_id: u32) -> Result<(), fidl::Error> {
1783        let _result = self.send_raw(hub_device_id);
1784        if _result.is_err() {
1785            self.control_handle.shutdown();
1786        }
1787        self.drop_without_shutdown();
1788        _result
1789    }
1790
1791    /// Similar to "send" but does not shutdown the channel if an error occurs.
1792    pub fn send_no_shutdown_on_err(self, mut hub_device_id: u32) -> Result<(), fidl::Error> {
1793        let _result = self.send_raw(hub_device_id);
1794        self.drop_without_shutdown();
1795        _result
1796    }
1797
1798    fn send_raw(&self, mut hub_device_id: u32) -> Result<(), fidl::Error> {
1799        self.control_handle.inner.send::<DeviceGetHubDeviceIdResponse>(
1800            (hub_device_id,),
1801            self.tx_id,
1802            0xce263c86f7bbbcd,
1803            fidl::encoding::DynamicFlags::empty(),
1804        )
1805    }
1806}
1807
1808#[must_use = "FIDL methods require a response to be sent"]
1809#[derive(Debug)]
1810pub struct DeviceGetConfigurationResponder {
1811    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1812    tx_id: u32,
1813}
1814
1815/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1816/// if the responder is dropped without sending a response, so that the client
1817/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1818impl std::ops::Drop for DeviceGetConfigurationResponder {
1819    fn drop(&mut self) {
1820        self.control_handle.shutdown();
1821        // Safety: drops once, never accessed again
1822        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1823    }
1824}
1825
1826impl fidl::endpoints::Responder for DeviceGetConfigurationResponder {
1827    type ControlHandle = DeviceControlHandle;
1828
1829    fn control_handle(&self) -> &DeviceControlHandle {
1830        &self.control_handle
1831    }
1832
1833    fn drop_without_shutdown(mut self) {
1834        // Safety: drops once, never accessed again due to mem::forget
1835        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1836        // Prevent Drop from running (which would shut down the channel)
1837        std::mem::forget(self);
1838    }
1839}
1840
1841impl DeviceGetConfigurationResponder {
1842    /// Sends a response to the FIDL transaction.
1843    ///
1844    /// Sets the channel to shutdown if an error occurs.
1845    pub fn send(self, mut configuration: u8) -> Result<(), fidl::Error> {
1846        let _result = self.send_raw(configuration);
1847        if _result.is_err() {
1848            self.control_handle.shutdown();
1849        }
1850        self.drop_without_shutdown();
1851        _result
1852    }
1853
1854    /// Similar to "send" but does not shutdown the channel if an error occurs.
1855    pub fn send_no_shutdown_on_err(self, mut configuration: u8) -> Result<(), fidl::Error> {
1856        let _result = self.send_raw(configuration);
1857        self.drop_without_shutdown();
1858        _result
1859    }
1860
1861    fn send_raw(&self, mut configuration: u8) -> Result<(), fidl::Error> {
1862        self.control_handle.inner.send::<DeviceGetConfigurationResponse>(
1863            (configuration,),
1864            self.tx_id,
1865            0x73f644382a2335fd,
1866            fidl::encoding::DynamicFlags::empty(),
1867        )
1868    }
1869}
1870
1871#[must_use = "FIDL methods require a response to be sent"]
1872#[derive(Debug)]
1873pub struct DeviceSetConfigurationResponder {
1874    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1875    tx_id: u32,
1876}
1877
1878/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1879/// if the responder is dropped without sending a response, so that the client
1880/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1881impl std::ops::Drop for DeviceSetConfigurationResponder {
1882    fn drop(&mut self) {
1883        self.control_handle.shutdown();
1884        // Safety: drops once, never accessed again
1885        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1886    }
1887}
1888
1889impl fidl::endpoints::Responder for DeviceSetConfigurationResponder {
1890    type ControlHandle = DeviceControlHandle;
1891
1892    fn control_handle(&self) -> &DeviceControlHandle {
1893        &self.control_handle
1894    }
1895
1896    fn drop_without_shutdown(mut self) {
1897        // Safety: drops once, never accessed again due to mem::forget
1898        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1899        // Prevent Drop from running (which would shut down the channel)
1900        std::mem::forget(self);
1901    }
1902}
1903
1904impl DeviceSetConfigurationResponder {
1905    /// Sends a response to the FIDL transaction.
1906    ///
1907    /// Sets the channel to shutdown if an error occurs.
1908    pub fn send(self, mut s: i32) -> Result<(), fidl::Error> {
1909        let _result = self.send_raw(s);
1910        if _result.is_err() {
1911            self.control_handle.shutdown();
1912        }
1913        self.drop_without_shutdown();
1914        _result
1915    }
1916
1917    /// Similar to "send" but does not shutdown the channel if an error occurs.
1918    pub fn send_no_shutdown_on_err(self, mut s: i32) -> Result<(), fidl::Error> {
1919        let _result = self.send_raw(s);
1920        self.drop_without_shutdown();
1921        _result
1922    }
1923
1924    fn send_raw(&self, mut s: i32) -> Result<(), fidl::Error> {
1925        self.control_handle.inner.send::<DeviceSetConfigurationResponse>(
1926            (s,),
1927            self.tx_id,
1928            0x12bf6e43b045ee9d,
1929            fidl::encoding::DynamicFlags::empty(),
1930        )
1931    }
1932}
1933
1934#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1935pub struct ServiceMarker;
1936
1937#[cfg(target_os = "fuchsia")]
1938impl fidl::endpoints::ServiceMarker for ServiceMarker {
1939    type Proxy = ServiceProxy;
1940    type Request = ServiceRequest;
1941    const SERVICE_NAME: &'static str = "fuchsia.hardware.usb.device.Service";
1942}
1943
1944/// A request for one of the member protocols of Service.
1945///
1946#[cfg(target_os = "fuchsia")]
1947pub enum ServiceRequest {
1948    Device(DeviceRequestStream),
1949}
1950
1951#[cfg(target_os = "fuchsia")]
1952impl fidl::endpoints::ServiceRequest for ServiceRequest {
1953    type Service = ServiceMarker;
1954
1955    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
1956        match name {
1957            "device" => Self::Device(
1958                <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
1959            ),
1960            _ => panic!("no such member protocol name for service Service"),
1961        }
1962    }
1963
1964    fn member_names() -> &'static [&'static str] {
1965        &["device"]
1966    }
1967}
1968#[cfg(target_os = "fuchsia")]
1969pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
1970
1971#[cfg(target_os = "fuchsia")]
1972impl fidl::endpoints::ServiceProxy for ServiceProxy {
1973    type Service = ServiceMarker;
1974
1975    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
1976        Self(opener)
1977    }
1978}
1979
1980#[cfg(target_os = "fuchsia")]
1981impl ServiceProxy {
1982    pub fn connect_to_device(&self) -> Result<DeviceProxy, fidl::Error> {
1983        let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
1984        self.connect_channel_to_device(server_end)?;
1985        Ok(proxy)
1986    }
1987
1988    /// Like `connect_to_device`, but returns a sync proxy.
1989    /// See [`Self::connect_to_device`] for more details.
1990    pub fn connect_to_device_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
1991        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
1992        self.connect_channel_to_device(server_end)?;
1993        Ok(proxy)
1994    }
1995
1996    /// Like `connect_to_device`, but accepts a server end.
1997    /// See [`Self::connect_to_device`] for more details.
1998    pub fn connect_channel_to_device(
1999        &self,
2000        server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
2001    ) -> Result<(), fidl::Error> {
2002        self.0.open_member("device", server_end.into_channel())
2003    }
2004
2005    pub fn instance_name(&self) -> &str {
2006        self.0.instance_name()
2007    }
2008}
2009
2010mod internal {
2011    use super::*;
2012
2013    impl fidl::encoding::ValueTypeMarker for DeviceGetConfigurationDescriptorRequest {
2014        type Borrowed<'a> = &'a Self;
2015        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2016            value
2017        }
2018    }
2019
2020    unsafe impl fidl::encoding::TypeMarker for DeviceGetConfigurationDescriptorRequest {
2021        type Owned = Self;
2022
2023        #[inline(always)]
2024        fn inline_align(_context: fidl::encoding::Context) -> usize {
2025            1
2026        }
2027
2028        #[inline(always)]
2029        fn inline_size(_context: fidl::encoding::Context) -> usize {
2030            1
2031        }
2032        #[inline(always)]
2033        fn encode_is_copy() -> bool {
2034            true
2035        }
2036
2037        #[inline(always)]
2038        fn decode_is_copy() -> bool {
2039            true
2040        }
2041    }
2042
2043    unsafe impl<D: fidl::encoding::ResourceDialect>
2044        fidl::encoding::Encode<DeviceGetConfigurationDescriptorRequest, D>
2045        for &DeviceGetConfigurationDescriptorRequest
2046    {
2047        #[inline]
2048        unsafe fn encode(
2049            self,
2050            encoder: &mut fidl::encoding::Encoder<'_, D>,
2051            offset: usize,
2052            _depth: fidl::encoding::Depth,
2053        ) -> fidl::Result<()> {
2054            encoder.debug_check_bounds::<DeviceGetConfigurationDescriptorRequest>(offset);
2055            unsafe {
2056                // Copy the object into the buffer.
2057                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2058                (buf_ptr as *mut DeviceGetConfigurationDescriptorRequest).write_unaligned(
2059                    (self as *const DeviceGetConfigurationDescriptorRequest).read(),
2060                );
2061                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2062                // done second because the memcpy will write garbage to these bytes.
2063            }
2064            Ok(())
2065        }
2066    }
2067    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
2068        fidl::encoding::Encode<DeviceGetConfigurationDescriptorRequest, D> for (T0,)
2069    {
2070        #[inline]
2071        unsafe fn encode(
2072            self,
2073            encoder: &mut fidl::encoding::Encoder<'_, D>,
2074            offset: usize,
2075            depth: fidl::encoding::Depth,
2076        ) -> fidl::Result<()> {
2077            encoder.debug_check_bounds::<DeviceGetConfigurationDescriptorRequest>(offset);
2078            // Zero out padding regions. There's no need to apply masks
2079            // because the unmasked parts will be overwritten by fields.
2080            // Write the fields.
2081            self.0.encode(encoder, offset + 0, depth)?;
2082            Ok(())
2083        }
2084    }
2085
2086    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2087        for DeviceGetConfigurationDescriptorRequest
2088    {
2089        #[inline(always)]
2090        fn new_empty() -> Self {
2091            Self { config: fidl::new_empty!(u8, D) }
2092        }
2093
2094        #[inline]
2095        unsafe fn decode(
2096            &mut self,
2097            decoder: &mut fidl::encoding::Decoder<'_, D>,
2098            offset: usize,
2099            _depth: fidl::encoding::Depth,
2100        ) -> fidl::Result<()> {
2101            decoder.debug_check_bounds::<Self>(offset);
2102            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2103            // Verify that padding bytes are zero.
2104            // Copy from the buffer into the object.
2105            unsafe {
2106                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
2107            }
2108            Ok(())
2109        }
2110    }
2111
2112    impl fidl::encoding::ValueTypeMarker for DeviceGetConfigurationDescriptorResponse {
2113        type Borrowed<'a> = &'a Self;
2114        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2115            value
2116        }
2117    }
2118
2119    unsafe impl fidl::encoding::TypeMarker for DeviceGetConfigurationDescriptorResponse {
2120        type Owned = Self;
2121
2122        #[inline(always)]
2123        fn inline_align(_context: fidl::encoding::Context) -> usize {
2124            8
2125        }
2126
2127        #[inline(always)]
2128        fn inline_size(_context: fidl::encoding::Context) -> usize {
2129            24
2130        }
2131    }
2132
2133    unsafe impl<D: fidl::encoding::ResourceDialect>
2134        fidl::encoding::Encode<DeviceGetConfigurationDescriptorResponse, D>
2135        for &DeviceGetConfigurationDescriptorResponse
2136    {
2137        #[inline]
2138        unsafe fn encode(
2139            self,
2140            encoder: &mut fidl::encoding::Encoder<'_, D>,
2141            offset: usize,
2142            _depth: fidl::encoding::Depth,
2143        ) -> fidl::Result<()> {
2144            encoder.debug_check_bounds::<DeviceGetConfigurationDescriptorResponse>(offset);
2145            // Delegate to tuple encoding.
2146            fidl::encoding::Encode::<DeviceGetConfigurationDescriptorResponse, D>::encode(
2147                (
2148                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.s),
2149                    <fidl::encoding::Vector<u8, 65536> as fidl::encoding::ValueTypeMarker>::borrow(
2150                        &self.desc,
2151                    ),
2152                ),
2153                encoder,
2154                offset,
2155                _depth,
2156            )
2157        }
2158    }
2159    unsafe impl<
2160            D: fidl::encoding::ResourceDialect,
2161            T0: fidl::encoding::Encode<i32, D>,
2162            T1: fidl::encoding::Encode<fidl::encoding::Vector<u8, 65536>, D>,
2163        > fidl::encoding::Encode<DeviceGetConfigurationDescriptorResponse, D> for (T0, T1)
2164    {
2165        #[inline]
2166        unsafe fn encode(
2167            self,
2168            encoder: &mut fidl::encoding::Encoder<'_, D>,
2169            offset: usize,
2170            depth: fidl::encoding::Depth,
2171        ) -> fidl::Result<()> {
2172            encoder.debug_check_bounds::<DeviceGetConfigurationDescriptorResponse>(offset);
2173            // Zero out padding regions. There's no need to apply masks
2174            // because the unmasked parts will be overwritten by fields.
2175            unsafe {
2176                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2177                (ptr as *mut u64).write_unaligned(0);
2178            }
2179            // Write the fields.
2180            self.0.encode(encoder, offset + 0, depth)?;
2181            self.1.encode(encoder, offset + 8, depth)?;
2182            Ok(())
2183        }
2184    }
2185
2186    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2187        for DeviceGetConfigurationDescriptorResponse
2188    {
2189        #[inline(always)]
2190        fn new_empty() -> Self {
2191            Self {
2192                s: fidl::new_empty!(i32, D),
2193                desc: fidl::new_empty!(fidl::encoding::Vector<u8, 65536>, D),
2194            }
2195        }
2196
2197        #[inline]
2198        unsafe fn decode(
2199            &mut self,
2200            decoder: &mut fidl::encoding::Decoder<'_, D>,
2201            offset: usize,
2202            _depth: fidl::encoding::Depth,
2203        ) -> fidl::Result<()> {
2204            decoder.debug_check_bounds::<Self>(offset);
2205            // Verify that padding bytes are zero.
2206            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2207            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2208            let mask = 0xffffffff00000000u64;
2209            let maskedval = padval & mask;
2210            if maskedval != 0 {
2211                return Err(fidl::Error::NonZeroPadding {
2212                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2213                });
2214            }
2215            fidl::decode!(i32, D, &mut self.s, decoder, offset + 0, _depth)?;
2216            fidl::decode!(fidl::encoding::Vector<u8, 65536>, D, &mut self.desc, decoder, offset + 8, _depth)?;
2217            Ok(())
2218        }
2219    }
2220
2221    impl fidl::encoding::ValueTypeMarker for DeviceGetConfigurationDescriptorSizeRequest {
2222        type Borrowed<'a> = &'a Self;
2223        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2224            value
2225        }
2226    }
2227
2228    unsafe impl fidl::encoding::TypeMarker for DeviceGetConfigurationDescriptorSizeRequest {
2229        type Owned = Self;
2230
2231        #[inline(always)]
2232        fn inline_align(_context: fidl::encoding::Context) -> usize {
2233            1
2234        }
2235
2236        #[inline(always)]
2237        fn inline_size(_context: fidl::encoding::Context) -> usize {
2238            1
2239        }
2240        #[inline(always)]
2241        fn encode_is_copy() -> bool {
2242            true
2243        }
2244
2245        #[inline(always)]
2246        fn decode_is_copy() -> bool {
2247            true
2248        }
2249    }
2250
2251    unsafe impl<D: fidl::encoding::ResourceDialect>
2252        fidl::encoding::Encode<DeviceGetConfigurationDescriptorSizeRequest, D>
2253        for &DeviceGetConfigurationDescriptorSizeRequest
2254    {
2255        #[inline]
2256        unsafe fn encode(
2257            self,
2258            encoder: &mut fidl::encoding::Encoder<'_, D>,
2259            offset: usize,
2260            _depth: fidl::encoding::Depth,
2261        ) -> fidl::Result<()> {
2262            encoder.debug_check_bounds::<DeviceGetConfigurationDescriptorSizeRequest>(offset);
2263            unsafe {
2264                // Copy the object into the buffer.
2265                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2266                (buf_ptr as *mut DeviceGetConfigurationDescriptorSizeRequest).write_unaligned(
2267                    (self as *const DeviceGetConfigurationDescriptorSizeRequest).read(),
2268                );
2269                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2270                // done second because the memcpy will write garbage to these bytes.
2271            }
2272            Ok(())
2273        }
2274    }
2275    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
2276        fidl::encoding::Encode<DeviceGetConfigurationDescriptorSizeRequest, D> for (T0,)
2277    {
2278        #[inline]
2279        unsafe fn encode(
2280            self,
2281            encoder: &mut fidl::encoding::Encoder<'_, D>,
2282            offset: usize,
2283            depth: fidl::encoding::Depth,
2284        ) -> fidl::Result<()> {
2285            encoder.debug_check_bounds::<DeviceGetConfigurationDescriptorSizeRequest>(offset);
2286            // Zero out padding regions. There's no need to apply masks
2287            // because the unmasked parts will be overwritten by fields.
2288            // Write the fields.
2289            self.0.encode(encoder, offset + 0, depth)?;
2290            Ok(())
2291        }
2292    }
2293
2294    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2295        for DeviceGetConfigurationDescriptorSizeRequest
2296    {
2297        #[inline(always)]
2298        fn new_empty() -> Self {
2299            Self { config: fidl::new_empty!(u8, D) }
2300        }
2301
2302        #[inline]
2303        unsafe fn decode(
2304            &mut self,
2305            decoder: &mut fidl::encoding::Decoder<'_, D>,
2306            offset: usize,
2307            _depth: fidl::encoding::Depth,
2308        ) -> fidl::Result<()> {
2309            decoder.debug_check_bounds::<Self>(offset);
2310            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2311            // Verify that padding bytes are zero.
2312            // Copy from the buffer into the object.
2313            unsafe {
2314                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
2315            }
2316            Ok(())
2317        }
2318    }
2319
2320    impl fidl::encoding::ValueTypeMarker for DeviceGetConfigurationDescriptorSizeResponse {
2321        type Borrowed<'a> = &'a Self;
2322        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2323            value
2324        }
2325    }
2326
2327    unsafe impl fidl::encoding::TypeMarker for DeviceGetConfigurationDescriptorSizeResponse {
2328        type Owned = Self;
2329
2330        #[inline(always)]
2331        fn inline_align(_context: fidl::encoding::Context) -> usize {
2332            4
2333        }
2334
2335        #[inline(always)]
2336        fn inline_size(_context: fidl::encoding::Context) -> usize {
2337            8
2338        }
2339    }
2340
2341    unsafe impl<D: fidl::encoding::ResourceDialect>
2342        fidl::encoding::Encode<DeviceGetConfigurationDescriptorSizeResponse, D>
2343        for &DeviceGetConfigurationDescriptorSizeResponse
2344    {
2345        #[inline]
2346        unsafe fn encode(
2347            self,
2348            encoder: &mut fidl::encoding::Encoder<'_, D>,
2349            offset: usize,
2350            _depth: fidl::encoding::Depth,
2351        ) -> fidl::Result<()> {
2352            encoder.debug_check_bounds::<DeviceGetConfigurationDescriptorSizeResponse>(offset);
2353            unsafe {
2354                // Copy the object into the buffer.
2355                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2356                (buf_ptr as *mut DeviceGetConfigurationDescriptorSizeResponse).write_unaligned(
2357                    (self as *const DeviceGetConfigurationDescriptorSizeResponse).read(),
2358                );
2359                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2360                // done second because the memcpy will write garbage to these bytes.
2361                let padding_ptr = buf_ptr.offset(4) as *mut u32;
2362                let padding_mask = 0xffff0000u32;
2363                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
2364            }
2365            Ok(())
2366        }
2367    }
2368    unsafe impl<
2369            D: fidl::encoding::ResourceDialect,
2370            T0: fidl::encoding::Encode<i32, D>,
2371            T1: fidl::encoding::Encode<u16, D>,
2372        > fidl::encoding::Encode<DeviceGetConfigurationDescriptorSizeResponse, D> for (T0, T1)
2373    {
2374        #[inline]
2375        unsafe fn encode(
2376            self,
2377            encoder: &mut fidl::encoding::Encoder<'_, D>,
2378            offset: usize,
2379            depth: fidl::encoding::Depth,
2380        ) -> fidl::Result<()> {
2381            encoder.debug_check_bounds::<DeviceGetConfigurationDescriptorSizeResponse>(offset);
2382            // Zero out padding regions. There's no need to apply masks
2383            // because the unmasked parts will be overwritten by fields.
2384            unsafe {
2385                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(4);
2386                (ptr as *mut u32).write_unaligned(0);
2387            }
2388            // Write the fields.
2389            self.0.encode(encoder, offset + 0, depth)?;
2390            self.1.encode(encoder, offset + 4, depth)?;
2391            Ok(())
2392        }
2393    }
2394
2395    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2396        for DeviceGetConfigurationDescriptorSizeResponse
2397    {
2398        #[inline(always)]
2399        fn new_empty() -> Self {
2400            Self { s: fidl::new_empty!(i32, D), size: fidl::new_empty!(u16, D) }
2401        }
2402
2403        #[inline]
2404        unsafe fn decode(
2405            &mut self,
2406            decoder: &mut fidl::encoding::Decoder<'_, D>,
2407            offset: usize,
2408            _depth: fidl::encoding::Depth,
2409        ) -> fidl::Result<()> {
2410            decoder.debug_check_bounds::<Self>(offset);
2411            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2412            // Verify that padding bytes are zero.
2413            let ptr = unsafe { buf_ptr.offset(4) };
2414            let padval = unsafe { (ptr as *const u32).read_unaligned() };
2415            let mask = 0xffff0000u32;
2416            let maskedval = padval & mask;
2417            if maskedval != 0 {
2418                return Err(fidl::Error::NonZeroPadding {
2419                    padding_start: offset + 4 + ((mask as u64).trailing_zeros() / 8) as usize,
2420                });
2421            }
2422            // Copy from the buffer into the object.
2423            unsafe {
2424                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
2425            }
2426            Ok(())
2427        }
2428    }
2429
2430    impl fidl::encoding::ValueTypeMarker for DeviceGetConfigurationResponse {
2431        type Borrowed<'a> = &'a Self;
2432        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2433            value
2434        }
2435    }
2436
2437    unsafe impl fidl::encoding::TypeMarker for DeviceGetConfigurationResponse {
2438        type Owned = Self;
2439
2440        #[inline(always)]
2441        fn inline_align(_context: fidl::encoding::Context) -> usize {
2442            1
2443        }
2444
2445        #[inline(always)]
2446        fn inline_size(_context: fidl::encoding::Context) -> usize {
2447            1
2448        }
2449        #[inline(always)]
2450        fn encode_is_copy() -> bool {
2451            true
2452        }
2453
2454        #[inline(always)]
2455        fn decode_is_copy() -> bool {
2456            true
2457        }
2458    }
2459
2460    unsafe impl<D: fidl::encoding::ResourceDialect>
2461        fidl::encoding::Encode<DeviceGetConfigurationResponse, D>
2462        for &DeviceGetConfigurationResponse
2463    {
2464        #[inline]
2465        unsafe fn encode(
2466            self,
2467            encoder: &mut fidl::encoding::Encoder<'_, D>,
2468            offset: usize,
2469            _depth: fidl::encoding::Depth,
2470        ) -> fidl::Result<()> {
2471            encoder.debug_check_bounds::<DeviceGetConfigurationResponse>(offset);
2472            unsafe {
2473                // Copy the object into the buffer.
2474                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2475                (buf_ptr as *mut DeviceGetConfigurationResponse)
2476                    .write_unaligned((self as *const DeviceGetConfigurationResponse).read());
2477                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2478                // done second because the memcpy will write garbage to these bytes.
2479            }
2480            Ok(())
2481        }
2482    }
2483    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
2484        fidl::encoding::Encode<DeviceGetConfigurationResponse, D> for (T0,)
2485    {
2486        #[inline]
2487        unsafe fn encode(
2488            self,
2489            encoder: &mut fidl::encoding::Encoder<'_, D>,
2490            offset: usize,
2491            depth: fidl::encoding::Depth,
2492        ) -> fidl::Result<()> {
2493            encoder.debug_check_bounds::<DeviceGetConfigurationResponse>(offset);
2494            // Zero out padding regions. There's no need to apply masks
2495            // because the unmasked parts will be overwritten by fields.
2496            // Write the fields.
2497            self.0.encode(encoder, offset + 0, depth)?;
2498            Ok(())
2499        }
2500    }
2501
2502    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2503        for DeviceGetConfigurationResponse
2504    {
2505        #[inline(always)]
2506        fn new_empty() -> Self {
2507            Self { configuration: fidl::new_empty!(u8, D) }
2508        }
2509
2510        #[inline]
2511        unsafe fn decode(
2512            &mut self,
2513            decoder: &mut fidl::encoding::Decoder<'_, D>,
2514            offset: usize,
2515            _depth: fidl::encoding::Depth,
2516        ) -> fidl::Result<()> {
2517            decoder.debug_check_bounds::<Self>(offset);
2518            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2519            // Verify that padding bytes are zero.
2520            // Copy from the buffer into the object.
2521            unsafe {
2522                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
2523            }
2524            Ok(())
2525        }
2526    }
2527
2528    impl fidl::encoding::ValueTypeMarker for DeviceGetDeviceDescriptorResponse {
2529        type Borrowed<'a> = &'a Self;
2530        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2531            value
2532        }
2533    }
2534
2535    unsafe impl fidl::encoding::TypeMarker for DeviceGetDeviceDescriptorResponse {
2536        type Owned = Self;
2537
2538        #[inline(always)]
2539        fn inline_align(_context: fidl::encoding::Context) -> usize {
2540            1
2541        }
2542
2543        #[inline(always)]
2544        fn inline_size(_context: fidl::encoding::Context) -> usize {
2545            18
2546        }
2547        #[inline(always)]
2548        fn encode_is_copy() -> bool {
2549            true
2550        }
2551
2552        #[inline(always)]
2553        fn decode_is_copy() -> bool {
2554            true
2555        }
2556    }
2557
2558    unsafe impl<D: fidl::encoding::ResourceDialect>
2559        fidl::encoding::Encode<DeviceGetDeviceDescriptorResponse, D>
2560        for &DeviceGetDeviceDescriptorResponse
2561    {
2562        #[inline]
2563        unsafe fn encode(
2564            self,
2565            encoder: &mut fidl::encoding::Encoder<'_, D>,
2566            offset: usize,
2567            _depth: fidl::encoding::Depth,
2568        ) -> fidl::Result<()> {
2569            encoder.debug_check_bounds::<DeviceGetDeviceDescriptorResponse>(offset);
2570            unsafe {
2571                // Copy the object into the buffer.
2572                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2573                (buf_ptr as *mut DeviceGetDeviceDescriptorResponse)
2574                    .write_unaligned((self as *const DeviceGetDeviceDescriptorResponse).read());
2575                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2576                // done second because the memcpy will write garbage to these bytes.
2577            }
2578            Ok(())
2579        }
2580    }
2581    unsafe impl<
2582            D: fidl::encoding::ResourceDialect,
2583            T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 18>, D>,
2584        > fidl::encoding::Encode<DeviceGetDeviceDescriptorResponse, D> for (T0,)
2585    {
2586        #[inline]
2587        unsafe fn encode(
2588            self,
2589            encoder: &mut fidl::encoding::Encoder<'_, D>,
2590            offset: usize,
2591            depth: fidl::encoding::Depth,
2592        ) -> fidl::Result<()> {
2593            encoder.debug_check_bounds::<DeviceGetDeviceDescriptorResponse>(offset);
2594            // Zero out padding regions. There's no need to apply masks
2595            // because the unmasked parts will be overwritten by fields.
2596            // Write the fields.
2597            self.0.encode(encoder, offset + 0, depth)?;
2598            Ok(())
2599        }
2600    }
2601
2602    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2603        for DeviceGetDeviceDescriptorResponse
2604    {
2605        #[inline(always)]
2606        fn new_empty() -> Self {
2607            Self { desc: fidl::new_empty!(fidl::encoding::Array<u8, 18>, D) }
2608        }
2609
2610        #[inline]
2611        unsafe fn decode(
2612            &mut self,
2613            decoder: &mut fidl::encoding::Decoder<'_, D>,
2614            offset: usize,
2615            _depth: fidl::encoding::Depth,
2616        ) -> fidl::Result<()> {
2617            decoder.debug_check_bounds::<Self>(offset);
2618            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2619            // Verify that padding bytes are zero.
2620            // Copy from the buffer into the object.
2621            unsafe {
2622                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 18);
2623            }
2624            Ok(())
2625        }
2626    }
2627
2628    impl fidl::encoding::ValueTypeMarker for DeviceGetDeviceIdResponse {
2629        type Borrowed<'a> = &'a Self;
2630        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2631            value
2632        }
2633    }
2634
2635    unsafe impl fidl::encoding::TypeMarker for DeviceGetDeviceIdResponse {
2636        type Owned = Self;
2637
2638        #[inline(always)]
2639        fn inline_align(_context: fidl::encoding::Context) -> usize {
2640            4
2641        }
2642
2643        #[inline(always)]
2644        fn inline_size(_context: fidl::encoding::Context) -> usize {
2645            4
2646        }
2647        #[inline(always)]
2648        fn encode_is_copy() -> bool {
2649            true
2650        }
2651
2652        #[inline(always)]
2653        fn decode_is_copy() -> bool {
2654            true
2655        }
2656    }
2657
2658    unsafe impl<D: fidl::encoding::ResourceDialect>
2659        fidl::encoding::Encode<DeviceGetDeviceIdResponse, D> for &DeviceGetDeviceIdResponse
2660    {
2661        #[inline]
2662        unsafe fn encode(
2663            self,
2664            encoder: &mut fidl::encoding::Encoder<'_, D>,
2665            offset: usize,
2666            _depth: fidl::encoding::Depth,
2667        ) -> fidl::Result<()> {
2668            encoder.debug_check_bounds::<DeviceGetDeviceIdResponse>(offset);
2669            unsafe {
2670                // Copy the object into the buffer.
2671                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2672                (buf_ptr as *mut DeviceGetDeviceIdResponse)
2673                    .write_unaligned((self as *const DeviceGetDeviceIdResponse).read());
2674                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2675                // done second because the memcpy will write garbage to these bytes.
2676            }
2677            Ok(())
2678        }
2679    }
2680    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
2681        fidl::encoding::Encode<DeviceGetDeviceIdResponse, D> for (T0,)
2682    {
2683        #[inline]
2684        unsafe fn encode(
2685            self,
2686            encoder: &mut fidl::encoding::Encoder<'_, D>,
2687            offset: usize,
2688            depth: fidl::encoding::Depth,
2689        ) -> fidl::Result<()> {
2690            encoder.debug_check_bounds::<DeviceGetDeviceIdResponse>(offset);
2691            // Zero out padding regions. There's no need to apply masks
2692            // because the unmasked parts will be overwritten by fields.
2693            // Write the fields.
2694            self.0.encode(encoder, offset + 0, depth)?;
2695            Ok(())
2696        }
2697    }
2698
2699    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2700        for DeviceGetDeviceIdResponse
2701    {
2702        #[inline(always)]
2703        fn new_empty() -> Self {
2704            Self { device_id: fidl::new_empty!(u32, D) }
2705        }
2706
2707        #[inline]
2708        unsafe fn decode(
2709            &mut self,
2710            decoder: &mut fidl::encoding::Decoder<'_, D>,
2711            offset: usize,
2712            _depth: fidl::encoding::Depth,
2713        ) -> fidl::Result<()> {
2714            decoder.debug_check_bounds::<Self>(offset);
2715            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2716            // Verify that padding bytes are zero.
2717            // Copy from the buffer into the object.
2718            unsafe {
2719                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
2720            }
2721            Ok(())
2722        }
2723    }
2724
2725    impl fidl::encoding::ValueTypeMarker for DeviceGetDeviceSpeedResponse {
2726        type Borrowed<'a> = &'a Self;
2727        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2728            value
2729        }
2730    }
2731
2732    unsafe impl fidl::encoding::TypeMarker for DeviceGetDeviceSpeedResponse {
2733        type Owned = Self;
2734
2735        #[inline(always)]
2736        fn inline_align(_context: fidl::encoding::Context) -> usize {
2737            4
2738        }
2739
2740        #[inline(always)]
2741        fn inline_size(_context: fidl::encoding::Context) -> usize {
2742            4
2743        }
2744        #[inline(always)]
2745        fn encode_is_copy() -> bool {
2746            true
2747        }
2748
2749        #[inline(always)]
2750        fn decode_is_copy() -> bool {
2751            true
2752        }
2753    }
2754
2755    unsafe impl<D: fidl::encoding::ResourceDialect>
2756        fidl::encoding::Encode<DeviceGetDeviceSpeedResponse, D> for &DeviceGetDeviceSpeedResponse
2757    {
2758        #[inline]
2759        unsafe fn encode(
2760            self,
2761            encoder: &mut fidl::encoding::Encoder<'_, D>,
2762            offset: usize,
2763            _depth: fidl::encoding::Depth,
2764        ) -> fidl::Result<()> {
2765            encoder.debug_check_bounds::<DeviceGetDeviceSpeedResponse>(offset);
2766            unsafe {
2767                // Copy the object into the buffer.
2768                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2769                (buf_ptr as *mut DeviceGetDeviceSpeedResponse)
2770                    .write_unaligned((self as *const DeviceGetDeviceSpeedResponse).read());
2771                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2772                // done second because the memcpy will write garbage to these bytes.
2773            }
2774            Ok(())
2775        }
2776    }
2777    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
2778        fidl::encoding::Encode<DeviceGetDeviceSpeedResponse, D> for (T0,)
2779    {
2780        #[inline]
2781        unsafe fn encode(
2782            self,
2783            encoder: &mut fidl::encoding::Encoder<'_, D>,
2784            offset: usize,
2785            depth: fidl::encoding::Depth,
2786        ) -> fidl::Result<()> {
2787            encoder.debug_check_bounds::<DeviceGetDeviceSpeedResponse>(offset);
2788            // Zero out padding regions. There's no need to apply masks
2789            // because the unmasked parts will be overwritten by fields.
2790            // Write the fields.
2791            self.0.encode(encoder, offset + 0, depth)?;
2792            Ok(())
2793        }
2794    }
2795
2796    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2797        for DeviceGetDeviceSpeedResponse
2798    {
2799        #[inline(always)]
2800        fn new_empty() -> Self {
2801            Self { speed: fidl::new_empty!(u32, D) }
2802        }
2803
2804        #[inline]
2805        unsafe fn decode(
2806            &mut self,
2807            decoder: &mut fidl::encoding::Decoder<'_, D>,
2808            offset: usize,
2809            _depth: fidl::encoding::Depth,
2810        ) -> fidl::Result<()> {
2811            decoder.debug_check_bounds::<Self>(offset);
2812            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2813            // Verify that padding bytes are zero.
2814            // Copy from the buffer into the object.
2815            unsafe {
2816                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
2817            }
2818            Ok(())
2819        }
2820    }
2821
2822    impl fidl::encoding::ValueTypeMarker for DeviceGetHubDeviceIdResponse {
2823        type Borrowed<'a> = &'a Self;
2824        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2825            value
2826        }
2827    }
2828
2829    unsafe impl fidl::encoding::TypeMarker for DeviceGetHubDeviceIdResponse {
2830        type Owned = Self;
2831
2832        #[inline(always)]
2833        fn inline_align(_context: fidl::encoding::Context) -> usize {
2834            4
2835        }
2836
2837        #[inline(always)]
2838        fn inline_size(_context: fidl::encoding::Context) -> usize {
2839            4
2840        }
2841        #[inline(always)]
2842        fn encode_is_copy() -> bool {
2843            true
2844        }
2845
2846        #[inline(always)]
2847        fn decode_is_copy() -> bool {
2848            true
2849        }
2850    }
2851
2852    unsafe impl<D: fidl::encoding::ResourceDialect>
2853        fidl::encoding::Encode<DeviceGetHubDeviceIdResponse, D> for &DeviceGetHubDeviceIdResponse
2854    {
2855        #[inline]
2856        unsafe fn encode(
2857            self,
2858            encoder: &mut fidl::encoding::Encoder<'_, D>,
2859            offset: usize,
2860            _depth: fidl::encoding::Depth,
2861        ) -> fidl::Result<()> {
2862            encoder.debug_check_bounds::<DeviceGetHubDeviceIdResponse>(offset);
2863            unsafe {
2864                // Copy the object into the buffer.
2865                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2866                (buf_ptr as *mut DeviceGetHubDeviceIdResponse)
2867                    .write_unaligned((self as *const DeviceGetHubDeviceIdResponse).read());
2868                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2869                // done second because the memcpy will write garbage to these bytes.
2870            }
2871            Ok(())
2872        }
2873    }
2874    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
2875        fidl::encoding::Encode<DeviceGetHubDeviceIdResponse, D> for (T0,)
2876    {
2877        #[inline]
2878        unsafe fn encode(
2879            self,
2880            encoder: &mut fidl::encoding::Encoder<'_, D>,
2881            offset: usize,
2882            depth: fidl::encoding::Depth,
2883        ) -> fidl::Result<()> {
2884            encoder.debug_check_bounds::<DeviceGetHubDeviceIdResponse>(offset);
2885            // Zero out padding regions. There's no need to apply masks
2886            // because the unmasked parts will be overwritten by fields.
2887            // Write the fields.
2888            self.0.encode(encoder, offset + 0, depth)?;
2889            Ok(())
2890        }
2891    }
2892
2893    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2894        for DeviceGetHubDeviceIdResponse
2895    {
2896        #[inline(always)]
2897        fn new_empty() -> Self {
2898            Self { hub_device_id: fidl::new_empty!(u32, D) }
2899        }
2900
2901        #[inline]
2902        unsafe fn decode(
2903            &mut self,
2904            decoder: &mut fidl::encoding::Decoder<'_, D>,
2905            offset: usize,
2906            _depth: fidl::encoding::Depth,
2907        ) -> fidl::Result<()> {
2908            decoder.debug_check_bounds::<Self>(offset);
2909            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2910            // Verify that padding bytes are zero.
2911            // Copy from the buffer into the object.
2912            unsafe {
2913                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
2914            }
2915            Ok(())
2916        }
2917    }
2918
2919    impl fidl::encoding::ValueTypeMarker for DeviceGetStringDescriptorRequest {
2920        type Borrowed<'a> = &'a Self;
2921        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2922            value
2923        }
2924    }
2925
2926    unsafe impl fidl::encoding::TypeMarker for DeviceGetStringDescriptorRequest {
2927        type Owned = Self;
2928
2929        #[inline(always)]
2930        fn inline_align(_context: fidl::encoding::Context) -> usize {
2931            2
2932        }
2933
2934        #[inline(always)]
2935        fn inline_size(_context: fidl::encoding::Context) -> usize {
2936            4
2937        }
2938    }
2939
2940    unsafe impl<D: fidl::encoding::ResourceDialect>
2941        fidl::encoding::Encode<DeviceGetStringDescriptorRequest, D>
2942        for &DeviceGetStringDescriptorRequest
2943    {
2944        #[inline]
2945        unsafe fn encode(
2946            self,
2947            encoder: &mut fidl::encoding::Encoder<'_, D>,
2948            offset: usize,
2949            _depth: fidl::encoding::Depth,
2950        ) -> fidl::Result<()> {
2951            encoder.debug_check_bounds::<DeviceGetStringDescriptorRequest>(offset);
2952            unsafe {
2953                // Copy the object into the buffer.
2954                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2955                (buf_ptr as *mut DeviceGetStringDescriptorRequest)
2956                    .write_unaligned((self as *const DeviceGetStringDescriptorRequest).read());
2957                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2958                // done second because the memcpy will write garbage to these bytes.
2959                let padding_ptr = buf_ptr.offset(0) as *mut u16;
2960                let padding_mask = 0xff00u16;
2961                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
2962            }
2963            Ok(())
2964        }
2965    }
2966    unsafe impl<
2967            D: fidl::encoding::ResourceDialect,
2968            T0: fidl::encoding::Encode<u8, D>,
2969            T1: fidl::encoding::Encode<u16, D>,
2970        > fidl::encoding::Encode<DeviceGetStringDescriptorRequest, D> for (T0, T1)
2971    {
2972        #[inline]
2973        unsafe fn encode(
2974            self,
2975            encoder: &mut fidl::encoding::Encoder<'_, D>,
2976            offset: usize,
2977            depth: fidl::encoding::Depth,
2978        ) -> fidl::Result<()> {
2979            encoder.debug_check_bounds::<DeviceGetStringDescriptorRequest>(offset);
2980            // Zero out padding regions. There's no need to apply masks
2981            // because the unmasked parts will be overwritten by fields.
2982            unsafe {
2983                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2984                (ptr as *mut u16).write_unaligned(0);
2985            }
2986            // Write the fields.
2987            self.0.encode(encoder, offset + 0, depth)?;
2988            self.1.encode(encoder, offset + 2, depth)?;
2989            Ok(())
2990        }
2991    }
2992
2993    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2994        for DeviceGetStringDescriptorRequest
2995    {
2996        #[inline(always)]
2997        fn new_empty() -> Self {
2998            Self { desc_id: fidl::new_empty!(u8, D), lang_id: fidl::new_empty!(u16, D) }
2999        }
3000
3001        #[inline]
3002        unsafe fn decode(
3003            &mut self,
3004            decoder: &mut fidl::encoding::Decoder<'_, D>,
3005            offset: usize,
3006            _depth: fidl::encoding::Depth,
3007        ) -> fidl::Result<()> {
3008            decoder.debug_check_bounds::<Self>(offset);
3009            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3010            // Verify that padding bytes are zero.
3011            let ptr = unsafe { buf_ptr.offset(0) };
3012            let padval = unsafe { (ptr as *const u16).read_unaligned() };
3013            let mask = 0xff00u16;
3014            let maskedval = padval & mask;
3015            if maskedval != 0 {
3016                return Err(fidl::Error::NonZeroPadding {
3017                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3018                });
3019            }
3020            // Copy from the buffer into the object.
3021            unsafe {
3022                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
3023            }
3024            Ok(())
3025        }
3026    }
3027
3028    impl fidl::encoding::ValueTypeMarker for DeviceGetStringDescriptorResponse {
3029        type Borrowed<'a> = &'a Self;
3030        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3031            value
3032        }
3033    }
3034
3035    unsafe impl fidl::encoding::TypeMarker for DeviceGetStringDescriptorResponse {
3036        type Owned = Self;
3037
3038        #[inline(always)]
3039        fn inline_align(_context: fidl::encoding::Context) -> usize {
3040            8
3041        }
3042
3043        #[inline(always)]
3044        fn inline_size(_context: fidl::encoding::Context) -> usize {
3045            32
3046        }
3047    }
3048
3049    unsafe impl<D: fidl::encoding::ResourceDialect>
3050        fidl::encoding::Encode<DeviceGetStringDescriptorResponse, D>
3051        for &DeviceGetStringDescriptorResponse
3052    {
3053        #[inline]
3054        unsafe fn encode(
3055            self,
3056            encoder: &mut fidl::encoding::Encoder<'_, D>,
3057            offset: usize,
3058            _depth: fidl::encoding::Depth,
3059        ) -> fidl::Result<()> {
3060            encoder.debug_check_bounds::<DeviceGetStringDescriptorResponse>(offset);
3061            // Delegate to tuple encoding.
3062            fidl::encoding::Encode::<DeviceGetStringDescriptorResponse, D>::encode(
3063                (
3064                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.s),
3065                    <fidl::encoding::BoundedString<384> as fidl::encoding::ValueTypeMarker>::borrow(
3066                        &self.desc,
3067                    ),
3068                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.actual_lang_id),
3069                ),
3070                encoder,
3071                offset,
3072                _depth,
3073            )
3074        }
3075    }
3076    unsafe impl<
3077            D: fidl::encoding::ResourceDialect,
3078            T0: fidl::encoding::Encode<i32, D>,
3079            T1: fidl::encoding::Encode<fidl::encoding::BoundedString<384>, D>,
3080            T2: fidl::encoding::Encode<u16, D>,
3081        > fidl::encoding::Encode<DeviceGetStringDescriptorResponse, D> for (T0, T1, T2)
3082    {
3083        #[inline]
3084        unsafe fn encode(
3085            self,
3086            encoder: &mut fidl::encoding::Encoder<'_, D>,
3087            offset: usize,
3088            depth: fidl::encoding::Depth,
3089        ) -> fidl::Result<()> {
3090            encoder.debug_check_bounds::<DeviceGetStringDescriptorResponse>(offset);
3091            // Zero out padding regions. There's no need to apply masks
3092            // because the unmasked parts will be overwritten by fields.
3093            unsafe {
3094                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3095                (ptr as *mut u64).write_unaligned(0);
3096            }
3097            unsafe {
3098                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
3099                (ptr as *mut u64).write_unaligned(0);
3100            }
3101            // Write the fields.
3102            self.0.encode(encoder, offset + 0, depth)?;
3103            self.1.encode(encoder, offset + 8, depth)?;
3104            self.2.encode(encoder, offset + 24, depth)?;
3105            Ok(())
3106        }
3107    }
3108
3109    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3110        for DeviceGetStringDescriptorResponse
3111    {
3112        #[inline(always)]
3113        fn new_empty() -> Self {
3114            Self {
3115                s: fidl::new_empty!(i32, D),
3116                desc: fidl::new_empty!(fidl::encoding::BoundedString<384>, D),
3117                actual_lang_id: fidl::new_empty!(u16, D),
3118            }
3119        }
3120
3121        #[inline]
3122        unsafe fn decode(
3123            &mut self,
3124            decoder: &mut fidl::encoding::Decoder<'_, D>,
3125            offset: usize,
3126            _depth: fidl::encoding::Depth,
3127        ) -> fidl::Result<()> {
3128            decoder.debug_check_bounds::<Self>(offset);
3129            // Verify that padding bytes are zero.
3130            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3131            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3132            let mask = 0xffffffff00000000u64;
3133            let maskedval = padval & mask;
3134            if maskedval != 0 {
3135                return Err(fidl::Error::NonZeroPadding {
3136                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3137                });
3138            }
3139            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
3140            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3141            let mask = 0xffffffffffff0000u64;
3142            let maskedval = padval & mask;
3143            if maskedval != 0 {
3144                return Err(fidl::Error::NonZeroPadding {
3145                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
3146                });
3147            }
3148            fidl::decode!(i32, D, &mut self.s, decoder, offset + 0, _depth)?;
3149            fidl::decode!(
3150                fidl::encoding::BoundedString<384>,
3151                D,
3152                &mut self.desc,
3153                decoder,
3154                offset + 8,
3155                _depth
3156            )?;
3157            fidl::decode!(u16, D, &mut self.actual_lang_id, decoder, offset + 24, _depth)?;
3158            Ok(())
3159        }
3160    }
3161
3162    impl fidl::encoding::ValueTypeMarker for DeviceSetConfigurationRequest {
3163        type Borrowed<'a> = &'a Self;
3164        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3165            value
3166        }
3167    }
3168
3169    unsafe impl fidl::encoding::TypeMarker for DeviceSetConfigurationRequest {
3170        type Owned = Self;
3171
3172        #[inline(always)]
3173        fn inline_align(_context: fidl::encoding::Context) -> usize {
3174            1
3175        }
3176
3177        #[inline(always)]
3178        fn inline_size(_context: fidl::encoding::Context) -> usize {
3179            1
3180        }
3181        #[inline(always)]
3182        fn encode_is_copy() -> bool {
3183            true
3184        }
3185
3186        #[inline(always)]
3187        fn decode_is_copy() -> bool {
3188            true
3189        }
3190    }
3191
3192    unsafe impl<D: fidl::encoding::ResourceDialect>
3193        fidl::encoding::Encode<DeviceSetConfigurationRequest, D>
3194        for &DeviceSetConfigurationRequest
3195    {
3196        #[inline]
3197        unsafe fn encode(
3198            self,
3199            encoder: &mut fidl::encoding::Encoder<'_, D>,
3200            offset: usize,
3201            _depth: fidl::encoding::Depth,
3202        ) -> fidl::Result<()> {
3203            encoder.debug_check_bounds::<DeviceSetConfigurationRequest>(offset);
3204            unsafe {
3205                // Copy the object into the buffer.
3206                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3207                (buf_ptr as *mut DeviceSetConfigurationRequest)
3208                    .write_unaligned((self as *const DeviceSetConfigurationRequest).read());
3209                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3210                // done second because the memcpy will write garbage to these bytes.
3211            }
3212            Ok(())
3213        }
3214    }
3215    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
3216        fidl::encoding::Encode<DeviceSetConfigurationRequest, D> for (T0,)
3217    {
3218        #[inline]
3219        unsafe fn encode(
3220            self,
3221            encoder: &mut fidl::encoding::Encoder<'_, D>,
3222            offset: usize,
3223            depth: fidl::encoding::Depth,
3224        ) -> fidl::Result<()> {
3225            encoder.debug_check_bounds::<DeviceSetConfigurationRequest>(offset);
3226            // Zero out padding regions. There's no need to apply masks
3227            // because the unmasked parts will be overwritten by fields.
3228            // Write the fields.
3229            self.0.encode(encoder, offset + 0, depth)?;
3230            Ok(())
3231        }
3232    }
3233
3234    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3235        for DeviceSetConfigurationRequest
3236    {
3237        #[inline(always)]
3238        fn new_empty() -> Self {
3239            Self { configuration: fidl::new_empty!(u8, D) }
3240        }
3241
3242        #[inline]
3243        unsafe fn decode(
3244            &mut self,
3245            decoder: &mut fidl::encoding::Decoder<'_, D>,
3246            offset: usize,
3247            _depth: fidl::encoding::Depth,
3248        ) -> fidl::Result<()> {
3249            decoder.debug_check_bounds::<Self>(offset);
3250            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3251            // Verify that padding bytes are zero.
3252            // Copy from the buffer into the object.
3253            unsafe {
3254                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
3255            }
3256            Ok(())
3257        }
3258    }
3259
3260    impl fidl::encoding::ValueTypeMarker for DeviceSetConfigurationResponse {
3261        type Borrowed<'a> = &'a Self;
3262        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3263            value
3264        }
3265    }
3266
3267    unsafe impl fidl::encoding::TypeMarker for DeviceSetConfigurationResponse {
3268        type Owned = Self;
3269
3270        #[inline(always)]
3271        fn inline_align(_context: fidl::encoding::Context) -> usize {
3272            4
3273        }
3274
3275        #[inline(always)]
3276        fn inline_size(_context: fidl::encoding::Context) -> usize {
3277            4
3278        }
3279        #[inline(always)]
3280        fn encode_is_copy() -> bool {
3281            true
3282        }
3283
3284        #[inline(always)]
3285        fn decode_is_copy() -> bool {
3286            true
3287        }
3288    }
3289
3290    unsafe impl<D: fidl::encoding::ResourceDialect>
3291        fidl::encoding::Encode<DeviceSetConfigurationResponse, D>
3292        for &DeviceSetConfigurationResponse
3293    {
3294        #[inline]
3295        unsafe fn encode(
3296            self,
3297            encoder: &mut fidl::encoding::Encoder<'_, D>,
3298            offset: usize,
3299            _depth: fidl::encoding::Depth,
3300        ) -> fidl::Result<()> {
3301            encoder.debug_check_bounds::<DeviceSetConfigurationResponse>(offset);
3302            unsafe {
3303                // Copy the object into the buffer.
3304                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3305                (buf_ptr as *mut DeviceSetConfigurationResponse)
3306                    .write_unaligned((self as *const DeviceSetConfigurationResponse).read());
3307                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3308                // done second because the memcpy will write garbage to these bytes.
3309            }
3310            Ok(())
3311        }
3312    }
3313    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
3314        fidl::encoding::Encode<DeviceSetConfigurationResponse, D> for (T0,)
3315    {
3316        #[inline]
3317        unsafe fn encode(
3318            self,
3319            encoder: &mut fidl::encoding::Encoder<'_, D>,
3320            offset: usize,
3321            depth: fidl::encoding::Depth,
3322        ) -> fidl::Result<()> {
3323            encoder.debug_check_bounds::<DeviceSetConfigurationResponse>(offset);
3324            // Zero out padding regions. There's no need to apply masks
3325            // because the unmasked parts will be overwritten by fields.
3326            // Write the fields.
3327            self.0.encode(encoder, offset + 0, depth)?;
3328            Ok(())
3329        }
3330    }
3331
3332    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3333        for DeviceSetConfigurationResponse
3334    {
3335        #[inline(always)]
3336        fn new_empty() -> Self {
3337            Self { s: fidl::new_empty!(i32, D) }
3338        }
3339
3340        #[inline]
3341        unsafe fn decode(
3342            &mut self,
3343            decoder: &mut fidl::encoding::Decoder<'_, D>,
3344            offset: usize,
3345            _depth: fidl::encoding::Depth,
3346        ) -> fidl::Result<()> {
3347            decoder.debug_check_bounds::<Self>(offset);
3348            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3349            // Verify that padding bytes are zero.
3350            // Copy from the buffer into the object.
3351            unsafe {
3352                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
3353            }
3354            Ok(())
3355        }
3356    }
3357
3358    impl fidl::encoding::ValueTypeMarker for DeviceSetInterfaceRequest {
3359        type Borrowed<'a> = &'a Self;
3360        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3361            value
3362        }
3363    }
3364
3365    unsafe impl fidl::encoding::TypeMarker for DeviceSetInterfaceRequest {
3366        type Owned = Self;
3367
3368        #[inline(always)]
3369        fn inline_align(_context: fidl::encoding::Context) -> usize {
3370            1
3371        }
3372
3373        #[inline(always)]
3374        fn inline_size(_context: fidl::encoding::Context) -> usize {
3375            2
3376        }
3377        #[inline(always)]
3378        fn encode_is_copy() -> bool {
3379            true
3380        }
3381
3382        #[inline(always)]
3383        fn decode_is_copy() -> bool {
3384            true
3385        }
3386    }
3387
3388    unsafe impl<D: fidl::encoding::ResourceDialect>
3389        fidl::encoding::Encode<DeviceSetInterfaceRequest, D> for &DeviceSetInterfaceRequest
3390    {
3391        #[inline]
3392        unsafe fn encode(
3393            self,
3394            encoder: &mut fidl::encoding::Encoder<'_, D>,
3395            offset: usize,
3396            _depth: fidl::encoding::Depth,
3397        ) -> fidl::Result<()> {
3398            encoder.debug_check_bounds::<DeviceSetInterfaceRequest>(offset);
3399            unsafe {
3400                // Copy the object into the buffer.
3401                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3402                (buf_ptr as *mut DeviceSetInterfaceRequest)
3403                    .write_unaligned((self as *const DeviceSetInterfaceRequest).read());
3404                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3405                // done second because the memcpy will write garbage to these bytes.
3406            }
3407            Ok(())
3408        }
3409    }
3410    unsafe impl<
3411            D: fidl::encoding::ResourceDialect,
3412            T0: fidl::encoding::Encode<u8, D>,
3413            T1: fidl::encoding::Encode<u8, D>,
3414        > fidl::encoding::Encode<DeviceSetInterfaceRequest, D> for (T0, T1)
3415    {
3416        #[inline]
3417        unsafe fn encode(
3418            self,
3419            encoder: &mut fidl::encoding::Encoder<'_, D>,
3420            offset: usize,
3421            depth: fidl::encoding::Depth,
3422        ) -> fidl::Result<()> {
3423            encoder.debug_check_bounds::<DeviceSetInterfaceRequest>(offset);
3424            // Zero out padding regions. There's no need to apply masks
3425            // because the unmasked parts will be overwritten by fields.
3426            // Write the fields.
3427            self.0.encode(encoder, offset + 0, depth)?;
3428            self.1.encode(encoder, offset + 1, depth)?;
3429            Ok(())
3430        }
3431    }
3432
3433    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3434        for DeviceSetInterfaceRequest
3435    {
3436        #[inline(always)]
3437        fn new_empty() -> Self {
3438            Self { interface_number: fidl::new_empty!(u8, D), alt_setting: fidl::new_empty!(u8, D) }
3439        }
3440
3441        #[inline]
3442        unsafe fn decode(
3443            &mut self,
3444            decoder: &mut fidl::encoding::Decoder<'_, D>,
3445            offset: usize,
3446            _depth: fidl::encoding::Depth,
3447        ) -> fidl::Result<()> {
3448            decoder.debug_check_bounds::<Self>(offset);
3449            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3450            // Verify that padding bytes are zero.
3451            // Copy from the buffer into the object.
3452            unsafe {
3453                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
3454            }
3455            Ok(())
3456        }
3457    }
3458
3459    impl fidl::encoding::ValueTypeMarker for DeviceSetInterfaceResponse {
3460        type Borrowed<'a> = &'a Self;
3461        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3462            value
3463        }
3464    }
3465
3466    unsafe impl fidl::encoding::TypeMarker for DeviceSetInterfaceResponse {
3467        type Owned = Self;
3468
3469        #[inline(always)]
3470        fn inline_align(_context: fidl::encoding::Context) -> usize {
3471            4
3472        }
3473
3474        #[inline(always)]
3475        fn inline_size(_context: fidl::encoding::Context) -> usize {
3476            4
3477        }
3478        #[inline(always)]
3479        fn encode_is_copy() -> bool {
3480            true
3481        }
3482
3483        #[inline(always)]
3484        fn decode_is_copy() -> bool {
3485            true
3486        }
3487    }
3488
3489    unsafe impl<D: fidl::encoding::ResourceDialect>
3490        fidl::encoding::Encode<DeviceSetInterfaceResponse, D> for &DeviceSetInterfaceResponse
3491    {
3492        #[inline]
3493        unsafe fn encode(
3494            self,
3495            encoder: &mut fidl::encoding::Encoder<'_, D>,
3496            offset: usize,
3497            _depth: fidl::encoding::Depth,
3498        ) -> fidl::Result<()> {
3499            encoder.debug_check_bounds::<DeviceSetInterfaceResponse>(offset);
3500            unsafe {
3501                // Copy the object into the buffer.
3502                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3503                (buf_ptr as *mut DeviceSetInterfaceResponse)
3504                    .write_unaligned((self as *const DeviceSetInterfaceResponse).read());
3505                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3506                // done second because the memcpy will write garbage to these bytes.
3507            }
3508            Ok(())
3509        }
3510    }
3511    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
3512        fidl::encoding::Encode<DeviceSetInterfaceResponse, D> for (T0,)
3513    {
3514        #[inline]
3515        unsafe fn encode(
3516            self,
3517            encoder: &mut fidl::encoding::Encoder<'_, D>,
3518            offset: usize,
3519            depth: fidl::encoding::Depth,
3520        ) -> fidl::Result<()> {
3521            encoder.debug_check_bounds::<DeviceSetInterfaceResponse>(offset);
3522            // Zero out padding regions. There's no need to apply masks
3523            // because the unmasked parts will be overwritten by fields.
3524            // Write the fields.
3525            self.0.encode(encoder, offset + 0, depth)?;
3526            Ok(())
3527        }
3528    }
3529
3530    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3531        for DeviceSetInterfaceResponse
3532    {
3533        #[inline(always)]
3534        fn new_empty() -> Self {
3535            Self { s: fidl::new_empty!(i32, D) }
3536        }
3537
3538        #[inline]
3539        unsafe fn decode(
3540            &mut self,
3541            decoder: &mut fidl::encoding::Decoder<'_, D>,
3542            offset: usize,
3543            _depth: fidl::encoding::Depth,
3544        ) -> fidl::Result<()> {
3545            decoder.debug_check_bounds::<Self>(offset);
3546            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3547            // Verify that padding bytes are zero.
3548            // Copy from the buffer into the object.
3549            unsafe {
3550                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
3551            }
3552            Ok(())
3553        }
3554    }
3555}