#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use {
bitflags::bitflags,
fidl::{
client::QueryResponseFut,
endpoints::{ControlHandle as _, Responder as _},
},
fuchsia_zircon_status as zx_status,
futures::future::{self, MaybeDone, TryFutureExt},
};
#[cfg(target_os = "fuchsia")]
use fuchsia_zircon as zx;
pub const MAX_CONNECT_MATCHES: u16 = 5;
pub const MAX_NUM_MATCHES: u16 = 250;
pub const NODE_NAME_MAX: u32 = 255;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum CompatibilityState {
Error,
Absent,
Supported,
Unknown,
Unsupported,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u32 },
}
#[macro_export]
macro_rules! CompatibilityStateUnknown {
() => {
_
};
}
impl CompatibilityState {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::Error),
1 => Some(Self::Absent),
2 => Some(Self::Supported),
3 => Some(Self::Unknown),
4 => Some(Self::Unsupported),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
0 => Self::Error,
1 => Self::Absent,
2 => Self::Supported,
3 => Self::Unknown,
4 => Self::Unsupported,
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::Error => 0,
Self::Absent => 1,
Self::Supported => 2,
Self::Unknown => 3,
Self::Unsupported => 4,
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 ConnectCapabilityError {
InvalidMoniker,
NoMatchingCapabilities,
NoMatchingComponent,
CapabilityConnectFailed,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u32,
},
}
#[macro_export]
macro_rules! ConnectCapabilityErrorUnknown {
() => {
_
};
}
impl ConnectCapabilityError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::InvalidMoniker),
2 => Some(Self::NoMatchingCapabilities),
3 => Some(Self::NoMatchingComponent),
4 => Some(Self::CapabilityConnectFailed),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::InvalidMoniker,
2 => Self::NoMatchingCapabilities,
3 => Self::NoMatchingComponent,
4 => Self::CapabilityConnectFailed,
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::InvalidMoniker => 1,
Self::NoMatchingCapabilities => 2,
Self::NoMatchingComponent => 3,
Self::CapabilityConnectFailed => 4,
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 IdentifyHostError {
ListInterfacesFailed,
GetDeviceNameFailed,
ProxyConnectionFailed,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u32,
},
}
#[macro_export]
macro_rules! IdentifyHostErrorUnknown {
() => {
_
};
}
impl IdentifyHostError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::ListInterfacesFailed),
2 => Some(Self::GetDeviceNameFailed),
3 => Some(Self::ProxyConnectionFailed),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::ListInterfacesFailed,
2 => Self::GetDeviceNameFailed,
3 => Self::ProxyConnectionFailed,
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::ListInterfacesFailed => 1,
Self::GetDeviceNameFailed => 2,
Self::ProxyConnectionFailed => 3,
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 TunnelError {
ConnectFailed,
SocketFailed,
CallbackError,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u32,
},
}
#[macro_export]
macro_rules! TunnelErrorUnknown {
() => {
_
};
}
impl TunnelError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::ConnectFailed),
2 => Some(Self::SocketFailed),
3 => Some(Self::CallbackError),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::ConnectFailed,
2 => Self::SocketFailed,
3 => Self::CallbackError,
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::ConnectFailed => 1,
Self::SocketFailed => 2,
Self::CallbackError => 3,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct CompatibilityInfo {
pub state: CompatibilityState,
pub platform_abi: u64,
pub message: String,
}
impl fidl::Persistable for CompatibilityInfo {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RemoteControlEchoStringRequest {
pub value: String,
}
impl fidl::Persistable for RemoteControlEchoStringRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RemoteControlEchoStringResponse {
pub response: String,
}
impl fidl::Persistable for RemoteControlEchoStringResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct RemoteControlGetTimeResponse {
pub time: i64,
}
impl fidl::Persistable for RemoteControlGetTimeResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RemoteControlLogMessageRequest {
pub tag: String,
pub message: String,
pub severity: fidl_fuchsia_diagnostics::Severity,
}
impl fidl::Persistable for RemoteControlLogMessageRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RemoteControlOpenCapabilityRequest {
pub moniker: String,
pub capability_set: fidl_fuchsia_sys2::OpenDirType,
pub capability_name: String,
pub server_channel: fidl::Channel,
pub flags: fidl_fuchsia_io::OpenFlags,
}
impl fidl::Standalone for RemoteControlOpenCapabilityRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct RemoteControlIdentifyHostResponse {
pub response: IdentifyHostResponse,
}
impl fidl::Persistable for RemoteControlIdentifyHostResponse {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct IdentifyHostResponse {
pub nodename: Option<String>,
pub boot_timestamp_nanos: Option<u64>,
pub serial_number: Option<String>,
pub ids: Option<Vec<u64>>,
pub product_config: Option<String>,
pub board_config: Option<String>,
pub addresses: Option<Vec<fidl_fuchsia_net::Subnet>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for IdentifyHostResponse {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct RemoteControlMarker;
impl fidl::endpoints::ProtocolMarker for RemoteControlMarker {
type Proxy = RemoteControlProxy;
type RequestStream = RemoteControlRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = RemoteControlSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.developer.remotecontrol.RemoteControl";
}
impl fidl::endpoints::DiscoverableProtocolMarker for RemoteControlMarker {}
pub type RemoteControlIdentifyHostResult = Result<IdentifyHostResponse, IdentifyHostError>;
pub type RemoteControlOpenCapabilityResult = Result<(), ConnectCapabilityError>;
pub trait RemoteControlProxyInterface: Send + Sync {
type EchoStringResponseFut: std::future::Future<Output = Result<String, fidl::Error>> + Send;
fn r#echo_string(&self, value: &str) -> Self::EchoStringResponseFut;
type LogMessageResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#log_message(
&self,
tag: &str,
message: &str,
severity: fidl_fuchsia_diagnostics::Severity,
) -> Self::LogMessageResponseFut;
type IdentifyHostResponseFut: std::future::Future<Output = Result<RemoteControlIdentifyHostResult, fidl::Error>>
+ Send;
fn r#identify_host(&self) -> Self::IdentifyHostResponseFut;
type OpenCapabilityResponseFut: std::future::Future<Output = Result<RemoteControlOpenCapabilityResult, fidl::Error>>
+ Send;
fn r#open_capability(
&self,
moniker: &str,
capability_set: fidl_fuchsia_sys2::OpenDirType,
capability_name: &str,
server_channel: fidl::Channel,
flags: fidl_fuchsia_io::OpenFlags,
) -> Self::OpenCapabilityResponseFut;
type GetTimeResponseFut: std::future::Future<Output = Result<i64, fidl::Error>> + Send;
fn r#get_time(&self) -> Self::GetTimeResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct RemoteControlSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for RemoteControlSynchronousProxy {
type Proxy = RemoteControlProxy;
type Protocol = RemoteControlMarker;
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 RemoteControlSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <RemoteControlMarker 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::Time) -> Result<RemoteControlEvent, fidl::Error> {
RemoteControlEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#echo_string(
&self,
mut value: &str,
___deadline: zx::Time,
) -> Result<String, fidl::Error> {
let _response = self
.client
.send_query::<RemoteControlEchoStringRequest, RemoteControlEchoStringResponse>(
(value,),
0x2bbec7ca8a72e82b,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.response)
}
pub fn r#log_message(
&self,
mut tag: &str,
mut message: &str,
mut severity: fidl_fuchsia_diagnostics::Severity,
___deadline: zx::Time,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<RemoteControlLogMessageRequest, fidl::encoding::EmptyPayload>(
(tag, message, severity),
0x3da84acd5bbf3926,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#identify_host(
&self,
___deadline: zx::Time,
) -> Result<RemoteControlIdentifyHostResult, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::FlexibleResultType<
RemoteControlIdentifyHostResponse,
IdentifyHostError,
>>(
(), 0x6035e1ab368deee1, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
)?
.into_result::<RemoteControlMarker>("identify_host")?;
Ok(_response.map(|x| x.response))
}
pub fn r#open_capability(
&self,
mut moniker: &str,
mut capability_set: fidl_fuchsia_sys2::OpenDirType,
mut capability_name: &str,
mut server_channel: fidl::Channel,
mut flags: fidl_fuchsia_io::OpenFlags,
___deadline: zx::Time,
) -> Result<RemoteControlOpenCapabilityResult, fidl::Error> {
let _response = self.client.send_query::<
RemoteControlOpenCapabilityRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, ConnectCapabilityError>,
>(
(moniker, capability_set, capability_name, server_channel, flags,),
0x51b5801f3e27e431,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<RemoteControlMarker>("open_capability")?;
Ok(_response.map(|x| x))
}
pub fn r#get_time(&self, ___deadline: zx::Time) -> Result<i64, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, RemoteControlGetTimeResponse>(
(),
0x3588f31e9067748d,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.time)
}
}
#[derive(Debug, Clone)]
pub struct RemoteControlProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for RemoteControlProxy {
type Protocol = RemoteControlMarker;
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 RemoteControlProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <RemoteControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> RemoteControlEventStream {
RemoteControlEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#echo_string(&self, mut value: &str) -> fidl::client::QueryResponseFut<String> {
RemoteControlProxyInterface::r#echo_string(self, value)
}
pub fn r#log_message(
&self,
mut tag: &str,
mut message: &str,
mut severity: fidl_fuchsia_diagnostics::Severity,
) -> fidl::client::QueryResponseFut<()> {
RemoteControlProxyInterface::r#log_message(self, tag, message, severity)
}
pub fn r#identify_host(
&self,
) -> fidl::client::QueryResponseFut<RemoteControlIdentifyHostResult> {
RemoteControlProxyInterface::r#identify_host(self)
}
pub fn r#open_capability(
&self,
mut moniker: &str,
mut capability_set: fidl_fuchsia_sys2::OpenDirType,
mut capability_name: &str,
mut server_channel: fidl::Channel,
mut flags: fidl_fuchsia_io::OpenFlags,
) -> fidl::client::QueryResponseFut<RemoteControlOpenCapabilityResult> {
RemoteControlProxyInterface::r#open_capability(
self,
moniker,
capability_set,
capability_name,
server_channel,
flags,
)
}
pub fn r#get_time(&self) -> fidl::client::QueryResponseFut<i64> {
RemoteControlProxyInterface::r#get_time(self)
}
}
impl RemoteControlProxyInterface for RemoteControlProxy {
type EchoStringResponseFut = fidl::client::QueryResponseFut<String>;
fn r#echo_string(&self, mut value: &str) -> Self::EchoStringResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<String, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
RemoteControlEchoStringResponse,
0x2bbec7ca8a72e82b,
>(_buf?)?;
Ok(_response.response)
}
self.client.send_query_and_decode::<RemoteControlEchoStringRequest, String>(
(value,),
0x2bbec7ca8a72e82b,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type LogMessageResponseFut = fidl::client::QueryResponseFut<()>;
fn r#log_message(
&self,
mut tag: &str,
mut message: &str,
mut severity: fidl_fuchsia_diagnostics::Severity,
) -> Self::LogMessageResponseFut {
fn _decode(mut _buf: Result<fidl::MessageBufEtc, fidl::Error>) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
0x3da84acd5bbf3926,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<RemoteControlLogMessageRequest, ()>(
(tag, message, severity),
0x3da84acd5bbf3926,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type IdentifyHostResponseFut = fidl::client::QueryResponseFut<RemoteControlIdentifyHostResult>;
fn r#identify_host(&self) -> Self::IdentifyHostResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<RemoteControlIdentifyHostResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<
RemoteControlIdentifyHostResponse,
IdentifyHostError,
>,
0x6035e1ab368deee1,
>(_buf?)?
.into_result::<RemoteControlMarker>("identify_host")?;
Ok(_response.map(|x| x.response))
}
self.client
.send_query_and_decode::<fidl::encoding::EmptyPayload, RemoteControlIdentifyHostResult>(
(),
0x6035e1ab368deee1,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type OpenCapabilityResponseFut =
fidl::client::QueryResponseFut<RemoteControlOpenCapabilityResult>;
fn r#open_capability(
&self,
mut moniker: &str,
mut capability_set: fidl_fuchsia_sys2::OpenDirType,
mut capability_name: &str,
mut server_channel: fidl::Channel,
mut flags: fidl_fuchsia_io::OpenFlags,
) -> Self::OpenCapabilityResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<RemoteControlOpenCapabilityResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
ConnectCapabilityError,
>,
0x51b5801f3e27e431,
>(_buf?)?
.into_result::<RemoteControlMarker>("open_capability")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
RemoteControlOpenCapabilityRequest,
RemoteControlOpenCapabilityResult,
>(
(moniker, capability_set, capability_name, server_channel, flags,),
0x51b5801f3e27e431,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type GetTimeResponseFut = fidl::client::QueryResponseFut<i64>;
fn r#get_time(&self) -> Self::GetTimeResponseFut {
fn _decode(mut _buf: Result<fidl::MessageBufEtc, fidl::Error>) -> Result<i64, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
RemoteControlGetTimeResponse,
0x3588f31e9067748d,
>(_buf?)?;
Ok(_response.time)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
(),
0x3588f31e9067748d,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct RemoteControlEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for RemoteControlEventStream {}
impl futures::stream::FusedStream for RemoteControlEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for RemoteControlEventStream {
type Item = Result<RemoteControlEvent, 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(RemoteControlEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum RemoteControlEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl RemoteControlEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<RemoteControlEvent, 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(RemoteControlEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <RemoteControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct RemoteControlRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for RemoteControlRequestStream {}
impl futures::stream::FusedStream for RemoteControlRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for RemoteControlRequestStream {
type Protocol = RemoteControlMarker;
type ControlHandle = RemoteControlControlHandle;
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 {
RemoteControlControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for RemoteControlRequestStream {
type Item = Result<RemoteControlRequest, 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 RemoteControlRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|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))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x2bbec7ca8a72e82b => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(RemoteControlEchoStringRequest);
fidl::encoding::Decoder::decode_into::<RemoteControlEchoStringRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RemoteControlControlHandle { inner: this.inner.clone() };
Ok(RemoteControlRequest::EchoString {
value: req.value,
responder: RemoteControlEchoStringResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3da84acd5bbf3926 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(RemoteControlLogMessageRequest);
fidl::encoding::Decoder::decode_into::<RemoteControlLogMessageRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RemoteControlControlHandle { inner: this.inner.clone() };
Ok(RemoteControlRequest::LogMessage {
tag: req.tag,
message: req.message,
severity: req.severity,
responder: RemoteControlLogMessageResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6035e1ab368deee1 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RemoteControlControlHandle { inner: this.inner.clone() };
Ok(RemoteControlRequest::IdentifyHost {
responder: RemoteControlIdentifyHostResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x51b5801f3e27e431 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(RemoteControlOpenCapabilityRequest);
fidl::encoding::Decoder::decode_into::<RemoteControlOpenCapabilityRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RemoteControlControlHandle { inner: this.inner.clone() };
Ok(RemoteControlRequest::OpenCapability {
moniker: req.moniker,
capability_set: req.capability_set,
capability_name: req.capability_name,
server_channel: req.server_channel,
flags: req.flags,
responder: RemoteControlOpenCapabilityResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3588f31e9067748d => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RemoteControlControlHandle { inner: this.inner.clone() };
Ok(RemoteControlRequest::GetTime {
responder: RemoteControlGetTimeResponder {
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(RemoteControlRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: RemoteControlControlHandle { 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(RemoteControlRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: RemoteControlControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<RemoteControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum RemoteControlRequest {
EchoString {
value: String,
responder: RemoteControlEchoStringResponder,
},
LogMessage {
tag: String,
message: String,
severity: fidl_fuchsia_diagnostics::Severity,
responder: RemoteControlLogMessageResponder,
},
IdentifyHost {
responder: RemoteControlIdentifyHostResponder,
},
OpenCapability {
moniker: String,
capability_set: fidl_fuchsia_sys2::OpenDirType,
capability_name: String,
server_channel: fidl::Channel,
flags: fidl_fuchsia_io::OpenFlags,
responder: RemoteControlOpenCapabilityResponder,
},
GetTime {
responder: RemoteControlGetTimeResponder,
},
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: RemoteControlControlHandle,
method_type: fidl::MethodType,
},
}
impl RemoteControlRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_echo_string(self) -> Option<(String, RemoteControlEchoStringResponder)> {
if let RemoteControlRequest::EchoString { value, responder } = self {
Some((value, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_log_message(
self,
) -> Option<(
String,
String,
fidl_fuchsia_diagnostics::Severity,
RemoteControlLogMessageResponder,
)> {
if let RemoteControlRequest::LogMessage { tag, message, severity, responder } = self {
Some((tag, message, severity, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_identify_host(self) -> Option<(RemoteControlIdentifyHostResponder)> {
if let RemoteControlRequest::IdentifyHost { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_open_capability(
self,
) -> Option<(
String,
fidl_fuchsia_sys2::OpenDirType,
String,
fidl::Channel,
fidl_fuchsia_io::OpenFlags,
RemoteControlOpenCapabilityResponder,
)> {
if let RemoteControlRequest::OpenCapability {
moniker,
capability_set,
capability_name,
server_channel,
flags,
responder,
} = self
{
Some((moniker, capability_set, capability_name, server_channel, flags, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_time(self) -> Option<(RemoteControlGetTimeResponder)> {
if let RemoteControlRequest::GetTime { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
RemoteControlRequest::EchoString { .. } => "echo_string",
RemoteControlRequest::LogMessage { .. } => "log_message",
RemoteControlRequest::IdentifyHost { .. } => "identify_host",
RemoteControlRequest::OpenCapability { .. } => "open_capability",
RemoteControlRequest::GetTime { .. } => "get_time",
RemoteControlRequest::_UnknownMethod {
method_type: fidl::MethodType::OneWay, ..
} => "unknown one-way method",
RemoteControlRequest::_UnknownMethod {
method_type: fidl::MethodType::TwoWay, ..
} => "unknown two-way method",
}
}
}
#[derive(Debug, Clone)]
pub struct RemoteControlControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for RemoteControlControlHandle {
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()
}
}
impl RemoteControlControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RemoteControlEchoStringResponder {
control_handle: std::mem::ManuallyDrop<RemoteControlControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RemoteControlEchoStringResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RemoteControlEchoStringResponder {
type ControlHandle = RemoteControlControlHandle;
fn control_handle(&self) -> &RemoteControlControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RemoteControlEchoStringResponder {
pub fn send(self, mut response: &str) -> Result<(), fidl::Error> {
let _result = self.send_raw(response);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut response: &str) -> Result<(), fidl::Error> {
let _result = self.send_raw(response);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut response: &str) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<RemoteControlEchoStringResponse>(
(response,),
self.tx_id,
0x2bbec7ca8a72e82b,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RemoteControlLogMessageResponder {
control_handle: std::mem::ManuallyDrop<RemoteControlControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RemoteControlLogMessageResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RemoteControlLogMessageResponder {
type ControlHandle = RemoteControlControlHandle;
fn control_handle(&self) -> &RemoteControlControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RemoteControlLogMessageResponder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x3da84acd5bbf3926,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RemoteControlIdentifyHostResponder {
control_handle: std::mem::ManuallyDrop<RemoteControlControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RemoteControlIdentifyHostResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RemoteControlIdentifyHostResponder {
type ControlHandle = RemoteControlControlHandle;
fn control_handle(&self) -> &RemoteControlControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RemoteControlIdentifyHostResponder {
pub fn send(
self,
mut result: Result<&IdentifyHostResponse, IdentifyHostError>,
) -> 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<&IdentifyHostResponse, IdentifyHostError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<&IdentifyHostResponse, IdentifyHostError>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
RemoteControlIdentifyHostResponse,
IdentifyHostError,
>>(
fidl::encoding::FlexibleResult::new(result.map(|response| (response,))),
self.tx_id,
0x6035e1ab368deee1,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RemoteControlOpenCapabilityResponder {
control_handle: std::mem::ManuallyDrop<RemoteControlControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RemoteControlOpenCapabilityResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RemoteControlOpenCapabilityResponder {
type ControlHandle = RemoteControlControlHandle;
fn control_handle(&self) -> &RemoteControlControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RemoteControlOpenCapabilityResponder {
pub fn send(self, mut result: Result<(), ConnectCapabilityError>) -> 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<(), ConnectCapabilityError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), ConnectCapabilityError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
ConnectCapabilityError,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x51b5801f3e27e431,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RemoteControlGetTimeResponder {
control_handle: std::mem::ManuallyDrop<RemoteControlControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RemoteControlGetTimeResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RemoteControlGetTimeResponder {
type ControlHandle = RemoteControlControlHandle;
fn control_handle(&self) -> &RemoteControlControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RemoteControlGetTimeResponder {
pub fn send(self, mut time: i64) -> Result<(), fidl::Error> {
let _result = self.send_raw(time);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut time: i64) -> Result<(), fidl::Error> {
let _result = self.send_raw(time);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut time: i64) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<RemoteControlGetTimeResponse>(
(time,),
self.tx_id,
0x3588f31e9067748d,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for CompatibilityState {
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 CompatibilityState {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for CompatibilityState {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for CompatibilityState {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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 ConnectCapabilityError {
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 ConnectCapabilityError {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for ConnectCapabilityError {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ConnectCapabilityError {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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 IdentifyHostError {
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 IdentifyHostError {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for IdentifyHostError {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for IdentifyHostError {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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 TunnelError {
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 TunnelError {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for TunnelError {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for TunnelError {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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 CompatibilityInfo {
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
}
}
impl fidl::encoding::ValueTypeMarker for CompatibilityInfo {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<CompatibilityInfo> for &CompatibilityInfo {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CompatibilityInfo>(offset);
fidl::encoding::Encode::<CompatibilityInfo>::encode(
(
<CompatibilityState as fidl::encoding::ValueTypeMarker>::borrow(&self.state),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.platform_abi),
<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
&self.message,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<CompatibilityState>,
T1: fidl::encoding::Encode<u64>,
T2: fidl::encoding::Encode<fidl::encoding::UnboundedString>,
> fidl::encoding::Encode<CompatibilityInfo> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CompatibilityInfo>(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 + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for CompatibilityInfo {
#[inline(always)]
fn new_empty() -> Self {
Self {
state: fidl::new_empty!(CompatibilityState),
platform_abi: fidl::new_empty!(u64),
message: fidl::new_empty!(fidl::encoding::UnboundedString),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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!(CompatibilityState, &mut self.state, decoder, offset + 0, _depth)?;
fidl::decode!(u64, &mut self.platform_abi, decoder, offset + 8, _depth)?;
fidl::decode!(
fidl::encoding::UnboundedString,
&mut self.message,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RemoteControlEchoStringRequest {
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
}
}
impl fidl::encoding::ValueTypeMarker for RemoteControlEchoStringRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RemoteControlEchoStringRequest>
for &RemoteControlEchoStringRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RemoteControlEchoStringRequest>(offset);
fidl::encoding::Encode::<RemoteControlEchoStringRequest>::encode(
(<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
&self.value,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>>>
fidl::encoding::Encode<RemoteControlEchoStringRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RemoteControlEchoStringRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RemoteControlEchoStringRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { value: fidl::new_empty!(fidl::encoding::BoundedString<255>) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<255>,
&mut self.value,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RemoteControlEchoStringResponse {
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
}
}
impl fidl::encoding::ValueTypeMarker for RemoteControlEchoStringResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RemoteControlEchoStringResponse>
for &RemoteControlEchoStringResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RemoteControlEchoStringResponse>(offset);
fidl::encoding::Encode::<RemoteControlEchoStringResponse>::encode(
(<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
&self.response,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>>>
fidl::encoding::Encode<RemoteControlEchoStringResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RemoteControlEchoStringResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RemoteControlEchoStringResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { response: fidl::new_empty!(fidl::encoding::BoundedString<255>) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<255>,
&mut self.response,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RemoteControlGetTimeResponse {
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
}
}
impl fidl::encoding::ValueTypeMarker for RemoteControlGetTimeResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RemoteControlGetTimeResponse> for &RemoteControlGetTimeResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RemoteControlGetTimeResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut RemoteControlGetTimeResponse)
.write_unaligned((self as *const RemoteControlGetTimeResponse).read());
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<i64>>
fidl::encoding::Encode<RemoteControlGetTimeResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RemoteControlGetTimeResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RemoteControlGetTimeResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { time: fidl::new_empty!(i64) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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(())
}
}
unsafe impl fidl::encoding::TypeMarker for RemoteControlLogMessageRequest {
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
}
}
impl fidl::encoding::ValueTypeMarker for RemoteControlLogMessageRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RemoteControlLogMessageRequest>
for &RemoteControlLogMessageRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RemoteControlLogMessageRequest>(offset);
fidl::encoding::Encode::<RemoteControlLogMessageRequest>::encode(
(
<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
&self.tag,
),
<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
&self.message,
),
<fidl_fuchsia_diagnostics::Severity as fidl::encoding::ValueTypeMarker>::borrow(
&self.severity,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<fidl::encoding::UnboundedString>,
T1: fidl::encoding::Encode<fidl::encoding::UnboundedString>,
T2: fidl::encoding::Encode<fidl_fuchsia_diagnostics::Severity>,
> fidl::encoding::Encode<RemoteControlLogMessageRequest> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RemoteControlLogMessageRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 32, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RemoteControlLogMessageRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
tag: fidl::new_empty!(fidl::encoding::UnboundedString),
message: fidl::new_empty!(fidl::encoding::UnboundedString),
severity: fidl::new_empty!(fidl_fuchsia_diagnostics::Severity),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffffff00u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::UnboundedString,
&mut self.tag,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::UnboundedString,
&mut self.message,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(
fidl_fuchsia_diagnostics::Severity,
&mut self.severity,
decoder,
offset + 32,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RemoteControlOpenCapabilityRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
48
}
}
impl fidl::encoding::ResourceTypeMarker for RemoteControlOpenCapabilityRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RemoteControlOpenCapabilityRequest>
for &mut RemoteControlOpenCapabilityRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RemoteControlOpenCapabilityRequest>(offset);
fidl::encoding::Encode::<RemoteControlOpenCapabilityRequest>::encode(
(
<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.moniker),
<fidl_fuchsia_sys2::OpenDirType as fidl::encoding::ValueTypeMarker>::borrow(&self.capability_set),
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(&self.capability_name),
<fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_channel),
<fidl_fuchsia_io::OpenFlags as fidl::encoding::ValueTypeMarker>::borrow(&self.flags),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<4096>>,
T1: fidl::encoding::Encode<fidl_fuchsia_sys2::OpenDirType>,
T2: fidl::encoding::Encode<fidl::encoding::BoundedString<255>>,
T3: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
>,
>,
T4: fidl::encoding::Encode<fidl_fuchsia_io::OpenFlags>,
> fidl::encoding::Encode<RemoteControlOpenCapabilityRequest> for (T0, T1, T2, T3, T4)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RemoteControlOpenCapabilityRequest>(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)?;
self.2.encode(encoder, offset + 24, depth)?;
self.3.encode(encoder, offset + 40, depth)?;
self.4.encode(encoder, offset + 44, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RemoteControlOpenCapabilityRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
moniker: fidl::new_empty!(fidl::encoding::BoundedString<4096>),
capability_set: fidl::new_empty!(fidl_fuchsia_sys2::OpenDirType),
capability_name: fidl::new_empty!(fidl::encoding::BoundedString<255>),
server_channel: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>),
flags: fidl::new_empty!(fidl_fuchsia_io::OpenFlags),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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!(
fidl::encoding::BoundedString<4096>,
&mut self.moniker,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl_fuchsia_sys2::OpenDirType,
&mut self.capability_set,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(
fidl::encoding::BoundedString<255>,
&mut self.capability_name,
decoder,
offset + 24,
_depth
)?;
fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, &mut self.server_channel, decoder, offset + 40, _depth)?;
fidl::decode!(
fidl_fuchsia_io::OpenFlags,
&mut self.flags,
decoder,
offset + 44,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RemoteControlIdentifyHostResponse {
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
}
}
impl fidl::encoding::ValueTypeMarker for RemoteControlIdentifyHostResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RemoteControlIdentifyHostResponse>
for &RemoteControlIdentifyHostResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RemoteControlIdentifyHostResponse>(offset);
fidl::encoding::Encode::<RemoteControlIdentifyHostResponse>::encode(
(<IdentifyHostResponse as fidl::encoding::ValueTypeMarker>::borrow(&self.response),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<IdentifyHostResponse>>
fidl::encoding::Encode<RemoteControlIdentifyHostResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RemoteControlIdentifyHostResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RemoteControlIdentifyHostResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { response: fidl::new_empty!(IdentifyHostResponse) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(IdentifyHostResponse, &mut self.response, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl IdentifyHostResponse {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.addresses {
return 8;
}
if let Some(_) = self.board_config {
return 7;
}
if let Some(_) = self.product_config {
return 6;
}
if let Some(_) = self.ids {
return 5;
}
if let Some(_) = self.serial_number {
return 4;
}
if let Some(_) = self.boot_timestamp_nanos {
return 3;
}
if let Some(_) = self.nodename {
return 2;
}
0
}
}
unsafe impl fidl::encoding::TypeMarker for IdentifyHostResponse {
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
}
}
impl fidl::encoding::ValueTypeMarker for IdentifyHostResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<IdentifyHostResponse> for &IdentifyHostResponse {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<IdentifyHostResponse>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<255>>(
self.nodename.as_ref().map(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u64>(
self.boot_timestamp_nanos
.as_ref()
.map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 4 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (4 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<255>>(
self.serial_number.as_ref().map(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 5 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (5 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<u64>>(
self.ids.as_ref().map(<fidl::encoding::UnboundedVector<u64> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
if 6 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (6 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<100>>(
self.product_config.as_ref().map(
<fidl::encoding::BoundedString<100> as fidl::encoding::ValueTypeMarker>::borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 7 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (7 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<100>>(
self.board_config.as_ref().map(
<fidl::encoding::BoundedString<100> as fidl::encoding::ValueTypeMarker>::borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 8 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (8 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_net::Subnet>>(
self.addresses.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_net::Subnet> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for IdentifyHostResponse {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.nodename
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>));
fidl::decode!(
fidl::encoding::BoundedString<255>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
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);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.boot_timestamp_nanos.get_or_insert_with(|| fidl::new_empty!(u64));
fidl::decode!(u64, val_ref, decoder, inner_offset, inner_depth)?;
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);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 4 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.serial_number
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>));
fidl::decode!(
fidl::encoding::BoundedString<255>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
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);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 5 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::UnboundedVector<u64> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.ids
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::UnboundedVector<u64>));
fidl::decode!(
fidl::encoding::UnboundedVector<u64>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
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);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 6 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::BoundedString<100> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.product_config
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<100>));
fidl::decode!(
fidl::encoding::BoundedString<100>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
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);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 7 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::BoundedString<100> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.board_config
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<100>));
fidl::decode!(
fidl::encoding::BoundedString<100>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
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);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 8 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::UnboundedVector<fidl_fuchsia_net::Subnet> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.addresses.get_or_insert_with(|| {
fidl::new_empty!(fidl::encoding::UnboundedVector<fidl_fuchsia_net::Subnet>)
});
fidl::decode!(
fidl::encoding::UnboundedVector<fidl_fuchsia_net::Subnet>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
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);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
}