#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use bitflags::bitflags;
use fidl::client::QueryResponseFut;
use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
use fidl::endpoints::{ControlHandle as _, Responder as _};
use futures::future::{self, MaybeDone, TryFutureExt};
use zx_status;
pub const DEVICE_DESC_SIZE: u32 = 18;
pub const MAX_CONFIG_DESC_SIZE: u32 = 65536;
pub const MAX_STRING_DESC_SIZE: u32 = 384;
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct DeviceGetConfigurationDescriptorRequest {
pub config: u8,
}
impl fidl::Persistable for DeviceGetConfigurationDescriptorRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DeviceGetConfigurationDescriptorResponse {
pub s: i32,
pub desc: Vec<u8>,
}
impl fidl::Persistable for DeviceGetConfigurationDescriptorResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct DeviceGetConfigurationDescriptorSizeRequest {
pub config: u8,
}
impl fidl::Persistable for DeviceGetConfigurationDescriptorSizeRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct DeviceGetConfigurationDescriptorSizeResponse {
pub s: i32,
pub size: u16,
}
impl fidl::Persistable for DeviceGetConfigurationDescriptorSizeResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct DeviceGetConfigurationResponse {
pub configuration: u8,
}
impl fidl::Persistable for DeviceGetConfigurationResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct DeviceGetDeviceDescriptorResponse {
pub desc: [u8; 18],
}
impl fidl::Persistable for DeviceGetDeviceDescriptorResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct DeviceGetDeviceIdResponse {
pub device_id: u32,
}
impl fidl::Persistable for DeviceGetDeviceIdResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct DeviceGetDeviceSpeedResponse {
pub speed: u32,
}
impl fidl::Persistable for DeviceGetDeviceSpeedResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct DeviceGetHubDeviceIdResponse {
pub hub_device_id: u32,
}
impl fidl::Persistable for DeviceGetHubDeviceIdResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct DeviceGetStringDescriptorRequest {
pub desc_id: u8,
pub lang_id: u16,
}
impl fidl::Persistable for DeviceGetStringDescriptorRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DeviceGetStringDescriptorResponse {
pub s: i32,
pub desc: String,
pub actual_lang_id: u16,
}
impl fidl::Persistable for DeviceGetStringDescriptorResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct DeviceSetConfigurationRequest {
pub configuration: u8,
}
impl fidl::Persistable for DeviceSetConfigurationRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct DeviceSetConfigurationResponse {
pub s: i32,
}
impl fidl::Persistable for DeviceSetConfigurationResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct DeviceSetInterfaceRequest {
pub interface_number: u8,
pub alt_setting: u8,
}
impl fidl::Persistable for DeviceSetInterfaceRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct DeviceSetInterfaceResponse {
pub s: i32,
}
impl fidl::Persistable for DeviceSetInterfaceResponse {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct DeviceMarker;
impl fidl::endpoints::ProtocolMarker for DeviceMarker {
type Proxy = DeviceProxy;
type RequestStream = DeviceRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = DeviceSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Device";
}
pub trait DeviceProxyInterface: Send + Sync {
type GetDeviceSpeedResponseFut: std::future::Future<Output = Result<u32, fidl::Error>> + Send;
fn r#get_device_speed(&self) -> Self::GetDeviceSpeedResponseFut;
type GetDeviceDescriptorResponseFut: std::future::Future<Output = Result<[u8; 18], fidl::Error>>
+ Send;
fn r#get_device_descriptor(&self) -> Self::GetDeviceDescriptorResponseFut;
type GetConfigurationDescriptorSizeResponseFut: std::future::Future<Output = Result<(i32, u16), fidl::Error>>
+ Send;
fn r#get_configuration_descriptor_size(
&self,
config: u8,
) -> Self::GetConfigurationDescriptorSizeResponseFut;
type GetConfigurationDescriptorResponseFut: std::future::Future<Output = Result<(i32, Vec<u8>), fidl::Error>>
+ Send;
fn r#get_configuration_descriptor(
&self,
config: u8,
) -> Self::GetConfigurationDescriptorResponseFut;
type GetStringDescriptorResponseFut: std::future::Future<Output = Result<(i32, String, u16), fidl::Error>>
+ Send;
fn r#get_string_descriptor(
&self,
desc_id: u8,
lang_id: u16,
) -> Self::GetStringDescriptorResponseFut;
type SetInterfaceResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
fn r#set_interface(
&self,
interface_number: u8,
alt_setting: u8,
) -> Self::SetInterfaceResponseFut;
type GetDeviceIdResponseFut: std::future::Future<Output = Result<u32, fidl::Error>> + Send;
fn r#get_device_id(&self) -> Self::GetDeviceIdResponseFut;
type GetHubDeviceIdResponseFut: std::future::Future<Output = Result<u32, fidl::Error>> + Send;
fn r#get_hub_device_id(&self) -> Self::GetHubDeviceIdResponseFut;
type GetConfigurationResponseFut: std::future::Future<Output = Result<u8, fidl::Error>> + Send;
fn r#get_configuration(&self) -> Self::GetConfigurationResponseFut;
type SetConfigurationResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
fn r#set_configuration(&self, configuration: u8) -> Self::SetConfigurationResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct DeviceSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
type Proxy = DeviceProxy;
type Protocol = DeviceMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl DeviceSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<DeviceEvent, fidl::Error> {
DeviceEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_device_speed(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<u32, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, DeviceGetDeviceSpeedResponse>(
(),
0x623cd7927fb449de,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.speed)
}
pub fn r#get_device_descriptor(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<[u8; 18], fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, DeviceGetDeviceDescriptorResponse>(
(),
0x5f761371f4b9f34a,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.desc)
}
pub fn r#get_configuration_descriptor_size(
&self,
mut config: u8,
___deadline: zx::MonotonicInstant,
) -> Result<(i32, u16), fidl::Error> {
let _response = self.client.send_query::<
DeviceGetConfigurationDescriptorSizeRequest,
DeviceGetConfigurationDescriptorSizeResponse,
>(
(config,),
0x65912d7d5e3a07c8,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.s, _response.size))
}
pub fn r#get_configuration_descriptor(
&self,
mut config: u8,
___deadline: zx::MonotonicInstant,
) -> Result<(i32, Vec<u8>), fidl::Error> {
let _response = self.client.send_query::<
DeviceGetConfigurationDescriptorRequest,
DeviceGetConfigurationDescriptorResponse,
>(
(config,),
0x1859a4e4421d2036,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.s, _response.desc))
}
pub fn r#get_string_descriptor(
&self,
mut desc_id: u8,
mut lang_id: u16,
___deadline: zx::MonotonicInstant,
) -> Result<(i32, String, u16), fidl::Error> {
let _response = self
.client
.send_query::<DeviceGetStringDescriptorRequest, DeviceGetStringDescriptorResponse>(
(desc_id, lang_id),
0x5ff601b3b6891337,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.s, _response.desc, _response.actual_lang_id))
}
pub fn r#set_interface(
&self,
mut interface_number: u8,
mut alt_setting: u8,
___deadline: zx::MonotonicInstant,
) -> Result<i32, fidl::Error> {
let _response =
self.client.send_query::<DeviceSetInterfaceRequest, DeviceSetInterfaceResponse>(
(interface_number, alt_setting),
0x45348c50850b641d,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.s)
}
pub fn r#get_device_id(&self, ___deadline: zx::MonotonicInstant) -> Result<u32, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, DeviceGetDeviceIdResponse>(
(),
0x34a73eef491c2ce0,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.device_id)
}
pub fn r#get_hub_device_id(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<u32, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, DeviceGetHubDeviceIdResponse>(
(),
0xce263c86f7bbbcd,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.hub_device_id)
}
pub fn r#get_configuration(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<u8, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, DeviceGetConfigurationResponse>(
(),
0x73f644382a2335fd,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.configuration)
}
pub fn r#set_configuration(
&self,
mut configuration: u8,
___deadline: zx::MonotonicInstant,
) -> Result<i32, fidl::Error> {
let _response = self
.client
.send_query::<DeviceSetConfigurationRequest, DeviceSetConfigurationResponse>(
(configuration,),
0x12bf6e43b045ee9d,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.s)
}
}
#[derive(Debug, Clone)]
pub struct DeviceProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for DeviceProxy {
type Protocol = DeviceMarker;
fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl DeviceProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> DeviceEventStream {
DeviceEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_device_speed(
&self,
) -> fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect> {
DeviceProxyInterface::r#get_device_speed(self)
}
pub fn r#get_device_descriptor(
&self,
) -> fidl::client::QueryResponseFut<[u8; 18], fidl::encoding::DefaultFuchsiaResourceDialect>
{
DeviceProxyInterface::r#get_device_descriptor(self)
}
pub fn r#get_configuration_descriptor_size(
&self,
mut config: u8,
) -> fidl::client::QueryResponseFut<(i32, u16), fidl::encoding::DefaultFuchsiaResourceDialect>
{
DeviceProxyInterface::r#get_configuration_descriptor_size(self, config)
}
pub fn r#get_configuration_descriptor(
&self,
mut config: u8,
) -> fidl::client::QueryResponseFut<(i32, Vec<u8>), fidl::encoding::DefaultFuchsiaResourceDialect>
{
DeviceProxyInterface::r#get_configuration_descriptor(self, config)
}
pub fn r#get_string_descriptor(
&self,
mut desc_id: u8,
mut lang_id: u16,
) -> fidl::client::QueryResponseFut<
(i32, String, u16),
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
DeviceProxyInterface::r#get_string_descriptor(self, desc_id, lang_id)
}
pub fn r#set_interface(
&self,
mut interface_number: u8,
mut alt_setting: u8,
) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
DeviceProxyInterface::r#set_interface(self, interface_number, alt_setting)
}
pub fn r#get_device_id(
&self,
) -> fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect> {
DeviceProxyInterface::r#get_device_id(self)
}
pub fn r#get_hub_device_id(
&self,
) -> fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect> {
DeviceProxyInterface::r#get_hub_device_id(self)
}
pub fn r#get_configuration(
&self,
) -> fidl::client::QueryResponseFut<u8, fidl::encoding::DefaultFuchsiaResourceDialect> {
DeviceProxyInterface::r#get_configuration(self)
}
pub fn r#set_configuration(
&self,
mut configuration: u8,
) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
DeviceProxyInterface::r#set_configuration(self, configuration)
}
}
impl DeviceProxyInterface for DeviceProxy {
type GetDeviceSpeedResponseFut =
fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get_device_speed(&self) -> Self::GetDeviceSpeedResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<u32, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
DeviceGetDeviceSpeedResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x623cd7927fb449de,
>(_buf?)?;
Ok(_response.speed)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
(),
0x623cd7927fb449de,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetDeviceDescriptorResponseFut =
fidl::client::QueryResponseFut<[u8; 18], fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get_device_descriptor(&self) -> Self::GetDeviceDescriptorResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<[u8; 18], fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
DeviceGetDeviceDescriptorResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x5f761371f4b9f34a,
>(_buf?)?;
Ok(_response.desc)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, [u8; 18]>(
(),
0x5f761371f4b9f34a,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetConfigurationDescriptorSizeResponseFut =
fidl::client::QueryResponseFut<(i32, u16), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get_configuration_descriptor_size(
&self,
mut config: u8,
) -> Self::GetConfigurationDescriptorSizeResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(i32, u16), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
DeviceGetConfigurationDescriptorSizeResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x65912d7d5e3a07c8,
>(_buf?)?;
Ok((_response.s, _response.size))
}
self.client
.send_query_and_decode::<DeviceGetConfigurationDescriptorSizeRequest, (i32, u16)>(
(config,),
0x65912d7d5e3a07c8,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetConfigurationDescriptorResponseFut = fidl::client::QueryResponseFut<
(i32, Vec<u8>),
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_configuration_descriptor(
&self,
mut config: u8,
) -> Self::GetConfigurationDescriptorResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(i32, Vec<u8>), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
DeviceGetConfigurationDescriptorResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x1859a4e4421d2036,
>(_buf?)?;
Ok((_response.s, _response.desc))
}
self.client
.send_query_and_decode::<DeviceGetConfigurationDescriptorRequest, (i32, Vec<u8>)>(
(config,),
0x1859a4e4421d2036,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetStringDescriptorResponseFut = fidl::client::QueryResponseFut<
(i32, String, u16),
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_string_descriptor(
&self,
mut desc_id: u8,
mut lang_id: u16,
) -> Self::GetStringDescriptorResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(i32, String, u16), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
DeviceGetStringDescriptorResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x5ff601b3b6891337,
>(_buf?)?;
Ok((_response.s, _response.desc, _response.actual_lang_id))
}
self.client.send_query_and_decode::<DeviceGetStringDescriptorRequest, (i32, String, u16)>(
(desc_id, lang_id),
0x5ff601b3b6891337,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type SetInterfaceResponseFut =
fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#set_interface(
&self,
mut interface_number: u8,
mut alt_setting: u8,
) -> Self::SetInterfaceResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<i32, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
DeviceSetInterfaceResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x45348c50850b641d,
>(_buf?)?;
Ok(_response.s)
}
self.client.send_query_and_decode::<DeviceSetInterfaceRequest, i32>(
(interface_number, alt_setting),
0x45348c50850b641d,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetDeviceIdResponseFut =
fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get_device_id(&self) -> Self::GetDeviceIdResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<u32, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
DeviceGetDeviceIdResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x34a73eef491c2ce0,
>(_buf?)?;
Ok(_response.device_id)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
(),
0x34a73eef491c2ce0,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetHubDeviceIdResponseFut =
fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get_hub_device_id(&self) -> Self::GetHubDeviceIdResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<u32, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
DeviceGetHubDeviceIdResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0xce263c86f7bbbcd,
>(_buf?)?;
Ok(_response.hub_device_id)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
(),
0xce263c86f7bbbcd,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetConfigurationResponseFut =
fidl::client::QueryResponseFut<u8, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get_configuration(&self) -> Self::GetConfigurationResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<u8, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
DeviceGetConfigurationResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x73f644382a2335fd,
>(_buf?)?;
Ok(_response.configuration)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u8>(
(),
0x73f644382a2335fd,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type SetConfigurationResponseFut =
fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#set_configuration(&self, mut configuration: u8) -> Self::SetConfigurationResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<i32, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
DeviceSetConfigurationResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x12bf6e43b045ee9d,
>(_buf?)?;
Ok(_response.s)
}
self.client.send_query_and_decode::<DeviceSetConfigurationRequest, i32>(
(configuration,),
0x12bf6e43b045ee9d,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct DeviceEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for DeviceEventStream {}
impl futures::stream::FusedStream for DeviceEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for DeviceEventStream {
type Item = Result<DeviceEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum DeviceEvent {}
impl DeviceEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<DeviceEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct DeviceRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for DeviceRequestStream {}
impl futures::stream::FusedStream for DeviceRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for DeviceRequestStream {
type Protocol = DeviceMarker;
type ControlHandle = DeviceControlHandle;
fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
DeviceControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for DeviceRequestStream {
type Item = Result<DeviceRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled DeviceRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x623cd7927fb449de => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DeviceControlHandle { inner: this.inner.clone() };
Ok(DeviceRequest::GetDeviceSpeed {
responder: DeviceGetDeviceSpeedResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x5f761371f4b9f34a => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DeviceControlHandle { inner: this.inner.clone() };
Ok(DeviceRequest::GetDeviceDescriptor {
responder: DeviceGetDeviceDescriptorResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x65912d7d5e3a07c8 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
DeviceGetConfigurationDescriptorSizeRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetConfigurationDescriptorSizeRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DeviceControlHandle { inner: this.inner.clone() };
Ok(DeviceRequest::GetConfigurationDescriptorSize {
config: req.config,
responder: DeviceGetConfigurationDescriptorSizeResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x1859a4e4421d2036 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
DeviceGetConfigurationDescriptorRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetConfigurationDescriptorRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DeviceControlHandle { inner: this.inner.clone() };
Ok(DeviceRequest::GetConfigurationDescriptor {
config: req.config,
responder: DeviceGetConfigurationDescriptorResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x5ff601b3b6891337 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
DeviceGetStringDescriptorRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetStringDescriptorRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DeviceControlHandle { inner: this.inner.clone() };
Ok(DeviceRequest::GetStringDescriptor {
desc_id: req.desc_id,
lang_id: req.lang_id,
responder: DeviceGetStringDescriptorResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x45348c50850b641d => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
DeviceSetInterfaceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetInterfaceRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DeviceControlHandle { inner: this.inner.clone() };
Ok(DeviceRequest::SetInterface {
interface_number: req.interface_number,
alt_setting: req.alt_setting,
responder: DeviceSetInterfaceResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x34a73eef491c2ce0 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DeviceControlHandle { inner: this.inner.clone() };
Ok(DeviceRequest::GetDeviceId {
responder: DeviceGetDeviceIdResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0xce263c86f7bbbcd => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DeviceControlHandle { inner: this.inner.clone() };
Ok(DeviceRequest::GetHubDeviceId {
responder: DeviceGetHubDeviceIdResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x73f644382a2335fd => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DeviceControlHandle { inner: this.inner.clone() };
Ok(DeviceRequest::GetConfiguration {
responder: DeviceGetConfigurationResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x12bf6e43b045ee9d => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
DeviceSetConfigurationRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetConfigurationRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DeviceControlHandle { inner: this.inner.clone() };
Ok(DeviceRequest::SetConfiguration {
configuration: req.configuration,
responder: DeviceSetConfigurationResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum DeviceRequest {
GetDeviceSpeed { responder: DeviceGetDeviceSpeedResponder },
GetDeviceDescriptor { responder: DeviceGetDeviceDescriptorResponder },
GetConfigurationDescriptorSize {
config: u8,
responder: DeviceGetConfigurationDescriptorSizeResponder,
},
GetConfigurationDescriptor { config: u8, responder: DeviceGetConfigurationDescriptorResponder },
GetStringDescriptor { desc_id: u8, lang_id: u16, responder: DeviceGetStringDescriptorResponder },
SetInterface { interface_number: u8, alt_setting: u8, responder: DeviceSetInterfaceResponder },
GetDeviceId { responder: DeviceGetDeviceIdResponder },
GetHubDeviceId { responder: DeviceGetHubDeviceIdResponder },
GetConfiguration { responder: DeviceGetConfigurationResponder },
SetConfiguration { configuration: u8, responder: DeviceSetConfigurationResponder },
}
impl DeviceRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_device_speed(self) -> Option<(DeviceGetDeviceSpeedResponder)> {
if let DeviceRequest::GetDeviceSpeed { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_device_descriptor(self) -> Option<(DeviceGetDeviceDescriptorResponder)> {
if let DeviceRequest::GetDeviceDescriptor { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_configuration_descriptor_size(
self,
) -> Option<(u8, DeviceGetConfigurationDescriptorSizeResponder)> {
if let DeviceRequest::GetConfigurationDescriptorSize { config, responder } = self {
Some((config, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_configuration_descriptor(
self,
) -> Option<(u8, DeviceGetConfigurationDescriptorResponder)> {
if let DeviceRequest::GetConfigurationDescriptor { config, responder } = self {
Some((config, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_string_descriptor(
self,
) -> Option<(u8, u16, DeviceGetStringDescriptorResponder)> {
if let DeviceRequest::GetStringDescriptor { desc_id, lang_id, responder } = self {
Some((desc_id, lang_id, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_interface(self) -> Option<(u8, u8, DeviceSetInterfaceResponder)> {
if let DeviceRequest::SetInterface { interface_number, alt_setting, responder } = self {
Some((interface_number, alt_setting, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_device_id(self) -> Option<(DeviceGetDeviceIdResponder)> {
if let DeviceRequest::GetDeviceId { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_hub_device_id(self) -> Option<(DeviceGetHubDeviceIdResponder)> {
if let DeviceRequest::GetHubDeviceId { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_configuration(self) -> Option<(DeviceGetConfigurationResponder)> {
if let DeviceRequest::GetConfiguration { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_configuration(self) -> Option<(u8, DeviceSetConfigurationResponder)> {
if let DeviceRequest::SetConfiguration { configuration, responder } = self {
Some((configuration, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
DeviceRequest::GetDeviceSpeed { .. } => "get_device_speed",
DeviceRequest::GetDeviceDescriptor { .. } => "get_device_descriptor",
DeviceRequest::GetConfigurationDescriptorSize { .. } => {
"get_configuration_descriptor_size"
}
DeviceRequest::GetConfigurationDescriptor { .. } => "get_configuration_descriptor",
DeviceRequest::GetStringDescriptor { .. } => "get_string_descriptor",
DeviceRequest::SetInterface { .. } => "set_interface",
DeviceRequest::GetDeviceId { .. } => "get_device_id",
DeviceRequest::GetHubDeviceId { .. } => "get_hub_device_id",
DeviceRequest::GetConfiguration { .. } => "get_configuration",
DeviceRequest::SetConfiguration { .. } => "set_configuration",
}
}
}
#[derive(Debug, Clone)]
pub struct DeviceControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for DeviceControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl DeviceControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DeviceGetDeviceSpeedResponder {
control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DeviceGetDeviceSpeedResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DeviceGetDeviceSpeedResponder {
type ControlHandle = DeviceControlHandle;
fn control_handle(&self) -> &DeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DeviceGetDeviceSpeedResponder {
pub fn send(self, mut speed: u32) -> Result<(), fidl::Error> {
let _result = self.send_raw(speed);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut speed: u32) -> Result<(), fidl::Error> {
let _result = self.send_raw(speed);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut speed: u32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<DeviceGetDeviceSpeedResponse>(
(speed,),
self.tx_id,
0x623cd7927fb449de,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DeviceGetDeviceDescriptorResponder {
control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DeviceGetDeviceDescriptorResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DeviceGetDeviceDescriptorResponder {
type ControlHandle = DeviceControlHandle;
fn control_handle(&self) -> &DeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DeviceGetDeviceDescriptorResponder {
pub fn send(self, mut desc: &[u8; 18]) -> Result<(), fidl::Error> {
let _result = self.send_raw(desc);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut desc: &[u8; 18]) -> Result<(), fidl::Error> {
let _result = self.send_raw(desc);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut desc: &[u8; 18]) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<DeviceGetDeviceDescriptorResponse>(
(desc,),
self.tx_id,
0x5f761371f4b9f34a,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DeviceGetConfigurationDescriptorSizeResponder {
control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DeviceGetConfigurationDescriptorSizeResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DeviceGetConfigurationDescriptorSizeResponder {
type ControlHandle = DeviceControlHandle;
fn control_handle(&self) -> &DeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DeviceGetConfigurationDescriptorSizeResponder {
pub fn send(self, mut s: i32, mut size: u16) -> Result<(), fidl::Error> {
let _result = self.send_raw(s, size);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut s: i32, mut size: u16) -> Result<(), fidl::Error> {
let _result = self.send_raw(s, size);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut s: i32, mut size: u16) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<DeviceGetConfigurationDescriptorSizeResponse>(
(s, size),
self.tx_id,
0x65912d7d5e3a07c8,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DeviceGetConfigurationDescriptorResponder {
control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DeviceGetConfigurationDescriptorResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DeviceGetConfigurationDescriptorResponder {
type ControlHandle = DeviceControlHandle;
fn control_handle(&self) -> &DeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DeviceGetConfigurationDescriptorResponder {
pub fn send(self, mut s: i32, mut desc: &[u8]) -> Result<(), fidl::Error> {
let _result = self.send_raw(s, desc);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut s: i32, mut desc: &[u8]) -> Result<(), fidl::Error> {
let _result = self.send_raw(s, desc);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut s: i32, mut desc: &[u8]) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<DeviceGetConfigurationDescriptorResponse>(
(s, desc),
self.tx_id,
0x1859a4e4421d2036,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DeviceGetStringDescriptorResponder {
control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DeviceGetStringDescriptorResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DeviceGetStringDescriptorResponder {
type ControlHandle = DeviceControlHandle;
fn control_handle(&self) -> &DeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DeviceGetStringDescriptorResponder {
pub fn send(
self,
mut s: i32,
mut desc: &str,
mut actual_lang_id: u16,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(s, desc, actual_lang_id);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut s: i32,
mut desc: &str,
mut actual_lang_id: u16,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(s, desc, actual_lang_id);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut s: i32,
mut desc: &str,
mut actual_lang_id: u16,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<DeviceGetStringDescriptorResponse>(
(s, desc, actual_lang_id),
self.tx_id,
0x5ff601b3b6891337,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DeviceSetInterfaceResponder {
control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DeviceSetInterfaceResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DeviceSetInterfaceResponder {
type ControlHandle = DeviceControlHandle;
fn control_handle(&self) -> &DeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DeviceSetInterfaceResponder {
pub fn send(self, mut s: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(s);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut s: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(s);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut s: i32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<DeviceSetInterfaceResponse>(
(s,),
self.tx_id,
0x45348c50850b641d,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DeviceGetDeviceIdResponder {
control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DeviceGetDeviceIdResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DeviceGetDeviceIdResponder {
type ControlHandle = DeviceControlHandle;
fn control_handle(&self) -> &DeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DeviceGetDeviceIdResponder {
pub fn send(self, mut device_id: u32) -> Result<(), fidl::Error> {
let _result = self.send_raw(device_id);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut device_id: u32) -> Result<(), fidl::Error> {
let _result = self.send_raw(device_id);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut device_id: u32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<DeviceGetDeviceIdResponse>(
(device_id,),
self.tx_id,
0x34a73eef491c2ce0,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DeviceGetHubDeviceIdResponder {
control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DeviceGetHubDeviceIdResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DeviceGetHubDeviceIdResponder {
type ControlHandle = DeviceControlHandle;
fn control_handle(&self) -> &DeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DeviceGetHubDeviceIdResponder {
pub fn send(self, mut hub_device_id: u32) -> Result<(), fidl::Error> {
let _result = self.send_raw(hub_device_id);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut hub_device_id: u32) -> Result<(), fidl::Error> {
let _result = self.send_raw(hub_device_id);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut hub_device_id: u32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<DeviceGetHubDeviceIdResponse>(
(hub_device_id,),
self.tx_id,
0xce263c86f7bbbcd,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DeviceGetConfigurationResponder {
control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DeviceGetConfigurationResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DeviceGetConfigurationResponder {
type ControlHandle = DeviceControlHandle;
fn control_handle(&self) -> &DeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DeviceGetConfigurationResponder {
pub fn send(self, mut configuration: u8) -> Result<(), fidl::Error> {
let _result = self.send_raw(configuration);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut configuration: u8) -> Result<(), fidl::Error> {
let _result = self.send_raw(configuration);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut configuration: u8) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<DeviceGetConfigurationResponse>(
(configuration,),
self.tx_id,
0x73f644382a2335fd,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DeviceSetConfigurationResponder {
control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DeviceSetConfigurationResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DeviceSetConfigurationResponder {
type ControlHandle = DeviceControlHandle;
fn control_handle(&self) -> &DeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DeviceSetConfigurationResponder {
pub fn send(self, mut s: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(s);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut s: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(s);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut s: i32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<DeviceSetConfigurationResponse>(
(s,),
self.tx_id,
0x12bf6e43b045ee9d,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
impl fidl::encoding::ValueTypeMarker for DeviceGetConfigurationDescriptorRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceGetConfigurationDescriptorRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<DeviceGetConfigurationDescriptorRequest, D>
for &DeviceGetConfigurationDescriptorRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetConfigurationDescriptorRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut DeviceGetConfigurationDescriptorRequest).write_unaligned(
(self as *const DeviceGetConfigurationDescriptorRequest).read(),
);
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
fidl::encoding::Encode<DeviceGetConfigurationDescriptorRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetConfigurationDescriptorRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DeviceGetConfigurationDescriptorRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { config: fidl::new_empty!(u8, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceGetConfigurationDescriptorResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceGetConfigurationDescriptorResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<DeviceGetConfigurationDescriptorResponse, D>
for &DeviceGetConfigurationDescriptorResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetConfigurationDescriptorResponse>(offset);
fidl::encoding::Encode::<DeviceGetConfigurationDescriptorResponse, D>::encode(
(
<i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.s),
<fidl::encoding::Vector<u8, 65536> as fidl::encoding::ValueTypeMarker>::borrow(
&self.desc,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<i32, D>,
T1: fidl::encoding::Encode<fidl::encoding::Vector<u8, 65536>, D>,
> fidl::encoding::Encode<DeviceGetConfigurationDescriptorResponse, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetConfigurationDescriptorResponse>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DeviceGetConfigurationDescriptorResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
s: fidl::new_empty!(i32, D),
desc: fidl::new_empty!(fidl::encoding::Vector<u8, 65536>, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(i32, D, &mut self.s, decoder, offset + 0, _depth)?;
fidl::decode!(fidl::encoding::Vector<u8, 65536>, D, &mut self.desc, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceGetConfigurationDescriptorSizeRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceGetConfigurationDescriptorSizeRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<DeviceGetConfigurationDescriptorSizeRequest, D>
for &DeviceGetConfigurationDescriptorSizeRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetConfigurationDescriptorSizeRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut DeviceGetConfigurationDescriptorSizeRequest).write_unaligned(
(self as *const DeviceGetConfigurationDescriptorSizeRequest).read(),
);
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
fidl::encoding::Encode<DeviceGetConfigurationDescriptorSizeRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetConfigurationDescriptorSizeRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DeviceGetConfigurationDescriptorSizeRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { config: fidl::new_empty!(u8, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceGetConfigurationDescriptorSizeResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceGetConfigurationDescriptorSizeResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<DeviceGetConfigurationDescriptorSizeResponse, D>
for &DeviceGetConfigurationDescriptorSizeResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetConfigurationDescriptorSizeResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut DeviceGetConfigurationDescriptorSizeResponse).write_unaligned(
(self as *const DeviceGetConfigurationDescriptorSizeResponse).read(),
);
let padding_ptr = buf_ptr.offset(4) as *mut u32;
let padding_mask = 0xffff0000u32;
padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<i32, D>,
T1: fidl::encoding::Encode<u16, D>,
> fidl::encoding::Encode<DeviceGetConfigurationDescriptorSizeResponse, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetConfigurationDescriptorSizeResponse>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(4);
(ptr as *mut u32).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DeviceGetConfigurationDescriptorSizeResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { s: fidl::new_empty!(i32, D), size: fidl::new_empty!(u16, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
let ptr = unsafe { buf_ptr.offset(4) };
let padval = unsafe { (ptr as *const u32).read_unaligned() };
let mask = 0xffff0000u32;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 4 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceGetConfigurationResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceGetConfigurationResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<DeviceGetConfigurationResponse, D>
for &DeviceGetConfigurationResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetConfigurationResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut DeviceGetConfigurationResponse)
.write_unaligned((self as *const DeviceGetConfigurationResponse).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
fidl::encoding::Encode<DeviceGetConfigurationResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetConfigurationResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DeviceGetConfigurationResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { configuration: fidl::new_empty!(u8, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceGetDeviceDescriptorResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceGetDeviceDescriptorResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
18
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<DeviceGetDeviceDescriptorResponse, D>
for &DeviceGetDeviceDescriptorResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetDeviceDescriptorResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut DeviceGetDeviceDescriptorResponse)
.write_unaligned((self as *const DeviceGetDeviceDescriptorResponse).read());
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 18>, D>,
> fidl::encoding::Encode<DeviceGetDeviceDescriptorResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetDeviceDescriptorResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DeviceGetDeviceDescriptorResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { desc: fidl::new_empty!(fidl::encoding::Array<u8, 18>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 18);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceGetDeviceIdResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceGetDeviceIdResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<DeviceGetDeviceIdResponse, D> for &DeviceGetDeviceIdResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetDeviceIdResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut DeviceGetDeviceIdResponse)
.write_unaligned((self as *const DeviceGetDeviceIdResponse).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
fidl::encoding::Encode<DeviceGetDeviceIdResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetDeviceIdResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DeviceGetDeviceIdResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { device_id: fidl::new_empty!(u32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceGetDeviceSpeedResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceGetDeviceSpeedResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<DeviceGetDeviceSpeedResponse, D> for &DeviceGetDeviceSpeedResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetDeviceSpeedResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut DeviceGetDeviceSpeedResponse)
.write_unaligned((self as *const DeviceGetDeviceSpeedResponse).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
fidl::encoding::Encode<DeviceGetDeviceSpeedResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetDeviceSpeedResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DeviceGetDeviceSpeedResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { speed: fidl::new_empty!(u32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceGetHubDeviceIdResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceGetHubDeviceIdResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<DeviceGetHubDeviceIdResponse, D> for &DeviceGetHubDeviceIdResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetHubDeviceIdResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut DeviceGetHubDeviceIdResponse)
.write_unaligned((self as *const DeviceGetHubDeviceIdResponse).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
fidl::encoding::Encode<DeviceGetHubDeviceIdResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetHubDeviceIdResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DeviceGetHubDeviceIdResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { hub_device_id: fidl::new_empty!(u32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceGetStringDescriptorRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceGetStringDescriptorRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
2
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<DeviceGetStringDescriptorRequest, D>
for &DeviceGetStringDescriptorRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetStringDescriptorRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut DeviceGetStringDescriptorRequest)
.write_unaligned((self as *const DeviceGetStringDescriptorRequest).read());
let padding_ptr = buf_ptr.offset(0) as *mut u16;
let padding_mask = 0xff00u16;
padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u8, D>,
T1: fidl::encoding::Encode<u16, D>,
> fidl::encoding::Encode<DeviceGetStringDescriptorRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetStringDescriptorRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u16).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 2, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DeviceGetStringDescriptorRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { desc_id: fidl::new_empty!(u8, D), lang_id: fidl::new_empty!(u16, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
let ptr = unsafe { buf_ptr.offset(0) };
let padval = unsafe { (ptr as *const u16).read_unaligned() };
let mask = 0xff00u16;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceGetStringDescriptorResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceGetStringDescriptorResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
32
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<DeviceGetStringDescriptorResponse, D>
for &DeviceGetStringDescriptorResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetStringDescriptorResponse>(offset);
fidl::encoding::Encode::<DeviceGetStringDescriptorResponse, D>::encode(
(
<i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.s),
<fidl::encoding::BoundedString<384> as fidl::encoding::ValueTypeMarker>::borrow(
&self.desc,
),
<u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.actual_lang_id),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<i32, D>,
T1: fidl::encoding::Encode<fidl::encoding::BoundedString<384>, D>,
T2: fidl::encoding::Encode<u16, D>,
> fidl::encoding::Encode<DeviceGetStringDescriptorResponse, D> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetStringDescriptorResponse>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 24, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DeviceGetStringDescriptorResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
s: fidl::new_empty!(i32, D),
desc: fidl::new_empty!(fidl::encoding::BoundedString<384>, D),
actual_lang_id: fidl::new_empty!(u16, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffff0000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(i32, D, &mut self.s, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::BoundedString<384>,
D,
&mut self.desc,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(u16, D, &mut self.actual_lang_id, decoder, offset + 24, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceSetConfigurationRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceSetConfigurationRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<DeviceSetConfigurationRequest, D>
for &DeviceSetConfigurationRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceSetConfigurationRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut DeviceSetConfigurationRequest)
.write_unaligned((self as *const DeviceSetConfigurationRequest).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
fidl::encoding::Encode<DeviceSetConfigurationRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceSetConfigurationRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DeviceSetConfigurationRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { configuration: fidl::new_empty!(u8, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceSetConfigurationResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceSetConfigurationResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<DeviceSetConfigurationResponse, D>
for &DeviceSetConfigurationResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceSetConfigurationResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut DeviceSetConfigurationResponse)
.write_unaligned((self as *const DeviceSetConfigurationResponse).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
fidl::encoding::Encode<DeviceSetConfigurationResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceSetConfigurationResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DeviceSetConfigurationResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { s: fidl::new_empty!(i32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceSetInterfaceRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceSetInterfaceRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
2
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<DeviceSetInterfaceRequest, D> for &DeviceSetInterfaceRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceSetInterfaceRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut DeviceSetInterfaceRequest)
.write_unaligned((self as *const DeviceSetInterfaceRequest).read());
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u8, D>,
T1: fidl::encoding::Encode<u8, D>,
> fidl::encoding::Encode<DeviceSetInterfaceRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceSetInterfaceRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 1, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DeviceSetInterfaceRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { interface_number: fidl::new_empty!(u8, D), alt_setting: fidl::new_empty!(u8, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceSetInterfaceResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceSetInterfaceResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<DeviceSetInterfaceResponse, D> for &DeviceSetInterfaceResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceSetInterfaceResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut DeviceSetInterfaceResponse)
.write_unaligned((self as *const DeviceSetInterfaceResponse).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
fidl::encoding::Encode<DeviceSetInterfaceResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceSetInterfaceResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DeviceSetInterfaceResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { s: fidl::new_empty!(i32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
}