#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use bitflags::bitflags;
use fidl::client::QueryResponseFut;
use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
use fidl::endpoints::{ControlHandle as _, Responder as _};
use futures::future::{self, MaybeDone, TryFutureExt};
use zx_status;
pub type PrivateKey = Vec<u8>;
pub type ServiceEndpointId = u64;
pub const MAX_HOST_PORTS: u32 = 256;
pub const MAX_PUBLIC_KEY_SIZE: u32 = 65;
pub const MAX_QR_CODE_SIZE: u32 = 256;
pub const MAX_SIGNATURE_SIZE: u32 = 139;
pub const RESET_CONFIG_ALL: u16 = 255;
bitflags! {
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct ResetConfigFlags: u16 {
const NETWORK_CONFIG = 1;
const FABRIC_CONFIG = 2;
const SERVICE_CONFIG = 4;
const OPERATIONAL_CREDENTIALS = 8;
}
}
impl ResetConfigFlags {
#[deprecated = "Strict bits should not use `has_unknown_bits`"]
#[inline(always)]
pub fn has_unknown_bits(&self) -> bool {
false
}
#[deprecated = "Strict bits should not use `get_unknown_bits`"]
#[inline(always)]
pub fn get_unknown_bits(&self) -> u16 {
0
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum ErrorCode {
FileNotFound = 1,
CryptoError = 2,
InvalidArgument = 3,
InvalidState = 4,
UnspecifiedError = 2147483647,
}
impl ErrorCode {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::FileNotFound),
2 => Some(Self::CryptoError),
3 => Some(Self::InvalidArgument),
4 => Some(Self::InvalidState),
2147483647 => Some(Self::UnspecifiedError),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Debug, PartialEq)]
pub struct BootstrapImportWeaveConfigRequest {
pub config_json: fidl_fuchsia_mem::Buffer,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for BootstrapImportWeaveConfigRequest
{
}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct FactoryDataManagerGetPairingCodeResponse {
pub pairing_code: Vec<u8>,
}
impl fidl::Persistable for FactoryDataManagerGetPairingCodeResponse {}
#[derive(Debug, PartialEq)]
pub struct FactoryDataManagerGetWeaveCertificateResponse {
pub certificate: fidl_fuchsia_mem::Buffer,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for FactoryDataManagerGetWeaveCertificateResponse
{
}
#[derive(Clone, Debug, PartialEq)]
pub struct HostPort {
pub host: Host,
pub port: u16,
}
impl fidl::Persistable for HostPort {}
#[derive(Clone, Debug, PartialEq)]
pub struct PairingStateWatcherWatchPairingStateResponse {
pub state: PairingState,
}
impl fidl::Persistable for PairingStateWatcherWatchPairingStateResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ProvisionerGenerateKeyPairResponse {
pub wrapped_private_key: Vec<u8>,
pub public_key: Vec<u8>,
}
impl fidl::Persistable for ProvisionerGenerateKeyPairResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct QrCode {
pub data: String,
}
impl fidl::Persistable for QrCode {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SignerSignHashRequest {
pub hash: Vec<u8>,
}
impl fidl::Persistable for SignerSignHashRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SignerSignHashWithPrivateKeyRequest {
pub hash: Vec<u8>,
pub wrapped_private_key: Vec<u8>,
}
impl fidl::Persistable for SignerSignHashWithPrivateKeyRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SignerSignHashWithPrivateKeyResponse {
pub signature: Vec<u8>,
}
impl fidl::Persistable for SignerSignHashWithPrivateKeyResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SignerSignHashResponse {
pub signature: Vec<u8>,
}
impl fidl::Persistable for SignerSignHashResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct StackGetPairingStateWatcherRequest {
pub watcher: fidl::endpoints::ServerEnd<PairingStateWatcherMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for StackGetPairingStateWatcherRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct StackGetSvcDirectoryWatcherRequest {
pub endpoint_id: u64,
pub watcher: fidl::endpoints::ServerEnd<SvcDirectoryWatcherMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for StackGetSvcDirectoryWatcherRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct StackProviderSetWlanNetworkConfigProviderRequest {
pub provider: fidl::endpoints::ClientEnd<WlanNetworkConfigProviderMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for StackProviderSetWlanNetworkConfigProviderRequest
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct StackResetConfigRequest {
pub flags: ResetConfigFlags,
}
impl fidl::Persistable for StackResetConfigRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct StackGetQrCodeResponse {
pub qr_code: QrCode,
}
impl fidl::Persistable for StackGetQrCodeResponse {}
#[derive(Clone, Debug, PartialEq)]
pub struct SvcDirectoryWatcherWatchServiceDirectoryResponse {
pub host_port_list: Vec<HostPort>,
}
impl fidl::Persistable for SvcDirectoryWatcherWatchServiceDirectoryResponse {}
#[derive(Clone, Debug, PartialEq)]
pub struct WlanNetworkConfigProviderWatchConnectedNetworkResponse {
pub network_config: fidl_fuchsia_wlan_policy::NetworkConfig,
}
impl fidl::Persistable for WlanNetworkConfigProviderWatchConnectedNetworkResponse {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct PairingState {
pub is_weave_fully_provisioned: Option<bool>,
pub is_wlan_provisioned: Option<bool>,
pub is_thread_provisioned: Option<bool>,
pub is_fabric_provisioned: Option<bool>,
pub is_service_provisioned: Option<bool>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for PairingState {}
#[derive(Clone, Debug, PartialEq)]
pub enum Host {
Hostname(String),
IpAddress(fidl_fuchsia_net::IpAddress),
}
impl Host {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Hostname(_) => 1,
Self::IpAddress(_) => 2,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Persistable for Host {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct BootstrapMarker;
impl fidl::endpoints::ProtocolMarker for BootstrapMarker {
type Proxy = BootstrapProxy;
type RequestStream = BootstrapRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = BootstrapSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.weave.Bootstrap";
}
impl fidl::endpoints::DiscoverableProtocolMarker for BootstrapMarker {}
pub type BootstrapImportWeaveConfigResult = Result<(), i32>;
pub trait BootstrapProxyInterface: Send + Sync {
type ImportWeaveConfigResponseFut: std::future::Future<Output = Result<BootstrapImportWeaveConfigResult, fidl::Error>>
+ Send;
fn r#import_weave_config(
&self,
config_json: fidl_fuchsia_mem::Buffer,
) -> Self::ImportWeaveConfigResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct BootstrapSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for BootstrapSynchronousProxy {
type Proxy = BootstrapProxy;
type Protocol = BootstrapMarker;
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 BootstrapSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <BootstrapMarker 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<BootstrapEvent, fidl::Error> {
BootstrapEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#import_weave_config(
&self,
mut config_json: fidl_fuchsia_mem::Buffer,
___deadline: zx::MonotonicInstant,
) -> Result<BootstrapImportWeaveConfigResult, fidl::Error> {
let _response = self.client.send_query::<
BootstrapImportWeaveConfigRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(&mut config_json,),
0x3cba680ade22f738,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct BootstrapProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for BootstrapProxy {
type Protocol = BootstrapMarker;
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 BootstrapProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <BootstrapMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> BootstrapEventStream {
BootstrapEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#import_weave_config(
&self,
mut config_json: fidl_fuchsia_mem::Buffer,
) -> fidl::client::QueryResponseFut<
BootstrapImportWeaveConfigResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
BootstrapProxyInterface::r#import_weave_config(self, config_json)
}
}
impl BootstrapProxyInterface for BootstrapProxy {
type ImportWeaveConfigResponseFut = fidl::client::QueryResponseFut<
BootstrapImportWeaveConfigResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#import_weave_config(
&self,
mut config_json: fidl_fuchsia_mem::Buffer,
) -> Self::ImportWeaveConfigResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<BootstrapImportWeaveConfigResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3cba680ade22f738,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
BootstrapImportWeaveConfigRequest,
BootstrapImportWeaveConfigResult,
>(
(&mut config_json,),
0x3cba680ade22f738,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct BootstrapEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for BootstrapEventStream {}
impl futures::stream::FusedStream for BootstrapEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for BootstrapEventStream {
type Item = Result<BootstrapEvent, 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(BootstrapEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum BootstrapEvent {}
impl BootstrapEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<BootstrapEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <BootstrapMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct BootstrapRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for BootstrapRequestStream {}
impl futures::stream::FusedStream for BootstrapRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for BootstrapRequestStream {
type Protocol = BootstrapMarker;
type ControlHandle = BootstrapControlHandle;
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 {
BootstrapControlHandle { 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 BootstrapRequestStream {
type Item = Result<BootstrapRequest, 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 BootstrapRequestStream 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 {
0x3cba680ade22f738 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
BootstrapImportWeaveConfigRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BootstrapImportWeaveConfigRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = BootstrapControlHandle { inner: this.inner.clone() };
Ok(BootstrapRequest::ImportWeaveConfig {
config_json: req.config_json,
responder: BootstrapImportWeaveConfigResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<BootstrapMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum BootstrapRequest {
ImportWeaveConfig {
config_json: fidl_fuchsia_mem::Buffer,
responder: BootstrapImportWeaveConfigResponder,
},
}
impl BootstrapRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_import_weave_config(
self,
) -> Option<(fidl_fuchsia_mem::Buffer, BootstrapImportWeaveConfigResponder)> {
if let BootstrapRequest::ImportWeaveConfig { config_json, responder } = self {
Some((config_json, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
BootstrapRequest::ImportWeaveConfig { .. } => "import_weave_config",
}
}
}
#[derive(Debug, Clone)]
pub struct BootstrapControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for BootstrapControlHandle {
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 BootstrapControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct BootstrapImportWeaveConfigResponder {
control_handle: std::mem::ManuallyDrop<BootstrapControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for BootstrapImportWeaveConfigResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for BootstrapImportWeaveConfigResponder {
type ControlHandle = BootstrapControlHandle;
fn control_handle(&self) -> &BootstrapControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl BootstrapImportWeaveConfigResponder {
pub fn send(self, mut result: Result<(), i32>) -> 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<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x3cba680ade22f738,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct FactoryDataManagerMarker;
impl fidl::endpoints::ProtocolMarker for FactoryDataManagerMarker {
type Proxy = FactoryDataManagerProxy;
type RequestStream = FactoryDataManagerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = FactoryDataManagerSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.weave.FactoryDataManager";
}
impl fidl::endpoints::DiscoverableProtocolMarker for FactoryDataManagerMarker {}
pub type FactoryDataManagerGetPairingCodeResult = Result<Vec<u8>, ErrorCode>;
pub type FactoryDataManagerGetWeaveCertificateResult = Result<fidl_fuchsia_mem::Buffer, ErrorCode>;
pub trait FactoryDataManagerProxyInterface: Send + Sync {
type GetPairingCodeResponseFut: std::future::Future<Output = Result<FactoryDataManagerGetPairingCodeResult, fidl::Error>>
+ Send;
fn r#get_pairing_code(&self) -> Self::GetPairingCodeResponseFut;
type GetWeaveCertificateResponseFut: std::future::Future<
Output = Result<FactoryDataManagerGetWeaveCertificateResult, fidl::Error>,
> + Send;
fn r#get_weave_certificate(&self) -> Self::GetWeaveCertificateResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct FactoryDataManagerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for FactoryDataManagerSynchronousProxy {
type Proxy = FactoryDataManagerProxy;
type Protocol = FactoryDataManagerMarker;
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 FactoryDataManagerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<FactoryDataManagerMarker 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<FactoryDataManagerEvent, fidl::Error> {
FactoryDataManagerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_pairing_code(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<FactoryDataManagerGetPairingCodeResult, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
FactoryDataManagerGetPairingCodeResponse,
ErrorCode,
>>(
(),
0x75630bcd80418a0f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.pairing_code))
}
pub fn r#get_weave_certificate(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<FactoryDataManagerGetWeaveCertificateResult, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
FactoryDataManagerGetWeaveCertificateResponse,
ErrorCode,
>>(
(),
0x1b4feca8bc141380,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.certificate))
}
}
#[derive(Debug, Clone)]
pub struct FactoryDataManagerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for FactoryDataManagerProxy {
type Protocol = FactoryDataManagerMarker;
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 FactoryDataManagerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<FactoryDataManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> FactoryDataManagerEventStream {
FactoryDataManagerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_pairing_code(
&self,
) -> fidl::client::QueryResponseFut<
FactoryDataManagerGetPairingCodeResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
FactoryDataManagerProxyInterface::r#get_pairing_code(self)
}
pub fn r#get_weave_certificate(
&self,
) -> fidl::client::QueryResponseFut<
FactoryDataManagerGetWeaveCertificateResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
FactoryDataManagerProxyInterface::r#get_weave_certificate(self)
}
}
impl FactoryDataManagerProxyInterface for FactoryDataManagerProxy {
type GetPairingCodeResponseFut = fidl::client::QueryResponseFut<
FactoryDataManagerGetPairingCodeResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_pairing_code(&self) -> Self::GetPairingCodeResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<FactoryDataManagerGetPairingCodeResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<FactoryDataManagerGetPairingCodeResponse, ErrorCode>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x75630bcd80418a0f,
>(_buf?)?;
Ok(_response.map(|x| x.pairing_code))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
FactoryDataManagerGetPairingCodeResult,
>(
(),
0x75630bcd80418a0f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetWeaveCertificateResponseFut = fidl::client::QueryResponseFut<
FactoryDataManagerGetWeaveCertificateResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_weave_certificate(&self) -> Self::GetWeaveCertificateResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<FactoryDataManagerGetWeaveCertificateResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<
FactoryDataManagerGetWeaveCertificateResponse,
ErrorCode,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x1b4feca8bc141380,
>(_buf?)?;
Ok(_response.map(|x| x.certificate))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
FactoryDataManagerGetWeaveCertificateResult,
>(
(),
0x1b4feca8bc141380,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct FactoryDataManagerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for FactoryDataManagerEventStream {}
impl futures::stream::FusedStream for FactoryDataManagerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for FactoryDataManagerEventStream {
type Item = Result<FactoryDataManagerEvent, 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(FactoryDataManagerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum FactoryDataManagerEvent {}
impl FactoryDataManagerEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<FactoryDataManagerEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<FactoryDataManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct FactoryDataManagerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for FactoryDataManagerRequestStream {}
impl futures::stream::FusedStream for FactoryDataManagerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for FactoryDataManagerRequestStream {
type Protocol = FactoryDataManagerMarker;
type ControlHandle = FactoryDataManagerControlHandle;
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 {
FactoryDataManagerControlHandle { 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 FactoryDataManagerRequestStream {
type Item = Result<FactoryDataManagerRequest, 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 FactoryDataManagerRequestStream 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 {
0x75630bcd80418a0f => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = FactoryDataManagerControlHandle {
inner: this.inner.clone(),
};
Ok(FactoryDataManagerRequest::GetPairingCode {
responder: FactoryDataManagerGetPairingCodeResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x1b4feca8bc141380 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = FactoryDataManagerControlHandle {
inner: this.inner.clone(),
};
Ok(FactoryDataManagerRequest::GetWeaveCertificate {
responder: FactoryDataManagerGetWeaveCertificateResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <FactoryDataManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum FactoryDataManagerRequest {
GetPairingCode { responder: FactoryDataManagerGetPairingCodeResponder },
GetWeaveCertificate { responder: FactoryDataManagerGetWeaveCertificateResponder },
}
impl FactoryDataManagerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_pairing_code(self) -> Option<(FactoryDataManagerGetPairingCodeResponder)> {
if let FactoryDataManagerRequest::GetPairingCode { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_weave_certificate(
self,
) -> Option<(FactoryDataManagerGetWeaveCertificateResponder)> {
if let FactoryDataManagerRequest::GetWeaveCertificate { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
FactoryDataManagerRequest::GetPairingCode { .. } => "get_pairing_code",
FactoryDataManagerRequest::GetWeaveCertificate { .. } => "get_weave_certificate",
}
}
}
#[derive(Debug, Clone)]
pub struct FactoryDataManagerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for FactoryDataManagerControlHandle {
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 FactoryDataManagerControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FactoryDataManagerGetPairingCodeResponder {
control_handle: std::mem::ManuallyDrop<FactoryDataManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FactoryDataManagerGetPairingCodeResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FactoryDataManagerGetPairingCodeResponder {
type ControlHandle = FactoryDataManagerControlHandle;
fn control_handle(&self) -> &FactoryDataManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FactoryDataManagerGetPairingCodeResponder {
pub fn send(self, mut result: Result<&[u8], ErrorCode>) -> 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], ErrorCode>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<&[u8], ErrorCode>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
FactoryDataManagerGetPairingCodeResponse,
ErrorCode,
>>(
result.map(|pairing_code| (pairing_code,)),
self.tx_id,
0x75630bcd80418a0f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FactoryDataManagerGetWeaveCertificateResponder {
control_handle: std::mem::ManuallyDrop<FactoryDataManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FactoryDataManagerGetWeaveCertificateResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FactoryDataManagerGetWeaveCertificateResponder {
type ControlHandle = FactoryDataManagerControlHandle;
fn control_handle(&self) -> &FactoryDataManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FactoryDataManagerGetWeaveCertificateResponder {
pub fn send(
self,
mut result: Result<fidl_fuchsia_mem::Buffer, ErrorCode>,
) -> 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<fidl_fuchsia_mem::Buffer, ErrorCode>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<fidl_fuchsia_mem::Buffer, ErrorCode>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
FactoryDataManagerGetWeaveCertificateResponse,
ErrorCode,
>>(
result.as_mut().map_err(|e| *e).map(|certificate| (certificate,)),
self.tx_id,
0x1b4feca8bc141380,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct PairingStateWatcherMarker;
impl fidl::endpoints::ProtocolMarker for PairingStateWatcherMarker {
type Proxy = PairingStateWatcherProxy;
type RequestStream = PairingStateWatcherRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = PairingStateWatcherSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) PairingStateWatcher";
}
pub trait PairingStateWatcherProxyInterface: Send + Sync {
type WatchPairingStateResponseFut: std::future::Future<Output = Result<PairingState, fidl::Error>>
+ Send;
fn r#watch_pairing_state(&self) -> Self::WatchPairingStateResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct PairingStateWatcherSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for PairingStateWatcherSynchronousProxy {
type Proxy = PairingStateWatcherProxy;
type Protocol = PairingStateWatcherMarker;
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 PairingStateWatcherSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<PairingStateWatcherMarker 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<PairingStateWatcherEvent, fidl::Error> {
PairingStateWatcherEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#watch_pairing_state(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<PairingState, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
PairingStateWatcherWatchPairingStateResponse,
>(
(),
0x1b3889b65cea014e,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.state)
}
}
#[derive(Debug, Clone)]
pub struct PairingStateWatcherProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for PairingStateWatcherProxy {
type Protocol = PairingStateWatcherMarker;
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 PairingStateWatcherProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<PairingStateWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> PairingStateWatcherEventStream {
PairingStateWatcherEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#watch_pairing_state(
&self,
) -> fidl::client::QueryResponseFut<PairingState, fidl::encoding::DefaultFuchsiaResourceDialect>
{
PairingStateWatcherProxyInterface::r#watch_pairing_state(self)
}
}
impl PairingStateWatcherProxyInterface for PairingStateWatcherProxy {
type WatchPairingStateResponseFut =
fidl::client::QueryResponseFut<PairingState, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#watch_pairing_state(&self) -> Self::WatchPairingStateResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<PairingState, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
PairingStateWatcherWatchPairingStateResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x1b3889b65cea014e,
>(_buf?)?;
Ok(_response.state)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PairingState>(
(),
0x1b3889b65cea014e,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct PairingStateWatcherEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for PairingStateWatcherEventStream {}
impl futures::stream::FusedStream for PairingStateWatcherEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for PairingStateWatcherEventStream {
type Item = Result<PairingStateWatcherEvent, 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(PairingStateWatcherEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum PairingStateWatcherEvent {}
impl PairingStateWatcherEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<PairingStateWatcherEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<PairingStateWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct PairingStateWatcherRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for PairingStateWatcherRequestStream {}
impl futures::stream::FusedStream for PairingStateWatcherRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for PairingStateWatcherRequestStream {
type Protocol = PairingStateWatcherMarker;
type ControlHandle = PairingStateWatcherControlHandle;
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 {
PairingStateWatcherControlHandle { 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 PairingStateWatcherRequestStream {
type Item = Result<PairingStateWatcherRequest, 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 PairingStateWatcherRequestStream 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 {
0x1b3889b65cea014e => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PairingStateWatcherControlHandle {
inner: this.inner.clone(),
};
Ok(PairingStateWatcherRequest::WatchPairingState {
responder: PairingStateWatcherWatchPairingStateResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <PairingStateWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum PairingStateWatcherRequest {
WatchPairingState { responder: PairingStateWatcherWatchPairingStateResponder },
}
impl PairingStateWatcherRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_watch_pairing_state(
self,
) -> Option<(PairingStateWatcherWatchPairingStateResponder)> {
if let PairingStateWatcherRequest::WatchPairingState { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
PairingStateWatcherRequest::WatchPairingState { .. } => "watch_pairing_state",
}
}
}
#[derive(Debug, Clone)]
pub struct PairingStateWatcherControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for PairingStateWatcherControlHandle {
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 PairingStateWatcherControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PairingStateWatcherWatchPairingStateResponder {
control_handle: std::mem::ManuallyDrop<PairingStateWatcherControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PairingStateWatcherWatchPairingStateResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PairingStateWatcherWatchPairingStateResponder {
type ControlHandle = PairingStateWatcherControlHandle;
fn control_handle(&self) -> &PairingStateWatcherControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PairingStateWatcherWatchPairingStateResponder {
pub fn send(self, mut state: &PairingState) -> Result<(), fidl::Error> {
let _result = self.send_raw(state);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut state: &PairingState) -> Result<(), fidl::Error> {
let _result = self.send_raw(state);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut state: &PairingState) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<PairingStateWatcherWatchPairingStateResponse>(
(state,),
self.tx_id,
0x1b3889b65cea014e,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ProvisionerMarker;
impl fidl::endpoints::ProtocolMarker for ProvisionerMarker {
type Proxy = ProvisionerProxy;
type RequestStream = ProvisionerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ProvisionerSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.weave.Provisioner";
}
impl fidl::endpoints::DiscoverableProtocolMarker for ProvisionerMarker {}
pub type ProvisionerGenerateKeyPairResult = Result<(Vec<u8>, Vec<u8>), ErrorCode>;
pub trait ProvisionerProxyInterface: Send + Sync {
type GenerateKeyPairResponseFut: std::future::Future<Output = Result<ProvisionerGenerateKeyPairResult, fidl::Error>>
+ Send;
fn r#generate_key_pair(&self) -> Self::GenerateKeyPairResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ProvisionerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ProvisionerSynchronousProxy {
type Proxy = ProvisionerProxy;
type Protocol = ProvisionerMarker;
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 ProvisionerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ProvisionerMarker 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<ProvisionerEvent, fidl::Error> {
ProvisionerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#generate_key_pair(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<ProvisionerGenerateKeyPairResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<ProvisionerGenerateKeyPairResponse, ErrorCode>,
>(
(),
0x9ba1ad04f47bd9f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| (x.wrapped_private_key, x.public_key)))
}
}
#[derive(Debug, Clone)]
pub struct ProvisionerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ProvisionerProxy {
type Protocol = ProvisionerMarker;
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 ProvisionerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <ProvisionerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ProvisionerEventStream {
ProvisionerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#generate_key_pair(
&self,
) -> fidl::client::QueryResponseFut<
ProvisionerGenerateKeyPairResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ProvisionerProxyInterface::r#generate_key_pair(self)
}
}
impl ProvisionerProxyInterface for ProvisionerProxy {
type GenerateKeyPairResponseFut = fidl::client::QueryResponseFut<
ProvisionerGenerateKeyPairResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#generate_key_pair(&self) -> Self::GenerateKeyPairResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ProvisionerGenerateKeyPairResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<ProvisionerGenerateKeyPairResponse, ErrorCode>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x9ba1ad04f47bd9f,
>(_buf?)?;
Ok(_response.map(|x| (x.wrapped_private_key, x.public_key)))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
ProvisionerGenerateKeyPairResult,
>(
(),
0x9ba1ad04f47bd9f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct ProvisionerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ProvisionerEventStream {}
impl futures::stream::FusedStream for ProvisionerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ProvisionerEventStream {
type Item = Result<ProvisionerEvent, 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(ProvisionerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ProvisionerEvent {}
impl ProvisionerEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ProvisionerEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <ProvisionerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ProvisionerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ProvisionerRequestStream {}
impl futures::stream::FusedStream for ProvisionerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ProvisionerRequestStream {
type Protocol = ProvisionerMarker;
type ControlHandle = ProvisionerControlHandle;
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 {
ProvisionerControlHandle { 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 ProvisionerRequestStream {
type Item = Result<ProvisionerRequest, 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 ProvisionerRequestStream 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 {
0x9ba1ad04f47bd9f => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ProvisionerControlHandle { inner: this.inner.clone() };
Ok(ProvisionerRequest::GenerateKeyPair {
responder: ProvisionerGenerateKeyPairResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ProvisionerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ProvisionerRequest {
GenerateKeyPair { responder: ProvisionerGenerateKeyPairResponder },
}
impl ProvisionerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_generate_key_pair(self) -> Option<(ProvisionerGenerateKeyPairResponder)> {
if let ProvisionerRequest::GenerateKeyPair { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ProvisionerRequest::GenerateKeyPair { .. } => "generate_key_pair",
}
}
}
#[derive(Debug, Clone)]
pub struct ProvisionerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ProvisionerControlHandle {
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 ProvisionerControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ProvisionerGenerateKeyPairResponder {
control_handle: std::mem::ManuallyDrop<ProvisionerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ProvisionerGenerateKeyPairResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ProvisionerGenerateKeyPairResponder {
type ControlHandle = ProvisionerControlHandle;
fn control_handle(&self) -> &ProvisionerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ProvisionerGenerateKeyPairResponder {
pub fn send(self, mut result: Result<(&[u8], &[u8]), ErrorCode>) -> 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], &[u8]), ErrorCode>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(&[u8], &[u8]), ErrorCode>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
ProvisionerGenerateKeyPairResponse,
ErrorCode,
>>(
result,
self.tx_id,
0x9ba1ad04f47bd9f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct SignerMarker;
impl fidl::endpoints::ProtocolMarker for SignerMarker {
type Proxy = SignerProxy;
type RequestStream = SignerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = SignerSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.weave.Signer";
}
impl fidl::endpoints::DiscoverableProtocolMarker for SignerMarker {}
pub type SignerSignHashResult = Result<Vec<u8>, ErrorCode>;
pub type SignerSignHashWithPrivateKeyResult = Result<Vec<u8>, ErrorCode>;
pub trait SignerProxyInterface: Send + Sync {
type SignHashResponseFut: std::future::Future<Output = Result<SignerSignHashResult, fidl::Error>>
+ Send;
fn r#sign_hash(&self, hash: &[u8]) -> Self::SignHashResponseFut;
type SignHashWithPrivateKeyResponseFut: std::future::Future<Output = Result<SignerSignHashWithPrivateKeyResult, fidl::Error>>
+ Send;
fn r#sign_hash_with_private_key(
&self,
hash: &[u8],
wrapped_private_key: &[u8],
) -> Self::SignHashWithPrivateKeyResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct SignerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for SignerSynchronousProxy {
type Proxy = SignerProxy;
type Protocol = SignerMarker;
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 SignerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <SignerMarker 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<SignerEvent, fidl::Error> {
SignerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#sign_hash(
&self,
mut hash: &[u8],
___deadline: zx::MonotonicInstant,
) -> Result<SignerSignHashResult, fidl::Error> {
let _response = self.client.send_query::<
SignerSignHashRequest,
fidl::encoding::ResultType<SignerSignHashResponse, ErrorCode>,
>(
(hash,),
0x3bfb1667fc4fe864,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.signature))
}
pub fn r#sign_hash_with_private_key(
&self,
mut hash: &[u8],
mut wrapped_private_key: &[u8],
___deadline: zx::MonotonicInstant,
) -> Result<SignerSignHashWithPrivateKeyResult, fidl::Error> {
let _response = self.client.send_query::<
SignerSignHashWithPrivateKeyRequest,
fidl::encoding::ResultType<SignerSignHashWithPrivateKeyResponse, ErrorCode>,
>(
(hash, wrapped_private_key,),
0x23e8ae3490affc11,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.signature))
}
}
#[derive(Debug, Clone)]
pub struct SignerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for SignerProxy {
type Protocol = SignerMarker;
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 SignerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <SignerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> SignerEventStream {
SignerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#sign_hash(
&self,
mut hash: &[u8],
) -> fidl::client::QueryResponseFut<
SignerSignHashResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
SignerProxyInterface::r#sign_hash(self, hash)
}
pub fn r#sign_hash_with_private_key(
&self,
mut hash: &[u8],
mut wrapped_private_key: &[u8],
) -> fidl::client::QueryResponseFut<
SignerSignHashWithPrivateKeyResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
SignerProxyInterface::r#sign_hash_with_private_key(self, hash, wrapped_private_key)
}
}
impl SignerProxyInterface for SignerProxy {
type SignHashResponseFut = fidl::client::QueryResponseFut<
SignerSignHashResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#sign_hash(&self, mut hash: &[u8]) -> Self::SignHashResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<SignerSignHashResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<SignerSignHashResponse, ErrorCode>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3bfb1667fc4fe864,
>(_buf?)?;
Ok(_response.map(|x| x.signature))
}
self.client.send_query_and_decode::<SignerSignHashRequest, SignerSignHashResult>(
(hash,),
0x3bfb1667fc4fe864,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type SignHashWithPrivateKeyResponseFut = fidl::client::QueryResponseFut<
SignerSignHashWithPrivateKeyResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#sign_hash_with_private_key(
&self,
mut hash: &[u8],
mut wrapped_private_key: &[u8],
) -> Self::SignHashWithPrivateKeyResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<SignerSignHashWithPrivateKeyResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<SignerSignHashWithPrivateKeyResponse, ErrorCode>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x23e8ae3490affc11,
>(_buf?)?;
Ok(_response.map(|x| x.signature))
}
self.client.send_query_and_decode::<
SignerSignHashWithPrivateKeyRequest,
SignerSignHashWithPrivateKeyResult,
>(
(hash, wrapped_private_key,),
0x23e8ae3490affc11,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct SignerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for SignerEventStream {}
impl futures::stream::FusedStream for SignerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for SignerEventStream {
type Item = Result<SignerEvent, 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(SignerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum SignerEvent {}
impl SignerEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<SignerEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <SignerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct SignerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for SignerRequestStream {}
impl futures::stream::FusedStream for SignerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for SignerRequestStream {
type Protocol = SignerMarker;
type ControlHandle = SignerControlHandle;
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 {
SignerControlHandle { 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 SignerRequestStream {
type Item = Result<SignerRequest, 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 SignerRequestStream 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 {
0x3bfb1667fc4fe864 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
SignerSignHashRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SignerSignHashRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = SignerControlHandle { inner: this.inner.clone() };
Ok(SignerRequest::SignHash {
hash: req.hash,
responder: SignerSignHashResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x23e8ae3490affc11 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
SignerSignHashWithPrivateKeyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SignerSignHashWithPrivateKeyRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = SignerControlHandle { inner: this.inner.clone() };
Ok(SignerRequest::SignHashWithPrivateKey {
hash: req.hash,
wrapped_private_key: req.wrapped_private_key,
responder: SignerSignHashWithPrivateKeyResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<SignerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum SignerRequest {
SignHash { hash: Vec<u8>, responder: SignerSignHashResponder },
SignHashWithPrivateKey {
hash: Vec<u8>,
wrapped_private_key: Vec<u8>,
responder: SignerSignHashWithPrivateKeyResponder,
},
}
impl SignerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_sign_hash(self) -> Option<(Vec<u8>, SignerSignHashResponder)> {
if let SignerRequest::SignHash { hash, responder } = self {
Some((hash, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_sign_hash_with_private_key(
self,
) -> Option<(Vec<u8>, Vec<u8>, SignerSignHashWithPrivateKeyResponder)> {
if let SignerRequest::SignHashWithPrivateKey { hash, wrapped_private_key, responder } = self
{
Some((hash, wrapped_private_key, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
SignerRequest::SignHash { .. } => "sign_hash",
SignerRequest::SignHashWithPrivateKey { .. } => "sign_hash_with_private_key",
}
}
}
#[derive(Debug, Clone)]
pub struct SignerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for SignerControlHandle {
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 SignerControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct SignerSignHashResponder {
control_handle: std::mem::ManuallyDrop<SignerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for SignerSignHashResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for SignerSignHashResponder {
type ControlHandle = SignerControlHandle;
fn control_handle(&self) -> &SignerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl SignerSignHashResponder {
pub fn send(self, mut result: Result<&[u8], ErrorCode>) -> 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], ErrorCode>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<&[u8], ErrorCode>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<SignerSignHashResponse, ErrorCode>>(
result.map(|signature| (signature,)),
self.tx_id,
0x3bfb1667fc4fe864,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct SignerSignHashWithPrivateKeyResponder {
control_handle: std::mem::ManuallyDrop<SignerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for SignerSignHashWithPrivateKeyResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for SignerSignHashWithPrivateKeyResponder {
type ControlHandle = SignerControlHandle;
fn control_handle(&self) -> &SignerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl SignerSignHashWithPrivateKeyResponder {
pub fn send(self, mut result: Result<&[u8], ErrorCode>) -> 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], ErrorCode>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<&[u8], ErrorCode>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
SignerSignHashWithPrivateKeyResponse,
ErrorCode,
>>(
result.map(|signature| (signature,)),
self.tx_id,
0x23e8ae3490affc11,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct StackMarker;
impl fidl::endpoints::ProtocolMarker for StackMarker {
type Proxy = StackProxy;
type RequestStream = StackRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = StackSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.weave.Stack";
}
impl fidl::endpoints::DiscoverableProtocolMarker for StackMarker {}
pub type StackGetQrCodeResult = Result<QrCode, ErrorCode>;
pub type StackResetConfigResult = Result<(), ErrorCode>;
pub trait StackProxyInterface: Send + Sync {
fn r#get_pairing_state_watcher(
&self,
watcher: fidl::endpoints::ServerEnd<PairingStateWatcherMarker>,
) -> Result<(), fidl::Error>;
fn r#get_svc_directory_watcher(
&self,
endpoint_id: u64,
watcher: fidl::endpoints::ServerEnd<SvcDirectoryWatcherMarker>,
) -> Result<(), fidl::Error>;
type GetQrCodeResponseFut: std::future::Future<Output = Result<StackGetQrCodeResult, fidl::Error>>
+ Send;
fn r#get_qr_code(&self) -> Self::GetQrCodeResponseFut;
type ResetConfigResponseFut: std::future::Future<Output = Result<StackResetConfigResult, fidl::Error>>
+ Send;
fn r#reset_config(&self, flags: ResetConfigFlags) -> Self::ResetConfigResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct StackSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for StackSynchronousProxy {
type Proxy = StackProxy;
type Protocol = StackMarker;
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 StackSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <StackMarker 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<StackEvent, fidl::Error> {
StackEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_pairing_state_watcher(
&self,
mut watcher: fidl::endpoints::ServerEnd<PairingStateWatcherMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<StackGetPairingStateWatcherRequest>(
(watcher,),
0x674bbfa106efdc8d,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#get_svc_directory_watcher(
&self,
mut endpoint_id: u64,
mut watcher: fidl::endpoints::ServerEnd<SvcDirectoryWatcherMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<StackGetSvcDirectoryWatcherRequest>(
(endpoint_id, watcher),
0x261fdbc7a8447180,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#get_qr_code(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<StackGetQrCodeResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<StackGetQrCodeResponse, ErrorCode>,
>(
(),
0x79e435f04eb8d342,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.qr_code))
}
pub fn r#reset_config(
&self,
mut flags: ResetConfigFlags,
___deadline: zx::MonotonicInstant,
) -> Result<StackResetConfigResult, fidl::Error> {
let _response = self.client.send_query::<
StackResetConfigRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ErrorCode>,
>(
(flags,),
0x7a009a9b62d35c10,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct StackProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for StackProxy {
type Protocol = StackMarker;
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 StackProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <StackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> StackEventStream {
StackEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_pairing_state_watcher(
&self,
mut watcher: fidl::endpoints::ServerEnd<PairingStateWatcherMarker>,
) -> Result<(), fidl::Error> {
StackProxyInterface::r#get_pairing_state_watcher(self, watcher)
}
pub fn r#get_svc_directory_watcher(
&self,
mut endpoint_id: u64,
mut watcher: fidl::endpoints::ServerEnd<SvcDirectoryWatcherMarker>,
) -> Result<(), fidl::Error> {
StackProxyInterface::r#get_svc_directory_watcher(self, endpoint_id, watcher)
}
pub fn r#get_qr_code(
&self,
) -> fidl::client::QueryResponseFut<
StackGetQrCodeResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
StackProxyInterface::r#get_qr_code(self)
}
pub fn r#reset_config(
&self,
mut flags: ResetConfigFlags,
) -> fidl::client::QueryResponseFut<
StackResetConfigResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
StackProxyInterface::r#reset_config(self, flags)
}
}
impl StackProxyInterface for StackProxy {
fn r#get_pairing_state_watcher(
&self,
mut watcher: fidl::endpoints::ServerEnd<PairingStateWatcherMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<StackGetPairingStateWatcherRequest>(
(watcher,),
0x674bbfa106efdc8d,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#get_svc_directory_watcher(
&self,
mut endpoint_id: u64,
mut watcher: fidl::endpoints::ServerEnd<SvcDirectoryWatcherMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<StackGetSvcDirectoryWatcherRequest>(
(endpoint_id, watcher),
0x261fdbc7a8447180,
fidl::encoding::DynamicFlags::empty(),
)
}
type GetQrCodeResponseFut = fidl::client::QueryResponseFut<
StackGetQrCodeResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_qr_code(&self) -> Self::GetQrCodeResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<StackGetQrCodeResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<StackGetQrCodeResponse, ErrorCode>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x79e435f04eb8d342,
>(_buf?)?;
Ok(_response.map(|x| x.qr_code))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, StackGetQrCodeResult>(
(),
0x79e435f04eb8d342,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ResetConfigResponseFut = fidl::client::QueryResponseFut<
StackResetConfigResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#reset_config(&self, mut flags: ResetConfigFlags) -> Self::ResetConfigResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<StackResetConfigResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ErrorCode>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x7a009a9b62d35c10,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<StackResetConfigRequest, StackResetConfigResult>(
(flags,),
0x7a009a9b62d35c10,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct StackEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for StackEventStream {}
impl futures::stream::FusedStream for StackEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for StackEventStream {
type Item = Result<StackEvent, 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(StackEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum StackEvent {}
impl StackEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<StackEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <StackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct StackRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for StackRequestStream {}
impl futures::stream::FusedStream for StackRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for StackRequestStream {
type Protocol = StackMarker;
type ControlHandle = StackControlHandle;
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 {
StackControlHandle { 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 StackRequestStream {
type Item = Result<StackRequest, 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 StackRequestStream 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 {
0x674bbfa106efdc8d => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
StackGetPairingStateWatcherRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StackGetPairingStateWatcherRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = StackControlHandle { inner: this.inner.clone() };
Ok(StackRequest::GetPairingStateWatcher {
watcher: req.watcher,
control_handle,
})
}
0x261fdbc7a8447180 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
StackGetSvcDirectoryWatcherRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StackGetSvcDirectoryWatcherRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = StackControlHandle { inner: this.inner.clone() };
Ok(StackRequest::GetSvcDirectoryWatcher {
endpoint_id: req.endpoint_id,
watcher: req.watcher,
control_handle,
})
}
0x79e435f04eb8d342 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = StackControlHandle { inner: this.inner.clone() };
Ok(StackRequest::GetQrCode {
responder: StackGetQrCodeResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x7a009a9b62d35c10 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
StackResetConfigRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StackResetConfigRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = StackControlHandle { inner: this.inner.clone() };
Ok(StackRequest::ResetConfig {
flags: req.flags,
responder: StackResetConfigResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <StackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum StackRequest {
GetPairingStateWatcher {
watcher: fidl::endpoints::ServerEnd<PairingStateWatcherMarker>,
control_handle: StackControlHandle,
},
GetSvcDirectoryWatcher {
endpoint_id: u64,
watcher: fidl::endpoints::ServerEnd<SvcDirectoryWatcherMarker>,
control_handle: StackControlHandle,
},
GetQrCode { responder: StackGetQrCodeResponder },
ResetConfig { flags: ResetConfigFlags, responder: StackResetConfigResponder },
}
impl StackRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_pairing_state_watcher(
self,
) -> Option<(fidl::endpoints::ServerEnd<PairingStateWatcherMarker>, StackControlHandle)> {
if let StackRequest::GetPairingStateWatcher { watcher, control_handle } = self {
Some((watcher, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_svc_directory_watcher(
self,
) -> Option<(u64, fidl::endpoints::ServerEnd<SvcDirectoryWatcherMarker>, StackControlHandle)>
{
if let StackRequest::GetSvcDirectoryWatcher { endpoint_id, watcher, control_handle } = self
{
Some((endpoint_id, watcher, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_qr_code(self) -> Option<(StackGetQrCodeResponder)> {
if let StackRequest::GetQrCode { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_reset_config(self) -> Option<(ResetConfigFlags, StackResetConfigResponder)> {
if let StackRequest::ResetConfig { flags, responder } = self {
Some((flags, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
StackRequest::GetPairingStateWatcher { .. } => "get_pairing_state_watcher",
StackRequest::GetSvcDirectoryWatcher { .. } => "get_svc_directory_watcher",
StackRequest::GetQrCode { .. } => "get_qr_code",
StackRequest::ResetConfig { .. } => "reset_config",
}
}
}
#[derive(Debug, Clone)]
pub struct StackControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for StackControlHandle {
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 StackControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct StackGetQrCodeResponder {
control_handle: std::mem::ManuallyDrop<StackControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for StackGetQrCodeResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for StackGetQrCodeResponder {
type ControlHandle = StackControlHandle;
fn control_handle(&self) -> &StackControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl StackGetQrCodeResponder {
pub fn send(self, mut result: Result<&QrCode, ErrorCode>) -> 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<&QrCode, ErrorCode>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<&QrCode, ErrorCode>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<StackGetQrCodeResponse, ErrorCode>>(
result.map(|qr_code| (qr_code,)),
self.tx_id,
0x79e435f04eb8d342,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct StackResetConfigResponder {
control_handle: std::mem::ManuallyDrop<StackControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for StackResetConfigResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for StackResetConfigResponder {
type ControlHandle = StackControlHandle;
fn control_handle(&self) -> &StackControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl StackResetConfigResponder {
pub fn send(self, mut result: Result<(), ErrorCode>) -> 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<(), ErrorCode>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), ErrorCode>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ErrorCode>>(
result,
self.tx_id,
0x7a009a9b62d35c10,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct StackProviderMarker;
impl fidl::endpoints::ProtocolMarker for StackProviderMarker {
type Proxy = StackProviderProxy;
type RequestStream = StackProviderRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = StackProviderSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.weave.StackProvider";
}
impl fidl::endpoints::DiscoverableProtocolMarker for StackProviderMarker {}
pub trait StackProviderProxyInterface: Send + Sync {
fn r#set_wlan_network_config_provider(
&self,
provider: fidl::endpoints::ClientEnd<WlanNetworkConfigProviderMarker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct StackProviderSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for StackProviderSynchronousProxy {
type Proxy = StackProviderProxy;
type Protocol = StackProviderMarker;
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 StackProviderSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <StackProviderMarker 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<StackProviderEvent, fidl::Error> {
StackProviderEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#set_wlan_network_config_provider(
&self,
mut provider: fidl::endpoints::ClientEnd<WlanNetworkConfigProviderMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<StackProviderSetWlanNetworkConfigProviderRequest>(
(provider,),
0x60f817738f6028b4,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct StackProviderProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for StackProviderProxy {
type Protocol = StackProviderMarker;
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 StackProviderProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <StackProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> StackProviderEventStream {
StackProviderEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#set_wlan_network_config_provider(
&self,
mut provider: fidl::endpoints::ClientEnd<WlanNetworkConfigProviderMarker>,
) -> Result<(), fidl::Error> {
StackProviderProxyInterface::r#set_wlan_network_config_provider(self, provider)
}
}
impl StackProviderProxyInterface for StackProviderProxy {
fn r#set_wlan_network_config_provider(
&self,
mut provider: fidl::endpoints::ClientEnd<WlanNetworkConfigProviderMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<StackProviderSetWlanNetworkConfigProviderRequest>(
(provider,),
0x60f817738f6028b4,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct StackProviderEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for StackProviderEventStream {}
impl futures::stream::FusedStream for StackProviderEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for StackProviderEventStream {
type Item = Result<StackProviderEvent, 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(StackProviderEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum StackProviderEvent {}
impl StackProviderEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<StackProviderEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <StackProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct StackProviderRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for StackProviderRequestStream {}
impl futures::stream::FusedStream for StackProviderRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for StackProviderRequestStream {
type Protocol = StackProviderMarker;
type ControlHandle = StackProviderControlHandle;
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 {
StackProviderControlHandle { 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 StackProviderRequestStream {
type Item = Result<StackProviderRequest, 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 StackProviderRequestStream 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 {
0x60f817738f6028b4 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
StackProviderSetWlanNetworkConfigProviderRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StackProviderSetWlanNetworkConfigProviderRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
StackProviderControlHandle { inner: this.inner.clone() };
Ok(StackProviderRequest::SetWlanNetworkConfigProvider {
provider: req.provider,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<StackProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum StackProviderRequest {
SetWlanNetworkConfigProvider {
provider: fidl::endpoints::ClientEnd<WlanNetworkConfigProviderMarker>,
control_handle: StackProviderControlHandle,
},
}
impl StackProviderRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_set_wlan_network_config_provider(
self,
) -> Option<(
fidl::endpoints::ClientEnd<WlanNetworkConfigProviderMarker>,
StackProviderControlHandle,
)> {
if let StackProviderRequest::SetWlanNetworkConfigProvider { provider, control_handle } =
self
{
Some((provider, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
StackProviderRequest::SetWlanNetworkConfigProvider { .. } => {
"set_wlan_network_config_provider"
}
}
}
}
#[derive(Debug, Clone)]
pub struct StackProviderControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for StackProviderControlHandle {
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 StackProviderControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct SvcDirectoryWatcherMarker;
impl fidl::endpoints::ProtocolMarker for SvcDirectoryWatcherMarker {
type Proxy = SvcDirectoryWatcherProxy;
type RequestStream = SvcDirectoryWatcherRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = SvcDirectoryWatcherSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) SvcDirectoryWatcher";
}
pub trait SvcDirectoryWatcherProxyInterface: Send + Sync {
type WatchServiceDirectoryResponseFut: std::future::Future<Output = Result<Vec<HostPort>, fidl::Error>>
+ Send;
fn r#watch_service_directory(&self) -> Self::WatchServiceDirectoryResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct SvcDirectoryWatcherSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for SvcDirectoryWatcherSynchronousProxy {
type Proxy = SvcDirectoryWatcherProxy;
type Protocol = SvcDirectoryWatcherMarker;
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 SvcDirectoryWatcherSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<SvcDirectoryWatcherMarker 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<SvcDirectoryWatcherEvent, fidl::Error> {
SvcDirectoryWatcherEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#watch_service_directory(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<Vec<HostPort>, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
SvcDirectoryWatcherWatchServiceDirectoryResponse,
>(
(),
0x4c1000286a01a142,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.host_port_list)
}
}
#[derive(Debug, Clone)]
pub struct SvcDirectoryWatcherProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for SvcDirectoryWatcherProxy {
type Protocol = SvcDirectoryWatcherMarker;
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 SvcDirectoryWatcherProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<SvcDirectoryWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> SvcDirectoryWatcherEventStream {
SvcDirectoryWatcherEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#watch_service_directory(
&self,
) -> fidl::client::QueryResponseFut<Vec<HostPort>, fidl::encoding::DefaultFuchsiaResourceDialect>
{
SvcDirectoryWatcherProxyInterface::r#watch_service_directory(self)
}
}
impl SvcDirectoryWatcherProxyInterface for SvcDirectoryWatcherProxy {
type WatchServiceDirectoryResponseFut = fidl::client::QueryResponseFut<
Vec<HostPort>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#watch_service_directory(&self) -> Self::WatchServiceDirectoryResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Vec<HostPort>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
SvcDirectoryWatcherWatchServiceDirectoryResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x4c1000286a01a142,
>(_buf?)?;
Ok(_response.host_port_list)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<HostPort>>(
(),
0x4c1000286a01a142,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct SvcDirectoryWatcherEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for SvcDirectoryWatcherEventStream {}
impl futures::stream::FusedStream for SvcDirectoryWatcherEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for SvcDirectoryWatcherEventStream {
type Item = Result<SvcDirectoryWatcherEvent, 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(SvcDirectoryWatcherEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum SvcDirectoryWatcherEvent {}
impl SvcDirectoryWatcherEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<SvcDirectoryWatcherEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<SvcDirectoryWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct SvcDirectoryWatcherRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for SvcDirectoryWatcherRequestStream {}
impl futures::stream::FusedStream for SvcDirectoryWatcherRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for SvcDirectoryWatcherRequestStream {
type Protocol = SvcDirectoryWatcherMarker;
type ControlHandle = SvcDirectoryWatcherControlHandle;
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 {
SvcDirectoryWatcherControlHandle { 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 SvcDirectoryWatcherRequestStream {
type Item = Result<SvcDirectoryWatcherRequest, 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 SvcDirectoryWatcherRequestStream 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 {
0x4c1000286a01a142 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = SvcDirectoryWatcherControlHandle {
inner: this.inner.clone(),
};
Ok(SvcDirectoryWatcherRequest::WatchServiceDirectory {
responder: SvcDirectoryWatcherWatchServiceDirectoryResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <SvcDirectoryWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum SvcDirectoryWatcherRequest {
WatchServiceDirectory { responder: SvcDirectoryWatcherWatchServiceDirectoryResponder },
}
impl SvcDirectoryWatcherRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_watch_service_directory(
self,
) -> Option<(SvcDirectoryWatcherWatchServiceDirectoryResponder)> {
if let SvcDirectoryWatcherRequest::WatchServiceDirectory { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
SvcDirectoryWatcherRequest::WatchServiceDirectory { .. } => "watch_service_directory",
}
}
}
#[derive(Debug, Clone)]
pub struct SvcDirectoryWatcherControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for SvcDirectoryWatcherControlHandle {
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 SvcDirectoryWatcherControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct SvcDirectoryWatcherWatchServiceDirectoryResponder {
control_handle: std::mem::ManuallyDrop<SvcDirectoryWatcherControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for SvcDirectoryWatcherWatchServiceDirectoryResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for SvcDirectoryWatcherWatchServiceDirectoryResponder {
type ControlHandle = SvcDirectoryWatcherControlHandle;
fn control_handle(&self) -> &SvcDirectoryWatcherControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl SvcDirectoryWatcherWatchServiceDirectoryResponder {
pub fn send(self, mut host_port_list: &[HostPort]) -> Result<(), fidl::Error> {
let _result = self.send_raw(host_port_list);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut host_port_list: &[HostPort],
) -> Result<(), fidl::Error> {
let _result = self.send_raw(host_port_list);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut host_port_list: &[HostPort]) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<SvcDirectoryWatcherWatchServiceDirectoryResponse>(
(host_port_list,),
self.tx_id,
0x4c1000286a01a142,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct WlanNetworkConfigProviderMarker;
impl fidl::endpoints::ProtocolMarker for WlanNetworkConfigProviderMarker {
type Proxy = WlanNetworkConfigProviderProxy;
type RequestStream = WlanNetworkConfigProviderRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = WlanNetworkConfigProviderSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) WlanNetworkConfigProvider";
}
pub trait WlanNetworkConfigProviderProxyInterface: Send + Sync {
type WatchConnectedNetworkResponseFut: std::future::Future<Output = Result<fidl_fuchsia_wlan_policy::NetworkConfig, fidl::Error>>
+ Send;
fn r#watch_connected_network(&self) -> Self::WatchConnectedNetworkResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct WlanNetworkConfigProviderSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for WlanNetworkConfigProviderSynchronousProxy {
type Proxy = WlanNetworkConfigProviderProxy;
type Protocol = WlanNetworkConfigProviderMarker;
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 WlanNetworkConfigProviderSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<WlanNetworkConfigProviderMarker 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<WlanNetworkConfigProviderEvent, fidl::Error> {
WlanNetworkConfigProviderEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#watch_connected_network(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<fidl_fuchsia_wlan_policy::NetworkConfig, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
WlanNetworkConfigProviderWatchConnectedNetworkResponse,
>(
(),
0x966c5bf4d6dfce1,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.network_config)
}
}
#[derive(Debug, Clone)]
pub struct WlanNetworkConfigProviderProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for WlanNetworkConfigProviderProxy {
type Protocol = WlanNetworkConfigProviderMarker;
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 WlanNetworkConfigProviderProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<WlanNetworkConfigProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> WlanNetworkConfigProviderEventStream {
WlanNetworkConfigProviderEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#watch_connected_network(
&self,
) -> fidl::client::QueryResponseFut<
fidl_fuchsia_wlan_policy::NetworkConfig,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
WlanNetworkConfigProviderProxyInterface::r#watch_connected_network(self)
}
}
impl WlanNetworkConfigProviderProxyInterface for WlanNetworkConfigProviderProxy {
type WatchConnectedNetworkResponseFut = fidl::client::QueryResponseFut<
fidl_fuchsia_wlan_policy::NetworkConfig,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#watch_connected_network(&self) -> Self::WatchConnectedNetworkResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<fidl_fuchsia_wlan_policy::NetworkConfig, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
WlanNetworkConfigProviderWatchConnectedNetworkResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x966c5bf4d6dfce1,
>(_buf?)?;
Ok(_response.network_config)
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
fidl_fuchsia_wlan_policy::NetworkConfig,
>(
(),
0x966c5bf4d6dfce1,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct WlanNetworkConfigProviderEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for WlanNetworkConfigProviderEventStream {}
impl futures::stream::FusedStream for WlanNetworkConfigProviderEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for WlanNetworkConfigProviderEventStream {
type Item = Result<WlanNetworkConfigProviderEvent, 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(WlanNetworkConfigProviderEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum WlanNetworkConfigProviderEvent {}
impl WlanNetworkConfigProviderEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<WlanNetworkConfigProviderEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<WlanNetworkConfigProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct WlanNetworkConfigProviderRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for WlanNetworkConfigProviderRequestStream {}
impl futures::stream::FusedStream for WlanNetworkConfigProviderRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for WlanNetworkConfigProviderRequestStream {
type Protocol = WlanNetworkConfigProviderMarker;
type ControlHandle = WlanNetworkConfigProviderControlHandle;
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 {
WlanNetworkConfigProviderControlHandle { 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 WlanNetworkConfigProviderRequestStream {
type Item = Result<WlanNetworkConfigProviderRequest, 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 WlanNetworkConfigProviderRequestStream 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 {
0x966c5bf4d6dfce1 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = WlanNetworkConfigProviderControlHandle {
inner: this.inner.clone(),
};
Ok(WlanNetworkConfigProviderRequest::WatchConnectedNetwork {
responder: WlanNetworkConfigProviderWatchConnectedNetworkResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <WlanNetworkConfigProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum WlanNetworkConfigProviderRequest {
WatchConnectedNetwork { responder: WlanNetworkConfigProviderWatchConnectedNetworkResponder },
}
impl WlanNetworkConfigProviderRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_watch_connected_network(
self,
) -> Option<(WlanNetworkConfigProviderWatchConnectedNetworkResponder)> {
if let WlanNetworkConfigProviderRequest::WatchConnectedNetwork { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
WlanNetworkConfigProviderRequest::WatchConnectedNetwork { .. } => {
"watch_connected_network"
}
}
}
}
#[derive(Debug, Clone)]
pub struct WlanNetworkConfigProviderControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for WlanNetworkConfigProviderControlHandle {
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 WlanNetworkConfigProviderControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct WlanNetworkConfigProviderWatchConnectedNetworkResponder {
control_handle: std::mem::ManuallyDrop<WlanNetworkConfigProviderControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for WlanNetworkConfigProviderWatchConnectedNetworkResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for WlanNetworkConfigProviderWatchConnectedNetworkResponder {
type ControlHandle = WlanNetworkConfigProviderControlHandle;
fn control_handle(&self) -> &WlanNetworkConfigProviderControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl WlanNetworkConfigProviderWatchConnectedNetworkResponder {
pub fn send(
self,
mut network_config: &fidl_fuchsia_wlan_policy::NetworkConfig,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(network_config);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut network_config: &fidl_fuchsia_wlan_policy::NetworkConfig,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(network_config);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut network_config: &fidl_fuchsia_wlan_policy::NetworkConfig,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<WlanNetworkConfigProviderWatchConnectedNetworkResponse>(
(network_config,),
self.tx_id,
0x966c5bf4d6dfce1,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for ResetConfigFlags {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
2
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
2
}
}
impl fidl::encoding::ValueTypeMarker for ResetConfigFlags {
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 ResetConfigFlags
{
#[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);
if self.bits() & Self::all().bits() != self.bits() {
return Err(fidl::Error::InvalidBitsValue);
}
encoder.write_num(self.bits(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ResetConfigFlags {
#[inline(always)]
fn new_empty() -> Self {
Self::empty()
}
#[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::<u16>(offset);
*self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ErrorCode {
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 {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for ErrorCode {
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 ErrorCode {
#[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 ErrorCode {
#[inline(always)]
fn new_empty() -> Self {
Self::FileNotFound
}
#[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(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for BootstrapImportWeaveConfigRequest {
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::TypeMarker for BootstrapImportWeaveConfigRequest {
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
fidl::encoding::Encode<
BootstrapImportWeaveConfigRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut BootstrapImportWeaveConfigRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BootstrapImportWeaveConfigRequest>(offset);
fidl::encoding::Encode::<
BootstrapImportWeaveConfigRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.config_json,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl_fuchsia_mem::Buffer,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
BootstrapImportWeaveConfigRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BootstrapImportWeaveConfigRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for BootstrapImportWeaveConfigRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
config_json: fidl::new_empty!(
fidl_fuchsia_mem::Buffer,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_mem::Buffer,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.config_json,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for FactoryDataManagerGetPairingCodeResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for FactoryDataManagerGetPairingCodeResponse {
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<FactoryDataManagerGetPairingCodeResponse, D>
for &FactoryDataManagerGetPairingCodeResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FactoryDataManagerGetPairingCodeResponse>(offset);
fidl::encoding::Encode::<FactoryDataManagerGetPairingCodeResponse, D>::encode(
(<fidl::encoding::Vector<u8, 16> as fidl::encoding::ValueTypeMarker>::borrow(
&self.pairing_code,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 16>, D>,
> fidl::encoding::Encode<FactoryDataManagerGetPairingCodeResponse, 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::<FactoryDataManagerGetPairingCodeResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for FactoryDataManagerGetPairingCodeResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { pairing_code: fidl::new_empty!(fidl::encoding::Vector<u8, 16>, 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::Vector<u8, 16>, D, &mut self.pairing_code, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for FactoryDataManagerGetWeaveCertificateResponse {
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::TypeMarker for FactoryDataManagerGetWeaveCertificateResponse {
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
fidl::encoding::Encode<
FactoryDataManagerGetWeaveCertificateResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut FactoryDataManagerGetWeaveCertificateResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FactoryDataManagerGetWeaveCertificateResponse>(offset);
fidl::encoding::Encode::<
FactoryDataManagerGetWeaveCertificateResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.certificate,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl_fuchsia_mem::Buffer,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
FactoryDataManagerGetWeaveCertificateResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FactoryDataManagerGetWeaveCertificateResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for FactoryDataManagerGetWeaveCertificateResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
certificate: fidl::new_empty!(
fidl_fuchsia_mem::Buffer,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_mem::Buffer,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.certificate,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for HostPort {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HostPort {
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<HostPort, D> for &HostPort {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostPort>(offset);
fidl::encoding::Encode::<HostPort, D>::encode(
(
<Host as fidl::encoding::ValueTypeMarker>::borrow(&self.host),
<u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.port),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<Host, D>,
T1: fidl::encoding::Encode<u16, D>,
> fidl::encoding::Encode<HostPort, 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::<HostPort>(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 HostPort {
#[inline(always)]
fn new_empty() -> Self {
Self { host: fidl::new_empty!(Host, D), port: fidl::new_empty!(u16, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffff0000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(Host, D, &mut self.host, decoder, offset + 0, _depth)?;
fidl::decode!(u16, D, &mut self.port, decoder, offset + 16, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PairingStateWatcherWatchPairingStateResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PairingStateWatcherWatchPairingStateResponse {
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<PairingStateWatcherWatchPairingStateResponse, D>
for &PairingStateWatcherWatchPairingStateResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PairingStateWatcherWatchPairingStateResponse>(offset);
fidl::encoding::Encode::<PairingStateWatcherWatchPairingStateResponse, D>::encode(
(<PairingState as fidl::encoding::ValueTypeMarker>::borrow(&self.state),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PairingState, D>>
fidl::encoding::Encode<PairingStateWatcherWatchPairingStateResponse, 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::<PairingStateWatcherWatchPairingStateResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PairingStateWatcherWatchPairingStateResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { state: fidl::new_empty!(PairingState, 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!(PairingState, D, &mut self.state, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ProvisionerGenerateKeyPairResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ProvisionerGenerateKeyPairResponse {
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<ProvisionerGenerateKeyPairResponse, D>
for &ProvisionerGenerateKeyPairResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProvisionerGenerateKeyPairResponse>(offset);
fidl::encoding::Encode::<ProvisionerGenerateKeyPairResponse, D>::encode(
(
<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.wrapped_private_key),
<fidl::encoding::Vector<u8, 65> as fidl::encoding::ValueTypeMarker>::borrow(&self.public_key),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
T1: fidl::encoding::Encode<fidl::encoding::Vector<u8, 65>, D>,
> fidl::encoding::Encode<ProvisionerGenerateKeyPairResponse, 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::<ProvisionerGenerateKeyPairResponse>(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 ProvisionerGenerateKeyPairResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
wrapped_private_key: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
public_key: fidl::new_empty!(fidl::encoding::Vector<u8, 65>, 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.wrapped_private_key,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(fidl::encoding::Vector<u8, 65>, D, &mut self.public_key, decoder, offset + 16, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for QrCode {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for QrCode {
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<QrCode, D> for &QrCode {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<QrCode>(offset);
fidl::encoding::Encode::<QrCode, D>::encode(
(<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
&self.data,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
> fidl::encoding::Encode<QrCode, 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::<QrCode>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for QrCode {
#[inline(always)]
fn new_empty() -> Self {
Self { data: fidl::new_empty!(fidl::encoding::BoundedString<256>, 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::BoundedString<256>,
D,
&mut self.data,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SignerSignHashRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SignerSignHashRequest {
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<SignerSignHashRequest, D>
for &SignerSignHashRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SignerSignHashRequest>(offset);
fidl::encoding::Encode::<SignerSignHashRequest, D>::encode(
(<fidl::encoding::Vector<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow(
&self.hash,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 32>, D>,
> fidl::encoding::Encode<SignerSignHashRequest, 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::<SignerSignHashRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SignerSignHashRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { hash: fidl::new_empty!(fidl::encoding::Vector<u8, 32>, 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::Vector<u8, 32>, D, &mut self.hash, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SignerSignHashWithPrivateKeyRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SignerSignHashWithPrivateKeyRequest {
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<SignerSignHashWithPrivateKeyRequest, D>
for &SignerSignHashWithPrivateKeyRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SignerSignHashWithPrivateKeyRequest>(offset);
fidl::encoding::Encode::<SignerSignHashWithPrivateKeyRequest, D>::encode(
(
<fidl::encoding::Vector<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow(&self.hash),
<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.wrapped_private_key),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 32>, D>,
T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
> fidl::encoding::Encode<SignerSignHashWithPrivateKeyRequest, 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::<SignerSignHashWithPrivateKeyRequest>(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 SignerSignHashWithPrivateKeyRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
hash: fidl::new_empty!(fidl::encoding::Vector<u8, 32>, D),
wrapped_private_key: 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::Vector<u8, 32>, D, &mut self.hash, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::UnboundedVector<u8>,
D,
&mut self.wrapped_private_key,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SignerSignHashWithPrivateKeyResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SignerSignHashWithPrivateKeyResponse {
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<SignerSignHashWithPrivateKeyResponse, D>
for &SignerSignHashWithPrivateKeyResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SignerSignHashWithPrivateKeyResponse>(offset);
fidl::encoding::Encode::<SignerSignHashWithPrivateKeyResponse, D>::encode(
(<fidl::encoding::Vector<u8, 139> as fidl::encoding::ValueTypeMarker>::borrow(
&self.signature,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 139>, D>,
> fidl::encoding::Encode<SignerSignHashWithPrivateKeyResponse, 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::<SignerSignHashWithPrivateKeyResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for SignerSignHashWithPrivateKeyResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { signature: fidl::new_empty!(fidl::encoding::Vector<u8, 139>, 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::Vector<u8, 139>, D, &mut self.signature, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SignerSignHashResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SignerSignHashResponse {
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<SignerSignHashResponse, D> for &SignerSignHashResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SignerSignHashResponse>(offset);
fidl::encoding::Encode::<SignerSignHashResponse, D>::encode(
(<fidl::encoding::Vector<u8, 139> as fidl::encoding::ValueTypeMarker>::borrow(
&self.signature,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 139>, D>,
> fidl::encoding::Encode<SignerSignHashResponse, 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::<SignerSignHashResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for SignerSignHashResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { signature: fidl::new_empty!(fidl::encoding::Vector<u8, 139>, 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::Vector<u8, 139>, D, &mut self.signature, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for StackGetPairingStateWatcherRequest {
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::TypeMarker for StackGetPairingStateWatcherRequest {
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
fidl::encoding::Encode<
StackGetPairingStateWatcherRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut StackGetPairingStateWatcherRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StackGetPairingStateWatcherRequest>(offset);
fidl::encoding::Encode::<StackGetPairingStateWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PairingStateWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PairingStateWatcherMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
StackGetPairingStateWatcherRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StackGetPairingStateWatcherRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for StackGetPairingStateWatcherRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
watcher: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PairingStateWatcherMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PairingStateWatcherMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.watcher,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for StackGetSvcDirectoryWatcherRequest {
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::TypeMarker for StackGetSvcDirectoryWatcherRequest {
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
fidl::encoding::Encode<
StackGetSvcDirectoryWatcherRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut StackGetSvcDirectoryWatcherRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StackGetSvcDirectoryWatcherRequest>(offset);
fidl::encoding::Encode::<StackGetSvcDirectoryWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.endpoint_id),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SvcDirectoryWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SvcDirectoryWatcherMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
StackGetSvcDirectoryWatcherRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StackGetSvcDirectoryWatcherRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for StackGetSvcDirectoryWatcherRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
endpoint_id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
watcher: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SvcDirectoryWatcherMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
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 + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
u64,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.endpoint_id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SvcDirectoryWatcherMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.watcher,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for StackProviderSetWlanNetworkConfigProviderRequest {
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::TypeMarker for StackProviderSetWlanNetworkConfigProviderRequest {
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
fidl::encoding::Encode<
StackProviderSetWlanNetworkConfigProviderRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut StackProviderSetWlanNetworkConfigProviderRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StackProviderSetWlanNetworkConfigProviderRequest>(offset);
fidl::encoding::Encode::<
StackProviderSetWlanNetworkConfigProviderRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<WlanNetworkConfigProviderMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.provider
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<WlanNetworkConfigProviderMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
StackProviderSetWlanNetworkConfigProviderRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StackProviderSetWlanNetworkConfigProviderRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for StackProviderSetWlanNetworkConfigProviderRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
provider: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<WlanNetworkConfigProviderMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<WlanNetworkConfigProviderMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.provider,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for StackResetConfigRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for StackResetConfigRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
2
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
2
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<StackResetConfigRequest, D> for &StackResetConfigRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StackResetConfigRequest>(offset);
fidl::encoding::Encode::<StackResetConfigRequest, D>::encode(
(<ResetConfigFlags as fidl::encoding::ValueTypeMarker>::borrow(&self.flags),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<ResetConfigFlags, D>>
fidl::encoding::Encode<StackResetConfigRequest, 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::<StackResetConfigRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for StackResetConfigRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { flags: fidl::new_empty!(ResetConfigFlags, 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!(ResetConfigFlags, D, &mut self.flags, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for StackGetQrCodeResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for StackGetQrCodeResponse {
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<StackGetQrCodeResponse, D> for &StackGetQrCodeResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StackGetQrCodeResponse>(offset);
fidl::encoding::Encode::<StackGetQrCodeResponse, D>::encode(
(<QrCode as fidl::encoding::ValueTypeMarker>::borrow(&self.qr_code),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<QrCode, D>>
fidl::encoding::Encode<StackGetQrCodeResponse, 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::<StackGetQrCodeResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for StackGetQrCodeResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { qr_code: fidl::new_empty!(QrCode, 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!(QrCode, D, &mut self.qr_code, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SvcDirectoryWatcherWatchServiceDirectoryResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SvcDirectoryWatcherWatchServiceDirectoryResponse {
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<SvcDirectoryWatcherWatchServiceDirectoryResponse, D>
for &SvcDirectoryWatcherWatchServiceDirectoryResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SvcDirectoryWatcherWatchServiceDirectoryResponse>(offset);
fidl::encoding::Encode::<SvcDirectoryWatcherWatchServiceDirectoryResponse, D>::encode(
(
<fidl::encoding::Vector<HostPort, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.host_port_list),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<HostPort, 256>, D>,
> fidl::encoding::Encode<SvcDirectoryWatcherWatchServiceDirectoryResponse, 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::<SvcDirectoryWatcherWatchServiceDirectoryResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for SvcDirectoryWatcherWatchServiceDirectoryResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { host_port_list: fidl::new_empty!(fidl::encoding::Vector<HostPort, 256>, 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::Vector<HostPort, 256>, D, &mut self.host_port_list, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for WlanNetworkConfigProviderWatchConnectedNetworkResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for WlanNetworkConfigProviderWatchConnectedNetworkResponse {
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<WlanNetworkConfigProviderWatchConnectedNetworkResponse, D>
for &WlanNetworkConfigProviderWatchConnectedNetworkResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<WlanNetworkConfigProviderWatchConnectedNetworkResponse>(
offset,
);
fidl::encoding::Encode::<WlanNetworkConfigProviderWatchConnectedNetworkResponse, D>::encode(
(
<fidl_fuchsia_wlan_policy::NetworkConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.network_config),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_wlan_policy::NetworkConfig, D>,
> fidl::encoding::Encode<WlanNetworkConfigProviderWatchConnectedNetworkResponse, 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::<WlanNetworkConfigProviderWatchConnectedNetworkResponse>(
offset,
);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for WlanNetworkConfigProviderWatchConnectedNetworkResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { network_config: fidl::new_empty!(fidl_fuchsia_wlan_policy::NetworkConfig, 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_fuchsia_wlan_policy::NetworkConfig,
D,
&mut self.network_config,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl PairingState {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.is_service_provisioned {
return 5;
}
if let Some(_) = self.is_fabric_provisioned {
return 4;
}
if let Some(_) = self.is_thread_provisioned {
return 3;
}
if let Some(_) = self.is_wlan_provisioned {
return 2;
}
if let Some(_) = self.is_weave_fully_provisioned {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for PairingState {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PairingState {
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<PairingState, D>
for &PairingState
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PairingState>(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 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.is_weave_fully_provisioned
.as_ref()
.map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
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::<bool, D>(
self.is_wlan_provisioned
.as_ref()
.map(<bool 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::<bool, D>(
self.is_thread_provisioned
.as_ref()
.map(<bool 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::<bool, D>(
self.is_fabric_provisioned
.as_ref()
.map(<bool 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::<bool, D>(
self.is_service_provisioned
.as_ref()
.map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PairingState {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
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);
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 < 1 {
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 =
<bool 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
.is_weave_fully_provisioned
.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, 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 < 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 =
<bool 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.is_wlan_provisioned.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, 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 =
<bool 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.is_thread_provisioned.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, 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 =
<bool 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.is_fabric_provisioned.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, 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 =
<bool 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.is_service_provisioned.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, 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(())
}
}
impl fidl::encoding::ValueTypeMarker for Host {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Host {
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<Host, D> for &Host {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Host>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
Host::Hostname(ref val) => fidl::encoding::encode_in_envelope::<
fidl::encoding::BoundedString<255>,
D,
>(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
val,
),
encoder,
offset + 8,
_depth,
),
Host::IpAddress(ref val) => fidl::encoding::encode_in_envelope::<
fidl_fuchsia_net::IpAddress,
D,
>(
<fidl_fuchsia_net::IpAddress as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Host {
#[inline(always)]
fn new_empty() -> Self {
Self::Hostname(fidl::new_empty!(fidl::encoding::BoundedString<255>, 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::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
)
}
2 => <fidl_fuchsia_net::IpAddress 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 Host::Hostname(_) = self {
} else {
*self =
Host::Hostname(fidl::new_empty!(fidl::encoding::BoundedString<255>, D));
}
#[allow(irrefutable_let_patterns)]
if let Host::Hostname(ref mut val) = self {
fidl::decode!(
fidl::encoding::BoundedString<255>,
D,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let Host::IpAddress(_) = self {
} else {
*self = Host::IpAddress(fidl::new_empty!(fidl_fuchsia_net::IpAddress, D));
}
#[allow(irrefutable_let_patterns)]
if let Host::IpAddress(ref mut val) = self {
fidl::decode!(
fidl_fuchsia_net::IpAddress,
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(())
}
}
}