#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use bitflags::bitflags;
use fidl::client::QueryResponseFut;
use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
use fidl::endpoints::{ControlHandle as _, Responder as _};
use futures::future::{self, MaybeDone, TryFutureExt};
use zx_status;
pub const MAX_ADDRESSES: u16 = 1024;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum LookupError {
NotFound = 1,
Transient = 2,
InvalidArgs = 3,
InternalError = 4,
}
impl LookupError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::NotFound),
2 => Some(Self::Transient),
3 => Some(Self::InvalidArgs),
4 => Some(Self::InternalError),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Clone, Debug, PartialEq)]
pub struct DnsServerWatcherWatchServersResponse {
pub servers: Vec<DnsServer_>,
}
impl fidl::Persistable for DnsServerWatcherWatchServersResponse {}
#[derive(Clone, Debug, PartialEq)]
pub struct LookupAdminGetDnsServersResponse {
pub servers: Vec<fidl_fuchsia_net::SocketAddress>,
}
impl fidl::Persistable for LookupAdminGetDnsServersResponse {}
#[derive(Clone, Debug, PartialEq)]
pub struct LookupAdminSetDnsServersRequest {
pub servers: Vec<fidl_fuchsia_net::SocketAddress>,
}
impl fidl::Persistable for LookupAdminSetDnsServersRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct LookupLookupHostnameRequest {
pub addr: fidl_fuchsia_net::IpAddress,
}
impl fidl::Persistable for LookupLookupHostnameRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct LookupLookupIpRequest {
pub hostname: String,
pub options: LookupIpOptions,
}
impl fidl::Persistable for LookupLookupIpRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct LookupLookupHostnameResponse {
pub hostname: String,
}
impl fidl::Persistable for LookupLookupHostnameResponse {}
#[derive(Clone, Debug, PartialEq)]
pub struct LookupLookupIpResponse {
pub result: LookupResult,
}
impl fidl::Persistable for LookupLookupIpResponse {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct DhcpDnsServerSource {
pub source_interface: Option<u64>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for DhcpDnsServerSource {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct Dhcpv6DnsServerSource {
pub source_interface: Option<u64>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for Dhcpv6DnsServerSource {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct DnsServer_ {
pub address: Option<fidl_fuchsia_net::SocketAddress>,
pub source: Option<DnsServerSource>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for DnsServer_ {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct LookupIpOptions {
pub ipv4_lookup: Option<bool>,
pub ipv6_lookup: Option<bool>,
pub sort_addresses: Option<bool>,
pub canonical_name_lookup: Option<bool>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for LookupIpOptions {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct LookupResult {
pub addresses: Option<Vec<fidl_fuchsia_net::IpAddress>>,
pub canonical_name: Option<String>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for LookupResult {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct NdpDnsServerSource {
pub source_interface: Option<u64>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for NdpDnsServerSource {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct StaticDnsServerSource {
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for StaticDnsServerSource {}
#[derive(Clone, Debug, PartialEq)]
pub enum DnsServerSource {
StaticSource(StaticDnsServerSource),
Dhcp(DhcpDnsServerSource),
Ndp(NdpDnsServerSource),
Dhcpv6(Dhcpv6DnsServerSource),
}
impl DnsServerSource {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::StaticSource(_) => 1,
Self::Dhcp(_) => 2,
Self::Ndp(_) => 3,
Self::Dhcpv6(_) => 4,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Persistable for DnsServerSource {}
#[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.net.name.DnsServerWatcher";
}
impl fidl::endpoints::DiscoverableProtocolMarker for DnsServerWatcherMarker {}
pub trait DnsServerWatcherProxyInterface: Send + Sync {
type WatchServersResponseFut: std::future::Future<Output = Result<Vec<DnsServer_>, 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<DnsServer_>, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, DnsServerWatcherWatchServersResponse>(
(),
0x5748907e7f11b632,
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<DnsServer_>,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
DnsServerWatcherProxyInterface::r#watch_servers(self)
}
}
impl DnsServerWatcherProxyInterface for DnsServerWatcherProxy {
type WatchServersResponseFut = fidl::client::QueryResponseFut<
Vec<DnsServer_>,
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<DnsServer_>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
DnsServerWatcherWatchServersResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x5748907e7f11b632,
>(_buf?)?;
Ok(_response.servers)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<DnsServer_>>(
(),
0x5748907e7f11b632,
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 {
0x5748907e7f11b632 => {
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: &[DnsServer_]) -> 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: &[DnsServer_]) -> Result<(), fidl::Error> {
let _result = self.send_raw(servers);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut servers: &[DnsServer_]) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<DnsServerWatcherWatchServersResponse>(
(servers,),
self.tx_id,
0x5748907e7f11b632,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct LookupMarker;
impl fidl::endpoints::ProtocolMarker for LookupMarker {
type Proxy = LookupProxy;
type RequestStream = LookupRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = LookupSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.net.name.Lookup";
}
impl fidl::endpoints::DiscoverableProtocolMarker for LookupMarker {}
pub type LookupLookupIpResult = Result<LookupResult, LookupError>;
pub type LookupLookupHostnameResult = Result<String, LookupError>;
pub trait LookupProxyInterface: Send + Sync {
type LookupIpResponseFut: std::future::Future<Output = Result<LookupLookupIpResult, fidl::Error>>
+ Send;
fn r#lookup_ip(&self, hostname: &str, options: &LookupIpOptions) -> Self::LookupIpResponseFut;
type LookupHostnameResponseFut: std::future::Future<Output = Result<LookupLookupHostnameResult, fidl::Error>>
+ Send;
fn r#lookup_hostname(
&self,
addr: &fidl_fuchsia_net::IpAddress,
) -> Self::LookupHostnameResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct LookupSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for LookupSynchronousProxy {
type Proxy = LookupProxy;
type Protocol = LookupMarker;
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 LookupSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <LookupMarker 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<LookupEvent, fidl::Error> {
LookupEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#lookup_ip(
&self,
mut hostname: &str,
mut options: &LookupIpOptions,
___deadline: zx::MonotonicInstant,
) -> Result<LookupLookupIpResult, fidl::Error> {
let _response = self.client.send_query::<
LookupLookupIpRequest,
fidl::encoding::ResultType<LookupLookupIpResponse, LookupError>,
>(
(hostname, options,),
0x59247caf7560c1d0,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.result))
}
pub fn r#lookup_hostname(
&self,
mut addr: &fidl_fuchsia_net::IpAddress,
___deadline: zx::MonotonicInstant,
) -> Result<LookupLookupHostnameResult, fidl::Error> {
let _response = self.client.send_query::<
LookupLookupHostnameRequest,
fidl::encoding::ResultType<LookupLookupHostnameResponse, LookupError>,
>(
(addr,),
0x1b456b0e84888324,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.hostname))
}
}
#[derive(Debug, Clone)]
pub struct LookupProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for LookupProxy {
type Protocol = LookupMarker;
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 LookupProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <LookupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> LookupEventStream {
LookupEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#lookup_ip(
&self,
mut hostname: &str,
mut options: &LookupIpOptions,
) -> fidl::client::QueryResponseFut<
LookupLookupIpResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
LookupProxyInterface::r#lookup_ip(self, hostname, options)
}
pub fn r#lookup_hostname(
&self,
mut addr: &fidl_fuchsia_net::IpAddress,
) -> fidl::client::QueryResponseFut<
LookupLookupHostnameResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
LookupProxyInterface::r#lookup_hostname(self, addr)
}
}
impl LookupProxyInterface for LookupProxy {
type LookupIpResponseFut = fidl::client::QueryResponseFut<
LookupLookupIpResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#lookup_ip(
&self,
mut hostname: &str,
mut options: &LookupIpOptions,
) -> Self::LookupIpResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<LookupLookupIpResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<LookupLookupIpResponse, LookupError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x59247caf7560c1d0,
>(_buf?)?;
Ok(_response.map(|x| x.result))
}
self.client.send_query_and_decode::<LookupLookupIpRequest, LookupLookupIpResult>(
(hostname, options),
0x59247caf7560c1d0,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type LookupHostnameResponseFut = fidl::client::QueryResponseFut<
LookupLookupHostnameResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#lookup_hostname(
&self,
mut addr: &fidl_fuchsia_net::IpAddress,
) -> Self::LookupHostnameResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<LookupLookupHostnameResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<LookupLookupHostnameResponse, LookupError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x1b456b0e84888324,
>(_buf?)?;
Ok(_response.map(|x| x.hostname))
}
self.client
.send_query_and_decode::<LookupLookupHostnameRequest, LookupLookupHostnameResult>(
(addr,),
0x1b456b0e84888324,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct LookupEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for LookupEventStream {}
impl futures::stream::FusedStream for LookupEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for LookupEventStream {
type Item = Result<LookupEvent, 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(LookupEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum LookupEvent {}
impl LookupEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<LookupEvent, 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: <LookupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct LookupRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for LookupRequestStream {}
impl futures::stream::FusedStream for LookupRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for LookupRequestStream {
type Protocol = LookupMarker;
type ControlHandle = LookupControlHandle;
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 {
LookupControlHandle { 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 LookupRequestStream {
type Item = Result<LookupRequest, 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 LookupRequestStream 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 {
0x59247caf7560c1d0 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
LookupLookupIpRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LookupLookupIpRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = LookupControlHandle { inner: this.inner.clone() };
Ok(LookupRequest::LookupIp {
hostname: req.hostname,
options: req.options,
responder: LookupLookupIpResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x1b456b0e84888324 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
LookupLookupHostnameRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LookupLookupHostnameRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = LookupControlHandle { inner: this.inner.clone() };
Ok(LookupRequest::LookupHostname {
addr: req.addr,
responder: LookupLookupHostnameResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<LookupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum LookupRequest {
LookupIp { hostname: String, options: LookupIpOptions, responder: LookupLookupIpResponder },
LookupHostname { addr: fidl_fuchsia_net::IpAddress, responder: LookupLookupHostnameResponder },
}
impl LookupRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_lookup_ip(self) -> Option<(String, LookupIpOptions, LookupLookupIpResponder)> {
if let LookupRequest::LookupIp { hostname, options, responder } = self {
Some((hostname, options, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_lookup_hostname(
self,
) -> Option<(fidl_fuchsia_net::IpAddress, LookupLookupHostnameResponder)> {
if let LookupRequest::LookupHostname { addr, responder } = self {
Some((addr, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
LookupRequest::LookupIp { .. } => "lookup_ip",
LookupRequest::LookupHostname { .. } => "lookup_hostname",
}
}
}
#[derive(Debug, Clone)]
pub struct LookupControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for LookupControlHandle {
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 LookupControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct LookupLookupIpResponder {
control_handle: std::mem::ManuallyDrop<LookupControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for LookupLookupIpResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for LookupLookupIpResponder {
type ControlHandle = LookupControlHandle;
fn control_handle(&self) -> &LookupControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl LookupLookupIpResponder {
pub fn send(self, mut result: Result<&LookupResult, LookupError>) -> 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<&LookupResult, LookupError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<&LookupResult, LookupError>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<LookupLookupIpResponse, LookupError>>(
result.map(|result| (result,)),
self.tx_id,
0x59247caf7560c1d0,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct LookupLookupHostnameResponder {
control_handle: std::mem::ManuallyDrop<LookupControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for LookupLookupHostnameResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for LookupLookupHostnameResponder {
type ControlHandle = LookupControlHandle;
fn control_handle(&self) -> &LookupControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl LookupLookupHostnameResponder {
pub fn send(self, mut result: Result<&str, LookupError>) -> 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<&str, LookupError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<&str, LookupError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
LookupLookupHostnameResponse,
LookupError,
>>(
result.map(|hostname| (hostname,)),
self.tx_id,
0x1b456b0e84888324,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct LookupAdminMarker;
impl fidl::endpoints::ProtocolMarker for LookupAdminMarker {
type Proxy = LookupAdminProxy;
type RequestStream = LookupAdminRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = LookupAdminSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.net.name.LookupAdmin";
}
impl fidl::endpoints::DiscoverableProtocolMarker for LookupAdminMarker {}
pub type LookupAdminSetDnsServersResult = Result<(), i32>;
pub trait LookupAdminProxyInterface: Send + Sync {
type SetDnsServersResponseFut: std::future::Future<Output = Result<LookupAdminSetDnsServersResult, fidl::Error>>
+ Send;
fn r#set_dns_servers(
&self,
servers: &[fidl_fuchsia_net::SocketAddress],
) -> Self::SetDnsServersResponseFut;
type GetDnsServersResponseFut: std::future::Future<Output = Result<Vec<fidl_fuchsia_net::SocketAddress>, fidl::Error>>
+ Send;
fn r#get_dns_servers(&self) -> Self::GetDnsServersResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct LookupAdminSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for LookupAdminSynchronousProxy {
type Proxy = LookupAdminProxy;
type Protocol = LookupAdminMarker;
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 LookupAdminSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <LookupAdminMarker 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<LookupAdminEvent, fidl::Error> {
LookupAdminEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#set_dns_servers(
&self,
mut servers: &[fidl_fuchsia_net::SocketAddress],
___deadline: zx::MonotonicInstant,
) -> Result<LookupAdminSetDnsServersResult, fidl::Error> {
let _response = self.client.send_query::<
LookupAdminSetDnsServersRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(servers,),
0x55e2b9fcc777be96,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#get_dns_servers(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<Vec<fidl_fuchsia_net::SocketAddress>, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, LookupAdminGetDnsServersResponse>(
(),
0x614303bf6e72f80f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.servers)
}
}
#[derive(Debug, Clone)]
pub struct LookupAdminProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for LookupAdminProxy {
type Protocol = LookupAdminMarker;
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 LookupAdminProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <LookupAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> LookupAdminEventStream {
LookupAdminEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#set_dns_servers(
&self,
mut servers: &[fidl_fuchsia_net::SocketAddress],
) -> fidl::client::QueryResponseFut<
LookupAdminSetDnsServersResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
LookupAdminProxyInterface::r#set_dns_servers(self, servers)
}
pub fn r#get_dns_servers(
&self,
) -> fidl::client::QueryResponseFut<
Vec<fidl_fuchsia_net::SocketAddress>,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
LookupAdminProxyInterface::r#get_dns_servers(self)
}
}
impl LookupAdminProxyInterface for LookupAdminProxy {
type SetDnsServersResponseFut = fidl::client::QueryResponseFut<
LookupAdminSetDnsServersResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#set_dns_servers(
&self,
mut servers: &[fidl_fuchsia_net::SocketAddress],
) -> Self::SetDnsServersResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<LookupAdminSetDnsServersResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x55e2b9fcc777be96,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
LookupAdminSetDnsServersRequest,
LookupAdminSetDnsServersResult,
>(
(servers,),
0x55e2b9fcc777be96,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetDnsServersResponseFut = fidl::client::QueryResponseFut<
Vec<fidl_fuchsia_net::SocketAddress>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_dns_servers(&self) -> Self::GetDnsServersResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Vec<fidl_fuchsia_net::SocketAddress>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
LookupAdminGetDnsServersResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x614303bf6e72f80f,
>(_buf?)?;
Ok(_response.servers)
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
Vec<fidl_fuchsia_net::SocketAddress>,
>(
(),
0x614303bf6e72f80f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct LookupAdminEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for LookupAdminEventStream {}
impl futures::stream::FusedStream for LookupAdminEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for LookupAdminEventStream {
type Item = Result<LookupAdminEvent, 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(LookupAdminEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum LookupAdminEvent {}
impl LookupAdminEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<LookupAdminEvent, 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: <LookupAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct LookupAdminRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for LookupAdminRequestStream {}
impl futures::stream::FusedStream for LookupAdminRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for LookupAdminRequestStream {
type Protocol = LookupAdminMarker;
type ControlHandle = LookupAdminControlHandle;
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 {
LookupAdminControlHandle { 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 LookupAdminRequestStream {
type Item = Result<LookupAdminRequest, 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 LookupAdminRequestStream 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 {
0x55e2b9fcc777be96 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
LookupAdminSetDnsServersRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LookupAdminSetDnsServersRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = LookupAdminControlHandle { inner: this.inner.clone() };
Ok(LookupAdminRequest::SetDnsServers {
servers: req.servers,
responder: LookupAdminSetDnsServersResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x614303bf6e72f80f => {
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 = LookupAdminControlHandle { inner: this.inner.clone() };
Ok(LookupAdminRequest::GetDnsServers {
responder: LookupAdminGetDnsServersResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<LookupAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum LookupAdminRequest {
SetDnsServers {
servers: Vec<fidl_fuchsia_net::SocketAddress>,
responder: LookupAdminSetDnsServersResponder,
},
GetDnsServers { responder: LookupAdminGetDnsServersResponder },
}
impl LookupAdminRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_set_dns_servers(
self,
) -> Option<(Vec<fidl_fuchsia_net::SocketAddress>, LookupAdminSetDnsServersResponder)> {
if let LookupAdminRequest::SetDnsServers { servers, responder } = self {
Some((servers, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_dns_servers(self) -> Option<(LookupAdminGetDnsServersResponder)> {
if let LookupAdminRequest::GetDnsServers { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
LookupAdminRequest::SetDnsServers { .. } => "set_dns_servers",
LookupAdminRequest::GetDnsServers { .. } => "get_dns_servers",
}
}
}
#[derive(Debug, Clone)]
pub struct LookupAdminControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for LookupAdminControlHandle {
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 LookupAdminControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct LookupAdminSetDnsServersResponder {
control_handle: std::mem::ManuallyDrop<LookupAdminControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for LookupAdminSetDnsServersResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for LookupAdminSetDnsServersResponder {
type ControlHandle = LookupAdminControlHandle;
fn control_handle(&self) -> &LookupAdminControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl LookupAdminSetDnsServersResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x55e2b9fcc777be96,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct LookupAdminGetDnsServersResponder {
control_handle: std::mem::ManuallyDrop<LookupAdminControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for LookupAdminGetDnsServersResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for LookupAdminGetDnsServersResponder {
type ControlHandle = LookupAdminControlHandle;
fn control_handle(&self) -> &LookupAdminControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl LookupAdminGetDnsServersResponder {
pub fn send(self, mut servers: &[fidl_fuchsia_net::SocketAddress]) -> 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: &[fidl_fuchsia_net::SocketAddress],
) -> Result<(), fidl::Error> {
let _result = self.send_raw(servers);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut servers: &[fidl_fuchsia_net::SocketAddress]) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<LookupAdminGetDnsServersResponse>(
(servers,),
self.tx_id,
0x614303bf6e72f80f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for LookupError {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for LookupError {
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 LookupError {
#[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 LookupError {
#[inline(always)]
fn new_empty() -> Self {
Self::NotFound
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
impl fidl::encoding::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<DnsServer_> as fidl::encoding::ValueTypeMarker>::borrow(&self.servers),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<DnsServer_>, 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<DnsServer_>, 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<DnsServer_>,
D,
&mut self.servers,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for LookupAdminGetDnsServersResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LookupAdminGetDnsServersResponse {
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<LookupAdminGetDnsServersResponse, D>
for &LookupAdminGetDnsServersResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LookupAdminGetDnsServersResponse>(offset);
fidl::encoding::Encode::<LookupAdminGetDnsServersResponse, D>::encode(
(
<fidl::encoding::UnboundedVector<fidl_fuchsia_net::SocketAddress> as fidl::encoding::ValueTypeMarker>::borrow(&self.servers),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<
fidl::encoding::UnboundedVector<fidl_fuchsia_net::SocketAddress>,
D,
>,
> fidl::encoding::Encode<LookupAdminGetDnsServersResponse, 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::<LookupAdminGetDnsServersResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for LookupAdminGetDnsServersResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
servers: fidl::new_empty!(
fidl::encoding::UnboundedVector<fidl_fuchsia_net::SocketAddress>,
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<fidl_fuchsia_net::SocketAddress>,
D,
&mut self.servers,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for LookupAdminSetDnsServersRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LookupAdminSetDnsServersRequest {
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<LookupAdminSetDnsServersRequest, D>
for &LookupAdminSetDnsServersRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LookupAdminSetDnsServersRequest>(offset);
fidl::encoding::Encode::<LookupAdminSetDnsServersRequest, D>::encode(
(
<fidl::encoding::UnboundedVector<fidl_fuchsia_net::SocketAddress> as fidl::encoding::ValueTypeMarker>::borrow(&self.servers),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<
fidl::encoding::UnboundedVector<fidl_fuchsia_net::SocketAddress>,
D,
>,
> fidl::encoding::Encode<LookupAdminSetDnsServersRequest, 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::<LookupAdminSetDnsServersRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for LookupAdminSetDnsServersRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
servers: fidl::new_empty!(
fidl::encoding::UnboundedVector<fidl_fuchsia_net::SocketAddress>,
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<fidl_fuchsia_net::SocketAddress>,
D,
&mut self.servers,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for LookupLookupHostnameRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LookupLookupHostnameRequest {
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<LookupLookupHostnameRequest, D> for &LookupLookupHostnameRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LookupLookupHostnameRequest>(offset);
fidl::encoding::Encode::<LookupLookupHostnameRequest, D>::encode(
(<fidl_fuchsia_net::IpAddress as fidl::encoding::ValueTypeMarker>::borrow(
&self.addr,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_net::IpAddress, D>,
> fidl::encoding::Encode<LookupLookupHostnameRequest, 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::<LookupLookupHostnameRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for LookupLookupHostnameRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { addr: fidl::new_empty!(fidl_fuchsia_net::IpAddress, 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_net::IpAddress,
D,
&mut self.addr,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for LookupLookupIpRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LookupLookupIpRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
32
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LookupLookupIpRequest, D>
for &LookupLookupIpRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LookupLookupIpRequest>(offset);
fidl::encoding::Encode::<LookupLookupIpRequest, D>::encode(
(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
&self.hostname,
),
<LookupIpOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>, D>,
T1: fidl::encoding::Encode<LookupIpOptions, D>,
> fidl::encoding::Encode<LookupLookupIpRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LookupLookupIpRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LookupLookupIpRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
hostname: fidl::new_empty!(fidl::encoding::BoundedString<255>, D),
options: fidl::new_empty!(LookupIpOptions, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<255>,
D,
&mut self.hostname,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(LookupIpOptions, D, &mut self.options, decoder, offset + 16, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for LookupLookupHostnameResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LookupLookupHostnameResponse {
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<LookupLookupHostnameResponse, D> for &LookupLookupHostnameResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LookupLookupHostnameResponse>(offset);
fidl::encoding::Encode::<LookupLookupHostnameResponse, D>::encode(
(<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
&self.hostname,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>, D>,
> fidl::encoding::Encode<LookupLookupHostnameResponse, 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::<LookupLookupHostnameResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for LookupLookupHostnameResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { hostname: fidl::new_empty!(fidl::encoding::BoundedString<255>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<255>,
D,
&mut self.hostname,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for LookupLookupIpResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LookupLookupIpResponse {
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<LookupLookupIpResponse, D> for &LookupLookupIpResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LookupLookupIpResponse>(offset);
fidl::encoding::Encode::<LookupLookupIpResponse, D>::encode(
(<LookupResult as fidl::encoding::ValueTypeMarker>::borrow(&self.result),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<LookupResult, D>>
fidl::encoding::Encode<LookupLookupIpResponse, 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::<LookupLookupIpResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for LookupLookupIpResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { result: fidl::new_empty!(LookupResult, 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!(LookupResult, D, &mut self.result, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl DhcpDnsServerSource {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.source_interface {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for DhcpDnsServerSource {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DhcpDnsServerSource {
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<DhcpDnsServerSource, D>
for &DhcpDnsServerSource
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DhcpDnsServerSource>(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::<u64, D>(
self.source_interface
.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 DhcpDnsServerSource {
#[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 =
<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.source_interface.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 Dhcpv6DnsServerSource {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.source_interface {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for Dhcpv6DnsServerSource {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Dhcpv6DnsServerSource {
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<Dhcpv6DnsServerSource, D>
for &Dhcpv6DnsServerSource
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Dhcpv6DnsServerSource>(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::<u64, D>(
self.source_interface
.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 Dhcpv6DnsServerSource {
#[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 =
<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.source_interface.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 DnsServer_ {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.source {
return 2;
}
if let Some(_) = self.address {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for DnsServer_ {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DnsServer_ {
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<DnsServer_, D>
for &DnsServer_
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DnsServer_>(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_fuchsia_net::SocketAddress, D>(
self.address.as_ref().map(
<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::<DnsServerSource, D>(
self.source
.as_ref()
.map(<DnsServerSource 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 DnsServer_ {
#[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_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
.address
.get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_net::SocketAddress, D));
fidl::decode!(
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 =
<DnsServerSource 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.get_or_insert_with(|| fidl::new_empty!(DnsServerSource, D));
fidl::decode!(DnsServerSource, 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 LookupIpOptions {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.canonical_name_lookup {
return 4;
}
if let Some(_) = self.sort_addresses {
return 3;
}
if let Some(_) = self.ipv6_lookup {
return 2;
}
if let Some(_) = self.ipv4_lookup {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for LookupIpOptions {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LookupIpOptions {
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<LookupIpOptions, D>
for &LookupIpOptions
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LookupIpOptions>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.ipv4_lookup.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.ipv6_lookup.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.sort_addresses.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 4 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (4 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.canonical_name_lookup
.as_ref()
.map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LookupIpOptions {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.ipv4_lookup.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.ipv6_lookup.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.sort_addresses.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 4 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.canonical_name_lookup.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl LookupResult {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.canonical_name {
return 2;
}
if let Some(_) = self.addresses {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for LookupResult {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LookupResult {
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<LookupResult, D>
for &LookupResult
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LookupResult>(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::Vector<fidl_fuchsia_net::IpAddress, 1024>, D>(
self.addresses.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_net::IpAddress, 1024> 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::BoundedString<255>, D>(
self.canonical_name.as_ref().map(
<fidl::encoding::BoundedString<255> 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 LookupResult {
#[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::Vector<fidl_fuchsia_net::IpAddress, 1024> 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::Vector<fidl_fuchsia_net::IpAddress, 1024>, D));
fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_net::IpAddress, 1024>, 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::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.canonical_name
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>, D));
fidl::decode!(
fidl::encoding::BoundedString<255>,
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 NdpDnsServerSource {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.source_interface {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for NdpDnsServerSource {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NdpDnsServerSource {
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<NdpDnsServerSource, D>
for &NdpDnsServerSource
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NdpDnsServerSource>(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::<u64, D>(
self.source_interface
.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 NdpDnsServerSource {
#[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 =
<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.source_interface.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 StaticDnsServerSource {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
0
}
}
impl fidl::encoding::ValueTypeMarker for StaticDnsServerSource {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for StaticDnsServerSource {
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<StaticDnsServerSource, D>
for &StaticDnsServerSource
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StaticDnsServerSource>(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;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StaticDnsServerSource {
#[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;
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 DnsServerSource {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DnsServerSource {
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<DnsServerSource, D>
for &DnsServerSource
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DnsServerSource>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
DnsServerSource::StaticSource(ref val) => {
fidl::encoding::encode_in_envelope::<StaticDnsServerSource, D>(
<StaticDnsServerSource as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
DnsServerSource::Dhcp(ref val) => {
fidl::encoding::encode_in_envelope::<DhcpDnsServerSource, D>(
<DhcpDnsServerSource as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
DnsServerSource::Ndp(ref val) => {
fidl::encoding::encode_in_envelope::<NdpDnsServerSource, D>(
<NdpDnsServerSource as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
DnsServerSource::Dhcpv6(ref val) => {
fidl::encoding::encode_in_envelope::<Dhcpv6DnsServerSource, D>(
<Dhcpv6DnsServerSource as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DnsServerSource {
#[inline(always)]
fn new_empty() -> Self {
Self::StaticSource(fidl::new_empty!(StaticDnsServerSource, D))
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <StaticDnsServerSource as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
),
2 => <DhcpDnsServerSource as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
),
3 => {
<NdpDnsServerSource as fidl::encoding::TypeMarker>::inline_size(decoder.context)
}
4 => <Dhcpv6DnsServerSource as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
),
_ => return Err(fidl::Error::UnknownUnionTag),
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let DnsServerSource::StaticSource(_) = self {
} else {
*self = DnsServerSource::StaticSource(fidl::new_empty!(
StaticDnsServerSource,
D
));
}
#[allow(irrefutable_let_patterns)]
if let DnsServerSource::StaticSource(ref mut val) = self {
fidl::decode!(
StaticDnsServerSource,
D,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let DnsServerSource::Dhcp(_) = self {
} else {
*self = DnsServerSource::Dhcp(fidl::new_empty!(DhcpDnsServerSource, D));
}
#[allow(irrefutable_let_patterns)]
if let DnsServerSource::Dhcp(ref mut val) = self {
fidl::decode!(DhcpDnsServerSource, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
3 => {
#[allow(irrefutable_let_patterns)]
if let DnsServerSource::Ndp(_) = self {
} else {
*self = DnsServerSource::Ndp(fidl::new_empty!(NdpDnsServerSource, D));
}
#[allow(irrefutable_let_patterns)]
if let DnsServerSource::Ndp(ref mut val) = self {
fidl::decode!(NdpDnsServerSource, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
4 => {
#[allow(irrefutable_let_patterns)]
if let DnsServerSource::Dhcpv6(_) = self {
} else {
*self = DnsServerSource::Dhcpv6(fidl::new_empty!(Dhcpv6DnsServerSource, D));
}
#[allow(irrefutable_let_patterns)]
if let DnsServerSource::Dhcpv6(ref mut val) = self {
fidl::decode!(
Dhcpv6DnsServerSource,
D,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
ordinal => panic!("unexpected ordinal {:?}", ordinal),
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
}