#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use bitflags::bitflags;
use fidl::client::QueryResponseFut;
use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
use fidl::endpoints::{ControlHandle as _, Responder as _};
use futures::future::{self, MaybeDone, TryFutureExt};
use zx_status;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum NetworkRegistryAddError {
MissingNetworkId,
MissingNetworkInfo,
MissingNetworkDnsServers,
DuplicateNetworkId,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u32 },
}
#[macro_export]
macro_rules! NetworkRegistryAddErrorUnknown {
() => {
_
};
}
impl NetworkRegistryAddError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::MissingNetworkId),
2 => Some(Self::MissingNetworkInfo),
3 => Some(Self::MissingNetworkDnsServers),
4 => Some(Self::DuplicateNetworkId),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::MissingNetworkId,
2 => Self::MissingNetworkInfo,
3 => Self::MissingNetworkDnsServers,
4 => Self::DuplicateNetworkId,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::MissingNetworkId => 1,
Self::MissingNetworkInfo => 2,
Self::MissingNetworkDnsServers => 3,
Self::DuplicateNetworkId => 4,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum NetworkRegistryRemoveError {
NotFound,
CannotRemoveDefaultNetwork,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u32 },
}
#[macro_export]
macro_rules! NetworkRegistryRemoveErrorUnknown {
() => {
_
};
}
impl NetworkRegistryRemoveError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::NotFound),
2 => Some(Self::CannotRemoveDefaultNetwork),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::NotFound,
2 => Self::CannotRemoveDefaultNetwork,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::NotFound => 1,
Self::CannotRemoveDefaultNetwork => 2,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum NetworkRegistrySetDefaultError {
NotFound,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u32 },
}
#[macro_export]
macro_rules! NetworkRegistrySetDefaultErrorUnknown {
() => {
_
};
}
impl NetworkRegistrySetDefaultError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::NotFound),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::NotFound,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::NotFound => 1,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum NetworkRegistryUpdateError {
MissingNetworkId,
MissingNetworkInfo,
MissingNetworkDnsServers,
NotFound,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u32 },
}
#[macro_export]
macro_rules! NetworkRegistryUpdateErrorUnknown {
() => {
_
};
}
impl NetworkRegistryUpdateError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::MissingNetworkId),
2 => Some(Self::MissingNetworkInfo),
3 => Some(Self::MissingNetworkDnsServers),
4 => Some(Self::NotFound),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::MissingNetworkId,
2 => Self::MissingNetworkInfo,
3 => Self::MissingNetworkDnsServers,
4 => Self::NotFound,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::MissingNetworkId => 1,
Self::MissingNetworkInfo => 2,
Self::MissingNetworkDnsServers => 3,
Self::NotFound => 4,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Clone, Debug, PartialEq)]
pub struct DnsServerWatcherWatchServersResponse {
pub servers: Vec<DnsServerList>,
}
impl fidl::Persistable for DnsServerWatcherWatchServersResponse {}
#[derive(Clone, Debug, PartialEq)]
pub struct NetworkRegistryAddRequest {
pub network: Network,
}
impl fidl::Persistable for NetworkRegistryAddRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct NetworkRegistryRemoveRequest {
pub network_id: u32,
}
impl fidl::Persistable for NetworkRegistryRemoveRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct NetworkRegistrySetDefaultRequest {
pub network_id: fidl_fuchsia_posix_socket::OptionalUint32,
}
impl fidl::Persistable for NetworkRegistrySetDefaultRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct NetworkRegistryUpdateRequest {
pub network: Network,
}
impl fidl::Persistable for NetworkRegistryUpdateRequest {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct DnsServerList {
pub addresses: Option<Vec<fidl_fuchsia_net::SocketAddress>>,
pub source_network_id: Option<u32>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for DnsServerList {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct Network {
pub network_id: Option<u32>,
pub info: Option<NetworkInfo>,
pub dns_servers: Option<NetworkDnsServers>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for Network {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct NetworkDnsServers {
pub v4: Option<Vec<fidl_fuchsia_net::Ipv4Address>>,
pub v6: Option<Vec<fidl_fuchsia_net::Ipv6Address>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for NetworkDnsServers {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct StarnixNetworkInfo {
pub mark: Option<u32>,
pub handle: Option<u64>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for StarnixNetworkInfo {}
#[derive(Clone, Debug)]
pub enum NetworkInfo {
Starnix(StarnixNetworkInfo),
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u64 },
}
#[macro_export]
macro_rules! NetworkInfoUnknown {
() => {
_
};
}
impl PartialEq for NetworkInfo {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Starnix(x), Self::Starnix(y)) => *x == *y,
_ => false,
}
}
}
impl NetworkInfo {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Starnix(_) => 1,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn unknown_variant_for_testing() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { .. } => true,
_ => false,
}
}
}
impl fidl::Persistable for NetworkInfo {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct DnsServerWatcherMarker;
impl fidl::endpoints::ProtocolMarker for DnsServerWatcherMarker {
type Proxy = DnsServerWatcherProxy;
type RequestStream = DnsServerWatcherRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = DnsServerWatcherSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.netpol.socketproxy.DnsServerWatcher";
}
impl fidl::endpoints::DiscoverableProtocolMarker for DnsServerWatcherMarker {}
pub trait DnsServerWatcherProxyInterface: Send + Sync {
type WatchServersResponseFut: std::future::Future<Output = Result<Vec<DnsServerList>, fidl::Error>>
+ Send;
fn r#watch_servers(&self) -> Self::WatchServersResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct DnsServerWatcherSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for DnsServerWatcherSynchronousProxy {
type Proxy = DnsServerWatcherProxy;
type Protocol = DnsServerWatcherMarker;
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 DnsServerWatcherSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <DnsServerWatcherMarker 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<DnsServerWatcherEvent, fidl::Error> {
DnsServerWatcherEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#watch_servers(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<Vec<DnsServerList>, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, DnsServerWatcherWatchServersResponse>(
(),
0x6dce6139f108b7ac,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.servers)
}
}
#[derive(Debug, Clone)]
pub struct DnsServerWatcherProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for DnsServerWatcherProxy {
type Protocol = DnsServerWatcherMarker;
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 DnsServerWatcherProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <DnsServerWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> DnsServerWatcherEventStream {
DnsServerWatcherEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#watch_servers(
&self,
) -> fidl::client::QueryResponseFut<
Vec<DnsServerList>,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
DnsServerWatcherProxyInterface::r#watch_servers(self)
}
}
impl DnsServerWatcherProxyInterface for DnsServerWatcherProxy {
type WatchServersResponseFut = fidl::client::QueryResponseFut<
Vec<DnsServerList>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#watch_servers(&self) -> Self::WatchServersResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Vec<DnsServerList>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
DnsServerWatcherWatchServersResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x6dce6139f108b7ac,
>(_buf?)?;
Ok(_response.servers)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<DnsServerList>>(
(),
0x6dce6139f108b7ac,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct DnsServerWatcherEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for DnsServerWatcherEventStream {}
impl futures::stream::FusedStream for DnsServerWatcherEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for DnsServerWatcherEventStream {
type Item = Result<DnsServerWatcherEvent, 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(DnsServerWatcherEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum DnsServerWatcherEvent {}
impl DnsServerWatcherEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<DnsServerWatcherEvent, 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:
<DnsServerWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct DnsServerWatcherRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for DnsServerWatcherRequestStream {}
impl futures::stream::FusedStream for DnsServerWatcherRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for DnsServerWatcherRequestStream {
type Protocol = DnsServerWatcherMarker;
type ControlHandle = DnsServerWatcherControlHandle;
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 {
DnsServerWatcherControlHandle { 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 DnsServerWatcherRequestStream {
type Item = Result<DnsServerWatcherRequest, 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 DnsServerWatcherRequestStream 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 {
0x6dce6139f108b7ac => {
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 =
DnsServerWatcherControlHandle { inner: this.inner.clone() };
Ok(DnsServerWatcherRequest::WatchServers {
responder: DnsServerWatcherWatchServersResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<DnsServerWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum DnsServerWatcherRequest {
WatchServers { responder: DnsServerWatcherWatchServersResponder },
}
impl DnsServerWatcherRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_watch_servers(self) -> Option<(DnsServerWatcherWatchServersResponder)> {
if let DnsServerWatcherRequest::WatchServers { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
DnsServerWatcherRequest::WatchServers { .. } => "watch_servers",
}
}
}
#[derive(Debug, Clone)]
pub struct DnsServerWatcherControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for DnsServerWatcherControlHandle {
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 DnsServerWatcherControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DnsServerWatcherWatchServersResponder {
control_handle: std::mem::ManuallyDrop<DnsServerWatcherControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DnsServerWatcherWatchServersResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DnsServerWatcherWatchServersResponder {
type ControlHandle = DnsServerWatcherControlHandle;
fn control_handle(&self) -> &DnsServerWatcherControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DnsServerWatcherWatchServersResponder {
pub fn send(self, mut servers: &[DnsServerList]) -> Result<(), fidl::Error> {
let _result = self.send_raw(servers);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut servers: &[DnsServerList]) -> Result<(), fidl::Error> {
let _result = self.send_raw(servers);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut servers: &[DnsServerList]) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<DnsServerWatcherWatchServersResponse>(
(servers,),
self.tx_id,
0x6dce6139f108b7ac,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct NetworkRegistryMarker;
impl fidl::endpoints::ProtocolMarker for NetworkRegistryMarker {
type Proxy = NetworkRegistryProxy;
type RequestStream = NetworkRegistryRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = NetworkRegistrySynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) NetworkRegistry";
}
pub type NetworkRegistrySetDefaultResult = Result<(), NetworkRegistrySetDefaultError>;
pub type NetworkRegistryAddResult = Result<(), NetworkRegistryAddError>;
pub type NetworkRegistryUpdateResult = Result<(), NetworkRegistryUpdateError>;
pub type NetworkRegistryRemoveResult = Result<(), NetworkRegistryRemoveError>;
pub trait NetworkRegistryProxyInterface: Send + Sync {
type SetDefaultResponseFut: std::future::Future<Output = Result<NetworkRegistrySetDefaultResult, fidl::Error>>
+ Send;
fn r#set_default(
&self,
network_id: &fidl_fuchsia_posix_socket::OptionalUint32,
) -> Self::SetDefaultResponseFut;
type AddResponseFut: std::future::Future<Output = Result<NetworkRegistryAddResult, fidl::Error>>
+ Send;
fn r#add(&self, network: &Network) -> Self::AddResponseFut;
type UpdateResponseFut: std::future::Future<Output = Result<NetworkRegistryUpdateResult, fidl::Error>>
+ Send;
fn r#update(&self, network: &Network) -> Self::UpdateResponseFut;
type RemoveResponseFut: std::future::Future<Output = Result<NetworkRegistryRemoveResult, fidl::Error>>
+ Send;
fn r#remove(&self, network_id: u32) -> Self::RemoveResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct NetworkRegistrySynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for NetworkRegistrySynchronousProxy {
type Proxy = NetworkRegistryProxy;
type Protocol = NetworkRegistryMarker;
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 NetworkRegistrySynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <NetworkRegistryMarker 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<NetworkRegistryEvent, fidl::Error> {
NetworkRegistryEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#set_default(
&self,
mut network_id: &fidl_fuchsia_posix_socket::OptionalUint32,
___deadline: zx::MonotonicInstant,
) -> Result<NetworkRegistrySetDefaultResult, fidl::Error> {
let _response =
self.client.send_query::<NetworkRegistrySetDefaultRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
NetworkRegistrySetDefaultError,
>>(
(network_id,),
0x59a90d7826a7f342,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#add(
&self,
mut network: &Network,
___deadline: zx::MonotonicInstant,
) -> Result<NetworkRegistryAddResult, fidl::Error> {
let _response =
self.client.send_query::<NetworkRegistryAddRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
NetworkRegistryAddError,
>>(
(network,),
0x4a988855b0fa4f7b,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#update(
&self,
mut network: &Network,
___deadline: zx::MonotonicInstant,
) -> Result<NetworkRegistryUpdateResult, fidl::Error> {
let _response =
self.client.send_query::<NetworkRegistryUpdateRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
NetworkRegistryUpdateError,
>>(
(network,),
0x460479796e3eadfe,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#remove(
&self,
mut network_id: u32,
___deadline: zx::MonotonicInstant,
) -> Result<NetworkRegistryRemoveResult, fidl::Error> {
let _response =
self.client.send_query::<NetworkRegistryRemoveRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
NetworkRegistryRemoveError,
>>(
(network_id,),
0xe62f98532295a85,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct NetworkRegistryProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for NetworkRegistryProxy {
type Protocol = NetworkRegistryMarker;
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 NetworkRegistryProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <NetworkRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> NetworkRegistryEventStream {
NetworkRegistryEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#set_default(
&self,
mut network_id: &fidl_fuchsia_posix_socket::OptionalUint32,
) -> fidl::client::QueryResponseFut<
NetworkRegistrySetDefaultResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
NetworkRegistryProxyInterface::r#set_default(self, network_id)
}
pub fn r#add(
&self,
mut network: &Network,
) -> fidl::client::QueryResponseFut<
NetworkRegistryAddResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
NetworkRegistryProxyInterface::r#add(self, network)
}
pub fn r#update(
&self,
mut network: &Network,
) -> fidl::client::QueryResponseFut<
NetworkRegistryUpdateResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
NetworkRegistryProxyInterface::r#update(self, network)
}
pub fn r#remove(
&self,
mut network_id: u32,
) -> fidl::client::QueryResponseFut<
NetworkRegistryRemoveResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
NetworkRegistryProxyInterface::r#remove(self, network_id)
}
}
impl NetworkRegistryProxyInterface for NetworkRegistryProxy {
type SetDefaultResponseFut = fidl::client::QueryResponseFut<
NetworkRegistrySetDefaultResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#set_default(
&self,
mut network_id: &fidl_fuchsia_posix_socket::OptionalUint32,
) -> Self::SetDefaultResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<NetworkRegistrySetDefaultResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
NetworkRegistrySetDefaultError,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x59a90d7826a7f342,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
NetworkRegistrySetDefaultRequest,
NetworkRegistrySetDefaultResult,
>(
(network_id,),
0x59a90d7826a7f342,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type AddResponseFut = fidl::client::QueryResponseFut<
NetworkRegistryAddResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#add(&self, mut network: &Network) -> Self::AddResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<NetworkRegistryAddResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, NetworkRegistryAddError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x4a988855b0fa4f7b,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<NetworkRegistryAddRequest, NetworkRegistryAddResult>(
(network,),
0x4a988855b0fa4f7b,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type UpdateResponseFut = fidl::client::QueryResponseFut<
NetworkRegistryUpdateResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#update(&self, mut network: &Network) -> Self::UpdateResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<NetworkRegistryUpdateResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, NetworkRegistryUpdateError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x460479796e3eadfe,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<NetworkRegistryUpdateRequest, NetworkRegistryUpdateResult>(
(network,),
0x460479796e3eadfe,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type RemoveResponseFut = fidl::client::QueryResponseFut<
NetworkRegistryRemoveResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#remove(&self, mut network_id: u32) -> Self::RemoveResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<NetworkRegistryRemoveResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, NetworkRegistryRemoveError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0xe62f98532295a85,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<NetworkRegistryRemoveRequest, NetworkRegistryRemoveResult>(
(network_id,),
0xe62f98532295a85,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct NetworkRegistryEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for NetworkRegistryEventStream {}
impl futures::stream::FusedStream for NetworkRegistryEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for NetworkRegistryEventStream {
type Item = Result<NetworkRegistryEvent, 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(NetworkRegistryEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum NetworkRegistryEvent {}
impl NetworkRegistryEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<NetworkRegistryEvent, 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:
<NetworkRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct NetworkRegistryRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for NetworkRegistryRequestStream {}
impl futures::stream::FusedStream for NetworkRegistryRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for NetworkRegistryRequestStream {
type Protocol = NetworkRegistryMarker;
type ControlHandle = NetworkRegistryControlHandle;
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 {
NetworkRegistryControlHandle { 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 NetworkRegistryRequestStream {
type Item = Result<NetworkRegistryRequest, 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 NetworkRegistryRequestStream 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 {
0x59a90d7826a7f342 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
NetworkRegistrySetDefaultRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkRegistrySetDefaultRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
NetworkRegistryControlHandle { inner: this.inner.clone() };
Ok(NetworkRegistryRequest::SetDefault {
network_id: req.network_id,
responder: NetworkRegistrySetDefaultResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x4a988855b0fa4f7b => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
NetworkRegistryAddRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkRegistryAddRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
NetworkRegistryControlHandle { inner: this.inner.clone() };
Ok(NetworkRegistryRequest::Add {
network: req.network,
responder: NetworkRegistryAddResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x460479796e3eadfe => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
NetworkRegistryUpdateRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkRegistryUpdateRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
NetworkRegistryControlHandle { inner: this.inner.clone() };
Ok(NetworkRegistryRequest::Update {
network: req.network,
responder: NetworkRegistryUpdateResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0xe62f98532295a85 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
NetworkRegistryRemoveRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkRegistryRemoveRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
NetworkRegistryControlHandle { inner: this.inner.clone() };
Ok(NetworkRegistryRequest::Remove {
network_id: req.network_id,
responder: NetworkRegistryRemoveResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<NetworkRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum NetworkRegistryRequest {
SetDefault {
network_id: fidl_fuchsia_posix_socket::OptionalUint32,
responder: NetworkRegistrySetDefaultResponder,
},
Add { network: Network, responder: NetworkRegistryAddResponder },
Update { network: Network, responder: NetworkRegistryUpdateResponder },
Remove { network_id: u32, responder: NetworkRegistryRemoveResponder },
}
impl NetworkRegistryRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_set_default(
self,
) -> Option<(fidl_fuchsia_posix_socket::OptionalUint32, NetworkRegistrySetDefaultResponder)>
{
if let NetworkRegistryRequest::SetDefault { network_id, responder } = self {
Some((network_id, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_add(self) -> Option<(Network, NetworkRegistryAddResponder)> {
if let NetworkRegistryRequest::Add { network, responder } = self {
Some((network, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_update(self) -> Option<(Network, NetworkRegistryUpdateResponder)> {
if let NetworkRegistryRequest::Update { network, responder } = self {
Some((network, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_remove(self) -> Option<(u32, NetworkRegistryRemoveResponder)> {
if let NetworkRegistryRequest::Remove { network_id, responder } = self {
Some((network_id, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
NetworkRegistryRequest::SetDefault { .. } => "set_default",
NetworkRegistryRequest::Add { .. } => "add",
NetworkRegistryRequest::Update { .. } => "update",
NetworkRegistryRequest::Remove { .. } => "remove",
}
}
}
#[derive(Debug, Clone)]
pub struct NetworkRegistryControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for NetworkRegistryControlHandle {
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 NetworkRegistryControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct NetworkRegistrySetDefaultResponder {
control_handle: std::mem::ManuallyDrop<NetworkRegistryControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for NetworkRegistrySetDefaultResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for NetworkRegistrySetDefaultResponder {
type ControlHandle = NetworkRegistryControlHandle;
fn control_handle(&self) -> &NetworkRegistryControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl NetworkRegistrySetDefaultResponder {
pub fn send(
self,
mut result: Result<(), NetworkRegistrySetDefaultError>,
) -> 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<(), NetworkRegistrySetDefaultError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<(), NetworkRegistrySetDefaultError>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
NetworkRegistrySetDefaultError,
>>(
result,
self.tx_id,
0x59a90d7826a7f342,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct NetworkRegistryAddResponder {
control_handle: std::mem::ManuallyDrop<NetworkRegistryControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for NetworkRegistryAddResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for NetworkRegistryAddResponder {
type ControlHandle = NetworkRegistryControlHandle;
fn control_handle(&self) -> &NetworkRegistryControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl NetworkRegistryAddResponder {
pub fn send(self, mut result: Result<(), NetworkRegistryAddError>) -> 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<(), NetworkRegistryAddError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), NetworkRegistryAddError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
NetworkRegistryAddError,
>>(
result,
self.tx_id,
0x4a988855b0fa4f7b,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct NetworkRegistryUpdateResponder {
control_handle: std::mem::ManuallyDrop<NetworkRegistryControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for NetworkRegistryUpdateResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for NetworkRegistryUpdateResponder {
type ControlHandle = NetworkRegistryControlHandle;
fn control_handle(&self) -> &NetworkRegistryControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl NetworkRegistryUpdateResponder {
pub fn send(
self,
mut result: Result<(), NetworkRegistryUpdateError>,
) -> 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<(), NetworkRegistryUpdateError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<(), NetworkRegistryUpdateError>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
NetworkRegistryUpdateError,
>>(
result,
self.tx_id,
0x460479796e3eadfe,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct NetworkRegistryRemoveResponder {
control_handle: std::mem::ManuallyDrop<NetworkRegistryControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for NetworkRegistryRemoveResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for NetworkRegistryRemoveResponder {
type ControlHandle = NetworkRegistryControlHandle;
fn control_handle(&self) -> &NetworkRegistryControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl NetworkRegistryRemoveResponder {
pub fn send(
self,
mut result: Result<(), NetworkRegistryRemoveError>,
) -> 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<(), NetworkRegistryRemoveError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<(), NetworkRegistryRemoveError>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
NetworkRegistryRemoveError,
>>(
result,
self.tx_id,
0xe62f98532295a85,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct StarnixNetworksMarker;
impl fidl::endpoints::ProtocolMarker for StarnixNetworksMarker {
type Proxy = StarnixNetworksProxy;
type RequestStream = StarnixNetworksRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = StarnixNetworksSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.netpol.socketproxy.StarnixNetworks";
}
impl fidl::endpoints::DiscoverableProtocolMarker for StarnixNetworksMarker {}
pub trait StarnixNetworksProxyInterface: Send + Sync {
type SetDefaultResponseFut: std::future::Future<Output = Result<NetworkRegistrySetDefaultResult, fidl::Error>>
+ Send;
fn r#set_default(
&self,
network_id: &fidl_fuchsia_posix_socket::OptionalUint32,
) -> Self::SetDefaultResponseFut;
type AddResponseFut: std::future::Future<Output = Result<NetworkRegistryAddResult, fidl::Error>>
+ Send;
fn r#add(&self, network: &Network) -> Self::AddResponseFut;
type UpdateResponseFut: std::future::Future<Output = Result<NetworkRegistryUpdateResult, fidl::Error>>
+ Send;
fn r#update(&self, network: &Network) -> Self::UpdateResponseFut;
type RemoveResponseFut: std::future::Future<Output = Result<NetworkRegistryRemoveResult, fidl::Error>>
+ Send;
fn r#remove(&self, network_id: u32) -> Self::RemoveResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct StarnixNetworksSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for StarnixNetworksSynchronousProxy {
type Proxy = StarnixNetworksProxy;
type Protocol = StarnixNetworksMarker;
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 StarnixNetworksSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <StarnixNetworksMarker 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<StarnixNetworksEvent, fidl::Error> {
StarnixNetworksEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#set_default(
&self,
mut network_id: &fidl_fuchsia_posix_socket::OptionalUint32,
___deadline: zx::MonotonicInstant,
) -> Result<NetworkRegistrySetDefaultResult, fidl::Error> {
let _response =
self.client.send_query::<NetworkRegistrySetDefaultRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
NetworkRegistrySetDefaultError,
>>(
(network_id,),
0x59a90d7826a7f342,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#add(
&self,
mut network: &Network,
___deadline: zx::MonotonicInstant,
) -> Result<NetworkRegistryAddResult, fidl::Error> {
let _response =
self.client.send_query::<NetworkRegistryAddRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
NetworkRegistryAddError,
>>(
(network,),
0x4a988855b0fa4f7b,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#update(
&self,
mut network: &Network,
___deadline: zx::MonotonicInstant,
) -> Result<NetworkRegistryUpdateResult, fidl::Error> {
let _response =
self.client.send_query::<NetworkRegistryUpdateRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
NetworkRegistryUpdateError,
>>(
(network,),
0x460479796e3eadfe,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#remove(
&self,
mut network_id: u32,
___deadline: zx::MonotonicInstant,
) -> Result<NetworkRegistryRemoveResult, fidl::Error> {
let _response =
self.client.send_query::<NetworkRegistryRemoveRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
NetworkRegistryRemoveError,
>>(
(network_id,),
0xe62f98532295a85,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct StarnixNetworksProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for StarnixNetworksProxy {
type Protocol = StarnixNetworksMarker;
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 StarnixNetworksProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <StarnixNetworksMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> StarnixNetworksEventStream {
StarnixNetworksEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#set_default(
&self,
mut network_id: &fidl_fuchsia_posix_socket::OptionalUint32,
) -> fidl::client::QueryResponseFut<
NetworkRegistrySetDefaultResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
StarnixNetworksProxyInterface::r#set_default(self, network_id)
}
pub fn r#add(
&self,
mut network: &Network,
) -> fidl::client::QueryResponseFut<
NetworkRegistryAddResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
StarnixNetworksProxyInterface::r#add(self, network)
}
pub fn r#update(
&self,
mut network: &Network,
) -> fidl::client::QueryResponseFut<
NetworkRegistryUpdateResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
StarnixNetworksProxyInterface::r#update(self, network)
}
pub fn r#remove(
&self,
mut network_id: u32,
) -> fidl::client::QueryResponseFut<
NetworkRegistryRemoveResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
StarnixNetworksProxyInterface::r#remove(self, network_id)
}
}
impl StarnixNetworksProxyInterface for StarnixNetworksProxy {
type SetDefaultResponseFut = fidl::client::QueryResponseFut<
NetworkRegistrySetDefaultResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#set_default(
&self,
mut network_id: &fidl_fuchsia_posix_socket::OptionalUint32,
) -> Self::SetDefaultResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<NetworkRegistrySetDefaultResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
NetworkRegistrySetDefaultError,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x59a90d7826a7f342,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
NetworkRegistrySetDefaultRequest,
NetworkRegistrySetDefaultResult,
>(
(network_id,),
0x59a90d7826a7f342,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type AddResponseFut = fidl::client::QueryResponseFut<
NetworkRegistryAddResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#add(&self, mut network: &Network) -> Self::AddResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<NetworkRegistryAddResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, NetworkRegistryAddError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x4a988855b0fa4f7b,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<NetworkRegistryAddRequest, NetworkRegistryAddResult>(
(network,),
0x4a988855b0fa4f7b,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type UpdateResponseFut = fidl::client::QueryResponseFut<
NetworkRegistryUpdateResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#update(&self, mut network: &Network) -> Self::UpdateResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<NetworkRegistryUpdateResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, NetworkRegistryUpdateError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x460479796e3eadfe,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<NetworkRegistryUpdateRequest, NetworkRegistryUpdateResult>(
(network,),
0x460479796e3eadfe,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type RemoveResponseFut = fidl::client::QueryResponseFut<
NetworkRegistryRemoveResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#remove(&self, mut network_id: u32) -> Self::RemoveResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<NetworkRegistryRemoveResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, NetworkRegistryRemoveError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0xe62f98532295a85,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<NetworkRegistryRemoveRequest, NetworkRegistryRemoveResult>(
(network_id,),
0xe62f98532295a85,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct StarnixNetworksEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for StarnixNetworksEventStream {}
impl futures::stream::FusedStream for StarnixNetworksEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for StarnixNetworksEventStream {
type Item = Result<StarnixNetworksEvent, 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(StarnixNetworksEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum StarnixNetworksEvent {}
impl StarnixNetworksEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<StarnixNetworksEvent, 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:
<StarnixNetworksMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct StarnixNetworksRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for StarnixNetworksRequestStream {}
impl futures::stream::FusedStream for StarnixNetworksRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for StarnixNetworksRequestStream {
type Protocol = StarnixNetworksMarker;
type ControlHandle = StarnixNetworksControlHandle;
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 {
StarnixNetworksControlHandle { 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 StarnixNetworksRequestStream {
type Item = Result<StarnixNetworksRequest, 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 StarnixNetworksRequestStream 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 {
0x59a90d7826a7f342 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
NetworkRegistrySetDefaultRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkRegistrySetDefaultRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
StarnixNetworksControlHandle { inner: this.inner.clone() };
Ok(StarnixNetworksRequest::SetDefault {
network_id: req.network_id,
responder: StarnixNetworksSetDefaultResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x4a988855b0fa4f7b => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
NetworkRegistryAddRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkRegistryAddRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
StarnixNetworksControlHandle { inner: this.inner.clone() };
Ok(StarnixNetworksRequest::Add {
network: req.network,
responder: StarnixNetworksAddResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x460479796e3eadfe => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
NetworkRegistryUpdateRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkRegistryUpdateRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
StarnixNetworksControlHandle { inner: this.inner.clone() };
Ok(StarnixNetworksRequest::Update {
network: req.network,
responder: StarnixNetworksUpdateResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0xe62f98532295a85 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
NetworkRegistryRemoveRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkRegistryRemoveRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
StarnixNetworksControlHandle { inner: this.inner.clone() };
Ok(StarnixNetworksRequest::Remove {
network_id: req.network_id,
responder: StarnixNetworksRemoveResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<StarnixNetworksMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum StarnixNetworksRequest {
SetDefault {
network_id: fidl_fuchsia_posix_socket::OptionalUint32,
responder: StarnixNetworksSetDefaultResponder,
},
Add { network: Network, responder: StarnixNetworksAddResponder },
Update { network: Network, responder: StarnixNetworksUpdateResponder },
Remove { network_id: u32, responder: StarnixNetworksRemoveResponder },
}
impl StarnixNetworksRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_set_default(
self,
) -> Option<(fidl_fuchsia_posix_socket::OptionalUint32, StarnixNetworksSetDefaultResponder)>
{
if let StarnixNetworksRequest::SetDefault { network_id, responder } = self {
Some((network_id, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_add(self) -> Option<(Network, StarnixNetworksAddResponder)> {
if let StarnixNetworksRequest::Add { network, responder } = self {
Some((network, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_update(self) -> Option<(Network, StarnixNetworksUpdateResponder)> {
if let StarnixNetworksRequest::Update { network, responder } = self {
Some((network, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_remove(self) -> Option<(u32, StarnixNetworksRemoveResponder)> {
if let StarnixNetworksRequest::Remove { network_id, responder } = self {
Some((network_id, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
StarnixNetworksRequest::SetDefault { .. } => "set_default",
StarnixNetworksRequest::Add { .. } => "add",
StarnixNetworksRequest::Update { .. } => "update",
StarnixNetworksRequest::Remove { .. } => "remove",
}
}
}
#[derive(Debug, Clone)]
pub struct StarnixNetworksControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for StarnixNetworksControlHandle {
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 StarnixNetworksControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct StarnixNetworksSetDefaultResponder {
control_handle: std::mem::ManuallyDrop<StarnixNetworksControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for StarnixNetworksSetDefaultResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for StarnixNetworksSetDefaultResponder {
type ControlHandle = StarnixNetworksControlHandle;
fn control_handle(&self) -> &StarnixNetworksControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl StarnixNetworksSetDefaultResponder {
pub fn send(
self,
mut result: Result<(), NetworkRegistrySetDefaultError>,
) -> 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<(), NetworkRegistrySetDefaultError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<(), NetworkRegistrySetDefaultError>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
NetworkRegistrySetDefaultError,
>>(
result,
self.tx_id,
0x59a90d7826a7f342,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct StarnixNetworksAddResponder {
control_handle: std::mem::ManuallyDrop<StarnixNetworksControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for StarnixNetworksAddResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for StarnixNetworksAddResponder {
type ControlHandle = StarnixNetworksControlHandle;
fn control_handle(&self) -> &StarnixNetworksControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl StarnixNetworksAddResponder {
pub fn send(self, mut result: Result<(), NetworkRegistryAddError>) -> 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<(), NetworkRegistryAddError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), NetworkRegistryAddError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
NetworkRegistryAddError,
>>(
result,
self.tx_id,
0x4a988855b0fa4f7b,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct StarnixNetworksUpdateResponder {
control_handle: std::mem::ManuallyDrop<StarnixNetworksControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for StarnixNetworksUpdateResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for StarnixNetworksUpdateResponder {
type ControlHandle = StarnixNetworksControlHandle;
fn control_handle(&self) -> &StarnixNetworksControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl StarnixNetworksUpdateResponder {
pub fn send(
self,
mut result: Result<(), NetworkRegistryUpdateError>,
) -> 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<(), NetworkRegistryUpdateError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<(), NetworkRegistryUpdateError>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
NetworkRegistryUpdateError,
>>(
result,
self.tx_id,
0x460479796e3eadfe,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct StarnixNetworksRemoveResponder {
control_handle: std::mem::ManuallyDrop<StarnixNetworksControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for StarnixNetworksRemoveResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for StarnixNetworksRemoveResponder {
type ControlHandle = StarnixNetworksControlHandle;
fn control_handle(&self) -> &StarnixNetworksControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl StarnixNetworksRemoveResponder {
pub fn send(
self,
mut result: Result<(), NetworkRegistryRemoveError>,
) -> 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<(), NetworkRegistryRemoveError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<(), NetworkRegistryRemoveError>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
NetworkRegistryRemoveError,
>>(
result,
self.tx_id,
0xe62f98532295a85,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for NetworkRegistryAddError {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for NetworkRegistryAddError {
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 NetworkRegistryAddError
{
#[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 NetworkRegistryAddError
{
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for NetworkRegistryRemoveError {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for NetworkRegistryRemoveError {
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 NetworkRegistryRemoveError
{
#[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 NetworkRegistryRemoveError
{
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for NetworkRegistrySetDefaultError {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for NetworkRegistrySetDefaultError {
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 NetworkRegistrySetDefaultError
{
#[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 NetworkRegistrySetDefaultError
{
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for NetworkRegistryUpdateError {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for NetworkRegistryUpdateError {
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 NetworkRegistryUpdateError
{
#[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 NetworkRegistryUpdateError
{
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DnsServerWatcherWatchServersResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DnsServerWatcherWatchServersResponse {
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<DnsServerWatcherWatchServersResponse, D>
for &DnsServerWatcherWatchServersResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DnsServerWatcherWatchServersResponse>(offset);
fidl::encoding::Encode::<DnsServerWatcherWatchServersResponse, D>::encode(
(
<fidl::encoding::UnboundedVector<DnsServerList> as fidl::encoding::ValueTypeMarker>::borrow(&self.servers),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<DnsServerList>, D>,
> fidl::encoding::Encode<DnsServerWatcherWatchServersResponse, 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::<DnsServerWatcherWatchServersResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DnsServerWatcherWatchServersResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { servers: fidl::new_empty!(fidl::encoding::UnboundedVector<DnsServerList>, 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<DnsServerList>,
D,
&mut self.servers,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for NetworkRegistryAddRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NetworkRegistryAddRequest {
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<NetworkRegistryAddRequest, D> for &NetworkRegistryAddRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkRegistryAddRequest>(offset);
fidl::encoding::Encode::<NetworkRegistryAddRequest, D>::encode(
(<Network as fidl::encoding::ValueTypeMarker>::borrow(&self.network),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Network, D>>
fidl::encoding::Encode<NetworkRegistryAddRequest, 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::<NetworkRegistryAddRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for NetworkRegistryAddRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { network: fidl::new_empty!(Network, 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!(Network, D, &mut self.network, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for NetworkRegistryRemoveRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NetworkRegistryRemoveRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<NetworkRegistryRemoveRequest, D> for &NetworkRegistryRemoveRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkRegistryRemoveRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut NetworkRegistryRemoveRequest)
.write_unaligned((self as *const NetworkRegistryRemoveRequest).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
fidl::encoding::Encode<NetworkRegistryRemoveRequest, 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::<NetworkRegistryRemoveRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for NetworkRegistryRemoveRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { network_id: fidl::new_empty!(u32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for NetworkRegistrySetDefaultRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NetworkRegistrySetDefaultRequest {
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<NetworkRegistrySetDefaultRequest, D>
for &NetworkRegistrySetDefaultRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkRegistrySetDefaultRequest>(offset);
fidl::encoding::Encode::<NetworkRegistrySetDefaultRequest, D>::encode(
(
<fidl_fuchsia_posix_socket::OptionalUint32 as fidl::encoding::ValueTypeMarker>::borrow(&self.network_id),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_posix_socket::OptionalUint32, D>,
> fidl::encoding::Encode<NetworkRegistrySetDefaultRequest, 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::<NetworkRegistrySetDefaultRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for NetworkRegistrySetDefaultRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { network_id: fidl::new_empty!(fidl_fuchsia_posix_socket::OptionalUint32, 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_posix_socket::OptionalUint32,
D,
&mut self.network_id,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for NetworkRegistryUpdateRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NetworkRegistryUpdateRequest {
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<NetworkRegistryUpdateRequest, D> for &NetworkRegistryUpdateRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkRegistryUpdateRequest>(offset);
fidl::encoding::Encode::<NetworkRegistryUpdateRequest, D>::encode(
(<Network as fidl::encoding::ValueTypeMarker>::borrow(&self.network),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Network, D>>
fidl::encoding::Encode<NetworkRegistryUpdateRequest, 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::<NetworkRegistryUpdateRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for NetworkRegistryUpdateRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { network: fidl::new_empty!(Network, 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!(Network, D, &mut self.network, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl DnsServerList {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.source_network_id {
return 2;
}
if let Some(_) = self.addresses {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for DnsServerList {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DnsServerList {
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<DnsServerList, D>
for &DnsServerList
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DnsServerList>(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::<fidl::encoding::UnboundedVector<fidl_fuchsia_net::SocketAddress>, D>(
self.addresses.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_net::SocketAddress> 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::<u32, D>(
self.source_network_id
.as_ref()
.map(<u32 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 DnsServerList {
#[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 = <fidl::encoding::UnboundedVector<
fidl_fuchsia_net::SocketAddress,
> as fidl::encoding::TypeMarker>::inline_size(
decoder.context
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.addresses.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::UnboundedVector<fidl_fuchsia_net::SocketAddress>,
D
)
});
fidl::decode!(
fidl::encoding::UnboundedVector<fidl_fuchsia_net::SocketAddress>,
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 =
<u32 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.source_network_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, 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 Network {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.dns_servers {
return 3;
}
if let Some(_) = self.info {
return 2;
}
if let Some(_) = self.network_id {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for Network {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Network {
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<Network, D> for &Network {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Network>(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::<u32, D>(
self.network_id.as_ref().map(<u32 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::<NetworkInfo, D>(
self.info.as_ref().map(<NetworkInfo 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::<NetworkDnsServers, D>(
self.dns_servers
.as_ref()
.map(<NetworkDnsServers 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 Network {
#[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 =
<u32 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.network_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, 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 =
<NetworkInfo 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.info.get_or_insert_with(|| fidl::new_empty!(NetworkInfo, D));
fidl::decode!(NetworkInfo, 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 =
<NetworkDnsServers 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.dns_servers.get_or_insert_with(|| fidl::new_empty!(NetworkDnsServers, D));
fidl::decode!(NetworkDnsServers, 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 NetworkDnsServers {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.v6 {
return 2;
}
if let Some(_) = self.v4 {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for NetworkDnsServers {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NetworkDnsServers {
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<NetworkDnsServers, D>
for &NetworkDnsServers
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkDnsServers>(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::<fidl::encoding::UnboundedVector<fidl_fuchsia_net::Ipv4Address>, D>(
self.v4.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_net::Ipv4Address> 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::<fidl::encoding::UnboundedVector<fidl_fuchsia_net::Ipv6Address>, D>(
self.v6.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_net::Ipv6Address> 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 NetworkDnsServers {
#[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 = <fidl::encoding::UnboundedVector<
fidl_fuchsia_net::Ipv4Address,
> 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.v4.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::UnboundedVector<fidl_fuchsia_net::Ipv4Address>,
D
)
});
fidl::decode!(
fidl::encoding::UnboundedVector<fidl_fuchsia_net::Ipv4Address>,
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 = <fidl::encoding::UnboundedVector<
fidl_fuchsia_net::Ipv6Address,
> 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.v6.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::UnboundedVector<fidl_fuchsia_net::Ipv6Address>,
D
)
});
fidl::decode!(
fidl::encoding::UnboundedVector<fidl_fuchsia_net::Ipv6Address>,
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 StarnixNetworkInfo {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.handle {
return 2;
}
if let Some(_) = self.mark {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for StarnixNetworkInfo {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for StarnixNetworkInfo {
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<StarnixNetworkInfo, D>
for &StarnixNetworkInfo
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StarnixNetworkInfo>(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::<u32, D>(
self.mark.as_ref().map(<u32 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::<u64, D>(
self.handle.as_ref().map(<u64 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 StarnixNetworkInfo {
#[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 =
<u32 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.mark.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, 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 =
<u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.handle.get_or_insert_with(|| fidl::new_empty!(u64, D));
fidl::decode!(u64, 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 NetworkInfo {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NetworkInfo {
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<NetworkInfo, D>
for &NetworkInfo
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetworkInfo>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
NetworkInfo::Starnix(ref val) => {
fidl::encoding::encode_in_envelope::<StarnixNetworkInfo, D>(
<StarnixNetworkInfo as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
NetworkInfo::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NetworkInfo {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => {
<StarnixNetworkInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context)
}
0 => return Err(fidl::Error::UnknownUnionTag),
_ => num_bytes as usize,
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let NetworkInfo::Starnix(_) = self {
} else {
*self = NetworkInfo::Starnix(fidl::new_empty!(StarnixNetworkInfo, D));
}
#[allow(irrefutable_let_patterns)]
if let NetworkInfo::Starnix(ref mut val) = self {
fidl::decode!(StarnixNetworkInfo, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = NetworkInfo::__SourceBreaking { unknown_ordinal: ordinal };
}
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
}