#![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;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum SocketDisposition {
NoChange,
WriteEnabled,
WriteDisabled,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u32,
},
}
#[macro_export]
macro_rules! SocketDispositionUnknown {
() => {
_
};
}
impl SocketDisposition {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::NoChange),
1 => Some(Self::WriteEnabled),
2 => Some(Self::WriteDisabled),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
0 => Self::NoChange,
1 => Self::WriteEnabled,
2 => Self::WriteDisabled,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::NoChange => 0,
Self::WriteEnabled => 1,
Self::WriteDisabled => 2,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum SocketType {
Stream,
Datagram,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u32,
},
}
#[macro_export]
macro_rules! SocketTypeUnknown {
() => {
_
};
}
impl SocketType {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::Stream),
1 => Some(Self::Datagram),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
0 => Self::Stream,
1 => Self::Datagram,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::Stream => 0,
Self::Datagram => 1,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Clone, Debug, PartialEq)]
pub struct AioStopped {
pub error: Option<Box<Error>>,
}
impl fidl::Persistable for AioStopped {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct BadHid {
pub id: u32,
}
impl fidl::Persistable for BadHid {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct ChannelCreateChannelRequest {
pub handles: [NewHid; 2],
}
impl fidl::Persistable for ChannelCreateChannelRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ChannelMessage {
pub data: Vec<u8>,
pub handles: Vec<HandleInfo>,
}
impl fidl::Persistable for ChannelMessage {}
#[derive(Clone, Debug, PartialEq)]
pub struct ChannelOnChannelStreamingDataRequest {
pub handle: Hid,
pub channel_sent: ChannelSent,
}
impl fidl::Persistable for ChannelOnChannelStreamingDataRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct ChannelReadChannelRequest {
pub handle: Hid,
}
impl fidl::Persistable for ChannelReadChannelRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct ChannelReadChannelStreamingStartRequest {
pub handle: Hid,
}
impl fidl::Persistable for ChannelReadChannelStreamingStartRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct ChannelReadChannelStreamingStopRequest {
pub handle: Hid,
}
impl fidl::Persistable for ChannelReadChannelStreamingStopRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ChannelWriteChannelRequest {
pub handle: Hid,
pub data: Vec<u8>,
pub handles: Handles,
}
impl fidl::Persistable for ChannelWriteChannelRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ClosedDuringRead;
impl fidl::Persistable for ClosedDuringRead {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ErrorPending;
impl fidl::Persistable for ErrorPending {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct EventCreateEventRequest {
pub handle: NewHid,
}
impl fidl::Persistable for EventCreateEventRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct EventPairCreateEventPairRequest {
pub handles: [NewHid; 2],
}
impl fidl::Persistable for EventPairCreateEventPairRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct FDomainAcknowledgeWriteErrorRequest {
pub handle: Hid,
}
impl fidl::Persistable for FDomainAcknowledgeWriteErrorRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct FDomainCloseRequest {
pub handles: Vec<Hid>,
}
impl fidl::Persistable for FDomainCloseRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct FDomainDuplicateRequest {
pub handle: Hid,
pub new_handle: NewHid,
pub rights: fidl::Rights,
}
impl fidl::Persistable for FDomainDuplicateRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct FDomainNamespaceRequest {
pub new_handle: NewHid,
}
impl fidl::Persistable for FDomainNamespaceRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct FDomainReplaceRequest {
pub handle: Hid,
pub new_handle: NewHid,
pub rights: fidl::Rights,
}
impl fidl::Persistable for FDomainReplaceRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct FDomainSignalPeerRequest {
pub handle: Hid,
pub set: u32,
pub clear: u32,
}
impl fidl::Persistable for FDomainSignalPeerRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct FDomainSignalRequest {
pub handle: Hid,
pub set: u32,
pub clear: u32,
}
impl fidl::Persistable for FDomainSignalRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct FDomainWaitForSignalsRequest {
pub handle: Hid,
pub signals: u32,
}
impl fidl::Persistable for FDomainWaitForSignalsRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct FDomainWaitForSignalsResponse {
pub signals: u32,
}
impl fidl::Persistable for FDomainWaitForSignalsResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct HandleDisposition {
pub handle: HandleOp,
pub rights: fidl::Rights,
}
impl fidl::Persistable for HandleDisposition {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct HandleInfo {
pub handle: Hid,
pub type_: fidl::ObjectType,
pub rights: fidl::Rights,
}
impl fidl::Persistable for HandleInfo {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct Hid {
pub id: u32,
}
impl fidl::Persistable for Hid {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct NewHid {
pub id: u32,
}
impl fidl::Persistable for NewHid {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct NewHidOutOfRange {
pub id: u32,
}
impl fidl::Persistable for NewHidOutOfRange {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NewHidReused {
pub id: u32,
pub same_call: bool,
}
impl fidl::Persistable for NewHidReused {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NoErrorPending;
impl fidl::Persistable for NoErrorPending {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NoReadInProgress;
impl fidl::Persistable for NoReadInProgress {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RightsUnknown {
pub rights: fidl::Rights,
}
impl fidl::Persistable for RightsUnknown {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct SignalsUnknown {
pub signals: u32,
}
impl fidl::Persistable for SignalsUnknown {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SocketCreateSocketRequest {
pub options: SocketType,
pub handles: [NewHid; 2],
}
impl fidl::Persistable for SocketCreateSocketRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SocketDispositionUnknown {
pub disposition: SocketDisposition,
}
impl fidl::Persistable for SocketDispositionUnknown {}
#[derive(Clone, Debug, PartialEq)]
pub struct SocketOnSocketStreamingDataRequest {
pub handle: Hid,
pub socket_message: SocketMessage,
}
impl fidl::Persistable for SocketOnSocketStreamingDataRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct SocketReadSocketRequest {
pub handle: Hid,
pub max_bytes: u64,
}
impl fidl::Persistable for SocketReadSocketRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct SocketReadSocketStreamingStartRequest {
pub handle: Hid,
}
impl fidl::Persistable for SocketReadSocketStreamingStartRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct SocketReadSocketStreamingStopRequest {
pub handle: Hid,
}
impl fidl::Persistable for SocketReadSocketStreamingStopRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SocketSetSocketDispositionRequest {
pub handle: Hid,
pub disposition: SocketDisposition,
pub disposition_peer: SocketDisposition,
}
impl fidl::Persistable for SocketSetSocketDispositionRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SocketTypeUnknown {
pub type_: SocketType,
}
impl fidl::Persistable for SocketTypeUnknown {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SocketWriteSocketRequest {
pub handle: Hid,
pub data: Vec<u8>,
}
impl fidl::Persistable for SocketWriteSocketRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SocketReadSocketResponse {
pub data: Vec<u8>,
}
impl fidl::Persistable for SocketReadSocketResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct SocketWriteSocketResponse {
pub wrote: u64,
}
impl fidl::Persistable for SocketWriteSocketResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct StreamingReadInProgress;
impl fidl::Persistable for StreamingReadInProgress {}
#[derive(Clone, Debug, PartialEq)]
pub struct WriteSocketError {
pub error: Error,
pub wrote: u64,
}
impl fidl::Persistable for WriteSocketError {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct WrongHandleType {
pub expected: fidl::ObjectType,
pub got: fidl::ObjectType,
}
impl fidl::Persistable for WrongHandleType {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct WroteToSelf;
impl fidl::Persistable for WroteToSelf {}
#[derive(Clone, Debug)]
pub enum ChannelSent {
Message(ChannelMessage),
Stopped(AioStopped),
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u64,
},
}
#[macro_export]
macro_rules! ChannelSentUnknown {
() => {
_
};
}
impl PartialEq for ChannelSent {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Message(x), Self::Message(y)) => *x == *y,
(Self::Stopped(x), Self::Stopped(y)) => *x == *y,
_ => false,
}
}
}
impl ChannelSent {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Message(_) => 1,
Self::Stopped(_) => 2,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn unknown_variant_for_testing() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { .. } => true,
_ => false,
}
}
}
impl fidl::Persistable for ChannelSent {}
#[derive(Clone, Debug)]
pub enum Error {
TargetError(i32),
BadHid(BadHid),
NewHidOutOfRange(NewHidOutOfRange),
NewHidReused(NewHidReused),
WrongHandleType(WrongHandleType),
StreamingReadInProgress(StreamingReadInProgress),
NoReadInProgress(NoReadInProgress),
ErrorPending(ErrorPending),
NoErrorPending(NoErrorPending),
WroteToSelf(WroteToSelf),
ClosedDuringRead(ClosedDuringRead),
SignalsUnknown(SignalsUnknown),
RightsUnknown(RightsUnknown),
SocketDispositionUnknown(SocketDispositionUnknown),
SocketTypeUnknown(SocketTypeUnknown),
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u64,
},
}
#[macro_export]
macro_rules! ErrorUnknown {
() => {
_
};
}
impl PartialEq for Error {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::TargetError(x), Self::TargetError(y)) => *x == *y,
(Self::BadHid(x), Self::BadHid(y)) => *x == *y,
(Self::NewHidOutOfRange(x), Self::NewHidOutOfRange(y)) => *x == *y,
(Self::NewHidReused(x), Self::NewHidReused(y)) => *x == *y,
(Self::WrongHandleType(x), Self::WrongHandleType(y)) => *x == *y,
(Self::StreamingReadInProgress(x), Self::StreamingReadInProgress(y)) => *x == *y,
(Self::NoReadInProgress(x), Self::NoReadInProgress(y)) => *x == *y,
(Self::ErrorPending(x), Self::ErrorPending(y)) => *x == *y,
(Self::NoErrorPending(x), Self::NoErrorPending(y)) => *x == *y,
(Self::WroteToSelf(x), Self::WroteToSelf(y)) => *x == *y,
(Self::ClosedDuringRead(x), Self::ClosedDuringRead(y)) => *x == *y,
(Self::SignalsUnknown(x), Self::SignalsUnknown(y)) => *x == *y,
(Self::RightsUnknown(x), Self::RightsUnknown(y)) => *x == *y,
(Self::SocketDispositionUnknown(x), Self::SocketDispositionUnknown(y)) => *x == *y,
(Self::SocketTypeUnknown(x), Self::SocketTypeUnknown(y)) => *x == *y,
_ => false,
}
}
}
impl Error {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::TargetError(_) => 1,
Self::BadHid(_) => 2,
Self::NewHidOutOfRange(_) => 3,
Self::NewHidReused(_) => 4,
Self::WrongHandleType(_) => 5,
Self::StreamingReadInProgress(_) => 6,
Self::NoReadInProgress(_) => 7,
Self::ErrorPending(_) => 8,
Self::NoErrorPending(_) => 9,
Self::WroteToSelf(_) => 10,
Self::ClosedDuringRead(_) => 11,
Self::SignalsUnknown(_) => 12,
Self::RightsUnknown(_) => 13,
Self::SocketDispositionUnknown(_) => 14,
Self::SocketTypeUnknown(_) => 15,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn unknown_variant_for_testing() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { .. } => true,
_ => false,
}
}
}
impl fidl::Persistable for Error {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum HandleOp {
Move_(Hid),
Duplicate(Hid),
}
impl HandleOp {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Move_(_) => 1,
Self::Duplicate(_) => 2,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Persistable for HandleOp {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum Handles {
Handles(Vec<Hid>),
Dispositions(Vec<HandleDisposition>),
}
impl Handles {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Handles(_) => 1,
Self::Dispositions(_) => 2,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Persistable for Handles {}
#[derive(Clone, Debug)]
pub enum SocketMessage {
Data(Vec<u8>),
Stopped(AioStopped),
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u64,
},
}
#[macro_export]
macro_rules! SocketMessageUnknown {
() => {
_
};
}
impl PartialEq for SocketMessage {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Data(x), Self::Data(y)) => *x == *y,
(Self::Stopped(x), Self::Stopped(y)) => *x == *y,
_ => false,
}
}
}
impl SocketMessage {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Data(_) => 1,
Self::Stopped(_) => 2,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn unknown_variant_for_testing() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { .. } => true,
_ => false,
}
}
}
impl fidl::Persistable for SocketMessage {}
#[derive(Clone, Debug, PartialEq)]
pub enum WriteChannelError {
Error(Error),
OpErrors(Vec<Option<Box<Error>>>),
}
impl WriteChannelError {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Error(_) => 1,
Self::OpErrors(_) => 2,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Persistable for WriteChannelError {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ChannelMarker;
impl fidl::endpoints::ProtocolMarker for ChannelMarker {
type Proxy = ChannelProxy;
type RequestStream = ChannelRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ChannelSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Channel";
}
pub type ChannelCreateChannelResult = Result<(), Error>;
pub type ChannelReadChannelResult = Result<(Vec<u8>, Vec<HandleInfo>), Error>;
pub type ChannelWriteChannelResult = Result<(), WriteChannelError>;
pub type ChannelReadChannelStreamingStartResult = Result<(), Error>;
pub type ChannelReadChannelStreamingStopResult = Result<(), Error>;
pub trait ChannelProxyInterface: Send + Sync {
type CreateChannelResponseFut: std::future::Future<Output = Result<ChannelCreateChannelResult, fidl::Error>>
+ Send;
fn r#create_channel(&self, handles: &[NewHid; 2]) -> Self::CreateChannelResponseFut;
type ReadChannelResponseFut: std::future::Future<Output = Result<ChannelReadChannelResult, fidl::Error>>
+ Send;
fn r#read_channel(&self, handle: &Hid) -> Self::ReadChannelResponseFut;
type WriteChannelResponseFut: std::future::Future<Output = Result<ChannelWriteChannelResult, fidl::Error>>
+ Send;
fn r#write_channel(
&self,
handle: &Hid,
data: &[u8],
handles: &Handles,
) -> Self::WriteChannelResponseFut;
type ReadChannelStreamingStartResponseFut: std::future::Future<Output = Result<ChannelReadChannelStreamingStartResult, fidl::Error>>
+ Send;
fn r#read_channel_streaming_start(
&self,
handle: &Hid,
) -> Self::ReadChannelStreamingStartResponseFut;
type ReadChannelStreamingStopResponseFut: std::future::Future<Output = Result<ChannelReadChannelStreamingStopResult, fidl::Error>>
+ Send;
fn r#read_channel_streaming_stop(
&self,
handle: &Hid,
) -> Self::ReadChannelStreamingStopResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ChannelSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ChannelSynchronousProxy {
type Proxy = ChannelProxy;
type Protocol = ChannelMarker;
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 ChannelSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ChannelMarker 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<ChannelEvent, fidl::Error> {
ChannelEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#create_channel(
&self,
mut handles: &[NewHid; 2],
___deadline: zx::MonotonicInstant,
) -> Result<ChannelCreateChannelResult, fidl::Error> {
let _response = self.client.send_query::<
ChannelCreateChannelRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
>(
(handles,),
0x182d38bfe88673b5,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<ChannelMarker>("create_channel")?;
Ok(_response.map(|x| x))
}
pub fn r#read_channel(
&self,
mut handle: &Hid,
___deadline: zx::MonotonicInstant,
) -> Result<ChannelReadChannelResult, fidl::Error> {
let _response = self.client.send_query::<
ChannelReadChannelRequest,
fidl::encoding::FlexibleResultType<ChannelMessage, Error>,
>(
(handle,),
0x6ef47bf27bf7d050,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<ChannelMarker>("read_channel")?;
Ok(_response.map(|x| (x.data, x.handles)))
}
pub fn r#write_channel(
&self,
mut handle: &Hid,
mut data: &[u8],
mut handles: &Handles,
___deadline: zx::MonotonicInstant,
) -> Result<ChannelWriteChannelResult, fidl::Error> {
let _response = self.client.send_query::<
ChannelWriteChannelRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, WriteChannelError>,
>(
(handle, data, handles,),
0x75a2559b945d5eb5,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<ChannelMarker>("write_channel")?;
Ok(_response.map(|x| x))
}
pub fn r#read_channel_streaming_start(
&self,
mut handle: &Hid,
___deadline: zx::MonotonicInstant,
) -> Result<ChannelReadChannelStreamingStartResult, fidl::Error> {
let _response = self.client.send_query::<
ChannelReadChannelStreamingStartRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
>(
(handle,),
0x3c73e85476a203df,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<ChannelMarker>("read_channel_streaming_start")?;
Ok(_response.map(|x| x))
}
pub fn r#read_channel_streaming_stop(
&self,
mut handle: &Hid,
___deadline: zx::MonotonicInstant,
) -> Result<ChannelReadChannelStreamingStopResult, fidl::Error> {
let _response = self.client.send_query::<
ChannelReadChannelStreamingStopRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
>(
(handle,),
0x56f21d6ed68186e0,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<ChannelMarker>("read_channel_streaming_stop")?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct ChannelProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ChannelProxy {
type Protocol = ChannelMarker;
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 ChannelProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <ChannelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ChannelEventStream {
ChannelEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#create_channel(
&self,
mut handles: &[NewHid; 2],
) -> fidl::client::QueryResponseFut<
ChannelCreateChannelResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ChannelProxyInterface::r#create_channel(self, handles)
}
pub fn r#read_channel(
&self,
mut handle: &Hid,
) -> fidl::client::QueryResponseFut<
ChannelReadChannelResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ChannelProxyInterface::r#read_channel(self, handle)
}
pub fn r#write_channel(
&self,
mut handle: &Hid,
mut data: &[u8],
mut handles: &Handles,
) -> fidl::client::QueryResponseFut<
ChannelWriteChannelResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ChannelProxyInterface::r#write_channel(self, handle, data, handles)
}
pub fn r#read_channel_streaming_start(
&self,
mut handle: &Hid,
) -> fidl::client::QueryResponseFut<
ChannelReadChannelStreamingStartResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ChannelProxyInterface::r#read_channel_streaming_start(self, handle)
}
pub fn r#read_channel_streaming_stop(
&self,
mut handle: &Hid,
) -> fidl::client::QueryResponseFut<
ChannelReadChannelStreamingStopResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ChannelProxyInterface::r#read_channel_streaming_stop(self, handle)
}
}
impl ChannelProxyInterface for ChannelProxy {
type CreateChannelResponseFut = fidl::client::QueryResponseFut<
ChannelCreateChannelResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#create_channel(&self, mut handles: &[NewHid; 2]) -> Self::CreateChannelResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ChannelCreateChannelResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x182d38bfe88673b5,
>(_buf?)?
.into_result::<ChannelMarker>("create_channel")?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<ChannelCreateChannelRequest, ChannelCreateChannelResult>(
(handles,),
0x182d38bfe88673b5,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type ReadChannelResponseFut = fidl::client::QueryResponseFut<
ChannelReadChannelResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#read_channel(&self, mut handle: &Hid) -> Self::ReadChannelResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ChannelReadChannelResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<ChannelMessage, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x6ef47bf27bf7d050,
>(_buf?)?
.into_result::<ChannelMarker>("read_channel")?;
Ok(_response.map(|x| (x.data, x.handles)))
}
self.client.send_query_and_decode::<ChannelReadChannelRequest, ChannelReadChannelResult>(
(handle,),
0x6ef47bf27bf7d050,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type WriteChannelResponseFut = fidl::client::QueryResponseFut<
ChannelWriteChannelResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#write_channel(
&self,
mut handle: &Hid,
mut data: &[u8],
mut handles: &Handles,
) -> Self::WriteChannelResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ChannelWriteChannelResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, WriteChannelError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x75a2559b945d5eb5,
>(_buf?)?
.into_result::<ChannelMarker>("write_channel")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<ChannelWriteChannelRequest, ChannelWriteChannelResult>(
(handle, data, handles),
0x75a2559b945d5eb5,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type ReadChannelStreamingStartResponseFut = fidl::client::QueryResponseFut<
ChannelReadChannelStreamingStartResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#read_channel_streaming_start(
&self,
mut handle: &Hid,
) -> Self::ReadChannelStreamingStartResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ChannelReadChannelStreamingStartResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3c73e85476a203df,
>(_buf?)?
.into_result::<ChannelMarker>("read_channel_streaming_start")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
ChannelReadChannelStreamingStartRequest,
ChannelReadChannelStreamingStartResult,
>(
(handle,),
0x3c73e85476a203df,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type ReadChannelStreamingStopResponseFut = fidl::client::QueryResponseFut<
ChannelReadChannelStreamingStopResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#read_channel_streaming_stop(
&self,
mut handle: &Hid,
) -> Self::ReadChannelStreamingStopResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ChannelReadChannelStreamingStopResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x56f21d6ed68186e0,
>(_buf?)?
.into_result::<ChannelMarker>("read_channel_streaming_stop")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
ChannelReadChannelStreamingStopRequest,
ChannelReadChannelStreamingStopResult,
>(
(handle,),
0x56f21d6ed68186e0,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
}
pub struct ChannelEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ChannelEventStream {}
impl futures::stream::FusedStream for ChannelEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ChannelEventStream {
type Item = Result<ChannelEvent, 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(ChannelEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ChannelEvent {
OnChannelStreamingData {
handle: Hid,
channel_sent: ChannelSent,
},
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl ChannelEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_channel_streaming_data(self) -> Option<(Hid, ChannelSent)> {
if let ChannelEvent::OnChannelStreamingData { handle, channel_sent } = self {
Some((handle, channel_sent))
} else {
None
}
}
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ChannelEvent, 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 {
0x7d4431805202dfe1 => {
let mut out = fidl::new_empty!(
ChannelOnChannelStreamingDataRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelOnChannelStreamingDataRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((ChannelEvent::OnChannelStreamingData {
handle: out.handle,
channel_sent: out.channel_sent,
}))
}
_ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(ChannelEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <ChannelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ChannelRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ChannelRequestStream {}
impl futures::stream::FusedStream for ChannelRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ChannelRequestStream {
type Protocol = ChannelMarker;
type ControlHandle = ChannelControlHandle;
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 {
ChannelControlHandle { 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 ChannelRequestStream {
type Item = Result<ChannelRequest, 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 ChannelRequestStream 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 {
0x182d38bfe88673b5 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ChannelCreateChannelRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelCreateChannelRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ChannelControlHandle { inner: this.inner.clone() };
Ok(ChannelRequest::CreateChannel {
handles: req.handles,
responder: ChannelCreateChannelResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6ef47bf27bf7d050 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ChannelReadChannelRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelReadChannelRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ChannelControlHandle { inner: this.inner.clone() };
Ok(ChannelRequest::ReadChannel {
handle: req.handle,
responder: ChannelReadChannelResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x75a2559b945d5eb5 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ChannelWriteChannelRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelWriteChannelRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ChannelControlHandle { inner: this.inner.clone() };
Ok(ChannelRequest::WriteChannel {
handle: req.handle,
data: req.data,
handles: req.handles,
responder: ChannelWriteChannelResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3c73e85476a203df => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ChannelReadChannelStreamingStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelReadChannelStreamingStartRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ChannelControlHandle { inner: this.inner.clone() };
Ok(ChannelRequest::ReadChannelStreamingStart {
handle: req.handle,
responder: ChannelReadChannelStreamingStartResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x56f21d6ed68186e0 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ChannelReadChannelStreamingStopRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelReadChannelStreamingStopRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ChannelControlHandle { inner: this.inner.clone() };
Ok(ChannelRequest::ReadChannelStreamingStop {
handle: req.handle,
responder: ChannelReadChannelStreamingStopResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ if header.tx_id == 0
&& header
.dynamic_flags()
.contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
Ok(ChannelRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: ChannelControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::OneWay,
})
}
_ if header
.dynamic_flags()
.contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
this.inner.send_framework_err(
fidl::encoding::FrameworkErr::UnknownMethod,
header.tx_id,
header.ordinal,
header.dynamic_flags(),
(bytes, handles),
)?;
Ok(ChannelRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: ChannelControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ChannelMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ChannelRequest {
CreateChannel {
handles: [NewHid; 2],
responder: ChannelCreateChannelResponder,
},
ReadChannel {
handle: Hid,
responder: ChannelReadChannelResponder,
},
WriteChannel {
handle: Hid,
data: Vec<u8>,
handles: Handles,
responder: ChannelWriteChannelResponder,
},
ReadChannelStreamingStart {
handle: Hid,
responder: ChannelReadChannelStreamingStartResponder,
},
ReadChannelStreamingStop {
handle: Hid,
responder: ChannelReadChannelStreamingStopResponder,
},
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: ChannelControlHandle,
method_type: fidl::MethodType,
},
}
impl ChannelRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_create_channel(self) -> Option<([NewHid; 2], ChannelCreateChannelResponder)> {
if let ChannelRequest::CreateChannel { handles, responder } = self {
Some((handles, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_read_channel(self) -> Option<(Hid, ChannelReadChannelResponder)> {
if let ChannelRequest::ReadChannel { handle, responder } = self {
Some((handle, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_write_channel(
self,
) -> Option<(Hid, Vec<u8>, Handles, ChannelWriteChannelResponder)> {
if let ChannelRequest::WriteChannel { handle, data, handles, responder } = self {
Some((handle, data, handles, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_read_channel_streaming_start(
self,
) -> Option<(Hid, ChannelReadChannelStreamingStartResponder)> {
if let ChannelRequest::ReadChannelStreamingStart { handle, responder } = self {
Some((handle, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_read_channel_streaming_stop(
self,
) -> Option<(Hid, ChannelReadChannelStreamingStopResponder)> {
if let ChannelRequest::ReadChannelStreamingStop { handle, responder } = self {
Some((handle, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ChannelRequest::CreateChannel { .. } => "create_channel",
ChannelRequest::ReadChannel { .. } => "read_channel",
ChannelRequest::WriteChannel { .. } => "write_channel",
ChannelRequest::ReadChannelStreamingStart { .. } => "read_channel_streaming_start",
ChannelRequest::ReadChannelStreamingStop { .. } => "read_channel_streaming_stop",
ChannelRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
"unknown one-way method"
}
ChannelRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
"unknown two-way method"
}
}
}
}
#[derive(Debug, Clone)]
pub struct ChannelControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ChannelControlHandle {
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 ChannelControlHandle {
pub fn send_on_channel_streaming_data(
&self,
mut handle: &Hid,
mut channel_sent: &ChannelSent,
) -> Result<(), fidl::Error> {
self.inner.send::<ChannelOnChannelStreamingDataRequest>(
(handle, channel_sent),
0,
0x7d4431805202dfe1,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ChannelCreateChannelResponder {
control_handle: std::mem::ManuallyDrop<ChannelControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ChannelCreateChannelResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ChannelCreateChannelResponder {
type ControlHandle = ChannelControlHandle;
fn control_handle(&self) -> &ChannelControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ChannelCreateChannelResponder {
pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), &Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
Error,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x182d38bfe88673b5,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ChannelReadChannelResponder {
control_handle: std::mem::ManuallyDrop<ChannelControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ChannelReadChannelResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ChannelReadChannelResponder {
type ControlHandle = ChannelControlHandle;
fn control_handle(&self) -> &ChannelControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ChannelReadChannelResponder {
pub fn send(
self,
mut result: Result<(&[u8], &[HandleInfo]), &Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(&[u8], &[HandleInfo]), &Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<(&[u8], &[HandleInfo]), &Error>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<ChannelMessage, Error>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x6ef47bf27bf7d050,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ChannelWriteChannelResponder {
control_handle: std::mem::ManuallyDrop<ChannelControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ChannelWriteChannelResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ChannelWriteChannelResponder {
type ControlHandle = ChannelControlHandle;
fn control_handle(&self) -> &ChannelControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ChannelWriteChannelResponder {
pub fn send(self, mut result: Result<(), &WriteChannelError>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), &WriteChannelError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), &WriteChannelError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
WriteChannelError,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x75a2559b945d5eb5,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ChannelReadChannelStreamingStartResponder {
control_handle: std::mem::ManuallyDrop<ChannelControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ChannelReadChannelStreamingStartResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ChannelReadChannelStreamingStartResponder {
type ControlHandle = ChannelControlHandle;
fn control_handle(&self) -> &ChannelControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ChannelReadChannelStreamingStartResponder {
pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), &Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
Error,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x3c73e85476a203df,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ChannelReadChannelStreamingStopResponder {
control_handle: std::mem::ManuallyDrop<ChannelControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ChannelReadChannelStreamingStopResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ChannelReadChannelStreamingStopResponder {
type ControlHandle = ChannelControlHandle;
fn control_handle(&self) -> &ChannelControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ChannelReadChannelStreamingStopResponder {
pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), &Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
Error,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x56f21d6ed68186e0,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct EventMarker;
impl fidl::endpoints::ProtocolMarker for EventMarker {
type Proxy = EventProxy;
type RequestStream = EventRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = EventSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Event";
}
pub type EventCreateEventResult = Result<(), Error>;
pub trait EventProxyInterface: Send + Sync {
type CreateEventResponseFut: std::future::Future<Output = Result<EventCreateEventResult, fidl::Error>>
+ Send;
fn r#create_event(&self, handle: &NewHid) -> Self::CreateEventResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct EventSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for EventSynchronousProxy {
type Proxy = EventProxy;
type Protocol = EventMarker;
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 EventSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <EventMarker 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<EventEvent, fidl::Error> {
EventEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#create_event(
&self,
mut handle: &NewHid,
___deadline: zx::MonotonicInstant,
) -> Result<EventCreateEventResult, fidl::Error> {
let _response = self.client.send_query::<
EventCreateEventRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
>(
(handle,),
0x7b05b3f262635987,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<EventMarker>("create_event")?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct EventProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for EventProxy {
type Protocol = EventMarker;
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 EventProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <EventMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> EventEventStream {
EventEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#create_event(
&self,
mut handle: &NewHid,
) -> fidl::client::QueryResponseFut<
EventCreateEventResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
EventProxyInterface::r#create_event(self, handle)
}
}
impl EventProxyInterface for EventProxy {
type CreateEventResponseFut = fidl::client::QueryResponseFut<
EventCreateEventResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#create_event(&self, mut handle: &NewHid) -> Self::CreateEventResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<EventCreateEventResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x7b05b3f262635987,
>(_buf?)?
.into_result::<EventMarker>("create_event")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<EventCreateEventRequest, EventCreateEventResult>(
(handle,),
0x7b05b3f262635987,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
}
pub struct EventEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for EventEventStream {}
impl futures::stream::FusedStream for EventEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for EventEventStream {
type Item = Result<EventEvent, 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(EventEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum EventEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl EventEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<EventEvent, 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 {
_ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(EventEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <EventMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct EventRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for EventRequestStream {}
impl futures::stream::FusedStream for EventRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for EventRequestStream {
type Protocol = EventMarker;
type ControlHandle = EventControlHandle;
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 {
EventControlHandle { 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 EventRequestStream {
type Item = Result<EventRequest, 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 EventRequestStream 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 {
0x7b05b3f262635987 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
EventCreateEventRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EventCreateEventRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = EventControlHandle { inner: this.inner.clone() };
Ok(EventRequest::CreateEvent {
handle: req.handle,
responder: EventCreateEventResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ if header.tx_id == 0
&& header
.dynamic_flags()
.contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
Ok(EventRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: EventControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::OneWay,
})
}
_ if header
.dynamic_flags()
.contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
this.inner.send_framework_err(
fidl::encoding::FrameworkErr::UnknownMethod,
header.tx_id,
header.ordinal,
header.dynamic_flags(),
(bytes, handles),
)?;
Ok(EventRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: EventControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <EventMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum EventRequest {
CreateEvent {
handle: NewHid,
responder: EventCreateEventResponder,
},
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: EventControlHandle,
method_type: fidl::MethodType,
},
}
impl EventRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_create_event(self) -> Option<(NewHid, EventCreateEventResponder)> {
if let EventRequest::CreateEvent { handle, responder } = self {
Some((handle, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
EventRequest::CreateEvent { .. } => "create_event",
EventRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
"unknown one-way method"
}
EventRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
"unknown two-way method"
}
}
}
}
#[derive(Debug, Clone)]
pub struct EventControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for EventControlHandle {
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 EventControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct EventCreateEventResponder {
control_handle: std::mem::ManuallyDrop<EventControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for EventCreateEventResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for EventCreateEventResponder {
type ControlHandle = EventControlHandle;
fn control_handle(&self) -> &EventControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl EventCreateEventResponder {
pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), &Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
Error,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x7b05b3f262635987,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct EventPairMarker;
impl fidl::endpoints::ProtocolMarker for EventPairMarker {
type Proxy = EventPairProxy;
type RequestStream = EventPairRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = EventPairSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) EventPair";
}
pub type EventPairCreateEventPairResult = Result<(), Error>;
pub trait EventPairProxyInterface: Send + Sync {
type CreateEventPairResponseFut: std::future::Future<Output = Result<EventPairCreateEventPairResult, fidl::Error>>
+ Send;
fn r#create_event_pair(&self, handles: &[NewHid; 2]) -> Self::CreateEventPairResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct EventPairSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for EventPairSynchronousProxy {
type Proxy = EventPairProxy;
type Protocol = EventPairMarker;
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 EventPairSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <EventPairMarker 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<EventPairEvent, fidl::Error> {
EventPairEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#create_event_pair(
&self,
mut handles: &[NewHid; 2],
___deadline: zx::MonotonicInstant,
) -> Result<EventPairCreateEventPairResult, fidl::Error> {
let _response = self.client.send_query::<
EventPairCreateEventPairRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
>(
(handles,),
0x7aef61effa65656d,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<EventPairMarker>("create_event_pair")?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct EventPairProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for EventPairProxy {
type Protocol = EventPairMarker;
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 EventPairProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <EventPairMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> EventPairEventStream {
EventPairEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#create_event_pair(
&self,
mut handles: &[NewHid; 2],
) -> fidl::client::QueryResponseFut<
EventPairCreateEventPairResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
EventPairProxyInterface::r#create_event_pair(self, handles)
}
}
impl EventPairProxyInterface for EventPairProxy {
type CreateEventPairResponseFut = fidl::client::QueryResponseFut<
EventPairCreateEventPairResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#create_event_pair(&self, mut handles: &[NewHid; 2]) -> Self::CreateEventPairResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<EventPairCreateEventPairResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x7aef61effa65656d,
>(_buf?)?
.into_result::<EventPairMarker>("create_event_pair")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
EventPairCreateEventPairRequest,
EventPairCreateEventPairResult,
>(
(handles,),
0x7aef61effa65656d,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
}
pub struct EventPairEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for EventPairEventStream {}
impl futures::stream::FusedStream for EventPairEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for EventPairEventStream {
type Item = Result<EventPairEvent, 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(EventPairEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum EventPairEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl EventPairEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<EventPairEvent, 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 {
_ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(EventPairEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <EventPairMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct EventPairRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for EventPairRequestStream {}
impl futures::stream::FusedStream for EventPairRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for EventPairRequestStream {
type Protocol = EventPairMarker;
type ControlHandle = EventPairControlHandle;
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 {
EventPairControlHandle { 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 EventPairRequestStream {
type Item = Result<EventPairRequest, 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 EventPairRequestStream 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 {
0x7aef61effa65656d => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
EventPairCreateEventPairRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EventPairCreateEventPairRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = EventPairControlHandle { inner: this.inner.clone() };
Ok(EventPairRequest::CreateEventPair {
handles: req.handles,
responder: EventPairCreateEventPairResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ if header.tx_id == 0
&& header
.dynamic_flags()
.contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
Ok(EventPairRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: EventPairControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::OneWay,
})
}
_ if header
.dynamic_flags()
.contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
this.inner.send_framework_err(
fidl::encoding::FrameworkErr::UnknownMethod,
header.tx_id,
header.ordinal,
header.dynamic_flags(),
(bytes, handles),
)?;
Ok(EventPairRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: EventPairControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<EventPairMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum EventPairRequest {
CreateEventPair {
handles: [NewHid; 2],
responder: EventPairCreateEventPairResponder,
},
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: EventPairControlHandle,
method_type: fidl::MethodType,
},
}
impl EventPairRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_create_event_pair(
self,
) -> Option<([NewHid; 2], EventPairCreateEventPairResponder)> {
if let EventPairRequest::CreateEventPair { handles, responder } = self {
Some((handles, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
EventPairRequest::CreateEventPair { .. } => "create_event_pair",
EventPairRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
"unknown one-way method"
}
EventPairRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
"unknown two-way method"
}
}
}
}
#[derive(Debug, Clone)]
pub struct EventPairControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for EventPairControlHandle {
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 EventPairControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct EventPairCreateEventPairResponder {
control_handle: std::mem::ManuallyDrop<EventPairControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for EventPairCreateEventPairResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for EventPairCreateEventPairResponder {
type ControlHandle = EventPairControlHandle;
fn control_handle(&self) -> &EventPairControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl EventPairCreateEventPairResponder {
pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), &Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
Error,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x7aef61effa65656d,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct FDomainMarker;
impl fidl::endpoints::ProtocolMarker for FDomainMarker {
type Proxy = FDomainProxy;
type RequestStream = FDomainRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = FDomainSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) FDomain";
}
pub type FDomainNamespaceResult = Result<(), Error>;
pub type FDomainCloseResult = Result<(), Error>;
pub type FDomainDuplicateResult = Result<(), Error>;
pub type FDomainReplaceResult = Result<(), Error>;
pub type FDomainSignalResult = Result<(), Error>;
pub type FDomainSignalPeerResult = Result<(), Error>;
pub type FDomainWaitForSignalsResult = Result<u32, Error>;
pub type FDomainAcknowledgeWriteErrorResult = Result<(), Error>;
pub trait FDomainProxyInterface: Send + Sync {
type CreateChannelResponseFut: std::future::Future<Output = Result<ChannelCreateChannelResult, fidl::Error>>
+ Send;
fn r#create_channel(&self, handles: &[NewHid; 2]) -> Self::CreateChannelResponseFut;
type ReadChannelResponseFut: std::future::Future<Output = Result<ChannelReadChannelResult, fidl::Error>>
+ Send;
fn r#read_channel(&self, handle: &Hid) -> Self::ReadChannelResponseFut;
type WriteChannelResponseFut: std::future::Future<Output = Result<ChannelWriteChannelResult, fidl::Error>>
+ Send;
fn r#write_channel(
&self,
handle: &Hid,
data: &[u8],
handles: &Handles,
) -> Self::WriteChannelResponseFut;
type ReadChannelStreamingStartResponseFut: std::future::Future<Output = Result<ChannelReadChannelStreamingStartResult, fidl::Error>>
+ Send;
fn r#read_channel_streaming_start(
&self,
handle: &Hid,
) -> Self::ReadChannelStreamingStartResponseFut;
type ReadChannelStreamingStopResponseFut: std::future::Future<Output = Result<ChannelReadChannelStreamingStopResult, fidl::Error>>
+ Send;
fn r#read_channel_streaming_stop(
&self,
handle: &Hid,
) -> Self::ReadChannelStreamingStopResponseFut;
type CreateEventResponseFut: std::future::Future<Output = Result<EventCreateEventResult, fidl::Error>>
+ Send;
fn r#create_event(&self, handle: &NewHid) -> Self::CreateEventResponseFut;
type CreateEventPairResponseFut: std::future::Future<Output = Result<EventPairCreateEventPairResult, fidl::Error>>
+ Send;
fn r#create_event_pair(&self, handles: &[NewHid; 2]) -> Self::CreateEventPairResponseFut;
type CreateSocketResponseFut: std::future::Future<Output = Result<SocketCreateSocketResult, fidl::Error>>
+ Send;
fn r#create_socket(
&self,
options: SocketType,
handles: &[NewHid; 2],
) -> Self::CreateSocketResponseFut;
type SetSocketDispositionResponseFut: std::future::Future<Output = Result<SocketSetSocketDispositionResult, fidl::Error>>
+ Send;
fn r#set_socket_disposition(
&self,
handle: &Hid,
disposition: SocketDisposition,
disposition_peer: SocketDisposition,
) -> Self::SetSocketDispositionResponseFut;
type ReadSocketResponseFut: std::future::Future<Output = Result<SocketReadSocketResult, fidl::Error>>
+ Send;
fn r#read_socket(&self, handle: &Hid, max_bytes: u64) -> Self::ReadSocketResponseFut;
type WriteSocketResponseFut: std::future::Future<Output = Result<SocketWriteSocketResult, fidl::Error>>
+ Send;
fn r#write_socket(&self, handle: &Hid, data: &[u8]) -> Self::WriteSocketResponseFut;
type ReadSocketStreamingStartResponseFut: std::future::Future<Output = Result<SocketReadSocketStreamingStartResult, fidl::Error>>
+ Send;
fn r#read_socket_streaming_start(
&self,
handle: &Hid,
) -> Self::ReadSocketStreamingStartResponseFut;
type ReadSocketStreamingStopResponseFut: std::future::Future<Output = Result<SocketReadSocketStreamingStopResult, fidl::Error>>
+ Send;
fn r#read_socket_streaming_stop(
&self,
handle: &Hid,
) -> Self::ReadSocketStreamingStopResponseFut;
type NamespaceResponseFut: std::future::Future<Output = Result<FDomainNamespaceResult, fidl::Error>>
+ Send;
fn r#namespace(&self, new_handle: &NewHid) -> Self::NamespaceResponseFut;
type CloseResponseFut: std::future::Future<Output = Result<FDomainCloseResult, fidl::Error>>
+ Send;
fn r#close(&self, handles: &[Hid]) -> Self::CloseResponseFut;
type DuplicateResponseFut: std::future::Future<Output = Result<FDomainDuplicateResult, fidl::Error>>
+ Send;
fn r#duplicate(
&self,
handle: &Hid,
new_handle: &NewHid,
rights: fidl::Rights,
) -> Self::DuplicateResponseFut;
type ReplaceResponseFut: std::future::Future<Output = Result<FDomainReplaceResult, fidl::Error>>
+ Send;
fn r#replace(
&self,
handle: &Hid,
new_handle: &NewHid,
rights: fidl::Rights,
) -> Self::ReplaceResponseFut;
type SignalResponseFut: std::future::Future<Output = Result<FDomainSignalResult, fidl::Error>>
+ Send;
fn r#signal(&self, handle: &Hid, set: u32, clear: u32) -> Self::SignalResponseFut;
type SignalPeerResponseFut: std::future::Future<Output = Result<FDomainSignalPeerResult, fidl::Error>>
+ Send;
fn r#signal_peer(&self, handle: &Hid, set: u32, clear: u32) -> Self::SignalPeerResponseFut;
type WaitForSignalsResponseFut: std::future::Future<Output = Result<FDomainWaitForSignalsResult, fidl::Error>>
+ Send;
fn r#wait_for_signals(&self, handle: &Hid, signals: u32) -> Self::WaitForSignalsResponseFut;
type AcknowledgeWriteErrorResponseFut: std::future::Future<Output = Result<FDomainAcknowledgeWriteErrorResult, fidl::Error>>
+ Send;
fn r#acknowledge_write_error(&self, handle: &Hid) -> Self::AcknowledgeWriteErrorResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct FDomainSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for FDomainSynchronousProxy {
type Proxy = FDomainProxy;
type Protocol = FDomainMarker;
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 FDomainSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <FDomainMarker 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<FDomainEvent, fidl::Error> {
FDomainEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#create_channel(
&self,
mut handles: &[NewHid; 2],
___deadline: zx::MonotonicInstant,
) -> Result<ChannelCreateChannelResult, fidl::Error> {
let _response = self.client.send_query::<
ChannelCreateChannelRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
>(
(handles,),
0x182d38bfe88673b5,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<FDomainMarker>("create_channel")?;
Ok(_response.map(|x| x))
}
pub fn r#read_channel(
&self,
mut handle: &Hid,
___deadline: zx::MonotonicInstant,
) -> Result<ChannelReadChannelResult, fidl::Error> {
let _response = self.client.send_query::<
ChannelReadChannelRequest,
fidl::encoding::FlexibleResultType<ChannelMessage, Error>,
>(
(handle,),
0x6ef47bf27bf7d050,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<FDomainMarker>("read_channel")?;
Ok(_response.map(|x| (x.data, x.handles)))
}
pub fn r#write_channel(
&self,
mut handle: &Hid,
mut data: &[u8],
mut handles: &Handles,
___deadline: zx::MonotonicInstant,
) -> Result<ChannelWriteChannelResult, fidl::Error> {
let _response = self.client.send_query::<
ChannelWriteChannelRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, WriteChannelError>,
>(
(handle, data, handles,),
0x75a2559b945d5eb5,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<FDomainMarker>("write_channel")?;
Ok(_response.map(|x| x))
}
pub fn r#read_channel_streaming_start(
&self,
mut handle: &Hid,
___deadline: zx::MonotonicInstant,
) -> Result<ChannelReadChannelStreamingStartResult, fidl::Error> {
let _response = self.client.send_query::<
ChannelReadChannelStreamingStartRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
>(
(handle,),
0x3c73e85476a203df,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<FDomainMarker>("read_channel_streaming_start")?;
Ok(_response.map(|x| x))
}
pub fn r#read_channel_streaming_stop(
&self,
mut handle: &Hid,
___deadline: zx::MonotonicInstant,
) -> Result<ChannelReadChannelStreamingStopResult, fidl::Error> {
let _response = self.client.send_query::<
ChannelReadChannelStreamingStopRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
>(
(handle,),
0x56f21d6ed68186e0,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<FDomainMarker>("read_channel_streaming_stop")?;
Ok(_response.map(|x| x))
}
pub fn r#create_event(
&self,
mut handle: &NewHid,
___deadline: zx::MonotonicInstant,
) -> Result<EventCreateEventResult, fidl::Error> {
let _response = self.client.send_query::<
EventCreateEventRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
>(
(handle,),
0x7b05b3f262635987,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<FDomainMarker>("create_event")?;
Ok(_response.map(|x| x))
}
pub fn r#create_event_pair(
&self,
mut handles: &[NewHid; 2],
___deadline: zx::MonotonicInstant,
) -> Result<EventPairCreateEventPairResult, fidl::Error> {
let _response = self.client.send_query::<
EventPairCreateEventPairRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
>(
(handles,),
0x7aef61effa65656d,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<FDomainMarker>("create_event_pair")?;
Ok(_response.map(|x| x))
}
pub fn r#create_socket(
&self,
mut options: SocketType,
mut handles: &[NewHid; 2],
___deadline: zx::MonotonicInstant,
) -> Result<SocketCreateSocketResult, fidl::Error> {
let _response = self.client.send_query::<
SocketCreateSocketRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
>(
(options, handles,),
0x200bf0ea21932de0,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<FDomainMarker>("create_socket")?;
Ok(_response.map(|x| x))
}
pub fn r#set_socket_disposition(
&self,
mut handle: &Hid,
mut disposition: SocketDisposition,
mut disposition_peer: SocketDisposition,
___deadline: zx::MonotonicInstant,
) -> Result<SocketSetSocketDispositionResult, fidl::Error> {
let _response = self.client.send_query::<
SocketSetSocketDispositionRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
>(
(handle, disposition, disposition_peer,),
0x60d3c7ccb17f9bdf,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<FDomainMarker>("set_socket_disposition")?;
Ok(_response.map(|x| x))
}
pub fn r#read_socket(
&self,
mut handle: &Hid,
mut max_bytes: u64,
___deadline: zx::MonotonicInstant,
) -> Result<SocketReadSocketResult, fidl::Error> {
let _response = self.client.send_query::<
SocketReadSocketRequest,
fidl::encoding::FlexibleResultType<SocketReadSocketResponse, Error>,
>(
(handle, max_bytes,),
0x1da8aabec249c02e,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<FDomainMarker>("read_socket")?;
Ok(_response.map(|x| x.data))
}
pub fn r#write_socket(
&self,
mut handle: &Hid,
mut data: &[u8],
___deadline: zx::MonotonicInstant,
) -> Result<SocketWriteSocketResult, fidl::Error> {
let _response = self.client.send_query::<
SocketWriteSocketRequest,
fidl::encoding::FlexibleResultType<SocketWriteSocketResponse, WriteSocketError>,
>(
(handle, data,),
0x5b541623cbbbf683,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<FDomainMarker>("write_socket")?;
Ok(_response.map(|x| x.wrote))
}
pub fn r#read_socket_streaming_start(
&self,
mut handle: &Hid,
___deadline: zx::MonotonicInstant,
) -> Result<SocketReadSocketStreamingStartResult, fidl::Error> {
let _response = self.client.send_query::<
SocketReadSocketStreamingStartRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
>(
(handle,),
0x2a592748d5f33445,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<FDomainMarker>("read_socket_streaming_start")?;
Ok(_response.map(|x| x))
}
pub fn r#read_socket_streaming_stop(
&self,
mut handle: &Hid,
___deadline: zx::MonotonicInstant,
) -> Result<SocketReadSocketStreamingStopResult, fidl::Error> {
let _response = self.client.send_query::<
SocketReadSocketStreamingStopRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
>(
(handle,),
0x53e5cade5f4d22e7,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<FDomainMarker>("read_socket_streaming_stop")?;
Ok(_response.map(|x| x))
}
pub fn r#namespace(
&self,
mut new_handle: &NewHid,
___deadline: zx::MonotonicInstant,
) -> Result<FDomainNamespaceResult, fidl::Error> {
let _response = self.client.send_query::<
FDomainNamespaceRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
>(
(new_handle,),
0x5fa84dd6b11bbebb,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<FDomainMarker>("namespace")?;
Ok(_response.map(|x| x))
}
pub fn r#close(
&self,
mut handles: &[Hid],
___deadline: zx::MonotonicInstant,
) -> Result<FDomainCloseResult, fidl::Error> {
let _response = self.client.send_query::<
FDomainCloseRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
>(
(handles,),
0x5ef8c24362964257,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<FDomainMarker>("close")?;
Ok(_response.map(|x| x))
}
pub fn r#duplicate(
&self,
mut handle: &Hid,
mut new_handle: &NewHid,
mut rights: fidl::Rights,
___deadline: zx::MonotonicInstant,
) -> Result<FDomainDuplicateResult, fidl::Error> {
let _response = self.client.send_query::<
FDomainDuplicateRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
>(
(handle, new_handle, rights,),
0x7a85b94bd1777ab9,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<FDomainMarker>("duplicate")?;
Ok(_response.map(|x| x))
}
pub fn r#replace(
&self,
mut handle: &Hid,
mut new_handle: &NewHid,
mut rights: fidl::Rights,
___deadline: zx::MonotonicInstant,
) -> Result<FDomainReplaceResult, fidl::Error> {
let _response = self.client.send_query::<
FDomainReplaceRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
>(
(handle, new_handle, rights,),
0x32fa64625a5bd3be,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<FDomainMarker>("replace")?;
Ok(_response.map(|x| x))
}
pub fn r#signal(
&self,
mut handle: &Hid,
mut set: u32,
mut clear: u32,
___deadline: zx::MonotonicInstant,
) -> Result<FDomainSignalResult, fidl::Error> {
let _response = self.client.send_query::<
FDomainSignalRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
>(
(handle, set, clear,),
0xe8352fb978996d9,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<FDomainMarker>("signal")?;
Ok(_response.map(|x| x))
}
pub fn r#signal_peer(
&self,
mut handle: &Hid,
mut set: u32,
mut clear: u32,
___deadline: zx::MonotonicInstant,
) -> Result<FDomainSignalPeerResult, fidl::Error> {
let _response = self.client.send_query::<
FDomainSignalPeerRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
>(
(handle, set, clear,),
0x7e84ec8ca7eabaf8,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<FDomainMarker>("signal_peer")?;
Ok(_response.map(|x| x))
}
pub fn r#wait_for_signals(
&self,
mut handle: &Hid,
mut signals: u32,
___deadline: zx::MonotonicInstant,
) -> Result<FDomainWaitForSignalsResult, fidl::Error> {
let _response = self.client.send_query::<
FDomainWaitForSignalsRequest,
fidl::encoding::FlexibleResultType<FDomainWaitForSignalsResponse, Error>,
>(
(handle, signals,),
0x8f72d9b4b85c1eb,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<FDomainMarker>("wait_for_signals")?;
Ok(_response.map(|x| x.signals))
}
pub fn r#acknowledge_write_error(
&self,
mut handle: &Hid,
___deadline: zx::MonotonicInstant,
) -> Result<FDomainAcknowledgeWriteErrorResult, fidl::Error> {
let _response = self.client.send_query::<
FDomainAcknowledgeWriteErrorRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
>(
(handle,),
0x23abaefeb6517510,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<FDomainMarker>("acknowledge_write_error")?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct FDomainProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for FDomainProxy {
type Protocol = FDomainMarker;
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 FDomainProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <FDomainMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> FDomainEventStream {
FDomainEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#create_channel(
&self,
mut handles: &[NewHid; 2],
) -> fidl::client::QueryResponseFut<
ChannelCreateChannelResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
FDomainProxyInterface::r#create_channel(self, handles)
}
pub fn r#read_channel(
&self,
mut handle: &Hid,
) -> fidl::client::QueryResponseFut<
ChannelReadChannelResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
FDomainProxyInterface::r#read_channel(self, handle)
}
pub fn r#write_channel(
&self,
mut handle: &Hid,
mut data: &[u8],
mut handles: &Handles,
) -> fidl::client::QueryResponseFut<
ChannelWriteChannelResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
FDomainProxyInterface::r#write_channel(self, handle, data, handles)
}
pub fn r#read_channel_streaming_start(
&self,
mut handle: &Hid,
) -> fidl::client::QueryResponseFut<
ChannelReadChannelStreamingStartResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
FDomainProxyInterface::r#read_channel_streaming_start(self, handle)
}
pub fn r#read_channel_streaming_stop(
&self,
mut handle: &Hid,
) -> fidl::client::QueryResponseFut<
ChannelReadChannelStreamingStopResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
FDomainProxyInterface::r#read_channel_streaming_stop(self, handle)
}
pub fn r#create_event(
&self,
mut handle: &NewHid,
) -> fidl::client::QueryResponseFut<
EventCreateEventResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
FDomainProxyInterface::r#create_event(self, handle)
}
pub fn r#create_event_pair(
&self,
mut handles: &[NewHid; 2],
) -> fidl::client::QueryResponseFut<
EventPairCreateEventPairResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
FDomainProxyInterface::r#create_event_pair(self, handles)
}
pub fn r#create_socket(
&self,
mut options: SocketType,
mut handles: &[NewHid; 2],
) -> fidl::client::QueryResponseFut<
SocketCreateSocketResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
FDomainProxyInterface::r#create_socket(self, options, handles)
}
pub fn r#set_socket_disposition(
&self,
mut handle: &Hid,
mut disposition: SocketDisposition,
mut disposition_peer: SocketDisposition,
) -> fidl::client::QueryResponseFut<
SocketSetSocketDispositionResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
FDomainProxyInterface::r#set_socket_disposition(self, handle, disposition, disposition_peer)
}
pub fn r#read_socket(
&self,
mut handle: &Hid,
mut max_bytes: u64,
) -> fidl::client::QueryResponseFut<
SocketReadSocketResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
FDomainProxyInterface::r#read_socket(self, handle, max_bytes)
}
pub fn r#write_socket(
&self,
mut handle: &Hid,
mut data: &[u8],
) -> fidl::client::QueryResponseFut<
SocketWriteSocketResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
FDomainProxyInterface::r#write_socket(self, handle, data)
}
pub fn r#read_socket_streaming_start(
&self,
mut handle: &Hid,
) -> fidl::client::QueryResponseFut<
SocketReadSocketStreamingStartResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
FDomainProxyInterface::r#read_socket_streaming_start(self, handle)
}
pub fn r#read_socket_streaming_stop(
&self,
mut handle: &Hid,
) -> fidl::client::QueryResponseFut<
SocketReadSocketStreamingStopResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
FDomainProxyInterface::r#read_socket_streaming_stop(self, handle)
}
pub fn r#namespace(
&self,
mut new_handle: &NewHid,
) -> fidl::client::QueryResponseFut<
FDomainNamespaceResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
FDomainProxyInterface::r#namespace(self, new_handle)
}
pub fn r#close(
&self,
mut handles: &[Hid],
) -> fidl::client::QueryResponseFut<
FDomainCloseResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
FDomainProxyInterface::r#close(self, handles)
}
pub fn r#duplicate(
&self,
mut handle: &Hid,
mut new_handle: &NewHid,
mut rights: fidl::Rights,
) -> fidl::client::QueryResponseFut<
FDomainDuplicateResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
FDomainProxyInterface::r#duplicate(self, handle, new_handle, rights)
}
pub fn r#replace(
&self,
mut handle: &Hid,
mut new_handle: &NewHid,
mut rights: fidl::Rights,
) -> fidl::client::QueryResponseFut<
FDomainReplaceResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
FDomainProxyInterface::r#replace(self, handle, new_handle, rights)
}
pub fn r#signal(
&self,
mut handle: &Hid,
mut set: u32,
mut clear: u32,
) -> fidl::client::QueryResponseFut<
FDomainSignalResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
FDomainProxyInterface::r#signal(self, handle, set, clear)
}
pub fn r#signal_peer(
&self,
mut handle: &Hid,
mut set: u32,
mut clear: u32,
) -> fidl::client::QueryResponseFut<
FDomainSignalPeerResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
FDomainProxyInterface::r#signal_peer(self, handle, set, clear)
}
pub fn r#wait_for_signals(
&self,
mut handle: &Hid,
mut signals: u32,
) -> fidl::client::QueryResponseFut<
FDomainWaitForSignalsResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
FDomainProxyInterface::r#wait_for_signals(self, handle, signals)
}
pub fn r#acknowledge_write_error(
&self,
mut handle: &Hid,
) -> fidl::client::QueryResponseFut<
FDomainAcknowledgeWriteErrorResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
FDomainProxyInterface::r#acknowledge_write_error(self, handle)
}
}
impl FDomainProxyInterface for FDomainProxy {
type CreateChannelResponseFut = fidl::client::QueryResponseFut<
ChannelCreateChannelResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#create_channel(&self, mut handles: &[NewHid; 2]) -> Self::CreateChannelResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ChannelCreateChannelResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x182d38bfe88673b5,
>(_buf?)?
.into_result::<FDomainMarker>("create_channel")?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<ChannelCreateChannelRequest, ChannelCreateChannelResult>(
(handles,),
0x182d38bfe88673b5,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type ReadChannelResponseFut = fidl::client::QueryResponseFut<
ChannelReadChannelResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#read_channel(&self, mut handle: &Hid) -> Self::ReadChannelResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ChannelReadChannelResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<ChannelMessage, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x6ef47bf27bf7d050,
>(_buf?)?
.into_result::<FDomainMarker>("read_channel")?;
Ok(_response.map(|x| (x.data, x.handles)))
}
self.client.send_query_and_decode::<ChannelReadChannelRequest, ChannelReadChannelResult>(
(handle,),
0x6ef47bf27bf7d050,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type WriteChannelResponseFut = fidl::client::QueryResponseFut<
ChannelWriteChannelResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#write_channel(
&self,
mut handle: &Hid,
mut data: &[u8],
mut handles: &Handles,
) -> Self::WriteChannelResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ChannelWriteChannelResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, WriteChannelError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x75a2559b945d5eb5,
>(_buf?)?
.into_result::<FDomainMarker>("write_channel")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<ChannelWriteChannelRequest, ChannelWriteChannelResult>(
(handle, data, handles),
0x75a2559b945d5eb5,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type ReadChannelStreamingStartResponseFut = fidl::client::QueryResponseFut<
ChannelReadChannelStreamingStartResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#read_channel_streaming_start(
&self,
mut handle: &Hid,
) -> Self::ReadChannelStreamingStartResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ChannelReadChannelStreamingStartResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3c73e85476a203df,
>(_buf?)?
.into_result::<FDomainMarker>("read_channel_streaming_start")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
ChannelReadChannelStreamingStartRequest,
ChannelReadChannelStreamingStartResult,
>(
(handle,),
0x3c73e85476a203df,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type ReadChannelStreamingStopResponseFut = fidl::client::QueryResponseFut<
ChannelReadChannelStreamingStopResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#read_channel_streaming_stop(
&self,
mut handle: &Hid,
) -> Self::ReadChannelStreamingStopResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ChannelReadChannelStreamingStopResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x56f21d6ed68186e0,
>(_buf?)?
.into_result::<FDomainMarker>("read_channel_streaming_stop")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
ChannelReadChannelStreamingStopRequest,
ChannelReadChannelStreamingStopResult,
>(
(handle,),
0x56f21d6ed68186e0,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type CreateEventResponseFut = fidl::client::QueryResponseFut<
EventCreateEventResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#create_event(&self, mut handle: &NewHid) -> Self::CreateEventResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<EventCreateEventResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x7b05b3f262635987,
>(_buf?)?
.into_result::<FDomainMarker>("create_event")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<EventCreateEventRequest, EventCreateEventResult>(
(handle,),
0x7b05b3f262635987,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type CreateEventPairResponseFut = fidl::client::QueryResponseFut<
EventPairCreateEventPairResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#create_event_pair(&self, mut handles: &[NewHid; 2]) -> Self::CreateEventPairResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<EventPairCreateEventPairResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x7aef61effa65656d,
>(_buf?)?
.into_result::<FDomainMarker>("create_event_pair")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
EventPairCreateEventPairRequest,
EventPairCreateEventPairResult,
>(
(handles,),
0x7aef61effa65656d,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type CreateSocketResponseFut = fidl::client::QueryResponseFut<
SocketCreateSocketResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#create_socket(
&self,
mut options: SocketType,
mut handles: &[NewHid; 2],
) -> Self::CreateSocketResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<SocketCreateSocketResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x200bf0ea21932de0,
>(_buf?)?
.into_result::<FDomainMarker>("create_socket")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<SocketCreateSocketRequest, SocketCreateSocketResult>(
(options, handles),
0x200bf0ea21932de0,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type SetSocketDispositionResponseFut = fidl::client::QueryResponseFut<
SocketSetSocketDispositionResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#set_socket_disposition(
&self,
mut handle: &Hid,
mut disposition: SocketDisposition,
mut disposition_peer: SocketDisposition,
) -> Self::SetSocketDispositionResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<SocketSetSocketDispositionResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x60d3c7ccb17f9bdf,
>(_buf?)?
.into_result::<FDomainMarker>("set_socket_disposition")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
SocketSetSocketDispositionRequest,
SocketSetSocketDispositionResult,
>(
(handle, disposition, disposition_peer,),
0x60d3c7ccb17f9bdf,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type ReadSocketResponseFut = fidl::client::QueryResponseFut<
SocketReadSocketResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#read_socket(&self, mut handle: &Hid, mut max_bytes: u64) -> Self::ReadSocketResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<SocketReadSocketResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<SocketReadSocketResponse, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x1da8aabec249c02e,
>(_buf?)?
.into_result::<FDomainMarker>("read_socket")?;
Ok(_response.map(|x| x.data))
}
self.client.send_query_and_decode::<SocketReadSocketRequest, SocketReadSocketResult>(
(handle, max_bytes),
0x1da8aabec249c02e,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type WriteSocketResponseFut = fidl::client::QueryResponseFut<
SocketWriteSocketResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#write_socket(&self, mut handle: &Hid, mut data: &[u8]) -> Self::WriteSocketResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<SocketWriteSocketResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<SocketWriteSocketResponse, WriteSocketError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x5b541623cbbbf683,
>(_buf?)?
.into_result::<FDomainMarker>("write_socket")?;
Ok(_response.map(|x| x.wrote))
}
self.client.send_query_and_decode::<SocketWriteSocketRequest, SocketWriteSocketResult>(
(handle, data),
0x5b541623cbbbf683,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type ReadSocketStreamingStartResponseFut = fidl::client::QueryResponseFut<
SocketReadSocketStreamingStartResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#read_socket_streaming_start(
&self,
mut handle: &Hid,
) -> Self::ReadSocketStreamingStartResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<SocketReadSocketStreamingStartResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2a592748d5f33445,
>(_buf?)?
.into_result::<FDomainMarker>("read_socket_streaming_start")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
SocketReadSocketStreamingStartRequest,
SocketReadSocketStreamingStartResult,
>(
(handle,),
0x2a592748d5f33445,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type ReadSocketStreamingStopResponseFut = fidl::client::QueryResponseFut<
SocketReadSocketStreamingStopResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#read_socket_streaming_stop(
&self,
mut handle: &Hid,
) -> Self::ReadSocketStreamingStopResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<SocketReadSocketStreamingStopResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x53e5cade5f4d22e7,
>(_buf?)?
.into_result::<FDomainMarker>("read_socket_streaming_stop")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
SocketReadSocketStreamingStopRequest,
SocketReadSocketStreamingStopResult,
>(
(handle,),
0x53e5cade5f4d22e7,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type NamespaceResponseFut = fidl::client::QueryResponseFut<
FDomainNamespaceResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#namespace(&self, mut new_handle: &NewHid) -> Self::NamespaceResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<FDomainNamespaceResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x5fa84dd6b11bbebb,
>(_buf?)?
.into_result::<FDomainMarker>("namespace")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<FDomainNamespaceRequest, FDomainNamespaceResult>(
(new_handle,),
0x5fa84dd6b11bbebb,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type CloseResponseFut = fidl::client::QueryResponseFut<
FDomainCloseResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#close(&self, mut handles: &[Hid]) -> Self::CloseResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<FDomainCloseResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x5ef8c24362964257,
>(_buf?)?
.into_result::<FDomainMarker>("close")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<FDomainCloseRequest, FDomainCloseResult>(
(handles,),
0x5ef8c24362964257,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type DuplicateResponseFut = fidl::client::QueryResponseFut<
FDomainDuplicateResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#duplicate(
&self,
mut handle: &Hid,
mut new_handle: &NewHid,
mut rights: fidl::Rights,
) -> Self::DuplicateResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<FDomainDuplicateResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x7a85b94bd1777ab9,
>(_buf?)?
.into_result::<FDomainMarker>("duplicate")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<FDomainDuplicateRequest, FDomainDuplicateResult>(
(handle, new_handle, rights),
0x7a85b94bd1777ab9,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type ReplaceResponseFut = fidl::client::QueryResponseFut<
FDomainReplaceResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#replace(
&self,
mut handle: &Hid,
mut new_handle: &NewHid,
mut rights: fidl::Rights,
) -> Self::ReplaceResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<FDomainReplaceResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x32fa64625a5bd3be,
>(_buf?)?
.into_result::<FDomainMarker>("replace")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<FDomainReplaceRequest, FDomainReplaceResult>(
(handle, new_handle, rights),
0x32fa64625a5bd3be,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type SignalResponseFut = fidl::client::QueryResponseFut<
FDomainSignalResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#signal(&self, mut handle: &Hid, mut set: u32, mut clear: u32) -> Self::SignalResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<FDomainSignalResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0xe8352fb978996d9,
>(_buf?)?
.into_result::<FDomainMarker>("signal")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<FDomainSignalRequest, FDomainSignalResult>(
(handle, set, clear),
0xe8352fb978996d9,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type SignalPeerResponseFut = fidl::client::QueryResponseFut<
FDomainSignalPeerResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#signal_peer(
&self,
mut handle: &Hid,
mut set: u32,
mut clear: u32,
) -> Self::SignalPeerResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<FDomainSignalPeerResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x7e84ec8ca7eabaf8,
>(_buf?)?
.into_result::<FDomainMarker>("signal_peer")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<FDomainSignalPeerRequest, FDomainSignalPeerResult>(
(handle, set, clear),
0x7e84ec8ca7eabaf8,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type WaitForSignalsResponseFut = fidl::client::QueryResponseFut<
FDomainWaitForSignalsResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#wait_for_signals(
&self,
mut handle: &Hid,
mut signals: u32,
) -> Self::WaitForSignalsResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<FDomainWaitForSignalsResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<FDomainWaitForSignalsResponse, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x8f72d9b4b85c1eb,
>(_buf?)?
.into_result::<FDomainMarker>("wait_for_signals")?;
Ok(_response.map(|x| x.signals))
}
self.client
.send_query_and_decode::<FDomainWaitForSignalsRequest, FDomainWaitForSignalsResult>(
(handle, signals),
0x8f72d9b4b85c1eb,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type AcknowledgeWriteErrorResponseFut = fidl::client::QueryResponseFut<
FDomainAcknowledgeWriteErrorResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#acknowledge_write_error(
&self,
mut handle: &Hid,
) -> Self::AcknowledgeWriteErrorResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<FDomainAcknowledgeWriteErrorResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x23abaefeb6517510,
>(_buf?)?
.into_result::<FDomainMarker>("acknowledge_write_error")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
FDomainAcknowledgeWriteErrorRequest,
FDomainAcknowledgeWriteErrorResult,
>(
(handle,),
0x23abaefeb6517510,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
}
pub struct FDomainEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for FDomainEventStream {}
impl futures::stream::FusedStream for FDomainEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for FDomainEventStream {
type Item = Result<FDomainEvent, 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(FDomainEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum FDomainEvent {
OnChannelStreamingData {
handle: Hid,
channel_sent: ChannelSent,
},
OnSocketStreamingData {
handle: Hid,
socket_message: SocketMessage,
},
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl FDomainEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_channel_streaming_data(self) -> Option<(Hid, ChannelSent)> {
if let FDomainEvent::OnChannelStreamingData { handle, channel_sent } = self {
Some((handle, channel_sent))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_socket_streaming_data(self) -> Option<(Hid, SocketMessage)> {
if let FDomainEvent::OnSocketStreamingData { handle, socket_message } = self {
Some((handle, socket_message))
} else {
None
}
}
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<FDomainEvent, 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 {
0x7d4431805202dfe1 => {
let mut out = fidl::new_empty!(
ChannelOnChannelStreamingDataRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelOnChannelStreamingDataRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((FDomainEvent::OnChannelStreamingData {
handle: out.handle,
channel_sent: out.channel_sent,
}))
}
0x998b5e66b3c80a2 => {
let mut out = fidl::new_empty!(
SocketOnSocketStreamingDataRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketOnSocketStreamingDataRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((FDomainEvent::OnSocketStreamingData {
handle: out.handle,
socket_message: out.socket_message,
}))
}
_ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(FDomainEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <FDomainMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct FDomainRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for FDomainRequestStream {}
impl futures::stream::FusedStream for FDomainRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for FDomainRequestStream {
type Protocol = FDomainMarker;
type ControlHandle = FDomainControlHandle;
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 {
FDomainControlHandle { 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 FDomainRequestStream {
type Item = Result<FDomainRequest, 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 FDomainRequestStream 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 {
0x182d38bfe88673b5 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ChannelCreateChannelRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelCreateChannelRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = FDomainControlHandle { inner: this.inner.clone() };
Ok(FDomainRequest::CreateChannel {
handles: req.handles,
responder: FDomainCreateChannelResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6ef47bf27bf7d050 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ChannelReadChannelRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelReadChannelRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = FDomainControlHandle { inner: this.inner.clone() };
Ok(FDomainRequest::ReadChannel {
handle: req.handle,
responder: FDomainReadChannelResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x75a2559b945d5eb5 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ChannelWriteChannelRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelWriteChannelRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = FDomainControlHandle { inner: this.inner.clone() };
Ok(FDomainRequest::WriteChannel {
handle: req.handle,
data: req.data,
handles: req.handles,
responder: FDomainWriteChannelResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3c73e85476a203df => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ChannelReadChannelStreamingStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelReadChannelStreamingStartRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = FDomainControlHandle { inner: this.inner.clone() };
Ok(FDomainRequest::ReadChannelStreamingStart {
handle: req.handle,
responder: FDomainReadChannelStreamingStartResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x56f21d6ed68186e0 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ChannelReadChannelStreamingStopRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelReadChannelStreamingStopRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = FDomainControlHandle { inner: this.inner.clone() };
Ok(FDomainRequest::ReadChannelStreamingStop {
handle: req.handle,
responder: FDomainReadChannelStreamingStopResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x7b05b3f262635987 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
EventCreateEventRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EventCreateEventRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = FDomainControlHandle { inner: this.inner.clone() };
Ok(FDomainRequest::CreateEvent {
handle: req.handle,
responder: FDomainCreateEventResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x7aef61effa65656d => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
EventPairCreateEventPairRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EventPairCreateEventPairRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = FDomainControlHandle { inner: this.inner.clone() };
Ok(FDomainRequest::CreateEventPair {
handles: req.handles,
responder: FDomainCreateEventPairResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x200bf0ea21932de0 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
SocketCreateSocketRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketCreateSocketRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = FDomainControlHandle { inner: this.inner.clone() };
Ok(FDomainRequest::CreateSocket {
options: req.options,
handles: req.handles,
responder: FDomainCreateSocketResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x60d3c7ccb17f9bdf => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
SocketSetSocketDispositionRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketSetSocketDispositionRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = FDomainControlHandle { inner: this.inner.clone() };
Ok(FDomainRequest::SetSocketDisposition {
handle: req.handle,
disposition: req.disposition,
disposition_peer: req.disposition_peer,
responder: FDomainSetSocketDispositionResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x1da8aabec249c02e => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
SocketReadSocketRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketReadSocketRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = FDomainControlHandle { inner: this.inner.clone() };
Ok(FDomainRequest::ReadSocket {
handle: req.handle,
max_bytes: req.max_bytes,
responder: FDomainReadSocketResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x5b541623cbbbf683 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
SocketWriteSocketRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketWriteSocketRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = FDomainControlHandle { inner: this.inner.clone() };
Ok(FDomainRequest::WriteSocket {
handle: req.handle,
data: req.data,
responder: FDomainWriteSocketResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2a592748d5f33445 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
SocketReadSocketStreamingStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketReadSocketStreamingStartRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = FDomainControlHandle { inner: this.inner.clone() };
Ok(FDomainRequest::ReadSocketStreamingStart {
handle: req.handle,
responder: FDomainReadSocketStreamingStartResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x53e5cade5f4d22e7 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
SocketReadSocketStreamingStopRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketReadSocketStreamingStopRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = FDomainControlHandle { inner: this.inner.clone() };
Ok(FDomainRequest::ReadSocketStreamingStop {
handle: req.handle,
responder: FDomainReadSocketStreamingStopResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x5fa84dd6b11bbebb => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
FDomainNamespaceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FDomainNamespaceRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = FDomainControlHandle { inner: this.inner.clone() };
Ok(FDomainRequest::Namespace {
new_handle: req.new_handle,
responder: FDomainNamespaceResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x5ef8c24362964257 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
FDomainCloseRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FDomainCloseRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = FDomainControlHandle { inner: this.inner.clone() };
Ok(FDomainRequest::Close {
handles: req.handles,
responder: FDomainCloseResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x7a85b94bd1777ab9 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
FDomainDuplicateRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FDomainDuplicateRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = FDomainControlHandle { inner: this.inner.clone() };
Ok(FDomainRequest::Duplicate {
handle: req.handle,
new_handle: req.new_handle,
rights: req.rights,
responder: FDomainDuplicateResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x32fa64625a5bd3be => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
FDomainReplaceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FDomainReplaceRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = FDomainControlHandle { inner: this.inner.clone() };
Ok(FDomainRequest::Replace {
handle: req.handle,
new_handle: req.new_handle,
rights: req.rights,
responder: FDomainReplaceResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0xe8352fb978996d9 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
FDomainSignalRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FDomainSignalRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = FDomainControlHandle { inner: this.inner.clone() };
Ok(FDomainRequest::Signal {
handle: req.handle,
set: req.set,
clear: req.clear,
responder: FDomainSignalResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x7e84ec8ca7eabaf8 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
FDomainSignalPeerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FDomainSignalPeerRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = FDomainControlHandle { inner: this.inner.clone() };
Ok(FDomainRequest::SignalPeer {
handle: req.handle,
set: req.set,
clear: req.clear,
responder: FDomainSignalPeerResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x8f72d9b4b85c1eb => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
FDomainWaitForSignalsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FDomainWaitForSignalsRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = FDomainControlHandle { inner: this.inner.clone() };
Ok(FDomainRequest::WaitForSignals {
handle: req.handle,
signals: req.signals,
responder: FDomainWaitForSignalsResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x23abaefeb6517510 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
FDomainAcknowledgeWriteErrorRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FDomainAcknowledgeWriteErrorRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = FDomainControlHandle { inner: this.inner.clone() };
Ok(FDomainRequest::AcknowledgeWriteError {
handle: req.handle,
responder: FDomainAcknowledgeWriteErrorResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ if header.tx_id == 0
&& header
.dynamic_flags()
.contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
Ok(FDomainRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: FDomainControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::OneWay,
})
}
_ if header
.dynamic_flags()
.contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
this.inner.send_framework_err(
fidl::encoding::FrameworkErr::UnknownMethod,
header.tx_id,
header.ordinal,
header.dynamic_flags(),
(bytes, handles),
)?;
Ok(FDomainRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: FDomainControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<FDomainMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum FDomainRequest {
CreateChannel {
handles: [NewHid; 2],
responder: FDomainCreateChannelResponder,
},
ReadChannel {
handle: Hid,
responder: FDomainReadChannelResponder,
},
WriteChannel {
handle: Hid,
data: Vec<u8>,
handles: Handles,
responder: FDomainWriteChannelResponder,
},
ReadChannelStreamingStart {
handle: Hid,
responder: FDomainReadChannelStreamingStartResponder,
},
ReadChannelStreamingStop {
handle: Hid,
responder: FDomainReadChannelStreamingStopResponder,
},
CreateEvent {
handle: NewHid,
responder: FDomainCreateEventResponder,
},
CreateEventPair {
handles: [NewHid; 2],
responder: FDomainCreateEventPairResponder,
},
CreateSocket {
options: SocketType,
handles: [NewHid; 2],
responder: FDomainCreateSocketResponder,
},
SetSocketDisposition {
handle: Hid,
disposition: SocketDisposition,
disposition_peer: SocketDisposition,
responder: FDomainSetSocketDispositionResponder,
},
ReadSocket {
handle: Hid,
max_bytes: u64,
responder: FDomainReadSocketResponder,
},
WriteSocket {
handle: Hid,
data: Vec<u8>,
responder: FDomainWriteSocketResponder,
},
ReadSocketStreamingStart {
handle: Hid,
responder: FDomainReadSocketStreamingStartResponder,
},
ReadSocketStreamingStop {
handle: Hid,
responder: FDomainReadSocketStreamingStopResponder,
},
Namespace {
new_handle: NewHid,
responder: FDomainNamespaceResponder,
},
Close {
handles: Vec<Hid>,
responder: FDomainCloseResponder,
},
Duplicate {
handle: Hid,
new_handle: NewHid,
rights: fidl::Rights,
responder: FDomainDuplicateResponder,
},
Replace {
handle: Hid,
new_handle: NewHid,
rights: fidl::Rights,
responder: FDomainReplaceResponder,
},
Signal {
handle: Hid,
set: u32,
clear: u32,
responder: FDomainSignalResponder,
},
SignalPeer {
handle: Hid,
set: u32,
clear: u32,
responder: FDomainSignalPeerResponder,
},
WaitForSignals {
handle: Hid,
signals: u32,
responder: FDomainWaitForSignalsResponder,
},
AcknowledgeWriteError {
handle: Hid,
responder: FDomainAcknowledgeWriteErrorResponder,
},
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: FDomainControlHandle,
method_type: fidl::MethodType,
},
}
impl FDomainRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_create_channel(self) -> Option<([NewHid; 2], FDomainCreateChannelResponder)> {
if let FDomainRequest::CreateChannel { handles, responder } = self {
Some((handles, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_read_channel(self) -> Option<(Hid, FDomainReadChannelResponder)> {
if let FDomainRequest::ReadChannel { handle, responder } = self {
Some((handle, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_write_channel(
self,
) -> Option<(Hid, Vec<u8>, Handles, FDomainWriteChannelResponder)> {
if let FDomainRequest::WriteChannel { handle, data, handles, responder } = self {
Some((handle, data, handles, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_read_channel_streaming_start(
self,
) -> Option<(Hid, FDomainReadChannelStreamingStartResponder)> {
if let FDomainRequest::ReadChannelStreamingStart { handle, responder } = self {
Some((handle, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_read_channel_streaming_stop(
self,
) -> Option<(Hid, FDomainReadChannelStreamingStopResponder)> {
if let FDomainRequest::ReadChannelStreamingStop { handle, responder } = self {
Some((handle, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_create_event(self) -> Option<(NewHid, FDomainCreateEventResponder)> {
if let FDomainRequest::CreateEvent { handle, responder } = self {
Some((handle, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_create_event_pair(self) -> Option<([NewHid; 2], FDomainCreateEventPairResponder)> {
if let FDomainRequest::CreateEventPair { handles, responder } = self {
Some((handles, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_create_socket(
self,
) -> Option<(SocketType, [NewHid; 2], FDomainCreateSocketResponder)> {
if let FDomainRequest::CreateSocket { options, handles, responder } = self {
Some((options, handles, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_socket_disposition(
self,
) -> Option<(Hid, SocketDisposition, SocketDisposition, FDomainSetSocketDispositionResponder)>
{
if let FDomainRequest::SetSocketDisposition {
handle,
disposition,
disposition_peer,
responder,
} = self
{
Some((handle, disposition, disposition_peer, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_read_socket(self) -> Option<(Hid, u64, FDomainReadSocketResponder)> {
if let FDomainRequest::ReadSocket { handle, max_bytes, responder } = self {
Some((handle, max_bytes, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_write_socket(self) -> Option<(Hid, Vec<u8>, FDomainWriteSocketResponder)> {
if let FDomainRequest::WriteSocket { handle, data, responder } = self {
Some((handle, data, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_read_socket_streaming_start(
self,
) -> Option<(Hid, FDomainReadSocketStreamingStartResponder)> {
if let FDomainRequest::ReadSocketStreamingStart { handle, responder } = self {
Some((handle, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_read_socket_streaming_stop(
self,
) -> Option<(Hid, FDomainReadSocketStreamingStopResponder)> {
if let FDomainRequest::ReadSocketStreamingStop { handle, responder } = self {
Some((handle, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_namespace(self) -> Option<(NewHid, FDomainNamespaceResponder)> {
if let FDomainRequest::Namespace { new_handle, responder } = self {
Some((new_handle, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_close(self) -> Option<(Vec<Hid>, FDomainCloseResponder)> {
if let FDomainRequest::Close { handles, responder } = self {
Some((handles, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_duplicate(self) -> Option<(Hid, NewHid, fidl::Rights, FDomainDuplicateResponder)> {
if let FDomainRequest::Duplicate { handle, new_handle, rights, responder } = self {
Some((handle, new_handle, rights, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_replace(self) -> Option<(Hid, NewHid, fidl::Rights, FDomainReplaceResponder)> {
if let FDomainRequest::Replace { handle, new_handle, rights, responder } = self {
Some((handle, new_handle, rights, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_signal(self) -> Option<(Hid, u32, u32, FDomainSignalResponder)> {
if let FDomainRequest::Signal { handle, set, clear, responder } = self {
Some((handle, set, clear, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_signal_peer(self) -> Option<(Hid, u32, u32, FDomainSignalPeerResponder)> {
if let FDomainRequest::SignalPeer { handle, set, clear, responder } = self {
Some((handle, set, clear, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_wait_for_signals(self) -> Option<(Hid, u32, FDomainWaitForSignalsResponder)> {
if let FDomainRequest::WaitForSignals { handle, signals, responder } = self {
Some((handle, signals, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_acknowledge_write_error(
self,
) -> Option<(Hid, FDomainAcknowledgeWriteErrorResponder)> {
if let FDomainRequest::AcknowledgeWriteError { handle, responder } = self {
Some((handle, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
FDomainRequest::CreateChannel { .. } => "create_channel",
FDomainRequest::ReadChannel { .. } => "read_channel",
FDomainRequest::WriteChannel { .. } => "write_channel",
FDomainRequest::ReadChannelStreamingStart { .. } => "read_channel_streaming_start",
FDomainRequest::ReadChannelStreamingStop { .. } => "read_channel_streaming_stop",
FDomainRequest::CreateEvent { .. } => "create_event",
FDomainRequest::CreateEventPair { .. } => "create_event_pair",
FDomainRequest::CreateSocket { .. } => "create_socket",
FDomainRequest::SetSocketDisposition { .. } => "set_socket_disposition",
FDomainRequest::ReadSocket { .. } => "read_socket",
FDomainRequest::WriteSocket { .. } => "write_socket",
FDomainRequest::ReadSocketStreamingStart { .. } => "read_socket_streaming_start",
FDomainRequest::ReadSocketStreamingStop { .. } => "read_socket_streaming_stop",
FDomainRequest::Namespace { .. } => "namespace",
FDomainRequest::Close { .. } => "close",
FDomainRequest::Duplicate { .. } => "duplicate",
FDomainRequest::Replace { .. } => "replace",
FDomainRequest::Signal { .. } => "signal",
FDomainRequest::SignalPeer { .. } => "signal_peer",
FDomainRequest::WaitForSignals { .. } => "wait_for_signals",
FDomainRequest::AcknowledgeWriteError { .. } => "acknowledge_write_error",
FDomainRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
"unknown one-way method"
}
FDomainRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
"unknown two-way method"
}
}
}
}
#[derive(Debug, Clone)]
pub struct FDomainControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for FDomainControlHandle {
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 FDomainControlHandle {
pub fn send_on_channel_streaming_data(
&self,
mut handle: &Hid,
mut channel_sent: &ChannelSent,
) -> Result<(), fidl::Error> {
self.inner.send::<ChannelOnChannelStreamingDataRequest>(
(handle, channel_sent),
0,
0x7d4431805202dfe1,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
pub fn send_on_socket_streaming_data(
&self,
mut handle: &Hid,
mut socket_message: &SocketMessage,
) -> Result<(), fidl::Error> {
self.inner.send::<SocketOnSocketStreamingDataRequest>(
(handle, socket_message),
0,
0x998b5e66b3c80a2,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FDomainCreateChannelResponder {
control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FDomainCreateChannelResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FDomainCreateChannelResponder {
type ControlHandle = FDomainControlHandle;
fn control_handle(&self) -> &FDomainControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FDomainCreateChannelResponder {
pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), &Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
Error,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x182d38bfe88673b5,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FDomainReadChannelResponder {
control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FDomainReadChannelResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FDomainReadChannelResponder {
type ControlHandle = FDomainControlHandle;
fn control_handle(&self) -> &FDomainControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FDomainReadChannelResponder {
pub fn send(
self,
mut result: Result<(&[u8], &[HandleInfo]), &Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(&[u8], &[HandleInfo]), &Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<(&[u8], &[HandleInfo]), &Error>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<ChannelMessage, Error>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x6ef47bf27bf7d050,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FDomainWriteChannelResponder {
control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FDomainWriteChannelResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FDomainWriteChannelResponder {
type ControlHandle = FDomainControlHandle;
fn control_handle(&self) -> &FDomainControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FDomainWriteChannelResponder {
pub fn send(self, mut result: Result<(), &WriteChannelError>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), &WriteChannelError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), &WriteChannelError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
WriteChannelError,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x75a2559b945d5eb5,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FDomainReadChannelStreamingStartResponder {
control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FDomainReadChannelStreamingStartResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FDomainReadChannelStreamingStartResponder {
type ControlHandle = FDomainControlHandle;
fn control_handle(&self) -> &FDomainControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FDomainReadChannelStreamingStartResponder {
pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), &Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
Error,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x3c73e85476a203df,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FDomainReadChannelStreamingStopResponder {
control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FDomainReadChannelStreamingStopResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FDomainReadChannelStreamingStopResponder {
type ControlHandle = FDomainControlHandle;
fn control_handle(&self) -> &FDomainControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FDomainReadChannelStreamingStopResponder {
pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), &Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
Error,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x56f21d6ed68186e0,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FDomainCreateEventResponder {
control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FDomainCreateEventResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FDomainCreateEventResponder {
type ControlHandle = FDomainControlHandle;
fn control_handle(&self) -> &FDomainControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FDomainCreateEventResponder {
pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), &Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
Error,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x7b05b3f262635987,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FDomainCreateEventPairResponder {
control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FDomainCreateEventPairResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FDomainCreateEventPairResponder {
type ControlHandle = FDomainControlHandle;
fn control_handle(&self) -> &FDomainControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FDomainCreateEventPairResponder {
pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), &Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
Error,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x7aef61effa65656d,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FDomainCreateSocketResponder {
control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FDomainCreateSocketResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FDomainCreateSocketResponder {
type ControlHandle = FDomainControlHandle;
fn control_handle(&self) -> &FDomainControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FDomainCreateSocketResponder {
pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), &Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
Error,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x200bf0ea21932de0,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FDomainSetSocketDispositionResponder {
control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FDomainSetSocketDispositionResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FDomainSetSocketDispositionResponder {
type ControlHandle = FDomainControlHandle;
fn control_handle(&self) -> &FDomainControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FDomainSetSocketDispositionResponder {
pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), &Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
Error,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x60d3c7ccb17f9bdf,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FDomainReadSocketResponder {
control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FDomainReadSocketResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FDomainReadSocketResponder {
type ControlHandle = FDomainControlHandle;
fn control_handle(&self) -> &FDomainControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FDomainReadSocketResponder {
pub fn send(self, mut result: Result<&[u8], &Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<&[u8], &Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<&[u8], &Error>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::FlexibleResultType<SocketReadSocketResponse, Error>>(
fidl::encoding::FlexibleResult::new(result.map(|data| (data,))),
self.tx_id,
0x1da8aabec249c02e,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FDomainWriteSocketResponder {
control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FDomainWriteSocketResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FDomainWriteSocketResponder {
type ControlHandle = FDomainControlHandle;
fn control_handle(&self) -> &FDomainControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FDomainWriteSocketResponder {
pub fn send(self, mut result: Result<u64, &WriteSocketError>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<u64, &WriteSocketError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<u64, &WriteSocketError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
SocketWriteSocketResponse,
WriteSocketError,
>>(
fidl::encoding::FlexibleResult::new(result.map(|wrote| (wrote,))),
self.tx_id,
0x5b541623cbbbf683,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FDomainReadSocketStreamingStartResponder {
control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FDomainReadSocketStreamingStartResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FDomainReadSocketStreamingStartResponder {
type ControlHandle = FDomainControlHandle;
fn control_handle(&self) -> &FDomainControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FDomainReadSocketStreamingStartResponder {
pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), &Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
Error,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x2a592748d5f33445,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FDomainReadSocketStreamingStopResponder {
control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FDomainReadSocketStreamingStopResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FDomainReadSocketStreamingStopResponder {
type ControlHandle = FDomainControlHandle;
fn control_handle(&self) -> &FDomainControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FDomainReadSocketStreamingStopResponder {
pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), &Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
Error,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x53e5cade5f4d22e7,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FDomainNamespaceResponder {
control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FDomainNamespaceResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FDomainNamespaceResponder {
type ControlHandle = FDomainControlHandle;
fn control_handle(&self) -> &FDomainControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FDomainNamespaceResponder {
pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), &Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
Error,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x5fa84dd6b11bbebb,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FDomainCloseResponder {
control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FDomainCloseResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FDomainCloseResponder {
type ControlHandle = FDomainControlHandle;
fn control_handle(&self) -> &FDomainControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FDomainCloseResponder {
pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), &Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
Error,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x5ef8c24362964257,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FDomainDuplicateResponder {
control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FDomainDuplicateResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FDomainDuplicateResponder {
type ControlHandle = FDomainControlHandle;
fn control_handle(&self) -> &FDomainControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FDomainDuplicateResponder {
pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), &Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
Error,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x7a85b94bd1777ab9,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FDomainReplaceResponder {
control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FDomainReplaceResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FDomainReplaceResponder {
type ControlHandle = FDomainControlHandle;
fn control_handle(&self) -> &FDomainControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FDomainReplaceResponder {
pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), &Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
Error,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x32fa64625a5bd3be,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FDomainSignalResponder {
control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FDomainSignalResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FDomainSignalResponder {
type ControlHandle = FDomainControlHandle;
fn control_handle(&self) -> &FDomainControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FDomainSignalResponder {
pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), &Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
Error,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0xe8352fb978996d9,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FDomainSignalPeerResponder {
control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FDomainSignalPeerResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FDomainSignalPeerResponder {
type ControlHandle = FDomainControlHandle;
fn control_handle(&self) -> &FDomainControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FDomainSignalPeerResponder {
pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), &Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
Error,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x7e84ec8ca7eabaf8,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FDomainWaitForSignalsResponder {
control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FDomainWaitForSignalsResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FDomainWaitForSignalsResponder {
type ControlHandle = FDomainControlHandle;
fn control_handle(&self) -> &FDomainControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FDomainWaitForSignalsResponder {
pub fn send(self, mut result: Result<u32, &Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<u32, &Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<u32, &Error>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
FDomainWaitForSignalsResponse,
Error,
>>(
fidl::encoding::FlexibleResult::new(result.map(|signals| (signals,))),
self.tx_id,
0x8f72d9b4b85c1eb,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FDomainAcknowledgeWriteErrorResponder {
control_handle: std::mem::ManuallyDrop<FDomainControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FDomainAcknowledgeWriteErrorResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FDomainAcknowledgeWriteErrorResponder {
type ControlHandle = FDomainControlHandle;
fn control_handle(&self) -> &FDomainControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FDomainAcknowledgeWriteErrorResponder {
pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), &Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
Error,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x23abaefeb6517510,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct SocketMarker;
impl fidl::endpoints::ProtocolMarker for SocketMarker {
type Proxy = SocketProxy;
type RequestStream = SocketRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = SocketSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Socket";
}
pub type SocketCreateSocketResult = Result<(), Error>;
pub type SocketSetSocketDispositionResult = Result<(), Error>;
pub type SocketReadSocketResult = Result<Vec<u8>, Error>;
pub type SocketWriteSocketResult = Result<u64, WriteSocketError>;
pub type SocketReadSocketStreamingStartResult = Result<(), Error>;
pub type SocketReadSocketStreamingStopResult = Result<(), Error>;
pub trait SocketProxyInterface: Send + Sync {
type CreateSocketResponseFut: std::future::Future<Output = Result<SocketCreateSocketResult, fidl::Error>>
+ Send;
fn r#create_socket(
&self,
options: SocketType,
handles: &[NewHid; 2],
) -> Self::CreateSocketResponseFut;
type SetSocketDispositionResponseFut: std::future::Future<Output = Result<SocketSetSocketDispositionResult, fidl::Error>>
+ Send;
fn r#set_socket_disposition(
&self,
handle: &Hid,
disposition: SocketDisposition,
disposition_peer: SocketDisposition,
) -> Self::SetSocketDispositionResponseFut;
type ReadSocketResponseFut: std::future::Future<Output = Result<SocketReadSocketResult, fidl::Error>>
+ Send;
fn r#read_socket(&self, handle: &Hid, max_bytes: u64) -> Self::ReadSocketResponseFut;
type WriteSocketResponseFut: std::future::Future<Output = Result<SocketWriteSocketResult, fidl::Error>>
+ Send;
fn r#write_socket(&self, handle: &Hid, data: &[u8]) -> Self::WriteSocketResponseFut;
type ReadSocketStreamingStartResponseFut: std::future::Future<Output = Result<SocketReadSocketStreamingStartResult, fidl::Error>>
+ Send;
fn r#read_socket_streaming_start(
&self,
handle: &Hid,
) -> Self::ReadSocketStreamingStartResponseFut;
type ReadSocketStreamingStopResponseFut: std::future::Future<Output = Result<SocketReadSocketStreamingStopResult, fidl::Error>>
+ Send;
fn r#read_socket_streaming_stop(
&self,
handle: &Hid,
) -> Self::ReadSocketStreamingStopResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct SocketSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for SocketSynchronousProxy {
type Proxy = SocketProxy;
type Protocol = SocketMarker;
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 SocketSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <SocketMarker 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<SocketEvent, fidl::Error> {
SocketEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#create_socket(
&self,
mut options: SocketType,
mut handles: &[NewHid; 2],
___deadline: zx::MonotonicInstant,
) -> Result<SocketCreateSocketResult, fidl::Error> {
let _response = self.client.send_query::<
SocketCreateSocketRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
>(
(options, handles,),
0x200bf0ea21932de0,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<SocketMarker>("create_socket")?;
Ok(_response.map(|x| x))
}
pub fn r#set_socket_disposition(
&self,
mut handle: &Hid,
mut disposition: SocketDisposition,
mut disposition_peer: SocketDisposition,
___deadline: zx::MonotonicInstant,
) -> Result<SocketSetSocketDispositionResult, fidl::Error> {
let _response = self.client.send_query::<
SocketSetSocketDispositionRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
>(
(handle, disposition, disposition_peer,),
0x60d3c7ccb17f9bdf,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<SocketMarker>("set_socket_disposition")?;
Ok(_response.map(|x| x))
}
pub fn r#read_socket(
&self,
mut handle: &Hid,
mut max_bytes: u64,
___deadline: zx::MonotonicInstant,
) -> Result<SocketReadSocketResult, fidl::Error> {
let _response = self.client.send_query::<
SocketReadSocketRequest,
fidl::encoding::FlexibleResultType<SocketReadSocketResponse, Error>,
>(
(handle, max_bytes,),
0x1da8aabec249c02e,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<SocketMarker>("read_socket")?;
Ok(_response.map(|x| x.data))
}
pub fn r#write_socket(
&self,
mut handle: &Hid,
mut data: &[u8],
___deadline: zx::MonotonicInstant,
) -> Result<SocketWriteSocketResult, fidl::Error> {
let _response = self.client.send_query::<
SocketWriteSocketRequest,
fidl::encoding::FlexibleResultType<SocketWriteSocketResponse, WriteSocketError>,
>(
(handle, data,),
0x5b541623cbbbf683,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<SocketMarker>("write_socket")?;
Ok(_response.map(|x| x.wrote))
}
pub fn r#read_socket_streaming_start(
&self,
mut handle: &Hid,
___deadline: zx::MonotonicInstant,
) -> Result<SocketReadSocketStreamingStartResult, fidl::Error> {
let _response = self.client.send_query::<
SocketReadSocketStreamingStartRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
>(
(handle,),
0x2a592748d5f33445,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<SocketMarker>("read_socket_streaming_start")?;
Ok(_response.map(|x| x))
}
pub fn r#read_socket_streaming_stop(
&self,
mut handle: &Hid,
___deadline: zx::MonotonicInstant,
) -> Result<SocketReadSocketStreamingStopResult, fidl::Error> {
let _response = self.client.send_query::<
SocketReadSocketStreamingStopRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
>(
(handle,),
0x53e5cade5f4d22e7,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<SocketMarker>("read_socket_streaming_stop")?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct SocketProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for SocketProxy {
type Protocol = SocketMarker;
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 SocketProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <SocketMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> SocketEventStream {
SocketEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#create_socket(
&self,
mut options: SocketType,
mut handles: &[NewHid; 2],
) -> fidl::client::QueryResponseFut<
SocketCreateSocketResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
SocketProxyInterface::r#create_socket(self, options, handles)
}
pub fn r#set_socket_disposition(
&self,
mut handle: &Hid,
mut disposition: SocketDisposition,
mut disposition_peer: SocketDisposition,
) -> fidl::client::QueryResponseFut<
SocketSetSocketDispositionResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
SocketProxyInterface::r#set_socket_disposition(self, handle, disposition, disposition_peer)
}
pub fn r#read_socket(
&self,
mut handle: &Hid,
mut max_bytes: u64,
) -> fidl::client::QueryResponseFut<
SocketReadSocketResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
SocketProxyInterface::r#read_socket(self, handle, max_bytes)
}
pub fn r#write_socket(
&self,
mut handle: &Hid,
mut data: &[u8],
) -> fidl::client::QueryResponseFut<
SocketWriteSocketResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
SocketProxyInterface::r#write_socket(self, handle, data)
}
pub fn r#read_socket_streaming_start(
&self,
mut handle: &Hid,
) -> fidl::client::QueryResponseFut<
SocketReadSocketStreamingStartResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
SocketProxyInterface::r#read_socket_streaming_start(self, handle)
}
pub fn r#read_socket_streaming_stop(
&self,
mut handle: &Hid,
) -> fidl::client::QueryResponseFut<
SocketReadSocketStreamingStopResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
SocketProxyInterface::r#read_socket_streaming_stop(self, handle)
}
}
impl SocketProxyInterface for SocketProxy {
type CreateSocketResponseFut = fidl::client::QueryResponseFut<
SocketCreateSocketResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#create_socket(
&self,
mut options: SocketType,
mut handles: &[NewHid; 2],
) -> Self::CreateSocketResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<SocketCreateSocketResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x200bf0ea21932de0,
>(_buf?)?
.into_result::<SocketMarker>("create_socket")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<SocketCreateSocketRequest, SocketCreateSocketResult>(
(options, handles),
0x200bf0ea21932de0,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type SetSocketDispositionResponseFut = fidl::client::QueryResponseFut<
SocketSetSocketDispositionResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#set_socket_disposition(
&self,
mut handle: &Hid,
mut disposition: SocketDisposition,
mut disposition_peer: SocketDisposition,
) -> Self::SetSocketDispositionResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<SocketSetSocketDispositionResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x60d3c7ccb17f9bdf,
>(_buf?)?
.into_result::<SocketMarker>("set_socket_disposition")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
SocketSetSocketDispositionRequest,
SocketSetSocketDispositionResult,
>(
(handle, disposition, disposition_peer,),
0x60d3c7ccb17f9bdf,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type ReadSocketResponseFut = fidl::client::QueryResponseFut<
SocketReadSocketResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#read_socket(&self, mut handle: &Hid, mut max_bytes: u64) -> Self::ReadSocketResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<SocketReadSocketResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<SocketReadSocketResponse, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x1da8aabec249c02e,
>(_buf?)?
.into_result::<SocketMarker>("read_socket")?;
Ok(_response.map(|x| x.data))
}
self.client.send_query_and_decode::<SocketReadSocketRequest, SocketReadSocketResult>(
(handle, max_bytes),
0x1da8aabec249c02e,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type WriteSocketResponseFut = fidl::client::QueryResponseFut<
SocketWriteSocketResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#write_socket(&self, mut handle: &Hid, mut data: &[u8]) -> Self::WriteSocketResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<SocketWriteSocketResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<SocketWriteSocketResponse, WriteSocketError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x5b541623cbbbf683,
>(_buf?)?
.into_result::<SocketMarker>("write_socket")?;
Ok(_response.map(|x| x.wrote))
}
self.client.send_query_and_decode::<SocketWriteSocketRequest, SocketWriteSocketResult>(
(handle, data),
0x5b541623cbbbf683,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type ReadSocketStreamingStartResponseFut = fidl::client::QueryResponseFut<
SocketReadSocketStreamingStartResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#read_socket_streaming_start(
&self,
mut handle: &Hid,
) -> Self::ReadSocketStreamingStartResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<SocketReadSocketStreamingStartResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2a592748d5f33445,
>(_buf?)?
.into_result::<SocketMarker>("read_socket_streaming_start")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
SocketReadSocketStreamingStartRequest,
SocketReadSocketStreamingStartResult,
>(
(handle,),
0x2a592748d5f33445,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type ReadSocketStreamingStopResponseFut = fidl::client::QueryResponseFut<
SocketReadSocketStreamingStopResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#read_socket_streaming_stop(
&self,
mut handle: &Hid,
) -> Self::ReadSocketStreamingStopResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<SocketReadSocketStreamingStopResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x53e5cade5f4d22e7,
>(_buf?)?
.into_result::<SocketMarker>("read_socket_streaming_stop")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
SocketReadSocketStreamingStopRequest,
SocketReadSocketStreamingStopResult,
>(
(handle,),
0x53e5cade5f4d22e7,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
}
pub struct SocketEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for SocketEventStream {}
impl futures::stream::FusedStream for SocketEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for SocketEventStream {
type Item = Result<SocketEvent, 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(SocketEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum SocketEvent {
OnSocketStreamingData {
handle: Hid,
socket_message: SocketMessage,
},
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl SocketEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_socket_streaming_data(self) -> Option<(Hid, SocketMessage)> {
if let SocketEvent::OnSocketStreamingData { handle, socket_message } = self {
Some((handle, socket_message))
} else {
None
}
}
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<SocketEvent, 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 {
0x998b5e66b3c80a2 => {
let mut out = fidl::new_empty!(
SocketOnSocketStreamingDataRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketOnSocketStreamingDataRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((SocketEvent::OnSocketStreamingData {
handle: out.handle,
socket_message: out.socket_message,
}))
}
_ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(SocketEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <SocketMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct SocketRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for SocketRequestStream {}
impl futures::stream::FusedStream for SocketRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for SocketRequestStream {
type Protocol = SocketMarker;
type ControlHandle = SocketControlHandle;
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 {
SocketControlHandle { 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 SocketRequestStream {
type Item = Result<SocketRequest, 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 SocketRequestStream 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 {
0x200bf0ea21932de0 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
SocketCreateSocketRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketCreateSocketRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = SocketControlHandle { inner: this.inner.clone() };
Ok(SocketRequest::CreateSocket {
options: req.options,
handles: req.handles,
responder: SocketCreateSocketResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x60d3c7ccb17f9bdf => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
SocketSetSocketDispositionRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketSetSocketDispositionRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = SocketControlHandle { inner: this.inner.clone() };
Ok(SocketRequest::SetSocketDisposition {
handle: req.handle,
disposition: req.disposition,
disposition_peer: req.disposition_peer,
responder: SocketSetSocketDispositionResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x1da8aabec249c02e => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
SocketReadSocketRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketReadSocketRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = SocketControlHandle { inner: this.inner.clone() };
Ok(SocketRequest::ReadSocket {
handle: req.handle,
max_bytes: req.max_bytes,
responder: SocketReadSocketResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x5b541623cbbbf683 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
SocketWriteSocketRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketWriteSocketRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = SocketControlHandle { inner: this.inner.clone() };
Ok(SocketRequest::WriteSocket {
handle: req.handle,
data: req.data,
responder: SocketWriteSocketResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2a592748d5f33445 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
SocketReadSocketStreamingStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketReadSocketStreamingStartRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = SocketControlHandle { inner: this.inner.clone() };
Ok(SocketRequest::ReadSocketStreamingStart {
handle: req.handle,
responder: SocketReadSocketStreamingStartResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x53e5cade5f4d22e7 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
SocketReadSocketStreamingStopRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketReadSocketStreamingStopRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = SocketControlHandle { inner: this.inner.clone() };
Ok(SocketRequest::ReadSocketStreamingStop {
handle: req.handle,
responder: SocketReadSocketStreamingStopResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ if header.tx_id == 0
&& header
.dynamic_flags()
.contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
Ok(SocketRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: SocketControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::OneWay,
})
}
_ if header
.dynamic_flags()
.contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
this.inner.send_framework_err(
fidl::encoding::FrameworkErr::UnknownMethod,
header.tx_id,
header.ordinal,
header.dynamic_flags(),
(bytes, handles),
)?;
Ok(SocketRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: SocketControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<SocketMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum SocketRequest {
CreateSocket {
options: SocketType,
handles: [NewHid; 2],
responder: SocketCreateSocketResponder,
},
SetSocketDisposition {
handle: Hid,
disposition: SocketDisposition,
disposition_peer: SocketDisposition,
responder: SocketSetSocketDispositionResponder,
},
ReadSocket {
handle: Hid,
max_bytes: u64,
responder: SocketReadSocketResponder,
},
WriteSocket {
handle: Hid,
data: Vec<u8>,
responder: SocketWriteSocketResponder,
},
ReadSocketStreamingStart {
handle: Hid,
responder: SocketReadSocketStreamingStartResponder,
},
ReadSocketStreamingStop {
handle: Hid,
responder: SocketReadSocketStreamingStopResponder,
},
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: SocketControlHandle,
method_type: fidl::MethodType,
},
}
impl SocketRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_create_socket(
self,
) -> Option<(SocketType, [NewHid; 2], SocketCreateSocketResponder)> {
if let SocketRequest::CreateSocket { options, handles, responder } = self {
Some((options, handles, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_socket_disposition(
self,
) -> Option<(Hid, SocketDisposition, SocketDisposition, SocketSetSocketDispositionResponder)>
{
if let SocketRequest::SetSocketDisposition {
handle,
disposition,
disposition_peer,
responder,
} = self
{
Some((handle, disposition, disposition_peer, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_read_socket(self) -> Option<(Hid, u64, SocketReadSocketResponder)> {
if let SocketRequest::ReadSocket { handle, max_bytes, responder } = self {
Some((handle, max_bytes, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_write_socket(self) -> Option<(Hid, Vec<u8>, SocketWriteSocketResponder)> {
if let SocketRequest::WriteSocket { handle, data, responder } = self {
Some((handle, data, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_read_socket_streaming_start(
self,
) -> Option<(Hid, SocketReadSocketStreamingStartResponder)> {
if let SocketRequest::ReadSocketStreamingStart { handle, responder } = self {
Some((handle, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_read_socket_streaming_stop(
self,
) -> Option<(Hid, SocketReadSocketStreamingStopResponder)> {
if let SocketRequest::ReadSocketStreamingStop { handle, responder } = self {
Some((handle, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
SocketRequest::CreateSocket { .. } => "create_socket",
SocketRequest::SetSocketDisposition { .. } => "set_socket_disposition",
SocketRequest::ReadSocket { .. } => "read_socket",
SocketRequest::WriteSocket { .. } => "write_socket",
SocketRequest::ReadSocketStreamingStart { .. } => "read_socket_streaming_start",
SocketRequest::ReadSocketStreamingStop { .. } => "read_socket_streaming_stop",
SocketRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
"unknown one-way method"
}
SocketRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
"unknown two-way method"
}
}
}
}
#[derive(Debug, Clone)]
pub struct SocketControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for SocketControlHandle {
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 SocketControlHandle {
pub fn send_on_socket_streaming_data(
&self,
mut handle: &Hid,
mut socket_message: &SocketMessage,
) -> Result<(), fidl::Error> {
self.inner.send::<SocketOnSocketStreamingDataRequest>(
(handle, socket_message),
0,
0x998b5e66b3c80a2,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct SocketCreateSocketResponder {
control_handle: std::mem::ManuallyDrop<SocketControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for SocketCreateSocketResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for SocketCreateSocketResponder {
type ControlHandle = SocketControlHandle;
fn control_handle(&self) -> &SocketControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl SocketCreateSocketResponder {
pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), &Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
Error,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x200bf0ea21932de0,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct SocketSetSocketDispositionResponder {
control_handle: std::mem::ManuallyDrop<SocketControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for SocketSetSocketDispositionResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for SocketSetSocketDispositionResponder {
type ControlHandle = SocketControlHandle;
fn control_handle(&self) -> &SocketControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl SocketSetSocketDispositionResponder {
pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), &Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
Error,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x60d3c7ccb17f9bdf,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct SocketReadSocketResponder {
control_handle: std::mem::ManuallyDrop<SocketControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for SocketReadSocketResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for SocketReadSocketResponder {
type ControlHandle = SocketControlHandle;
fn control_handle(&self) -> &SocketControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl SocketReadSocketResponder {
pub fn send(self, mut result: Result<&[u8], &Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<&[u8], &Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<&[u8], &Error>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::FlexibleResultType<SocketReadSocketResponse, Error>>(
fidl::encoding::FlexibleResult::new(result.map(|data| (data,))),
self.tx_id,
0x1da8aabec249c02e,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct SocketWriteSocketResponder {
control_handle: std::mem::ManuallyDrop<SocketControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for SocketWriteSocketResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for SocketWriteSocketResponder {
type ControlHandle = SocketControlHandle;
fn control_handle(&self) -> &SocketControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl SocketWriteSocketResponder {
pub fn send(self, mut result: Result<u64, &WriteSocketError>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<u64, &WriteSocketError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<u64, &WriteSocketError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
SocketWriteSocketResponse,
WriteSocketError,
>>(
fidl::encoding::FlexibleResult::new(result.map(|wrote| (wrote,))),
self.tx_id,
0x5b541623cbbbf683,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct SocketReadSocketStreamingStartResponder {
control_handle: std::mem::ManuallyDrop<SocketControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for SocketReadSocketStreamingStartResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for SocketReadSocketStreamingStartResponder {
type ControlHandle = SocketControlHandle;
fn control_handle(&self) -> &SocketControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl SocketReadSocketStreamingStartResponder {
pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), &Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
Error,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x2a592748d5f33445,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct SocketReadSocketStreamingStopResponder {
control_handle: std::mem::ManuallyDrop<SocketControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for SocketReadSocketStreamingStopResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for SocketReadSocketStreamingStopResponder {
type ControlHandle = SocketControlHandle;
fn control_handle(&self) -> &SocketControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl SocketReadSocketStreamingStopResponder {
pub fn send(self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), &Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), &Error>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
Error,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x53e5cade5f4d22e7,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for SocketDisposition {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for SocketDisposition {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
for SocketDisposition
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SocketDisposition {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[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 prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for SocketType {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for SocketType {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SocketType {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SocketType {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[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 prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AioStopped {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AioStopped {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AioStopped, D>
for &AioStopped
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AioStopped>(offset);
fidl::encoding::Encode::<AioStopped, D>::encode(
(
<fidl::encoding::OptionalUnion<Error> as fidl::encoding::ValueTypeMarker>::borrow(&self.error),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::OptionalUnion<Error>, D>,
> fidl::encoding::Encode<AioStopped, 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::<AioStopped>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AioStopped {
#[inline(always)]
fn new_empty() -> Self {
Self { error: fidl::new_empty!(fidl::encoding::OptionalUnion<Error>, 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);
fidl::decode!(
fidl::encoding::OptionalUnion<Error>,
D,
&mut self.error,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for BadHid {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for BadHid {
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<BadHid, D> for &BadHid {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BadHid>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut BadHid).write_unaligned((self as *const BadHid).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
fidl::encoding::Encode<BadHid, 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::<BadHid>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BadHid {
#[inline(always)]
fn new_empty() -> Self {
Self { 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 ChannelCreateChannelRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ChannelCreateChannelRequest {
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
}
#[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<ChannelCreateChannelRequest, D> for &ChannelCreateChannelRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ChannelCreateChannelRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut ChannelCreateChannelRequest)
.write_unaligned((self as *const ChannelCreateChannelRequest).read());
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Array<NewHid, 2>, D>,
> fidl::encoding::Encode<ChannelCreateChannelRequest, 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::<ChannelCreateChannelRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ChannelCreateChannelRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { handles: fidl::new_empty!(fidl::encoding::Array<NewHid, 2>, 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, 8);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ChannelMessage {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ChannelMessage {
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<ChannelMessage, D>
for &ChannelMessage
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ChannelMessage>(offset);
fidl::encoding::Encode::<ChannelMessage, D>::encode(
(
<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.data),
<fidl::encoding::UnboundedVector<HandleInfo> as fidl::encoding::ValueTypeMarker>::borrow(&self.handles),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<HandleInfo>, D>,
> fidl::encoding::Encode<ChannelMessage, 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::<ChannelMessage>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChannelMessage {
#[inline(always)]
fn new_empty() -> Self {
Self {
data: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
handles: fidl::new_empty!(fidl::encoding::UnboundedVector<HandleInfo>, 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);
fidl::decode!(
fidl::encoding::UnboundedVector<u8>,
D,
&mut self.data,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::UnboundedVector<HandleInfo>,
D,
&mut self.handles,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ChannelOnChannelStreamingDataRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ChannelOnChannelStreamingDataRequest {
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<ChannelOnChannelStreamingDataRequest, D>
for &ChannelOnChannelStreamingDataRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ChannelOnChannelStreamingDataRequest>(offset);
fidl::encoding::Encode::<ChannelOnChannelStreamingDataRequest, D>::encode(
(
<Hid as fidl::encoding::ValueTypeMarker>::borrow(&self.handle),
<ChannelSent as fidl::encoding::ValueTypeMarker>::borrow(&self.channel_sent),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<Hid, D>,
T1: fidl::encoding::Encode<ChannelSent, D>,
> fidl::encoding::Encode<ChannelOnChannelStreamingDataRequest, 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::<ChannelOnChannelStreamingDataRequest>(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 ChannelOnChannelStreamingDataRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
handle: fidl::new_empty!(Hid, D),
channel_sent: fidl::new_empty!(ChannelSent, 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!(Hid, D, &mut self.handle, decoder, offset + 0, _depth)?;
fidl::decode!(ChannelSent, D, &mut self.channel_sent, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ChannelReadChannelRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ChannelReadChannelRequest {
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<ChannelReadChannelRequest, D> for &ChannelReadChannelRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ChannelReadChannelRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut ChannelReadChannelRequest)
.write_unaligned((self as *const ChannelReadChannelRequest).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Hid, D>>
fidl::encoding::Encode<ChannelReadChannelRequest, 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::<ChannelReadChannelRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ChannelReadChannelRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { handle: fidl::new_empty!(Hid, 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 ChannelReadChannelStreamingStartRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ChannelReadChannelStreamingStartRequest {
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<ChannelReadChannelStreamingStartRequest, D>
for &ChannelReadChannelStreamingStartRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ChannelReadChannelStreamingStartRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut ChannelReadChannelStreamingStartRequest).write_unaligned(
(self as *const ChannelReadChannelStreamingStartRequest).read(),
);
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Hid, D>>
fidl::encoding::Encode<ChannelReadChannelStreamingStartRequest, 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::<ChannelReadChannelStreamingStartRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ChannelReadChannelStreamingStartRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { handle: fidl::new_empty!(Hid, 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 ChannelReadChannelStreamingStopRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ChannelReadChannelStreamingStopRequest {
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<ChannelReadChannelStreamingStopRequest, D>
for &ChannelReadChannelStreamingStopRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ChannelReadChannelStreamingStopRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut ChannelReadChannelStreamingStopRequest).write_unaligned(
(self as *const ChannelReadChannelStreamingStopRequest).read(),
);
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Hid, D>>
fidl::encoding::Encode<ChannelReadChannelStreamingStopRequest, 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::<ChannelReadChannelStreamingStopRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ChannelReadChannelStreamingStopRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { handle: fidl::new_empty!(Hid, 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 ChannelWriteChannelRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ChannelWriteChannelRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<ChannelWriteChannelRequest, D> for &ChannelWriteChannelRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ChannelWriteChannelRequest>(offset);
fidl::encoding::Encode::<ChannelWriteChannelRequest, D>::encode(
(
<Hid as fidl::encoding::ValueTypeMarker>::borrow(&self.handle),
<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.data),
<Handles as fidl::encoding::ValueTypeMarker>::borrow(&self.handles),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<Hid, D>,
T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
T2: fidl::encoding::Encode<Handles, D>,
> fidl::encoding::Encode<ChannelWriteChannelRequest, 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::<ChannelWriteChannelRequest>(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)?;
self.2.encode(encoder, offset + 24, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ChannelWriteChannelRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
handle: fidl::new_empty!(Hid, D),
data: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
handles: fidl::new_empty!(Handles, 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!(Hid, D, &mut self.handle, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::UnboundedVector<u8>,
D,
&mut self.data,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(Handles, D, &mut self.handles, decoder, offset + 24, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ClosedDuringRead {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ClosedDuringRead {
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ClosedDuringRead, D>
for &ClosedDuringRead
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ClosedDuringRead>(offset);
encoder.write_num(0u8, offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ClosedDuringRead {
#[inline(always)]
fn new_empty() -> Self {
Self
}
#[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);
match decoder.read_num::<u8>(offset) {
0 => Ok(()),
_ => Err(fidl::Error::Invalid),
}
}
}
impl fidl::encoding::ValueTypeMarker for ErrorPending {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ErrorPending {
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ErrorPending, D>
for &ErrorPending
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ErrorPending>(offset);
encoder.write_num(0u8, offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ErrorPending {
#[inline(always)]
fn new_empty() -> Self {
Self
}
#[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);
match decoder.read_num::<u8>(offset) {
0 => Ok(()),
_ => Err(fidl::Error::Invalid),
}
}
}
impl fidl::encoding::ValueTypeMarker for EventCreateEventRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for EventCreateEventRequest {
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<EventCreateEventRequest, D> for &EventCreateEventRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EventCreateEventRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut EventCreateEventRequest)
.write_unaligned((self as *const EventCreateEventRequest).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<NewHid, D>>
fidl::encoding::Encode<EventCreateEventRequest, 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::<EventCreateEventRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for EventCreateEventRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { handle: fidl::new_empty!(NewHid, 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 EventPairCreateEventPairRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for EventPairCreateEventPairRequest {
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
}
#[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<EventPairCreateEventPairRequest, D>
for &EventPairCreateEventPairRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EventPairCreateEventPairRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut EventPairCreateEventPairRequest)
.write_unaligned((self as *const EventPairCreateEventPairRequest).read());
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Array<NewHid, 2>, D>,
> fidl::encoding::Encode<EventPairCreateEventPairRequest, 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::<EventPairCreateEventPairRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for EventPairCreateEventPairRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { handles: fidl::new_empty!(fidl::encoding::Array<NewHid, 2>, 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, 8);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for FDomainAcknowledgeWriteErrorRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for FDomainAcknowledgeWriteErrorRequest {
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<FDomainAcknowledgeWriteErrorRequest, D>
for &FDomainAcknowledgeWriteErrorRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FDomainAcknowledgeWriteErrorRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut FDomainAcknowledgeWriteErrorRequest)
.write_unaligned((self as *const FDomainAcknowledgeWriteErrorRequest).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Hid, D>>
fidl::encoding::Encode<FDomainAcknowledgeWriteErrorRequest, 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::<FDomainAcknowledgeWriteErrorRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for FDomainAcknowledgeWriteErrorRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { handle: fidl::new_empty!(Hid, 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 FDomainCloseRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for FDomainCloseRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FDomainCloseRequest, D>
for &FDomainCloseRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FDomainCloseRequest>(offset);
fidl::encoding::Encode::<FDomainCloseRequest, D>::encode(
(
<fidl::encoding::UnboundedVector<Hid> as fidl::encoding::ValueTypeMarker>::borrow(&self.handles),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Hid>, D>,
> fidl::encoding::Encode<FDomainCloseRequest, 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::<FDomainCloseRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FDomainCloseRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { handles: fidl::new_empty!(fidl::encoding::UnboundedVector<Hid>, 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);
fidl::decode!(
fidl::encoding::UnboundedVector<Hid>,
D,
&mut self.handles,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for FDomainDuplicateRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for FDomainDuplicateRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
12
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<FDomainDuplicateRequest, D> for &FDomainDuplicateRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FDomainDuplicateRequest>(offset);
fidl::encoding::Encode::<FDomainDuplicateRequest, D>::encode(
(
<Hid as fidl::encoding::ValueTypeMarker>::borrow(&self.handle),
<NewHid as fidl::encoding::ValueTypeMarker>::borrow(&self.new_handle),
<fidl::Rights as fidl::encoding::ValueTypeMarker>::borrow(&self.rights),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<Hid, D>,
T1: fidl::encoding::Encode<NewHid, D>,
T2: fidl::encoding::Encode<fidl::Rights, D>,
> fidl::encoding::Encode<FDomainDuplicateRequest, 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::<FDomainDuplicateRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
self.2.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for FDomainDuplicateRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
handle: fidl::new_empty!(Hid, D),
new_handle: fidl::new_empty!(NewHid, D),
rights: fidl::new_empty!(fidl::Rights, 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);
fidl::decode!(Hid, D, &mut self.handle, decoder, offset + 0, _depth)?;
fidl::decode!(NewHid, D, &mut self.new_handle, decoder, offset + 4, _depth)?;
fidl::decode!(fidl::Rights, D, &mut self.rights, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for FDomainNamespaceRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for FDomainNamespaceRequest {
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<FDomainNamespaceRequest, D> for &FDomainNamespaceRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FDomainNamespaceRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut FDomainNamespaceRequest)
.write_unaligned((self as *const FDomainNamespaceRequest).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<NewHid, D>>
fidl::encoding::Encode<FDomainNamespaceRequest, 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::<FDomainNamespaceRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for FDomainNamespaceRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { new_handle: fidl::new_empty!(NewHid, 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 FDomainReplaceRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for FDomainReplaceRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
12
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FDomainReplaceRequest, D>
for &FDomainReplaceRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FDomainReplaceRequest>(offset);
fidl::encoding::Encode::<FDomainReplaceRequest, D>::encode(
(
<Hid as fidl::encoding::ValueTypeMarker>::borrow(&self.handle),
<NewHid as fidl::encoding::ValueTypeMarker>::borrow(&self.new_handle),
<fidl::Rights as fidl::encoding::ValueTypeMarker>::borrow(&self.rights),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<Hid, D>,
T1: fidl::encoding::Encode<NewHid, D>,
T2: fidl::encoding::Encode<fidl::Rights, D>,
> fidl::encoding::Encode<FDomainReplaceRequest, 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::<FDomainReplaceRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
self.2.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FDomainReplaceRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
handle: fidl::new_empty!(Hid, D),
new_handle: fidl::new_empty!(NewHid, D),
rights: fidl::new_empty!(fidl::Rights, 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);
fidl::decode!(Hid, D, &mut self.handle, decoder, offset + 0, _depth)?;
fidl::decode!(NewHid, D, &mut self.new_handle, decoder, offset + 4, _depth)?;
fidl::decode!(fidl::Rights, D, &mut self.rights, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for FDomainSignalPeerRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for FDomainSignalPeerRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
12
}
#[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<FDomainSignalPeerRequest, D> for &FDomainSignalPeerRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FDomainSignalPeerRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut FDomainSignalPeerRequest)
.write_unaligned((self as *const FDomainSignalPeerRequest).read());
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<Hid, D>,
T1: fidl::encoding::Encode<u32, D>,
T2: fidl::encoding::Encode<u32, D>,
> fidl::encoding::Encode<FDomainSignalPeerRequest, 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::<FDomainSignalPeerRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
self.2.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for FDomainSignalPeerRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
handle: fidl::new_empty!(Hid, D),
set: fidl::new_empty!(u32, D),
clear: 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, 12);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for FDomainSignalRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for FDomainSignalRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
12
}
#[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<FDomainSignalRequest, D>
for &FDomainSignalRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FDomainSignalRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut FDomainSignalRequest)
.write_unaligned((self as *const FDomainSignalRequest).read());
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<Hid, D>,
T1: fidl::encoding::Encode<u32, D>,
T2: fidl::encoding::Encode<u32, D>,
> fidl::encoding::Encode<FDomainSignalRequest, 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::<FDomainSignalRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
self.2.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FDomainSignalRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
handle: fidl::new_empty!(Hid, D),
set: fidl::new_empty!(u32, D),
clear: 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, 12);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for FDomainWaitForSignalsRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for FDomainWaitForSignalsRequest {
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
}
#[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<FDomainWaitForSignalsRequest, D> for &FDomainWaitForSignalsRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FDomainWaitForSignalsRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut FDomainWaitForSignalsRequest)
.write_unaligned((self as *const FDomainWaitForSignalsRequest).read());
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<Hid, D>,
T1: fidl::encoding::Encode<u32, D>,
> fidl::encoding::Encode<FDomainWaitForSignalsRequest, 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::<FDomainWaitForSignalsRequest>(offset);
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 FDomainWaitForSignalsRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { handle: fidl::new_empty!(Hid, D), signals: 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, 8);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for FDomainWaitForSignalsResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for FDomainWaitForSignalsResponse {
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<FDomainWaitForSignalsResponse, D>
for &FDomainWaitForSignalsResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FDomainWaitForSignalsResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut FDomainWaitForSignalsResponse)
.write_unaligned((self as *const FDomainWaitForSignalsResponse).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
fidl::encoding::Encode<FDomainWaitForSignalsResponse, 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::<FDomainWaitForSignalsResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for FDomainWaitForSignalsResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { signals: 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 HandleDisposition {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HandleDisposition {
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<HandleDisposition, D>
for &HandleDisposition
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HandleDisposition>(offset);
fidl::encoding::Encode::<HandleDisposition, D>::encode(
(
<HandleOp as fidl::encoding::ValueTypeMarker>::borrow(&self.handle),
<fidl::Rights as fidl::encoding::ValueTypeMarker>::borrow(&self.rights),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<HandleOp, D>,
T1: fidl::encoding::Encode<fidl::Rights, D>,
> fidl::encoding::Encode<HandleDisposition, 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::<HandleDisposition>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HandleDisposition {
#[inline(always)]
fn new_empty() -> Self {
Self {
handle: fidl::new_empty!(HandleOp, D),
rights: fidl::new_empty!(fidl::Rights, 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(16) };
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 + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(HandleOp, D, &mut self.handle, decoder, offset + 0, _depth)?;
fidl::decode!(fidl::Rights, D, &mut self.rights, decoder, offset + 16, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for HandleInfo {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HandleInfo {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
12
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HandleInfo, D>
for &HandleInfo
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HandleInfo>(offset);
fidl::encoding::Encode::<HandleInfo, D>::encode(
(
<Hid as fidl::encoding::ValueTypeMarker>::borrow(&self.handle),
<fidl::ObjectType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
<fidl::Rights as fidl::encoding::ValueTypeMarker>::borrow(&self.rights),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<Hid, D>,
T1: fidl::encoding::Encode<fidl::ObjectType, D>,
T2: fidl::encoding::Encode<fidl::Rights, D>,
> fidl::encoding::Encode<HandleInfo, 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::<HandleInfo>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
self.2.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HandleInfo {
#[inline(always)]
fn new_empty() -> Self {
Self {
handle: fidl::new_empty!(Hid, D),
type_: fidl::new_empty!(fidl::ObjectType, D),
rights: fidl::new_empty!(fidl::Rights, 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);
fidl::decode!(Hid, D, &mut self.handle, decoder, offset + 0, _depth)?;
fidl::decode!(fidl::ObjectType, D, &mut self.type_, decoder, offset + 4, _depth)?;
fidl::decode!(fidl::Rights, D, &mut self.rights, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Hid {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Hid {
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<Hid, D> for &Hid {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Hid>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut Hid).write_unaligned((self as *const Hid).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
fidl::encoding::Encode<Hid, 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::<Hid>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Hid {
#[inline(always)]
fn new_empty() -> Self {
Self { 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 NewHid {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NewHid {
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<NewHid, D> for &NewHid {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NewHid>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut NewHid).write_unaligned((self as *const NewHid).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
fidl::encoding::Encode<NewHid, 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::<NewHid>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NewHid {
#[inline(always)]
fn new_empty() -> Self {
Self { 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 NewHidOutOfRange {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NewHidOutOfRange {
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<NewHidOutOfRange, D>
for &NewHidOutOfRange
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NewHidOutOfRange>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut NewHidOutOfRange)
.write_unaligned((self as *const NewHidOutOfRange).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
fidl::encoding::Encode<NewHidOutOfRange, 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::<NewHidOutOfRange>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NewHidOutOfRange {
#[inline(always)]
fn new_empty() -> Self {
Self { 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 NewHidReused {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NewHidReused {
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<NewHidReused, D>
for &NewHidReused
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NewHidReused>(offset);
fidl::encoding::Encode::<NewHidReused, D>::encode(
(
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.same_call),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u32, D>,
T1: fidl::encoding::Encode<bool, D>,
> fidl::encoding::Encode<NewHidReused, 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::<NewHidReused>(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 NewHidReused {
#[inline(always)]
fn new_empty() -> Self {
Self { id: fidl::new_empty!(u32, D), same_call: fidl::new_empty!(bool, 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(4) };
let padval = unsafe { (ptr as *const u32).read_unaligned() };
let mask = 0xffffff00u32;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 4 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(u32, D, &mut self.id, decoder, offset + 0, _depth)?;
fidl::decode!(bool, D, &mut self.same_call, decoder, offset + 4, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for NoErrorPending {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NoErrorPending {
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NoErrorPending, D>
for &NoErrorPending
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NoErrorPending>(offset);
encoder.write_num(0u8, offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NoErrorPending {
#[inline(always)]
fn new_empty() -> Self {
Self
}
#[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);
match decoder.read_num::<u8>(offset) {
0 => Ok(()),
_ => Err(fidl::Error::Invalid),
}
}
}
impl fidl::encoding::ValueTypeMarker for NoReadInProgress {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NoReadInProgress {
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NoReadInProgress, D>
for &NoReadInProgress
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NoReadInProgress>(offset);
encoder.write_num(0u8, offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NoReadInProgress {
#[inline(always)]
fn new_empty() -> Self {
Self
}
#[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);
match decoder.read_num::<u8>(offset) {
0 => Ok(()),
_ => Err(fidl::Error::Invalid),
}
}
}
impl fidl::encoding::ValueTypeMarker for RightsUnknown {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RightsUnknown {
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RightsUnknown, D>
for &RightsUnknown
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RightsUnknown>(offset);
fidl::encoding::Encode::<RightsUnknown, D>::encode(
(<fidl::Rights as fidl::encoding::ValueTypeMarker>::borrow(&self.rights),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<fidl::Rights, D>>
fidl::encoding::Encode<RightsUnknown, 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::<RightsUnknown>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RightsUnknown {
#[inline(always)]
fn new_empty() -> Self {
Self { rights: fidl::new_empty!(fidl::Rights, 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);
fidl::decode!(fidl::Rights, D, &mut self.rights, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SignalsUnknown {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SignalsUnknown {
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<SignalsUnknown, D>
for &SignalsUnknown
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SignalsUnknown>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut SignalsUnknown)
.write_unaligned((self as *const SignalsUnknown).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
fidl::encoding::Encode<SignalsUnknown, 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::<SignalsUnknown>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SignalsUnknown {
#[inline(always)]
fn new_empty() -> Self {
Self { signals: 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 SocketCreateSocketRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SocketCreateSocketRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
12
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<SocketCreateSocketRequest, D> for &SocketCreateSocketRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SocketCreateSocketRequest>(offset);
fidl::encoding::Encode::<SocketCreateSocketRequest, D>::encode(
(
<SocketType as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
<fidl::encoding::Array<NewHid, 2> as fidl::encoding::ValueTypeMarker>::borrow(
&self.handles,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<SocketType, D>,
T1: fidl::encoding::Encode<fidl::encoding::Array<NewHid, 2>, D>,
> fidl::encoding::Encode<SocketCreateSocketRequest, 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::<SocketCreateSocketRequest>(offset);
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 SocketCreateSocketRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
options: fidl::new_empty!(SocketType, D),
handles: fidl::new_empty!(fidl::encoding::Array<NewHid, 2>, 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);
fidl::decode!(SocketType, D, &mut self.options, decoder, offset + 0, _depth)?;
fidl::decode!(fidl::encoding::Array<NewHid, 2>, D, &mut self.handles, decoder, offset + 4, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SocketDispositionUnknown {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SocketDispositionUnknown {
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<SocketDispositionUnknown, D> for &SocketDispositionUnknown
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SocketDispositionUnknown>(offset);
fidl::encoding::Encode::<SocketDispositionUnknown, D>::encode(
(<SocketDisposition as fidl::encoding::ValueTypeMarker>::borrow(&self.disposition),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<SocketDisposition, D>>
fidl::encoding::Encode<SocketDispositionUnknown, 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::<SocketDispositionUnknown>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for SocketDispositionUnknown
{
#[inline(always)]
fn new_empty() -> Self {
Self { disposition: fidl::new_empty!(SocketDisposition, 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);
fidl::decode!(
SocketDisposition,
D,
&mut self.disposition,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SocketOnSocketStreamingDataRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SocketOnSocketStreamingDataRequest {
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<SocketOnSocketStreamingDataRequest, D>
for &SocketOnSocketStreamingDataRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SocketOnSocketStreamingDataRequest>(offset);
fidl::encoding::Encode::<SocketOnSocketStreamingDataRequest, D>::encode(
(
<Hid as fidl::encoding::ValueTypeMarker>::borrow(&self.handle),
<SocketMessage as fidl::encoding::ValueTypeMarker>::borrow(
&self.socket_message,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<Hid, D>,
T1: fidl::encoding::Encode<SocketMessage, D>,
> fidl::encoding::Encode<SocketOnSocketStreamingDataRequest, 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::<SocketOnSocketStreamingDataRequest>(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 SocketOnSocketStreamingDataRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
handle: fidl::new_empty!(Hid, D),
socket_message: fidl::new_empty!(SocketMessage, 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!(Hid, D, &mut self.handle, decoder, offset + 0, _depth)?;
fidl::decode!(SocketMessage, D, &mut self.socket_message, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SocketReadSocketRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SocketReadSocketRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<SocketReadSocketRequest, D> for &SocketReadSocketRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SocketReadSocketRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut SocketReadSocketRequest)
.write_unaligned((self as *const SocketReadSocketRequest).read());
let padding_ptr = buf_ptr.offset(0) as *mut u64;
let padding_mask = 0xffffffff00000000u64;
padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<Hid, D>,
T1: fidl::encoding::Encode<u64, D>,
> fidl::encoding::Encode<SocketReadSocketRequest, 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::<SocketReadSocketRequest>(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 SocketReadSocketRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { handle: fidl::new_empty!(Hid, D), max_bytes: fidl::new_empty!(u64, 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 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,
});
}
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SocketReadSocketStreamingStartRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SocketReadSocketStreamingStartRequest {
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<SocketReadSocketStreamingStartRequest, D>
for &SocketReadSocketStreamingStartRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SocketReadSocketStreamingStartRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut SocketReadSocketStreamingStartRequest)
.write_unaligned((self as *const SocketReadSocketStreamingStartRequest).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Hid, D>>
fidl::encoding::Encode<SocketReadSocketStreamingStartRequest, 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::<SocketReadSocketStreamingStartRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for SocketReadSocketStreamingStartRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { handle: fidl::new_empty!(Hid, 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 SocketReadSocketStreamingStopRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SocketReadSocketStreamingStopRequest {
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<SocketReadSocketStreamingStopRequest, D>
for &SocketReadSocketStreamingStopRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SocketReadSocketStreamingStopRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut SocketReadSocketStreamingStopRequest)
.write_unaligned((self as *const SocketReadSocketStreamingStopRequest).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Hid, D>>
fidl::encoding::Encode<SocketReadSocketStreamingStopRequest, 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::<SocketReadSocketStreamingStopRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for SocketReadSocketStreamingStopRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { handle: fidl::new_empty!(Hid, 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 SocketSetSocketDispositionRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SocketSetSocketDispositionRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
12
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<SocketSetSocketDispositionRequest, D>
for &SocketSetSocketDispositionRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SocketSetSocketDispositionRequest>(offset);
fidl::encoding::Encode::<SocketSetSocketDispositionRequest, D>::encode(
(
<Hid as fidl::encoding::ValueTypeMarker>::borrow(&self.handle),
<SocketDisposition as fidl::encoding::ValueTypeMarker>::borrow(
&self.disposition,
),
<SocketDisposition as fidl::encoding::ValueTypeMarker>::borrow(
&self.disposition_peer,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<Hid, D>,
T1: fidl::encoding::Encode<SocketDisposition, D>,
T2: fidl::encoding::Encode<SocketDisposition, D>,
> fidl::encoding::Encode<SocketSetSocketDispositionRequest, 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::<SocketSetSocketDispositionRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
self.2.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for SocketSetSocketDispositionRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
handle: fidl::new_empty!(Hid, D),
disposition: fidl::new_empty!(SocketDisposition, D),
disposition_peer: fidl::new_empty!(SocketDisposition, 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);
fidl::decode!(Hid, D, &mut self.handle, decoder, offset + 0, _depth)?;
fidl::decode!(
SocketDisposition,
D,
&mut self.disposition,
decoder,
offset + 4,
_depth
)?;
fidl::decode!(
SocketDisposition,
D,
&mut self.disposition_peer,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SocketTypeUnknown {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SocketTypeUnknown {
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SocketTypeUnknown, D>
for &SocketTypeUnknown
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SocketTypeUnknown>(offset);
fidl::encoding::Encode::<SocketTypeUnknown, D>::encode(
(<SocketType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<SocketType, D>>
fidl::encoding::Encode<SocketTypeUnknown, 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::<SocketTypeUnknown>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SocketTypeUnknown {
#[inline(always)]
fn new_empty() -> Self {
Self { type_: fidl::new_empty!(SocketType, 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);
fidl::decode!(SocketType, D, &mut self.type_, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SocketWriteSocketRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SocketWriteSocketRequest {
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<SocketWriteSocketRequest, D> for &SocketWriteSocketRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SocketWriteSocketRequest>(offset);
fidl::encoding::Encode::<SocketWriteSocketRequest, D>::encode(
(
<Hid as fidl::encoding::ValueTypeMarker>::borrow(&self.handle),
<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.data),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<Hid, D>,
T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
> fidl::encoding::Encode<SocketWriteSocketRequest, 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::<SocketWriteSocketRequest>(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 SocketWriteSocketRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
handle: fidl::new_empty!(Hid, D),
data: fidl::new_empty!(fidl::encoding::UnboundedVector<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 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!(Hid, D, &mut self.handle, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::UnboundedVector<u8>,
D,
&mut self.data,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SocketReadSocketResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SocketReadSocketResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<SocketReadSocketResponse, D> for &SocketReadSocketResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SocketReadSocketResponse>(offset);
fidl::encoding::Encode::<SocketReadSocketResponse, D>::encode(
(<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(
&self.data,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
> fidl::encoding::Encode<SocketReadSocketResponse, 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::<SocketReadSocketResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for SocketReadSocketResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { data: fidl::new_empty!(fidl::encoding::UnboundedVector<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);
fidl::decode!(
fidl::encoding::UnboundedVector<u8>,
D,
&mut self.data,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SocketWriteSocketResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SocketWriteSocketResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
#[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<SocketWriteSocketResponse, D> for &SocketWriteSocketResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SocketWriteSocketResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut SocketWriteSocketResponse)
.write_unaligned((self as *const SocketWriteSocketResponse).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
fidl::encoding::Encode<SocketWriteSocketResponse, 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::<SocketWriteSocketResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for SocketWriteSocketResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { wrote: fidl::new_empty!(u64, 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, 8);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for StreamingReadInProgress {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for StreamingReadInProgress {
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<StreamingReadInProgress, D> for &StreamingReadInProgress
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StreamingReadInProgress>(offset);
encoder.write_num(0u8, offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for StreamingReadInProgress
{
#[inline(always)]
fn new_empty() -> Self {
Self
}
#[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);
match decoder.read_num::<u8>(offset) {
0 => Ok(()),
_ => Err(fidl::Error::Invalid),
}
}
}
impl fidl::encoding::ValueTypeMarker for WriteSocketError {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for WriteSocketError {
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<WriteSocketError, D>
for &WriteSocketError
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<WriteSocketError>(offset);
fidl::encoding::Encode::<WriteSocketError, D>::encode(
(
<Error as fidl::encoding::ValueTypeMarker>::borrow(&self.error),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.wrote),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<Error, D>,
T1: fidl::encoding::Encode<u64, D>,
> fidl::encoding::Encode<WriteSocketError, 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::<WriteSocketError>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WriteSocketError {
#[inline(always)]
fn new_empty() -> Self {
Self { error: fidl::new_empty!(Error, D), wrote: fidl::new_empty!(u64, 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);
fidl::decode!(Error, D, &mut self.error, decoder, offset + 0, _depth)?;
fidl::decode!(u64, D, &mut self.wrote, decoder, offset + 16, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for WrongHandleType {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for WrongHandleType {
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<WrongHandleType, D>
for &WrongHandleType
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<WrongHandleType>(offset);
fidl::encoding::Encode::<WrongHandleType, D>::encode(
(
<fidl::ObjectType as fidl::encoding::ValueTypeMarker>::borrow(&self.expected),
<fidl::ObjectType as fidl::encoding::ValueTypeMarker>::borrow(&self.got),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::ObjectType, D>,
T1: fidl::encoding::Encode<fidl::ObjectType, D>,
> fidl::encoding::Encode<WrongHandleType, 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::<WrongHandleType>(offset);
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 WrongHandleType {
#[inline(always)]
fn new_empty() -> Self {
Self {
expected: fidl::new_empty!(fidl::ObjectType, D),
got: fidl::new_empty!(fidl::ObjectType, 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);
fidl::decode!(fidl::ObjectType, D, &mut self.expected, decoder, offset + 0, _depth)?;
fidl::decode!(fidl::ObjectType, D, &mut self.got, decoder, offset + 4, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for WroteToSelf {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for WroteToSelf {
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WroteToSelf, D>
for &WroteToSelf
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<WroteToSelf>(offset);
encoder.write_num(0u8, offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WroteToSelf {
#[inline(always)]
fn new_empty() -> Self {
Self
}
#[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);
match decoder.read_num::<u8>(offset) {
0 => Ok(()),
_ => Err(fidl::Error::Invalid),
}
}
}
impl fidl::encoding::ValueTypeMarker for ChannelSent {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ChannelSent {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ChannelSent, D>
for &ChannelSent
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ChannelSent>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
ChannelSent::Message(ref val) => {
fidl::encoding::encode_in_envelope::<ChannelMessage, D>(
<ChannelMessage as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
ChannelSent::Stopped(ref val) => {
fidl::encoding::encode_in_envelope::<AioStopped, D>(
<AioStopped as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
ChannelSent::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChannelSent {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <ChannelMessage as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <AioStopped as fidl::encoding::TypeMarker>::inline_size(decoder.context),
0 => return Err(fidl::Error::UnknownUnionTag),
_ => num_bytes as usize,
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let ChannelSent::Message(_) = self {
} else {
*self = ChannelSent::Message(fidl::new_empty!(ChannelMessage, D));
}
#[allow(irrefutable_let_patterns)]
if let ChannelSent::Message(ref mut val) = self {
fidl::decode!(ChannelMessage, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let ChannelSent::Stopped(_) = self {
} else {
*self = ChannelSent::Stopped(fidl::new_empty!(AioStopped, D));
}
#[allow(irrefutable_let_patterns)]
if let ChannelSent::Stopped(ref mut val) = self {
fidl::decode!(AioStopped, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = ChannelSent::__SourceBreaking { unknown_ordinal: ordinal };
}
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Error {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Error {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Error, D> for &Error {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Error>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
Error::TargetError(ref val) => fidl::encoding::encode_in_envelope::<i32, D>(
<i32 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
Error::BadHid(ref val) => fidl::encoding::encode_in_envelope::<BadHid, D>(
<BadHid as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
Error::NewHidOutOfRange(ref val) => {
fidl::encoding::encode_in_envelope::<NewHidOutOfRange, D>(
<NewHidOutOfRange as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
Error::NewHidReused(ref val) => {
fidl::encoding::encode_in_envelope::<NewHidReused, D>(
<NewHidReused as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
Error::WrongHandleType(ref val) => {
fidl::encoding::encode_in_envelope::<WrongHandleType, D>(
<WrongHandleType as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
Error::StreamingReadInProgress(ref val) => {
fidl::encoding::encode_in_envelope::<StreamingReadInProgress, D>(
<StreamingReadInProgress as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
Error::NoReadInProgress(ref val) => {
fidl::encoding::encode_in_envelope::<NoReadInProgress, D>(
<NoReadInProgress as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
Error::ErrorPending(ref val) => {
fidl::encoding::encode_in_envelope::<ErrorPending, D>(
<ErrorPending as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
Error::NoErrorPending(ref val) => {
fidl::encoding::encode_in_envelope::<NoErrorPending, D>(
<NoErrorPending as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
Error::WroteToSelf(ref val) => {
fidl::encoding::encode_in_envelope::<WroteToSelf, D>(
<WroteToSelf as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
Error::ClosedDuringRead(ref val) => {
fidl::encoding::encode_in_envelope::<ClosedDuringRead, D>(
<ClosedDuringRead as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
Error::SignalsUnknown(ref val) => {
fidl::encoding::encode_in_envelope::<SignalsUnknown, D>(
<SignalsUnknown as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
Error::RightsUnknown(ref val) => {
fidl::encoding::encode_in_envelope::<RightsUnknown, D>(
<RightsUnknown as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
Error::SocketDispositionUnknown(ref val) => {
fidl::encoding::encode_in_envelope::<SocketDispositionUnknown, D>(
<SocketDispositionUnknown as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
Error::SocketTypeUnknown(ref val) => {
fidl::encoding::encode_in_envelope::<SocketTypeUnknown, D>(
<SocketTypeUnknown as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
Error::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Error {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <i32 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <BadHid as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3 => <NewHidOutOfRange as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4 => <NewHidReused as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5 => <WrongHandleType as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6 => <StreamingReadInProgress as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
),
7 => <NoReadInProgress as fidl::encoding::TypeMarker>::inline_size(decoder.context),
8 => <ErrorPending as fidl::encoding::TypeMarker>::inline_size(decoder.context),
9 => <NoErrorPending as fidl::encoding::TypeMarker>::inline_size(decoder.context),
10 => <WroteToSelf as fidl::encoding::TypeMarker>::inline_size(decoder.context),
11 => {
<ClosedDuringRead as fidl::encoding::TypeMarker>::inline_size(decoder.context)
}
12 => <SignalsUnknown as fidl::encoding::TypeMarker>::inline_size(decoder.context),
13 => <RightsUnknown as fidl::encoding::TypeMarker>::inline_size(decoder.context),
14 => <SocketDispositionUnknown as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
),
15 => {
<SocketTypeUnknown as fidl::encoding::TypeMarker>::inline_size(decoder.context)
}
0 => return Err(fidl::Error::UnknownUnionTag),
_ => num_bytes as usize,
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let Error::TargetError(_) = self {
} else {
*self = Error::TargetError(fidl::new_empty!(i32, D));
}
#[allow(irrefutable_let_patterns)]
if let Error::TargetError(ref mut val) = self {
fidl::decode!(i32, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let Error::BadHid(_) = self {
} else {
*self = Error::BadHid(fidl::new_empty!(BadHid, D));
}
#[allow(irrefutable_let_patterns)]
if let Error::BadHid(ref mut val) = self {
fidl::decode!(BadHid, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
3 => {
#[allow(irrefutable_let_patterns)]
if let Error::NewHidOutOfRange(_) = self {
} else {
*self = Error::NewHidOutOfRange(fidl::new_empty!(NewHidOutOfRange, D));
}
#[allow(irrefutable_let_patterns)]
if let Error::NewHidOutOfRange(ref mut val) = self {
fidl::decode!(NewHidOutOfRange, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
4 => {
#[allow(irrefutable_let_patterns)]
if let Error::NewHidReused(_) = self {
} else {
*self = Error::NewHidReused(fidl::new_empty!(NewHidReused, D));
}
#[allow(irrefutable_let_patterns)]
if let Error::NewHidReused(ref mut val) = self {
fidl::decode!(NewHidReused, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
5 => {
#[allow(irrefutable_let_patterns)]
if let Error::WrongHandleType(_) = self {
} else {
*self = Error::WrongHandleType(fidl::new_empty!(WrongHandleType, D));
}
#[allow(irrefutable_let_patterns)]
if let Error::WrongHandleType(ref mut val) = self {
fidl::decode!(WrongHandleType, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
6 => {
#[allow(irrefutable_let_patterns)]
if let Error::StreamingReadInProgress(_) = self {
} else {
*self = Error::StreamingReadInProgress(fidl::new_empty!(
StreamingReadInProgress,
D
));
}
#[allow(irrefutable_let_patterns)]
if let Error::StreamingReadInProgress(ref mut val) = self {
fidl::decode!(
StreamingReadInProgress,
D,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
7 => {
#[allow(irrefutable_let_patterns)]
if let Error::NoReadInProgress(_) = self {
} else {
*self = Error::NoReadInProgress(fidl::new_empty!(NoReadInProgress, D));
}
#[allow(irrefutable_let_patterns)]
if let Error::NoReadInProgress(ref mut val) = self {
fidl::decode!(NoReadInProgress, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
8 => {
#[allow(irrefutable_let_patterns)]
if let Error::ErrorPending(_) = self {
} else {
*self = Error::ErrorPending(fidl::new_empty!(ErrorPending, D));
}
#[allow(irrefutable_let_patterns)]
if let Error::ErrorPending(ref mut val) = self {
fidl::decode!(ErrorPending, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
9 => {
#[allow(irrefutable_let_patterns)]
if let Error::NoErrorPending(_) = self {
} else {
*self = Error::NoErrorPending(fidl::new_empty!(NoErrorPending, D));
}
#[allow(irrefutable_let_patterns)]
if let Error::NoErrorPending(ref mut val) = self {
fidl::decode!(NoErrorPending, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
10 => {
#[allow(irrefutable_let_patterns)]
if let Error::WroteToSelf(_) = self {
} else {
*self = Error::WroteToSelf(fidl::new_empty!(WroteToSelf, D));
}
#[allow(irrefutable_let_patterns)]
if let Error::WroteToSelf(ref mut val) = self {
fidl::decode!(WroteToSelf, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
11 => {
#[allow(irrefutable_let_patterns)]
if let Error::ClosedDuringRead(_) = self {
} else {
*self = Error::ClosedDuringRead(fidl::new_empty!(ClosedDuringRead, D));
}
#[allow(irrefutable_let_patterns)]
if let Error::ClosedDuringRead(ref mut val) = self {
fidl::decode!(ClosedDuringRead, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
12 => {
#[allow(irrefutable_let_patterns)]
if let Error::SignalsUnknown(_) = self {
} else {
*self = Error::SignalsUnknown(fidl::new_empty!(SignalsUnknown, D));
}
#[allow(irrefutable_let_patterns)]
if let Error::SignalsUnknown(ref mut val) = self {
fidl::decode!(SignalsUnknown, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
13 => {
#[allow(irrefutable_let_patterns)]
if let Error::RightsUnknown(_) = self {
} else {
*self = Error::RightsUnknown(fidl::new_empty!(RightsUnknown, D));
}
#[allow(irrefutable_let_patterns)]
if let Error::RightsUnknown(ref mut val) = self {
fidl::decode!(RightsUnknown, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
14 => {
#[allow(irrefutable_let_patterns)]
if let Error::SocketDispositionUnknown(_) = self {
} else {
*self = Error::SocketDispositionUnknown(fidl::new_empty!(
SocketDispositionUnknown,
D
));
}
#[allow(irrefutable_let_patterns)]
if let Error::SocketDispositionUnknown(ref mut val) = self {
fidl::decode!(
SocketDispositionUnknown,
D,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
15 => {
#[allow(irrefutable_let_patterns)]
if let Error::SocketTypeUnknown(_) = self {
} else {
*self = Error::SocketTypeUnknown(fidl::new_empty!(SocketTypeUnknown, D));
}
#[allow(irrefutable_let_patterns)]
if let Error::SocketTypeUnknown(ref mut val) = self {
fidl::decode!(SocketTypeUnknown, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = Error::__SourceBreaking { unknown_ordinal: ordinal };
}
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for HandleOp {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HandleOp {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HandleOp, D> for &HandleOp {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HandleOp>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
HandleOp::Move_(ref val) => fidl::encoding::encode_in_envelope::<Hid, D>(
<Hid as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
HandleOp::Duplicate(ref val) => fidl::encoding::encode_in_envelope::<Hid, D>(
<Hid as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HandleOp {
#[inline(always)]
fn new_empty() -> Self {
Self::Move_(fidl::new_empty!(Hid, D))
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <Hid as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <Hid as fidl::encoding::TypeMarker>::inline_size(decoder.context),
_ => return Err(fidl::Error::UnknownUnionTag),
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let HandleOp::Move_(_) = self {
} else {
*self = HandleOp::Move_(fidl::new_empty!(Hid, D));
}
#[allow(irrefutable_let_patterns)]
if let HandleOp::Move_(ref mut val) = self {
fidl::decode!(Hid, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let HandleOp::Duplicate(_) = self {
} else {
*self = HandleOp::Duplicate(fidl::new_empty!(Hid, D));
}
#[allow(irrefutable_let_patterns)]
if let HandleOp::Duplicate(ref mut val) = self {
fidl::decode!(Hid, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
ordinal => panic!("unexpected ordinal {:?}", ordinal),
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Handles {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Handles {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Handles, D> for &Handles {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Handles>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
Handles::Handles(ref val) => {
fidl::encoding::encode_in_envelope::<fidl::encoding::UnboundedVector<Hid>, D>(
<fidl::encoding::UnboundedVector<Hid> as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
Handles::Dispositions(ref val) => {
fidl::encoding::encode_in_envelope::<fidl::encoding::UnboundedVector<HandleDisposition>, D>(
<fidl::encoding::UnboundedVector<HandleDisposition> as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Handles {
#[inline(always)]
fn new_empty() -> Self {
Self::Handles(fidl::new_empty!(fidl::encoding::UnboundedVector<Hid>, D))
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <fidl::encoding::UnboundedVector<Hid> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <fidl::encoding::UnboundedVector<HandleDisposition> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
_ => return Err(fidl::Error::UnknownUnionTag),
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let Handles::Handles(_) = self {
} else {
*self = Handles::Handles(fidl::new_empty!(
fidl::encoding::UnboundedVector<Hid>,
D
));
}
#[allow(irrefutable_let_patterns)]
if let Handles::Handles(ref mut val) = self {
fidl::decode!(
fidl::encoding::UnboundedVector<Hid>,
D,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let Handles::Dispositions(_) = self {
} else {
*self = Handles::Dispositions(fidl::new_empty!(
fidl::encoding::UnboundedVector<HandleDisposition>,
D
));
}
#[allow(irrefutable_let_patterns)]
if let Handles::Dispositions(ref mut val) = self {
fidl::decode!(
fidl::encoding::UnboundedVector<HandleDisposition>,
D,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
ordinal => panic!("unexpected ordinal {:?}", ordinal),
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SocketMessage {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SocketMessage {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SocketMessage, D>
for &SocketMessage
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SocketMessage>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
SocketMessage::Data(ref val) => {
fidl::encoding::encode_in_envelope::<fidl::encoding::UnboundedVector<u8>, D>(
<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
SocketMessage::Stopped(ref val) => {
fidl::encoding::encode_in_envelope::<AioStopped, D>(
<AioStopped as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
SocketMessage::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SocketMessage {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => {
<fidl::encoding::UnboundedVector<u8> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
)
}
2 => <AioStopped as fidl::encoding::TypeMarker>::inline_size(decoder.context),
0 => return Err(fidl::Error::UnknownUnionTag),
_ => num_bytes as usize,
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let SocketMessage::Data(_) = self {
} else {
*self = SocketMessage::Data(fidl::new_empty!(
fidl::encoding::UnboundedVector<u8>,
D
));
}
#[allow(irrefutable_let_patterns)]
if let SocketMessage::Data(ref mut val) = self {
fidl::decode!(
fidl::encoding::UnboundedVector<u8>,
D,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let SocketMessage::Stopped(_) = self {
} else {
*self = SocketMessage::Stopped(fidl::new_empty!(AioStopped, D));
}
#[allow(irrefutable_let_patterns)]
if let SocketMessage::Stopped(ref mut val) = self {
fidl::decode!(AioStopped, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = SocketMessage::__SourceBreaking { unknown_ordinal: ordinal };
}
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for WriteChannelError {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for WriteChannelError {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WriteChannelError, D>
for &WriteChannelError
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<WriteChannelError>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
WriteChannelError::Error(ref val) => {
fidl::encoding::encode_in_envelope::<Error, D>(
<Error as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
WriteChannelError::OpErrors(ref val) => {
fidl::encoding::encode_in_envelope::<fidl::encoding::UnboundedVector<fidl::encoding::OptionalUnion<Error>>, D>(
<fidl::encoding::UnboundedVector<fidl::encoding::OptionalUnion<Error>> as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WriteChannelError {
#[inline(always)]
fn new_empty() -> Self {
Self::Error(fidl::new_empty!(Error, D))
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <Error as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <fidl::encoding::UnboundedVector<fidl::encoding::OptionalUnion<Error>> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
_ => return Err(fidl::Error::UnknownUnionTag),
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let WriteChannelError::Error(_) = self {
} else {
*self = WriteChannelError::Error(fidl::new_empty!(Error, D));
}
#[allow(irrefutable_let_patterns)]
if let WriteChannelError::Error(ref mut val) = self {
fidl::decode!(Error, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let WriteChannelError::OpErrors(_) = self {
} else {
*self = WriteChannelError::OpErrors(fidl::new_empty!(
fidl::encoding::UnboundedVector<fidl::encoding::OptionalUnion<Error>>,
D
));
}
#[allow(irrefutable_let_patterns)]
if let WriteChannelError::OpErrors(ref mut val) = self {
fidl::decode!(
fidl::encoding::UnboundedVector<fidl::encoding::OptionalUnion<Error>>,
D,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
ordinal => panic!("unexpected ordinal {:?}", ordinal),
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
}