#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use bitflags::bitflags;
use fidl::client::QueryResponseFut;
use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
use fidl::endpoints::{ControlHandle as _, Responder as _};
use futures::future::{self, MaybeDone, TryFutureExt};
use zx_status;
pub type HostName = String;
pub type InstanceName = String;
pub type ServiceName = String;
pub type SubtypeName = String;
pub type TxtCharacterString = Vec<u8>;
pub type TxtString = String;
pub const DEFAULT_PTR_TTL: i64 = 120000000000;
pub const DEFAULT_SRV_PRIORITY: u16 = 0;
pub const DEFAULT_SRV_TTL: i64 = 120000000000;
pub const DEFAULT_SRV_WEIGHT: u16 = 0;
pub const DEFAULT_TXT_TTL: i64 = 4500000000000;
pub const MAX_ADDRESSES: u32 = 64;
pub const MAX_SUBTYPES: u32 = 256;
pub const MAX_TEXT_STRINGS: u32 = 256;
bitflags! {
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct IpVersions: u32 {
const V4 = 1;
const V6 = 2;
}
}
impl IpVersions {
#[deprecated = "Strict bits should not use `has_unknown_bits`"]
#[inline(always)]
pub fn has_unknown_bits(&self) -> bool {
false
}
#[deprecated = "Strict bits should not use `get_unknown_bits`"]
#[inline(always)]
pub fn get_unknown_bits(&self) -> u32 {
0
}
}
bitflags! {
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Media: u32 {
const WIRED = 1;
const WIRELESS = 2;
}
}
impl Media {
#[deprecated = "Strict bits should not use `has_unknown_bits`"]
#[inline(always)]
pub fn has_unknown_bits(&self) -> bool {
false
}
#[deprecated = "Strict bits should not use `get_unknown_bits`"]
#[inline(always)]
pub fn get_unknown_bits(&self) -> u32 {
0
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum Error {
InvalidServiceName = 1,
InvalidInstanceName = 2,
AlreadyPublishedOnSubnet = 4,
InvalidMedia = 5,
}
impl Error {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::InvalidServiceName),
2 => Some(Self::InvalidInstanceName),
4 => Some(Self::AlreadyPublishedOnSubnet),
5 => Some(Self::InvalidMedia),
_ => 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(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum OnPublicationError {
DoNotRespond = 1,
}
impl OnPublicationError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::DoNotRespond),
_ => 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(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum PublicationCause {
Announcement = 1,
QueryMulticastResponse = 2,
QueryUnicastResponse = 3,
}
impl PublicationCause {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Announcement),
2 => Some(Self::QueryMulticastResponse),
3 => Some(Self::QueryUnicastResponse),
_ => 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(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum PublishProxyHostError {
AlreadyPublishedLocally,
AlreadyPublishedOnSubnet,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u32 },
}
#[macro_export]
macro_rules! PublishProxyHostErrorUnknown {
() => {
_
};
}
impl PublishProxyHostError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::AlreadyPublishedLocally),
2 => Some(Self::AlreadyPublishedOnSubnet),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::AlreadyPublishedLocally,
2 => Self::AlreadyPublishedOnSubnet,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::AlreadyPublishedLocally => 1,
Self::AlreadyPublishedOnSubnet => 2,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum PublishServiceInstanceError {
AlreadyPublishedLocally = 1,
AlreadyPublishedOnSubnet = 2,
}
impl PublishServiceInstanceError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::AlreadyPublishedLocally),
2 => Some(Self::AlreadyPublishedOnSubnet),
_ => 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(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum ResourceType {
Ptr = 12,
Any = 255,
}
impl ResourceType {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
12 => Some(Self::Ptr),
255 => Some(Self::Any),
_ => 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(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum ServiceInstancePublicationCause {
Announcement = 1,
QueryMulticastResponse = 2,
QueryUnicastResponse = 3,
}
impl ServiceInstancePublicationCause {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Announcement),
2 => Some(Self::QueryMulticastResponse),
3 => Some(Self::QueryUnicastResponse),
_ => 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 HostAddress {
pub address: fidl_fuchsia_net::IpAddress,
pub interface: u64,
pub ttl: i64,
}
impl fidl::Persistable for HostAddress {}
#[derive(Clone, Debug, PartialEq)]
pub struct HostNameResolverResolveHostNameRequest {
pub host: String,
pub timeout: i64,
pub options: HostNameResolutionOptions,
}
impl fidl::Persistable for HostNameResolverResolveHostNameRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct HostNameResolverResolveHostNameResponse {
pub addresses: Vec<HostAddress>,
}
impl fidl::Persistable for HostNameResolverResolveHostNameResponse {}
#[derive(Debug, PartialEq)]
pub struct HostNameSubscriberSubscribeToHostNameRequest {
pub host: String,
pub options: HostNameSubscriptionOptions,
pub listener: fidl::endpoints::ClientEnd<HostNameSubscriptionListenerMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for HostNameSubscriberSubscribeToHostNameRequest
{
}
#[derive(Clone, Debug, PartialEq)]
pub struct HostNameSubscriptionListenerOnAddressesChangedRequest {
pub addresses: Vec<HostAddress>,
}
impl fidl::Persistable for HostNameSubscriptionListenerOnAddressesChangedRequest {}
#[derive(Debug, PartialEq)]
pub struct ProxyHostPublisherPublishProxyHostRequest {
pub host: String,
pub addresses: Vec<fidl_fuchsia_net::IpAddress>,
pub options: ProxyHostPublicationOptions,
pub service_instance_publisher: fidl::endpoints::ServerEnd<ServiceInstancePublisherMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for ProxyHostPublisherPublishProxyHostRequest
{
}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Publication {
pub port: u16,
pub text: Vec<String>,
pub srv_priority: u16,
pub srv_weight: u16,
pub ptr_ttl: i64,
pub srv_ttl: i64,
pub txt_ttl: i64,
}
impl fidl::Persistable for Publication {}
#[derive(Clone, Debug, PartialEq)]
pub struct PublicationResponderOnPublicationRequest {
pub publication_cause: PublicationCause,
pub subtype: Option<String>,
pub source_addresses: Vec<fidl_fuchsia_net::IpAddress>,
}
impl fidl::Persistable for PublicationResponderOnPublicationRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PublicationResponderOnPublicationResponse {
pub publication: Option<Box<Publication>>,
}
impl fidl::Persistable for PublicationResponderOnPublicationResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PublicationResponderSetSubtypesRequest {
pub subtypes: Vec<String>,
}
impl fidl::Persistable for PublicationResponderSetSubtypesRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PublisherPublishServiceInstanceRequest {
pub service: String,
pub instance: String,
pub media: Media,
pub perform_probe: bool,
pub publication_responder: fidl::endpoints::ClientEnd<PublicationResponder_Marker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for PublisherPublishServiceInstanceRequest
{
}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ResolverResolveHostNameRequest {
pub host: String,
pub timeout: i64,
}
impl fidl::Persistable for ResolverResolveHostNameRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct ResolverResolveHostNameResponse {
pub v4_address: Option<Box<fidl_fuchsia_net::Ipv4Address>>,
pub v6_address: Option<Box<fidl_fuchsia_net::Ipv6Address>>,
}
impl fidl::Persistable for ResolverResolveHostNameResponse {}
#[derive(Clone, Debug, PartialEq)]
pub struct ServiceInstancePublicationResponderOnPublicationRequest {
pub publication_cause: ServiceInstancePublicationCause,
pub subtype: Option<String>,
pub source_addresses: Vec<fidl_fuchsia_net::IpAddress>,
}
impl fidl::Persistable for ServiceInstancePublicationResponderOnPublicationRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ServiceInstancePublicationResponderSetSubtypesRequest {
pub subtypes: Vec<String>,
}
impl fidl::Persistable for ServiceInstancePublicationResponderSetSubtypesRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct ServiceInstancePublicationResponderOnPublicationResponse {
pub publication: ServiceInstancePublication,
}
impl fidl::Persistable for ServiceInstancePublicationResponderOnPublicationResponse {}
#[derive(Debug, PartialEq)]
pub struct ServiceInstancePublisherPublishServiceInstanceRequest {
pub service: String,
pub instance: String,
pub options: ServiceInstancePublicationOptions,
pub publication_responder:
fidl::endpoints::ClientEnd<ServiceInstancePublicationResponder_Marker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for ServiceInstancePublisherPublishServiceInstanceRequest
{
}
#[derive(Clone, Debug, PartialEq)]
pub struct ServiceInstanceResolverResolveServiceInstanceRequest {
pub service: String,
pub instance: String,
pub timeout: i64,
pub options: ServiceInstanceResolutionOptions,
}
impl fidl::Persistable for ServiceInstanceResolverResolveServiceInstanceRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct ServiceInstanceResolverResolveServiceInstanceResponse {
pub instance: ServiceInstance,
}
impl fidl::Persistable for ServiceInstanceResolverResolveServiceInstanceResponse {}
#[derive(Debug, PartialEq)]
pub struct ServiceSubscriber2SubscribeToAllServicesRequest {
pub options: ServiceSubscriptionOptions,
pub listener: fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for ServiceSubscriber2SubscribeToAllServicesRequest
{
}
#[derive(Debug, PartialEq)]
pub struct ServiceSubscriber2SubscribeToServiceRequest {
pub service: String,
pub options: ServiceSubscriptionOptions,
pub listener: fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for ServiceSubscriber2SubscribeToServiceRequest
{
}
#[derive(Clone, Debug, PartialEq)]
pub struct ServiceSubscriberOnInstanceChangedRequest {
pub instance: ServiceInstance,
}
impl fidl::Persistable for ServiceSubscriberOnInstanceChangedRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct ServiceSubscriberOnInstanceDiscoveredRequest {
pub instance: ServiceInstance,
}
impl fidl::Persistable for ServiceSubscriberOnInstanceDiscoveredRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ServiceSubscriberOnInstanceLostRequest {
pub service: String,
pub instance: String,
}
impl fidl::Persistable for ServiceSubscriberOnInstanceLostRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ServiceSubscriberOnQueryRequest {
pub resource_type: ResourceType,
}
impl fidl::Persistable for ServiceSubscriberOnQueryRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct ServiceSubscriptionListenerOnInstanceChangedRequest {
pub instance: ServiceInstance,
}
impl fidl::Persistable for ServiceSubscriptionListenerOnInstanceChangedRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct ServiceSubscriptionListenerOnInstanceDiscoveredRequest {
pub instance: ServiceInstance,
}
impl fidl::Persistable for ServiceSubscriptionListenerOnInstanceDiscoveredRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ServiceSubscriptionListenerOnInstanceLostRequest {
pub service: String,
pub instance: String,
}
impl fidl::Persistable for ServiceSubscriptionListenerOnInstanceLostRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ServiceSubscriptionListenerOnQueryRequest {
pub resource_type: ResourceType,
}
impl fidl::Persistable for ServiceSubscriptionListenerOnQueryRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SubscriberSubscribeToServiceRequest {
pub service: String,
pub subscriber: fidl::endpoints::ClientEnd<ServiceSubscriberMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for SubscriberSubscribeToServiceRequest
{
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct HostNameResolutionOptions {
pub media: Option<Media>,
pub ip_versions: Option<IpVersions>,
pub exclude_local: Option<bool>,
pub exclude_local_proxies: Option<bool>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for HostNameResolutionOptions {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct HostNameSubscriptionOptions {
pub media: Option<Media>,
pub ip_versions: Option<IpVersions>,
pub exclude_local: Option<bool>,
pub exclude_local_proxies: Option<bool>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for HostNameSubscriptionOptions {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ProxyHostPublicationOptions {
pub media: Option<Media>,
pub ip_versions: Option<IpVersions>,
pub perform_probe: Option<bool>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for ProxyHostPublicationOptions {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ServiceInstance {
pub service: Option<String>,
pub instance: Option<String>,
pub ipv4_endpoint: Option<fidl_fuchsia_net::Ipv4SocketAddress>,
pub ipv6_endpoint: Option<fidl_fuchsia_net::Ipv6SocketAddress>,
pub text: Option<Vec<String>>,
pub srv_priority: Option<u16>,
pub srv_weight: Option<u16>,
pub target: Option<String>,
pub addresses: Option<Vec<fidl_fuchsia_net::SocketAddress>>,
pub text_strings: Option<Vec<Vec<u8>>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for ServiceInstance {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ServiceInstancePublication {
pub port: Option<u16>,
pub text: Option<Vec<Vec<u8>>>,
pub srv_priority: Option<u16>,
pub srv_weight: Option<u16>,
pub ptr_ttl: Option<i64>,
pub srv_ttl: Option<i64>,
pub txt_ttl: Option<i64>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for ServiceInstancePublication {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ServiceInstancePublicationOptions {
pub media: Option<Media>,
pub ip_versions: Option<IpVersions>,
pub perform_probe: Option<bool>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for ServiceInstancePublicationOptions {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ServiceInstanceResolutionOptions {
pub media: Option<Media>,
pub ip_versions: Option<IpVersions>,
pub exclude_local: Option<bool>,
pub exclude_local_proxies: Option<bool>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for ServiceInstanceResolutionOptions {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ServiceSubscriptionOptions {
pub media: Option<Media>,
pub ip_versions: Option<IpVersions>,
pub exclude_local: Option<bool>,
pub exclude_local_proxies: Option<bool>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for ServiceSubscriptionOptions {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct HostNameResolverMarker;
impl fidl::endpoints::ProtocolMarker for HostNameResolverMarker {
type Proxy = HostNameResolverProxy;
type RequestStream = HostNameResolverRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = HostNameResolverSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.net.mdns.HostNameResolver";
}
impl fidl::endpoints::DiscoverableProtocolMarker for HostNameResolverMarker {}
pub trait HostNameResolverProxyInterface: Send + Sync {
type ResolveHostNameResponseFut: std::future::Future<Output = Result<Vec<HostAddress>, fidl::Error>>
+ Send;
fn r#resolve_host_name(
&self,
host: &str,
timeout: i64,
options: &HostNameResolutionOptions,
) -> Self::ResolveHostNameResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct HostNameResolverSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for HostNameResolverSynchronousProxy {
type Proxy = HostNameResolverProxy;
type Protocol = HostNameResolverMarker;
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 HostNameResolverSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <HostNameResolverMarker 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<HostNameResolverEvent, fidl::Error> {
HostNameResolverEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#resolve_host_name(
&self,
mut host: &str,
mut timeout: i64,
mut options: &HostNameResolutionOptions,
___deadline: zx::MonotonicInstant,
) -> Result<Vec<HostAddress>, fidl::Error> {
let _response = self.client.send_query::<
HostNameResolverResolveHostNameRequest,
HostNameResolverResolveHostNameResponse,
>(
(host, timeout, options,),
0x54f422692b53c46d,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.addresses)
}
}
#[derive(Debug, Clone)]
pub struct HostNameResolverProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for HostNameResolverProxy {
type Protocol = HostNameResolverMarker;
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 HostNameResolverProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <HostNameResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> HostNameResolverEventStream {
HostNameResolverEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#resolve_host_name(
&self,
mut host: &str,
mut timeout: i64,
mut options: &HostNameResolutionOptions,
) -> fidl::client::QueryResponseFut<
Vec<HostAddress>,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
HostNameResolverProxyInterface::r#resolve_host_name(self, host, timeout, options)
}
}
impl HostNameResolverProxyInterface for HostNameResolverProxy {
type ResolveHostNameResponseFut = fidl::client::QueryResponseFut<
Vec<HostAddress>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#resolve_host_name(
&self,
mut host: &str,
mut timeout: i64,
mut options: &HostNameResolutionOptions,
) -> Self::ResolveHostNameResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Vec<HostAddress>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
HostNameResolverResolveHostNameResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x54f422692b53c46d,
>(_buf?)?;
Ok(_response.addresses)
}
self.client
.send_query_and_decode::<HostNameResolverResolveHostNameRequest, Vec<HostAddress>>(
(host, timeout, options),
0x54f422692b53c46d,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct HostNameResolverEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for HostNameResolverEventStream {}
impl futures::stream::FusedStream for HostNameResolverEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for HostNameResolverEventStream {
type Item = Result<HostNameResolverEvent, 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(HostNameResolverEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum HostNameResolverEvent {}
impl HostNameResolverEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<HostNameResolverEvent, 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:
<HostNameResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct HostNameResolverRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for HostNameResolverRequestStream {}
impl futures::stream::FusedStream for HostNameResolverRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for HostNameResolverRequestStream {
type Protocol = HostNameResolverMarker;
type ControlHandle = HostNameResolverControlHandle;
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 {
HostNameResolverControlHandle { 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 HostNameResolverRequestStream {
type Item = Result<HostNameResolverRequest, 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 HostNameResolverRequestStream 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 {
0x54f422692b53c46d => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
HostNameResolverResolveHostNameRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostNameResolverResolveHostNameRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
HostNameResolverControlHandle { inner: this.inner.clone() };
Ok(HostNameResolverRequest::ResolveHostName {
host: req.host,
timeout: req.timeout,
options: req.options,
responder: HostNameResolverResolveHostNameResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<HostNameResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum HostNameResolverRequest {
ResolveHostName {
host: String,
timeout: i64,
options: HostNameResolutionOptions,
responder: HostNameResolverResolveHostNameResponder,
},
}
impl HostNameResolverRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_resolve_host_name(
self,
) -> Option<(String, i64, HostNameResolutionOptions, HostNameResolverResolveHostNameResponder)>
{
if let HostNameResolverRequest::ResolveHostName { host, timeout, options, responder } = self
{
Some((host, timeout, options, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
HostNameResolverRequest::ResolveHostName { .. } => "resolve_host_name",
}
}
}
#[derive(Debug, Clone)]
pub struct HostNameResolverControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for HostNameResolverControlHandle {
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 HostNameResolverControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct HostNameResolverResolveHostNameResponder {
control_handle: std::mem::ManuallyDrop<HostNameResolverControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for HostNameResolverResolveHostNameResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for HostNameResolverResolveHostNameResponder {
type ControlHandle = HostNameResolverControlHandle;
fn control_handle(&self) -> &HostNameResolverControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl HostNameResolverResolveHostNameResponder {
pub fn send(self, mut addresses: &[HostAddress]) -> Result<(), fidl::Error> {
let _result = self.send_raw(addresses);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut addresses: &[HostAddress]) -> Result<(), fidl::Error> {
let _result = self.send_raw(addresses);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut addresses: &[HostAddress]) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<HostNameResolverResolveHostNameResponse>(
(addresses,),
self.tx_id,
0x54f422692b53c46d,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct HostNameSubscriberMarker;
impl fidl::endpoints::ProtocolMarker for HostNameSubscriberMarker {
type Proxy = HostNameSubscriberProxy;
type RequestStream = HostNameSubscriberRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = HostNameSubscriberSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.net.mdns.HostNameSubscriber";
}
impl fidl::endpoints::DiscoverableProtocolMarker for HostNameSubscriberMarker {}
pub trait HostNameSubscriberProxyInterface: Send + Sync {
fn r#subscribe_to_host_name(
&self,
host: &str,
options: &HostNameSubscriptionOptions,
listener: fidl::endpoints::ClientEnd<HostNameSubscriptionListenerMarker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct HostNameSubscriberSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for HostNameSubscriberSynchronousProxy {
type Proxy = HostNameSubscriberProxy;
type Protocol = HostNameSubscriberMarker;
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 HostNameSubscriberSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<HostNameSubscriberMarker 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<HostNameSubscriberEvent, fidl::Error> {
HostNameSubscriberEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#subscribe_to_host_name(
&self,
mut host: &str,
mut options: &HostNameSubscriptionOptions,
mut listener: fidl::endpoints::ClientEnd<HostNameSubscriptionListenerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<HostNameSubscriberSubscribeToHostNameRequest>(
(host, options, listener),
0x23b6c5f4954f40ea,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct HostNameSubscriberProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for HostNameSubscriberProxy {
type Protocol = HostNameSubscriberMarker;
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 HostNameSubscriberProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<HostNameSubscriberMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> HostNameSubscriberEventStream {
HostNameSubscriberEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#subscribe_to_host_name(
&self,
mut host: &str,
mut options: &HostNameSubscriptionOptions,
mut listener: fidl::endpoints::ClientEnd<HostNameSubscriptionListenerMarker>,
) -> Result<(), fidl::Error> {
HostNameSubscriberProxyInterface::r#subscribe_to_host_name(self, host, options, listener)
}
}
impl HostNameSubscriberProxyInterface for HostNameSubscriberProxy {
fn r#subscribe_to_host_name(
&self,
mut host: &str,
mut options: &HostNameSubscriptionOptions,
mut listener: fidl::endpoints::ClientEnd<HostNameSubscriptionListenerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<HostNameSubscriberSubscribeToHostNameRequest>(
(host, options, listener),
0x23b6c5f4954f40ea,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct HostNameSubscriberEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for HostNameSubscriberEventStream {}
impl futures::stream::FusedStream for HostNameSubscriberEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for HostNameSubscriberEventStream {
type Item = Result<HostNameSubscriberEvent, 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(HostNameSubscriberEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum HostNameSubscriberEvent {}
impl HostNameSubscriberEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<HostNameSubscriberEvent, 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:
<HostNameSubscriberMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct HostNameSubscriberRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for HostNameSubscriberRequestStream {}
impl futures::stream::FusedStream for HostNameSubscriberRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for HostNameSubscriberRequestStream {
type Protocol = HostNameSubscriberMarker;
type ControlHandle = HostNameSubscriberControlHandle;
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 {
HostNameSubscriberControlHandle { 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 HostNameSubscriberRequestStream {
type Item = Result<HostNameSubscriberRequest, 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 HostNameSubscriberRequestStream 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 {
0x23b6c5f4954f40ea => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(HostNameSubscriberSubscribeToHostNameRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostNameSubscriberSubscribeToHostNameRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = HostNameSubscriberControlHandle {
inner: this.inner.clone(),
};
Ok(HostNameSubscriberRequest::SubscribeToHostName {host: req.host,
options: req.options,
listener: req.listener,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <HostNameSubscriberMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum HostNameSubscriberRequest {
SubscribeToHostName {
host: String,
options: HostNameSubscriptionOptions,
listener: fidl::endpoints::ClientEnd<HostNameSubscriptionListenerMarker>,
control_handle: HostNameSubscriberControlHandle,
},
}
impl HostNameSubscriberRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_subscribe_to_host_name(
self,
) -> Option<(
String,
HostNameSubscriptionOptions,
fidl::endpoints::ClientEnd<HostNameSubscriptionListenerMarker>,
HostNameSubscriberControlHandle,
)> {
if let HostNameSubscriberRequest::SubscribeToHostName {
host,
options,
listener,
control_handle,
} = self
{
Some((host, options, listener, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
HostNameSubscriberRequest::SubscribeToHostName { .. } => "subscribe_to_host_name",
}
}
}
#[derive(Debug, Clone)]
pub struct HostNameSubscriberControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for HostNameSubscriberControlHandle {
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 HostNameSubscriberControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct HostNameSubscriptionListenerMarker;
impl fidl::endpoints::ProtocolMarker for HostNameSubscriptionListenerMarker {
type Proxy = HostNameSubscriptionListenerProxy;
type RequestStream = HostNameSubscriptionListenerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = HostNameSubscriptionListenerSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) HostNameSubscriptionListener";
}
pub trait HostNameSubscriptionListenerProxyInterface: Send + Sync {
type OnAddressesChangedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#on_addresses_changed(
&self,
addresses: &[HostAddress],
) -> Self::OnAddressesChangedResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct HostNameSubscriptionListenerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for HostNameSubscriptionListenerSynchronousProxy {
type Proxy = HostNameSubscriptionListenerProxy;
type Protocol = HostNameSubscriptionListenerMarker;
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 HostNameSubscriptionListenerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<HostNameSubscriptionListenerMarker 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<HostNameSubscriptionListenerEvent, fidl::Error> {
HostNameSubscriptionListenerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#on_addresses_changed(
&self,
mut addresses: &[HostAddress],
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self.client.send_query::<
HostNameSubscriptionListenerOnAddressesChangedRequest,
fidl::encoding::EmptyPayload,
>(
(addresses,),
0x44f5e70b2e8c1472,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct HostNameSubscriptionListenerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for HostNameSubscriptionListenerProxy {
type Protocol = HostNameSubscriptionListenerMarker;
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 HostNameSubscriptionListenerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<HostNameSubscriptionListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> HostNameSubscriptionListenerEventStream {
HostNameSubscriptionListenerEventStream {
event_receiver: self.client.take_event_receiver(),
}
}
pub fn r#on_addresses_changed(
&self,
mut addresses: &[HostAddress],
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
HostNameSubscriptionListenerProxyInterface::r#on_addresses_changed(self, addresses)
}
}
impl HostNameSubscriptionListenerProxyInterface for HostNameSubscriptionListenerProxy {
type OnAddressesChangedResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#on_addresses_changed(
&self,
mut addresses: &[HostAddress],
) -> Self::OnAddressesChangedResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x44f5e70b2e8c1472,
>(_buf?)?;
Ok(_response)
}
self.client
.send_query_and_decode::<HostNameSubscriptionListenerOnAddressesChangedRequest, ()>(
(addresses,),
0x44f5e70b2e8c1472,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct HostNameSubscriptionListenerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for HostNameSubscriptionListenerEventStream {}
impl futures::stream::FusedStream for HostNameSubscriptionListenerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for HostNameSubscriptionListenerEventStream {
type Item = Result<HostNameSubscriptionListenerEvent, 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(HostNameSubscriptionListenerEvent::decode(buf)))
}
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum HostNameSubscriptionListenerEvent {}
impl HostNameSubscriptionListenerEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<HostNameSubscriptionListenerEvent, 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: <HostNameSubscriptionListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
})
}
}
}
pub struct HostNameSubscriptionListenerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for HostNameSubscriptionListenerRequestStream {}
impl futures::stream::FusedStream for HostNameSubscriptionListenerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for HostNameSubscriptionListenerRequestStream {
type Protocol = HostNameSubscriptionListenerMarker;
type ControlHandle = HostNameSubscriptionListenerControlHandle;
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 {
HostNameSubscriptionListenerControlHandle { 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 HostNameSubscriptionListenerRequestStream {
type Item = Result<HostNameSubscriptionListenerRequest, 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 HostNameSubscriptionListenerRequestStream 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 {
0x44f5e70b2e8c1472 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(HostNameSubscriptionListenerOnAddressesChangedRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostNameSubscriptionListenerOnAddressesChangedRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = HostNameSubscriptionListenerControlHandle {
inner: this.inner.clone(),
};
Ok(HostNameSubscriptionListenerRequest::OnAddressesChanged {addresses: req.addresses,
responder: HostNameSubscriptionListenerOnAddressesChangedResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <HostNameSubscriptionListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum HostNameSubscriptionListenerRequest {
OnAddressesChanged {
addresses: Vec<HostAddress>,
responder: HostNameSubscriptionListenerOnAddressesChangedResponder,
},
}
impl HostNameSubscriptionListenerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_on_addresses_changed(
self,
) -> Option<(Vec<HostAddress>, HostNameSubscriptionListenerOnAddressesChangedResponder)> {
if let HostNameSubscriptionListenerRequest::OnAddressesChanged { addresses, responder } =
self
{
Some((addresses, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
HostNameSubscriptionListenerRequest::OnAddressesChanged { .. } => {
"on_addresses_changed"
}
}
}
}
#[derive(Debug, Clone)]
pub struct HostNameSubscriptionListenerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for HostNameSubscriptionListenerControlHandle {
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 HostNameSubscriptionListenerControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct HostNameSubscriptionListenerOnAddressesChangedResponder {
control_handle: std::mem::ManuallyDrop<HostNameSubscriptionListenerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for HostNameSubscriptionListenerOnAddressesChangedResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for HostNameSubscriptionListenerOnAddressesChangedResponder {
type ControlHandle = HostNameSubscriptionListenerControlHandle;
fn control_handle(&self) -> &HostNameSubscriptionListenerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl HostNameSubscriptionListenerOnAddressesChangedResponder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x44f5e70b2e8c1472,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ProxyHostPublisherMarker;
impl fidl::endpoints::ProtocolMarker for ProxyHostPublisherMarker {
type Proxy = ProxyHostPublisherProxy;
type RequestStream = ProxyHostPublisherRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ProxyHostPublisherSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.net.mdns.ProxyHostPublisher";
}
impl fidl::endpoints::DiscoverableProtocolMarker for ProxyHostPublisherMarker {}
pub type ProxyHostPublisherPublishProxyHostResult = Result<(), PublishProxyHostError>;
pub trait ProxyHostPublisherProxyInterface: Send + Sync {
type PublishProxyHostResponseFut: std::future::Future<Output = Result<ProxyHostPublisherPublishProxyHostResult, fidl::Error>>
+ Send;
fn r#publish_proxy_host(
&self,
host: &str,
addresses: &[fidl_fuchsia_net::IpAddress],
options: &ProxyHostPublicationOptions,
service_instance_publisher: fidl::endpoints::ServerEnd<ServiceInstancePublisherMarker>,
) -> Self::PublishProxyHostResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ProxyHostPublisherSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ProxyHostPublisherSynchronousProxy {
type Proxy = ProxyHostPublisherProxy;
type Protocol = ProxyHostPublisherMarker;
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 ProxyHostPublisherSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<ProxyHostPublisherMarker 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<ProxyHostPublisherEvent, fidl::Error> {
ProxyHostPublisherEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#publish_proxy_host(
&self,
mut host: &str,
mut addresses: &[fidl_fuchsia_net::IpAddress],
mut options: &ProxyHostPublicationOptions,
mut service_instance_publisher: fidl::endpoints::ServerEnd<ServiceInstancePublisherMarker>,
___deadline: zx::MonotonicInstant,
) -> Result<ProxyHostPublisherPublishProxyHostResult, fidl::Error> {
let _response = self.client.send_query::<
ProxyHostPublisherPublishProxyHostRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PublishProxyHostError>,
>(
(host, addresses, options, service_instance_publisher,),
0x639bfff950f973c2,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct ProxyHostPublisherProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ProxyHostPublisherProxy {
type Protocol = ProxyHostPublisherMarker;
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 ProxyHostPublisherProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<ProxyHostPublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ProxyHostPublisherEventStream {
ProxyHostPublisherEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#publish_proxy_host(
&self,
mut host: &str,
mut addresses: &[fidl_fuchsia_net::IpAddress],
mut options: &ProxyHostPublicationOptions,
mut service_instance_publisher: fidl::endpoints::ServerEnd<ServiceInstancePublisherMarker>,
) -> fidl::client::QueryResponseFut<
ProxyHostPublisherPublishProxyHostResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ProxyHostPublisherProxyInterface::r#publish_proxy_host(
self,
host,
addresses,
options,
service_instance_publisher,
)
}
}
impl ProxyHostPublisherProxyInterface for ProxyHostPublisherProxy {
type PublishProxyHostResponseFut = fidl::client::QueryResponseFut<
ProxyHostPublisherPublishProxyHostResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#publish_proxy_host(
&self,
mut host: &str,
mut addresses: &[fidl_fuchsia_net::IpAddress],
mut options: &ProxyHostPublicationOptions,
mut service_instance_publisher: fidl::endpoints::ServerEnd<ServiceInstancePublisherMarker>,
) -> Self::PublishProxyHostResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ProxyHostPublisherPublishProxyHostResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PublishProxyHostError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x639bfff950f973c2,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
ProxyHostPublisherPublishProxyHostRequest,
ProxyHostPublisherPublishProxyHostResult,
>(
(host, addresses, options, service_instance_publisher,),
0x639bfff950f973c2,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct ProxyHostPublisherEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ProxyHostPublisherEventStream {}
impl futures::stream::FusedStream for ProxyHostPublisherEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ProxyHostPublisherEventStream {
type Item = Result<ProxyHostPublisherEvent, 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(ProxyHostPublisherEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ProxyHostPublisherEvent {}
impl ProxyHostPublisherEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ProxyHostPublisherEvent, 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:
<ProxyHostPublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ProxyHostPublisherRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ProxyHostPublisherRequestStream {}
impl futures::stream::FusedStream for ProxyHostPublisherRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ProxyHostPublisherRequestStream {
type Protocol = ProxyHostPublisherMarker;
type ControlHandle = ProxyHostPublisherControlHandle;
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 {
ProxyHostPublisherControlHandle { 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 ProxyHostPublisherRequestStream {
type Item = Result<ProxyHostPublisherRequest, 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 ProxyHostPublisherRequestStream 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 {
0x639bfff950f973c2 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(ProxyHostPublisherPublishProxyHostRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProxyHostPublisherPublishProxyHostRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ProxyHostPublisherControlHandle {
inner: this.inner.clone(),
};
Ok(ProxyHostPublisherRequest::PublishProxyHost {host: req.host,
addresses: req.addresses,
options: req.options,
service_instance_publisher: req.service_instance_publisher,
responder: ProxyHostPublisherPublishProxyHostResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <ProxyHostPublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ProxyHostPublisherRequest {
PublishProxyHost {
host: String,
addresses: Vec<fidl_fuchsia_net::IpAddress>,
options: ProxyHostPublicationOptions,
service_instance_publisher: fidl::endpoints::ServerEnd<ServiceInstancePublisherMarker>,
responder: ProxyHostPublisherPublishProxyHostResponder,
},
}
impl ProxyHostPublisherRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_publish_proxy_host(
self,
) -> Option<(
String,
Vec<fidl_fuchsia_net::IpAddress>,
ProxyHostPublicationOptions,
fidl::endpoints::ServerEnd<ServiceInstancePublisherMarker>,
ProxyHostPublisherPublishProxyHostResponder,
)> {
if let ProxyHostPublisherRequest::PublishProxyHost {
host,
addresses,
options,
service_instance_publisher,
responder,
} = self
{
Some((host, addresses, options, service_instance_publisher, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ProxyHostPublisherRequest::PublishProxyHost { .. } => "publish_proxy_host",
}
}
}
#[derive(Debug, Clone)]
pub struct ProxyHostPublisherControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ProxyHostPublisherControlHandle {
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 ProxyHostPublisherControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ProxyHostPublisherPublishProxyHostResponder {
control_handle: std::mem::ManuallyDrop<ProxyHostPublisherControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ProxyHostPublisherPublishProxyHostResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ProxyHostPublisherPublishProxyHostResponder {
type ControlHandle = ProxyHostPublisherControlHandle;
fn control_handle(&self) -> &ProxyHostPublisherControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ProxyHostPublisherPublishProxyHostResponder {
pub fn send(self, mut result: Result<(), PublishProxyHostError>) -> 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<(), PublishProxyHostError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), PublishProxyHostError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
PublishProxyHostError,
>>(
result,
self.tx_id,
0x639bfff950f973c2,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct PublicationResponder_Marker;
impl fidl::endpoints::ProtocolMarker for PublicationResponder_Marker {
type Proxy = PublicationResponder_Proxy;
type RequestStream = PublicationResponder_RequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = PublicationResponder_SynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) PublicationResponder_";
}
pub trait PublicationResponder_ProxyInterface: Send + Sync {
type OnPublicationResponseFut: std::future::Future<Output = Result<Option<Box<Publication>>, fidl::Error>>
+ Send;
fn r#on_publication(
&self,
publication_cause: PublicationCause,
subtype: Option<&str>,
source_addresses: &[fidl_fuchsia_net::IpAddress],
) -> Self::OnPublicationResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct PublicationResponder_SynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for PublicationResponder_SynchronousProxy {
type Proxy = PublicationResponder_Proxy;
type Protocol = PublicationResponder_Marker;
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 PublicationResponder_SynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<PublicationResponder_Marker 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<PublicationResponder_Event, fidl::Error> {
PublicationResponder_Event::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#on_publication(
&self,
mut publication_cause: PublicationCause,
mut subtype: Option<&str>,
mut source_addresses: &[fidl_fuchsia_net::IpAddress],
___deadline: zx::MonotonicInstant,
) -> Result<Option<Box<Publication>>, fidl::Error> {
let _response = self.client.send_query::<
PublicationResponderOnPublicationRequest,
PublicationResponderOnPublicationResponse,
>(
(publication_cause, subtype, source_addresses,),
0x71d805aee2907d06,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.publication)
}
}
#[derive(Debug, Clone)]
pub struct PublicationResponder_Proxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for PublicationResponder_Proxy {
type Protocol = PublicationResponder_Marker;
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 PublicationResponder_Proxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<PublicationResponder_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> PublicationResponder_EventStream {
PublicationResponder_EventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#on_publication(
&self,
mut publication_cause: PublicationCause,
mut subtype: Option<&str>,
mut source_addresses: &[fidl_fuchsia_net::IpAddress],
) -> fidl::client::QueryResponseFut<
Option<Box<Publication>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
PublicationResponder_ProxyInterface::r#on_publication(
self,
publication_cause,
subtype,
source_addresses,
)
}
}
impl PublicationResponder_ProxyInterface for PublicationResponder_Proxy {
type OnPublicationResponseFut = fidl::client::QueryResponseFut<
Option<Box<Publication>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#on_publication(
&self,
mut publication_cause: PublicationCause,
mut subtype: Option<&str>,
mut source_addresses: &[fidl_fuchsia_net::IpAddress],
) -> Self::OnPublicationResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Option<Box<Publication>>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
PublicationResponderOnPublicationResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x71d805aee2907d06,
>(_buf?)?;
Ok(_response.publication)
}
self.client.send_query_and_decode::<
PublicationResponderOnPublicationRequest,
Option<Box<Publication>>,
>(
(publication_cause, subtype, source_addresses,),
0x71d805aee2907d06,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct PublicationResponder_EventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for PublicationResponder_EventStream {}
impl futures::stream::FusedStream for PublicationResponder_EventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for PublicationResponder_EventStream {
type Item = Result<PublicationResponder_Event, 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(PublicationResponder_Event::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum PublicationResponder_Event {
SetSubtypes { subtypes: Vec<String> },
Reannounce {},
}
impl PublicationResponder_Event {
#[allow(irrefutable_let_patterns)]
pub fn into_set_subtypes(self) -> Option<Vec<String>> {
if let PublicationResponder_Event::SetSubtypes { subtypes } = self {
Some((subtypes))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_reannounce(self) -> Option<()> {
if let PublicationResponder_Event::Reannounce {} = self {
Some(())
} else {
None
}
}
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<PublicationResponder_Event, 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 {
0x5593e156370b19df => {
let mut out = fidl::new_empty!(
PublicationResponderSetSubtypesRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PublicationResponderSetSubtypesRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((PublicationResponder_Event::SetSubtypes { subtypes: out.subtypes }))
}
0x2550cc2a43aa838b => {
let mut out = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((PublicationResponder_Event::Reannounce {}))
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<PublicationResponder_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct PublicationResponder_RequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for PublicationResponder_RequestStream {}
impl futures::stream::FusedStream for PublicationResponder_RequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for PublicationResponder_RequestStream {
type Protocol = PublicationResponder_Marker;
type ControlHandle = PublicationResponder_ControlHandle;
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 {
PublicationResponder_ControlHandle { 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 PublicationResponder_RequestStream {
type Item = Result<PublicationResponder_Request, 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 PublicationResponder_RequestStream 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 {
0x71d805aee2907d06 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(PublicationResponderOnPublicationRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PublicationResponderOnPublicationRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PublicationResponder_ControlHandle {
inner: this.inner.clone(),
};
Ok(PublicationResponder_Request::OnPublication {publication_cause: req.publication_cause,
subtype: req.subtype,
source_addresses: req.source_addresses,
responder: PublicationResponder_OnPublicationResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <PublicationResponder_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum PublicationResponder_Request {
OnPublication {
publication_cause: PublicationCause,
subtype: Option<String>,
source_addresses: Vec<fidl_fuchsia_net::IpAddress>,
responder: PublicationResponder_OnPublicationResponder,
},
}
impl PublicationResponder_Request {
#[allow(irrefutable_let_patterns)]
pub fn into_on_publication(
self,
) -> Option<(
PublicationCause,
Option<String>,
Vec<fidl_fuchsia_net::IpAddress>,
PublicationResponder_OnPublicationResponder,
)> {
if let PublicationResponder_Request::OnPublication {
publication_cause,
subtype,
source_addresses,
responder,
} = self
{
Some((publication_cause, subtype, source_addresses, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
PublicationResponder_Request::OnPublication { .. } => "on_publication",
}
}
}
#[derive(Debug, Clone)]
pub struct PublicationResponder_ControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for PublicationResponder_ControlHandle {
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 PublicationResponder_ControlHandle {
pub fn send_set_subtypes(&self, mut subtypes: &[String]) -> Result<(), fidl::Error> {
self.inner.send::<PublicationResponderSetSubtypesRequest>(
(subtypes,),
0,
0x5593e156370b19df,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn send_reannounce(&self) -> Result<(), fidl::Error> {
self.inner.send::<fidl::encoding::EmptyPayload>(
(),
0,
0x2550cc2a43aa838b,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PublicationResponder_OnPublicationResponder {
control_handle: std::mem::ManuallyDrop<PublicationResponder_ControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PublicationResponder_OnPublicationResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PublicationResponder_OnPublicationResponder {
type ControlHandle = PublicationResponder_ControlHandle;
fn control_handle(&self) -> &PublicationResponder_ControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PublicationResponder_OnPublicationResponder {
pub fn send(self, mut publication: Option<&Publication>) -> Result<(), fidl::Error> {
let _result = self.send_raw(publication);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut publication: Option<&Publication>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(publication);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut publication: Option<&Publication>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<PublicationResponderOnPublicationResponse>(
(publication,),
self.tx_id,
0x71d805aee2907d06,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct PublisherMarker;
impl fidl::endpoints::ProtocolMarker for PublisherMarker {
type Proxy = PublisherProxy;
type RequestStream = PublisherRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = PublisherSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.net.mdns.Publisher";
}
impl fidl::endpoints::DiscoverableProtocolMarker for PublisherMarker {}
pub type PublisherPublishServiceInstanceResult = Result<(), Error>;
pub trait PublisherProxyInterface: Send + Sync {
type PublishServiceInstanceResponseFut: std::future::Future<Output = Result<PublisherPublishServiceInstanceResult, fidl::Error>>
+ Send;
fn r#publish_service_instance(
&self,
service: &str,
instance: &str,
media: Media,
perform_probe: bool,
publication_responder: fidl::endpoints::ClientEnd<PublicationResponder_Marker>,
) -> Self::PublishServiceInstanceResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct PublisherSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for PublisherSynchronousProxy {
type Proxy = PublisherProxy;
type Protocol = PublisherMarker;
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 PublisherSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <PublisherMarker 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<PublisherEvent, fidl::Error> {
PublisherEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#publish_service_instance(
&self,
mut service: &str,
mut instance: &str,
mut media: Media,
mut perform_probe: bool,
mut publication_responder: fidl::endpoints::ClientEnd<PublicationResponder_Marker>,
___deadline: zx::MonotonicInstant,
) -> Result<PublisherPublishServiceInstanceResult, fidl::Error> {
let _response = self.client.send_query::<
PublisherPublishServiceInstanceRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
>(
(service, instance, media, perform_probe, publication_responder,),
0x3712171c42878797,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct PublisherProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for PublisherProxy {
type Protocol = PublisherMarker;
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 PublisherProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <PublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> PublisherEventStream {
PublisherEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#publish_service_instance(
&self,
mut service: &str,
mut instance: &str,
mut media: Media,
mut perform_probe: bool,
mut publication_responder: fidl::endpoints::ClientEnd<PublicationResponder_Marker>,
) -> fidl::client::QueryResponseFut<
PublisherPublishServiceInstanceResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
PublisherProxyInterface::r#publish_service_instance(
self,
service,
instance,
media,
perform_probe,
publication_responder,
)
}
}
impl PublisherProxyInterface for PublisherProxy {
type PublishServiceInstanceResponseFut = fidl::client::QueryResponseFut<
PublisherPublishServiceInstanceResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#publish_service_instance(
&self,
mut service: &str,
mut instance: &str,
mut media: Media,
mut perform_probe: bool,
mut publication_responder: fidl::endpoints::ClientEnd<PublicationResponder_Marker>,
) -> Self::PublishServiceInstanceResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<PublisherPublishServiceInstanceResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3712171c42878797,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
PublisherPublishServiceInstanceRequest,
PublisherPublishServiceInstanceResult,
>(
(service, instance, media, perform_probe, publication_responder,),
0x3712171c42878797,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct PublisherEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for PublisherEventStream {}
impl futures::stream::FusedStream for PublisherEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for PublisherEventStream {
type Item = Result<PublisherEvent, 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(PublisherEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum PublisherEvent {}
impl PublisherEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<PublisherEvent, 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: <PublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct PublisherRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for PublisherRequestStream {}
impl futures::stream::FusedStream for PublisherRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for PublisherRequestStream {
type Protocol = PublisherMarker;
type ControlHandle = PublisherControlHandle;
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 {
PublisherControlHandle { 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 PublisherRequestStream {
type Item = Result<PublisherRequest, 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 PublisherRequestStream 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 {
0x3712171c42878797 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
PublisherPublishServiceInstanceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PublisherPublishServiceInstanceRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PublisherControlHandle { inner: this.inner.clone() };
Ok(PublisherRequest::PublishServiceInstance {
service: req.service,
instance: req.instance,
media: req.media,
perform_probe: req.perform_probe,
publication_responder: req.publication_responder,
responder: PublisherPublishServiceInstanceResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<PublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum PublisherRequest {
PublishServiceInstance {
service: String,
instance: String,
media: Media,
perform_probe: bool,
publication_responder: fidl::endpoints::ClientEnd<PublicationResponder_Marker>,
responder: PublisherPublishServiceInstanceResponder,
},
}
impl PublisherRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_publish_service_instance(
self,
) -> Option<(
String,
String,
Media,
bool,
fidl::endpoints::ClientEnd<PublicationResponder_Marker>,
PublisherPublishServiceInstanceResponder,
)> {
if let PublisherRequest::PublishServiceInstance {
service,
instance,
media,
perform_probe,
publication_responder,
responder,
} = self
{
Some((service, instance, media, perform_probe, publication_responder, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
PublisherRequest::PublishServiceInstance { .. } => "publish_service_instance",
}
}
}
#[derive(Debug, Clone)]
pub struct PublisherControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for PublisherControlHandle {
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 PublisherControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PublisherPublishServiceInstanceResponder {
control_handle: std::mem::ManuallyDrop<PublisherControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PublisherPublishServiceInstanceResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PublisherPublishServiceInstanceResponder {
type ControlHandle = PublisherControlHandle;
fn control_handle(&self) -> &PublisherControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PublisherPublishServiceInstanceResponder {
pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
result,
self.tx_id,
0x3712171c42878797,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ResolverMarker;
impl fidl::endpoints::ProtocolMarker for ResolverMarker {
type Proxy = ResolverProxy;
type RequestStream = ResolverRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ResolverSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.net.mdns.Resolver";
}
impl fidl::endpoints::DiscoverableProtocolMarker for ResolverMarker {}
pub trait ResolverProxyInterface: Send + Sync {
type ResolveHostNameResponseFut: std::future::Future<
Output = Result<
(
Option<Box<fidl_fuchsia_net::Ipv4Address>>,
Option<Box<fidl_fuchsia_net::Ipv6Address>>,
),
fidl::Error,
>,
> + Send;
fn r#resolve_host_name(&self, host: &str, timeout: i64) -> Self::ResolveHostNameResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ResolverSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ResolverSynchronousProxy {
type Proxy = ResolverProxy;
type Protocol = ResolverMarker;
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 ResolverSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ResolverMarker 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<ResolverEvent, fidl::Error> {
ResolverEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#resolve_host_name(
&self,
mut host: &str,
mut timeout: i64,
___deadline: zx::MonotonicInstant,
) -> Result<
(Option<Box<fidl_fuchsia_net::Ipv4Address>>, Option<Box<fidl_fuchsia_net::Ipv6Address>>),
fidl::Error,
> {
let _response = self
.client
.send_query::<ResolverResolveHostNameRequest, ResolverResolveHostNameResponse>(
(host, timeout),
0x3c8b2b50aad28e4a,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.v4_address, _response.v6_address))
}
}
#[derive(Debug, Clone)]
pub struct ResolverProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ResolverProxy {
type Protocol = ResolverMarker;
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 ResolverProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <ResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ResolverEventStream {
ResolverEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#resolve_host_name(
&self,
mut host: &str,
mut timeout: i64,
) -> fidl::client::QueryResponseFut<
(Option<Box<fidl_fuchsia_net::Ipv4Address>>, Option<Box<fidl_fuchsia_net::Ipv6Address>>),
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ResolverProxyInterface::r#resolve_host_name(self, host, timeout)
}
}
impl ResolverProxyInterface for ResolverProxy {
type ResolveHostNameResponseFut = fidl::client::QueryResponseFut<
(Option<Box<fidl_fuchsia_net::Ipv4Address>>, Option<Box<fidl_fuchsia_net::Ipv6Address>>),
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#resolve_host_name(
&self,
mut host: &str,
mut timeout: i64,
) -> Self::ResolveHostNameResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<
(
Option<Box<fidl_fuchsia_net::Ipv4Address>>,
Option<Box<fidl_fuchsia_net::Ipv6Address>>,
),
fidl::Error,
> {
let _response = fidl::client::decode_transaction_body::<
ResolverResolveHostNameResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3c8b2b50aad28e4a,
>(_buf?)?;
Ok((_response.v4_address, _response.v6_address))
}
self.client.send_query_and_decode::<ResolverResolveHostNameRequest, (
Option<Box<fidl_fuchsia_net::Ipv4Address>>,
Option<Box<fidl_fuchsia_net::Ipv6Address>>,
)>(
(host, timeout),
0x3c8b2b50aad28e4a,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct ResolverEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ResolverEventStream {}
impl futures::stream::FusedStream for ResolverEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ResolverEventStream {
type Item = Result<ResolverEvent, 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(ResolverEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ResolverEvent {}
impl ResolverEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ResolverEvent, 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: <ResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ResolverRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ResolverRequestStream {}
impl futures::stream::FusedStream for ResolverRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ResolverRequestStream {
type Protocol = ResolverMarker;
type ControlHandle = ResolverControlHandle;
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 {
ResolverControlHandle { 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 ResolverRequestStream {
type Item = Result<ResolverRequest, 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 ResolverRequestStream 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 {
0x3c8b2b50aad28e4a => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ResolverResolveHostNameRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ResolverResolveHostNameRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ResolverControlHandle { inner: this.inner.clone() };
Ok(ResolverRequest::ResolveHostName {
host: req.host,
timeout: req.timeout,
responder: ResolverResolveHostNameResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ResolverRequest {
ResolveHostName { host: String, timeout: i64, responder: ResolverResolveHostNameResponder },
}
impl ResolverRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_resolve_host_name(self) -> Option<(String, i64, ResolverResolveHostNameResponder)> {
if let ResolverRequest::ResolveHostName { host, timeout, responder } = self {
Some((host, timeout, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ResolverRequest::ResolveHostName { .. } => "resolve_host_name",
}
}
}
#[derive(Debug, Clone)]
pub struct ResolverControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ResolverControlHandle {
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 ResolverControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ResolverResolveHostNameResponder {
control_handle: std::mem::ManuallyDrop<ResolverControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ResolverResolveHostNameResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ResolverResolveHostNameResponder {
type ControlHandle = ResolverControlHandle;
fn control_handle(&self) -> &ResolverControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ResolverResolveHostNameResponder {
pub fn send(
self,
mut v4_address: Option<&fidl_fuchsia_net::Ipv4Address>,
mut v6_address: Option<&fidl_fuchsia_net::Ipv6Address>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(v4_address, v6_address);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut v4_address: Option<&fidl_fuchsia_net::Ipv4Address>,
mut v6_address: Option<&fidl_fuchsia_net::Ipv6Address>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(v4_address, v6_address);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut v4_address: Option<&fidl_fuchsia_net::Ipv4Address>,
mut v6_address: Option<&fidl_fuchsia_net::Ipv6Address>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<ResolverResolveHostNameResponse>(
(v4_address, v6_address),
self.tx_id,
0x3c8b2b50aad28e4a,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ServiceInstancePublicationResponder_Marker;
impl fidl::endpoints::ProtocolMarker for ServiceInstancePublicationResponder_Marker {
type Proxy = ServiceInstancePublicationResponder_Proxy;
type RequestStream = ServiceInstancePublicationResponder_RequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ServiceInstancePublicationResponder_SynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) ServiceInstancePublicationResponder_";
}
pub type ServiceInstancePublicationResponderOnPublicationResult =
Result<ServiceInstancePublication, OnPublicationError>;
pub trait ServiceInstancePublicationResponder_ProxyInterface: Send + Sync {
type OnPublicationResponseFut: std::future::Future<
Output = Result<ServiceInstancePublicationResponderOnPublicationResult, fidl::Error>,
> + Send;
fn r#on_publication(
&self,
publication_cause: ServiceInstancePublicationCause,
subtype: Option<&str>,
source_addresses: &[fidl_fuchsia_net::IpAddress],
) -> Self::OnPublicationResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ServiceInstancePublicationResponder_SynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ServiceInstancePublicationResponder_SynchronousProxy {
type Proxy = ServiceInstancePublicationResponder_Proxy;
type Protocol = ServiceInstancePublicationResponder_Marker;
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 ServiceInstancePublicationResponder_SynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ServiceInstancePublicationResponder_Marker 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<ServiceInstancePublicationResponder_Event, fidl::Error> {
ServiceInstancePublicationResponder_Event::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#on_publication(
&self,
mut publication_cause: ServiceInstancePublicationCause,
mut subtype: Option<&str>,
mut source_addresses: &[fidl_fuchsia_net::IpAddress],
___deadline: zx::MonotonicInstant,
) -> Result<ServiceInstancePublicationResponderOnPublicationResult, fidl::Error> {
let _response = self.client.send_query::<
ServiceInstancePublicationResponderOnPublicationRequest,
fidl::encoding::ResultType<ServiceInstancePublicationResponderOnPublicationResponse, OnPublicationError>,
>(
(publication_cause, subtype, source_addresses,),
0x71753d79b12571ca,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.publication))
}
}
#[derive(Debug, Clone)]
pub struct ServiceInstancePublicationResponder_Proxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ServiceInstancePublicationResponder_Proxy {
type Protocol = ServiceInstancePublicationResponder_Marker;
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 ServiceInstancePublicationResponder_Proxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <ServiceInstancePublicationResponder_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ServiceInstancePublicationResponder_EventStream {
ServiceInstancePublicationResponder_EventStream {
event_receiver: self.client.take_event_receiver(),
}
}
pub fn r#on_publication(
&self,
mut publication_cause: ServiceInstancePublicationCause,
mut subtype: Option<&str>,
mut source_addresses: &[fidl_fuchsia_net::IpAddress],
) -> fidl::client::QueryResponseFut<
ServiceInstancePublicationResponderOnPublicationResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ServiceInstancePublicationResponder_ProxyInterface::r#on_publication(
self,
publication_cause,
subtype,
source_addresses,
)
}
}
impl ServiceInstancePublicationResponder_ProxyInterface
for ServiceInstancePublicationResponder_Proxy
{
type OnPublicationResponseFut = fidl::client::QueryResponseFut<
ServiceInstancePublicationResponderOnPublicationResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#on_publication(
&self,
mut publication_cause: ServiceInstancePublicationCause,
mut subtype: Option<&str>,
mut source_addresses: &[fidl_fuchsia_net::IpAddress],
) -> Self::OnPublicationResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ServiceInstancePublicationResponderOnPublicationResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<
ServiceInstancePublicationResponderOnPublicationResponse,
OnPublicationError,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x71753d79b12571ca,
>(_buf?)?;
Ok(_response.map(|x| x.publication))
}
self.client.send_query_and_decode::<
ServiceInstancePublicationResponderOnPublicationRequest,
ServiceInstancePublicationResponderOnPublicationResult,
>(
(publication_cause, subtype, source_addresses,),
0x71753d79b12571ca,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct ServiceInstancePublicationResponder_EventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ServiceInstancePublicationResponder_EventStream {}
impl futures::stream::FusedStream for ServiceInstancePublicationResponder_EventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ServiceInstancePublicationResponder_EventStream {
type Item = Result<ServiceInstancePublicationResponder_Event, 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(ServiceInstancePublicationResponder_Event::decode(buf)))
}
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ServiceInstancePublicationResponder_Event {
SetSubtypes { subtypes: Vec<String> },
Reannounce {},
}
impl ServiceInstancePublicationResponder_Event {
#[allow(irrefutable_let_patterns)]
pub fn into_set_subtypes(self) -> Option<Vec<String>> {
if let ServiceInstancePublicationResponder_Event::SetSubtypes { subtypes } = self {
Some((subtypes))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_reannounce(self) -> Option<()> {
if let ServiceInstancePublicationResponder_Event::Reannounce {} = self {
Some(())
} else {
None
}
}
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ServiceInstancePublicationResponder_Event, 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 {
0x217fed6e404312a9 => {
let mut out = fidl::new_empty!(ServiceInstancePublicationResponderSetSubtypesRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceInstancePublicationResponderSetSubtypesRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((
ServiceInstancePublicationResponder_Event::SetSubtypes {subtypes: out.subtypes,
}
))
}
0x1b48d9ed30dce1a8 => {
let mut out = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((
ServiceInstancePublicationResponder_Event::Reannounce {
}
))
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <ServiceInstancePublicationResponder_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
})
}
}
}
pub struct ServiceInstancePublicationResponder_RequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ServiceInstancePublicationResponder_RequestStream {}
impl futures::stream::FusedStream for ServiceInstancePublicationResponder_RequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ServiceInstancePublicationResponder_RequestStream {
type Protocol = ServiceInstancePublicationResponder_Marker;
type ControlHandle = ServiceInstancePublicationResponder_ControlHandle;
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 {
ServiceInstancePublicationResponder_ControlHandle { 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 ServiceInstancePublicationResponder_RequestStream {
type Item = Result<ServiceInstancePublicationResponder_Request, 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 ServiceInstancePublicationResponder_RequestStream 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 {
0x71753d79b12571ca => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(ServiceInstancePublicationResponderOnPublicationRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceInstancePublicationResponderOnPublicationRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ServiceInstancePublicationResponder_ControlHandle {
inner: this.inner.clone(),
};
Ok(ServiceInstancePublicationResponder_Request::OnPublication {publication_cause: req.publication_cause,
subtype: req.subtype,
source_addresses: req.source_addresses,
responder: ServiceInstancePublicationResponder_OnPublicationResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <ServiceInstancePublicationResponder_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ServiceInstancePublicationResponder_Request {
OnPublication {
publication_cause: ServiceInstancePublicationCause,
subtype: Option<String>,
source_addresses: Vec<fidl_fuchsia_net::IpAddress>,
responder: ServiceInstancePublicationResponder_OnPublicationResponder,
},
}
impl ServiceInstancePublicationResponder_Request {
#[allow(irrefutable_let_patterns)]
pub fn into_on_publication(
self,
) -> Option<(
ServiceInstancePublicationCause,
Option<String>,
Vec<fidl_fuchsia_net::IpAddress>,
ServiceInstancePublicationResponder_OnPublicationResponder,
)> {
if let ServiceInstancePublicationResponder_Request::OnPublication {
publication_cause,
subtype,
source_addresses,
responder,
} = self
{
Some((publication_cause, subtype, source_addresses, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ServiceInstancePublicationResponder_Request::OnPublication { .. } => "on_publication",
}
}
}
#[derive(Debug, Clone)]
pub struct ServiceInstancePublicationResponder_ControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ServiceInstancePublicationResponder_ControlHandle {
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 ServiceInstancePublicationResponder_ControlHandle {
pub fn send_set_subtypes(&self, mut subtypes: &[String]) -> Result<(), fidl::Error> {
self.inner.send::<ServiceInstancePublicationResponderSetSubtypesRequest>(
(subtypes,),
0,
0x217fed6e404312a9,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn send_reannounce(&self) -> Result<(), fidl::Error> {
self.inner.send::<fidl::encoding::EmptyPayload>(
(),
0,
0x1b48d9ed30dce1a8,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ServiceInstancePublicationResponder_OnPublicationResponder {
control_handle: std::mem::ManuallyDrop<ServiceInstancePublicationResponder_ControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ServiceInstancePublicationResponder_OnPublicationResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ServiceInstancePublicationResponder_OnPublicationResponder {
type ControlHandle = ServiceInstancePublicationResponder_ControlHandle;
fn control_handle(&self) -> &ServiceInstancePublicationResponder_ControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ServiceInstancePublicationResponder_OnPublicationResponder {
pub fn send(
self,
mut result: Result<&ServiceInstancePublication, OnPublicationError>,
) -> 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<&ServiceInstancePublication, OnPublicationError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<&ServiceInstancePublication, OnPublicationError>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
ServiceInstancePublicationResponderOnPublicationResponse,
OnPublicationError,
>>(
result.map(|publication| (publication,)),
self.tx_id,
0x71753d79b12571ca,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ServiceInstancePublisherMarker;
impl fidl::endpoints::ProtocolMarker for ServiceInstancePublisherMarker {
type Proxy = ServiceInstancePublisherProxy;
type RequestStream = ServiceInstancePublisherRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ServiceInstancePublisherSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.net.mdns.ServiceInstancePublisher";
}
impl fidl::endpoints::DiscoverableProtocolMarker for ServiceInstancePublisherMarker {}
pub type ServiceInstancePublisherPublishServiceInstanceResult =
Result<(), PublishServiceInstanceError>;
pub trait ServiceInstancePublisherProxyInterface: Send + Sync {
type PublishServiceInstanceResponseFut: std::future::Future<
Output = Result<ServiceInstancePublisherPublishServiceInstanceResult, fidl::Error>,
> + Send;
fn r#publish_service_instance(
&self,
service: &str,
instance: &str,
options: &ServiceInstancePublicationOptions,
publication_responder: fidl::endpoints::ClientEnd<
ServiceInstancePublicationResponder_Marker,
>,
) -> Self::PublishServiceInstanceResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ServiceInstancePublisherSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ServiceInstancePublisherSynchronousProxy {
type Proxy = ServiceInstancePublisherProxy;
type Protocol = ServiceInstancePublisherMarker;
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 ServiceInstancePublisherSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<ServiceInstancePublisherMarker 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<ServiceInstancePublisherEvent, fidl::Error> {
ServiceInstancePublisherEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#publish_service_instance(
&self,
mut service: &str,
mut instance: &str,
mut options: &ServiceInstancePublicationOptions,
mut publication_responder: fidl::endpoints::ClientEnd<
ServiceInstancePublicationResponder_Marker,
>,
___deadline: zx::MonotonicInstant,
) -> Result<ServiceInstancePublisherPublishServiceInstanceResult, fidl::Error> {
let _response = self.client.send_query::<
ServiceInstancePublisherPublishServiceInstanceRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PublishServiceInstanceError>,
>(
(service, instance, options, publication_responder,),
0x25d5fd0912cb5a9e,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct ServiceInstancePublisherProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ServiceInstancePublisherProxy {
type Protocol = ServiceInstancePublisherMarker;
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 ServiceInstancePublisherProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<ServiceInstancePublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ServiceInstancePublisherEventStream {
ServiceInstancePublisherEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#publish_service_instance(
&self,
mut service: &str,
mut instance: &str,
mut options: &ServiceInstancePublicationOptions,
mut publication_responder: fidl::endpoints::ClientEnd<
ServiceInstancePublicationResponder_Marker,
>,
) -> fidl::client::QueryResponseFut<
ServiceInstancePublisherPublishServiceInstanceResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ServiceInstancePublisherProxyInterface::r#publish_service_instance(
self,
service,
instance,
options,
publication_responder,
)
}
}
impl ServiceInstancePublisherProxyInterface for ServiceInstancePublisherProxy {
type PublishServiceInstanceResponseFut = fidl::client::QueryResponseFut<
ServiceInstancePublisherPublishServiceInstanceResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#publish_service_instance(
&self,
mut service: &str,
mut instance: &str,
mut options: &ServiceInstancePublicationOptions,
mut publication_responder: fidl::endpoints::ClientEnd<
ServiceInstancePublicationResponder_Marker,
>,
) -> Self::PublishServiceInstanceResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ServiceInstancePublisherPublishServiceInstanceResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
PublishServiceInstanceError,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x25d5fd0912cb5a9e,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
ServiceInstancePublisherPublishServiceInstanceRequest,
ServiceInstancePublisherPublishServiceInstanceResult,
>(
(service, instance, options, publication_responder,),
0x25d5fd0912cb5a9e,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct ServiceInstancePublisherEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ServiceInstancePublisherEventStream {}
impl futures::stream::FusedStream for ServiceInstancePublisherEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ServiceInstancePublisherEventStream {
type Item = Result<ServiceInstancePublisherEvent, 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(ServiceInstancePublisherEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ServiceInstancePublisherEvent {}
impl ServiceInstancePublisherEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ServiceInstancePublisherEvent, 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:
<ServiceInstancePublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ServiceInstancePublisherRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ServiceInstancePublisherRequestStream {}
impl futures::stream::FusedStream for ServiceInstancePublisherRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ServiceInstancePublisherRequestStream {
type Protocol = ServiceInstancePublisherMarker;
type ControlHandle = ServiceInstancePublisherControlHandle;
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 {
ServiceInstancePublisherControlHandle { 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 ServiceInstancePublisherRequestStream {
type Item = Result<ServiceInstancePublisherRequest, 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 ServiceInstancePublisherRequestStream 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 {
0x25d5fd0912cb5a9e => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(ServiceInstancePublisherPublishServiceInstanceRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceInstancePublisherPublishServiceInstanceRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ServiceInstancePublisherControlHandle {
inner: this.inner.clone(),
};
Ok(ServiceInstancePublisherRequest::PublishServiceInstance {service: req.service,
instance: req.instance,
options: req.options,
publication_responder: req.publication_responder,
responder: ServiceInstancePublisherPublishServiceInstanceResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <ServiceInstancePublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ServiceInstancePublisherRequest {
PublishServiceInstance {
service: String,
instance: String,
options: ServiceInstancePublicationOptions,
publication_responder:
fidl::endpoints::ClientEnd<ServiceInstancePublicationResponder_Marker>,
responder: ServiceInstancePublisherPublishServiceInstanceResponder,
},
}
impl ServiceInstancePublisherRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_publish_service_instance(
self,
) -> Option<(
String,
String,
ServiceInstancePublicationOptions,
fidl::endpoints::ClientEnd<ServiceInstancePublicationResponder_Marker>,
ServiceInstancePublisherPublishServiceInstanceResponder,
)> {
if let ServiceInstancePublisherRequest::PublishServiceInstance {
service,
instance,
options,
publication_responder,
responder,
} = self
{
Some((service, instance, options, publication_responder, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ServiceInstancePublisherRequest::PublishServiceInstance { .. } => {
"publish_service_instance"
}
}
}
}
#[derive(Debug, Clone)]
pub struct ServiceInstancePublisherControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ServiceInstancePublisherControlHandle {
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 ServiceInstancePublisherControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ServiceInstancePublisherPublishServiceInstanceResponder {
control_handle: std::mem::ManuallyDrop<ServiceInstancePublisherControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ServiceInstancePublisherPublishServiceInstanceResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ServiceInstancePublisherPublishServiceInstanceResponder {
type ControlHandle = ServiceInstancePublisherControlHandle;
fn control_handle(&self) -> &ServiceInstancePublisherControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ServiceInstancePublisherPublishServiceInstanceResponder {
pub fn send(
self,
mut result: Result<(), PublishServiceInstanceError>,
) -> 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<(), PublishServiceInstanceError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<(), PublishServiceInstanceError>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
PublishServiceInstanceError,
>>(
result,
self.tx_id,
0x25d5fd0912cb5a9e,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ServiceInstanceResolverMarker;
impl fidl::endpoints::ProtocolMarker for ServiceInstanceResolverMarker {
type Proxy = ServiceInstanceResolverProxy;
type RequestStream = ServiceInstanceResolverRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ServiceInstanceResolverSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.net.mdns.ServiceInstanceResolver";
}
impl fidl::endpoints::DiscoverableProtocolMarker for ServiceInstanceResolverMarker {}
pub trait ServiceInstanceResolverProxyInterface: Send + Sync {
type ResolveServiceInstanceResponseFut: std::future::Future<Output = Result<ServiceInstance, fidl::Error>>
+ Send;
fn r#resolve_service_instance(
&self,
service: &str,
instance: &str,
timeout: i64,
options: &ServiceInstanceResolutionOptions,
) -> Self::ResolveServiceInstanceResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ServiceInstanceResolverSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ServiceInstanceResolverSynchronousProxy {
type Proxy = ServiceInstanceResolverProxy;
type Protocol = ServiceInstanceResolverMarker;
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 ServiceInstanceResolverSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<ServiceInstanceResolverMarker 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<ServiceInstanceResolverEvent, fidl::Error> {
ServiceInstanceResolverEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#resolve_service_instance(
&self,
mut service: &str,
mut instance: &str,
mut timeout: i64,
mut options: &ServiceInstanceResolutionOptions,
___deadline: zx::MonotonicInstant,
) -> Result<ServiceInstance, fidl::Error> {
let _response = self.client.send_query::<
ServiceInstanceResolverResolveServiceInstanceRequest,
ServiceInstanceResolverResolveServiceInstanceResponse,
>(
(service, instance, timeout, options,),
0x1a0d0c9fc6f2fd7,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.instance)
}
}
#[derive(Debug, Clone)]
pub struct ServiceInstanceResolverProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ServiceInstanceResolverProxy {
type Protocol = ServiceInstanceResolverMarker;
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 ServiceInstanceResolverProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<ServiceInstanceResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ServiceInstanceResolverEventStream {
ServiceInstanceResolverEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#resolve_service_instance(
&self,
mut service: &str,
mut instance: &str,
mut timeout: i64,
mut options: &ServiceInstanceResolutionOptions,
) -> fidl::client::QueryResponseFut<
ServiceInstance,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ServiceInstanceResolverProxyInterface::r#resolve_service_instance(
self, service, instance, timeout, options,
)
}
}
impl ServiceInstanceResolverProxyInterface for ServiceInstanceResolverProxy {
type ResolveServiceInstanceResponseFut = fidl::client::QueryResponseFut<
ServiceInstance,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#resolve_service_instance(
&self,
mut service: &str,
mut instance: &str,
mut timeout: i64,
mut options: &ServiceInstanceResolutionOptions,
) -> Self::ResolveServiceInstanceResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ServiceInstance, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
ServiceInstanceResolverResolveServiceInstanceResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x1a0d0c9fc6f2fd7,
>(_buf?)?;
Ok(_response.instance)
}
self.client.send_query_and_decode::<
ServiceInstanceResolverResolveServiceInstanceRequest,
ServiceInstance,
>(
(service, instance, timeout, options,),
0x1a0d0c9fc6f2fd7,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct ServiceInstanceResolverEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ServiceInstanceResolverEventStream {}
impl futures::stream::FusedStream for ServiceInstanceResolverEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ServiceInstanceResolverEventStream {
type Item = Result<ServiceInstanceResolverEvent, 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(ServiceInstanceResolverEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ServiceInstanceResolverEvent {}
impl ServiceInstanceResolverEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ServiceInstanceResolverEvent, 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:
<ServiceInstanceResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ServiceInstanceResolverRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ServiceInstanceResolverRequestStream {}
impl futures::stream::FusedStream for ServiceInstanceResolverRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ServiceInstanceResolverRequestStream {
type Protocol = ServiceInstanceResolverMarker;
type ControlHandle = ServiceInstanceResolverControlHandle;
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 {
ServiceInstanceResolverControlHandle { 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 ServiceInstanceResolverRequestStream {
type Item = Result<ServiceInstanceResolverRequest, 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 ServiceInstanceResolverRequestStream 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 {
0x1a0d0c9fc6f2fd7 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(ServiceInstanceResolverResolveServiceInstanceRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceInstanceResolverResolveServiceInstanceRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ServiceInstanceResolverControlHandle {
inner: this.inner.clone(),
};
Ok(ServiceInstanceResolverRequest::ResolveServiceInstance {service: req.service,
instance: req.instance,
timeout: req.timeout,
options: req.options,
responder: ServiceInstanceResolverResolveServiceInstanceResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <ServiceInstanceResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ServiceInstanceResolverRequest {
ResolveServiceInstance {
service: String,
instance: String,
timeout: i64,
options: ServiceInstanceResolutionOptions,
responder: ServiceInstanceResolverResolveServiceInstanceResponder,
},
}
impl ServiceInstanceResolverRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_resolve_service_instance(
self,
) -> Option<(
String,
String,
i64,
ServiceInstanceResolutionOptions,
ServiceInstanceResolverResolveServiceInstanceResponder,
)> {
if let ServiceInstanceResolverRequest::ResolveServiceInstance {
service,
instance,
timeout,
options,
responder,
} = self
{
Some((service, instance, timeout, options, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ServiceInstanceResolverRequest::ResolveServiceInstance { .. } => {
"resolve_service_instance"
}
}
}
}
#[derive(Debug, Clone)]
pub struct ServiceInstanceResolverControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ServiceInstanceResolverControlHandle {
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 ServiceInstanceResolverControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ServiceInstanceResolverResolveServiceInstanceResponder {
control_handle: std::mem::ManuallyDrop<ServiceInstanceResolverControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ServiceInstanceResolverResolveServiceInstanceResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ServiceInstanceResolverResolveServiceInstanceResponder {
type ControlHandle = ServiceInstanceResolverControlHandle;
fn control_handle(&self) -> &ServiceInstanceResolverControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ServiceInstanceResolverResolveServiceInstanceResponder {
pub fn send(self, mut instance: &ServiceInstance) -> Result<(), fidl::Error> {
let _result = self.send_raw(instance);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut instance: &ServiceInstance,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(instance);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut instance: &ServiceInstance) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<ServiceInstanceResolverResolveServiceInstanceResponse>(
(instance,),
self.tx_id,
0x1a0d0c9fc6f2fd7,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ServiceSubscriberMarker;
impl fidl::endpoints::ProtocolMarker for ServiceSubscriberMarker {
type Proxy = ServiceSubscriberProxy;
type RequestStream = ServiceSubscriberRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ServiceSubscriberSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) ServiceSubscriber";
}
pub trait ServiceSubscriberProxyInterface: Send + Sync {
type OnInstanceDiscoveredResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
+ Send;
fn r#on_instance_discovered(
&self,
instance: &ServiceInstance,
) -> Self::OnInstanceDiscoveredResponseFut;
type OnInstanceChangedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#on_instance_changed(
&self,
instance: &ServiceInstance,
) -> Self::OnInstanceChangedResponseFut;
type OnInstanceLostResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#on_instance_lost(&self, service: &str, instance: &str) -> Self::OnInstanceLostResponseFut;
type OnQueryResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#on_query(&self, resource_type: ResourceType) -> Self::OnQueryResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ServiceSubscriberSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ServiceSubscriberSynchronousProxy {
type Proxy = ServiceSubscriberProxy;
type Protocol = ServiceSubscriberMarker;
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 ServiceSubscriberSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<ServiceSubscriberMarker 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<ServiceSubscriberEvent, fidl::Error> {
ServiceSubscriberEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#on_instance_discovered(
&self,
mut instance: &ServiceInstance,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self.client.send_query::<
ServiceSubscriberOnInstanceDiscoveredRequest,
fidl::encoding::EmptyPayload,
>(
(instance,),
0x74aa039fd81dcab2,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#on_instance_changed(
&self,
mut instance: &ServiceInstance,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<ServiceSubscriberOnInstanceChangedRequest, fidl::encoding::EmptyPayload>(
(instance,),
0x24da258aad929434,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#on_instance_lost(
&self,
mut service: &str,
mut instance: &str,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<ServiceSubscriberOnInstanceLostRequest, fidl::encoding::EmptyPayload>(
(service, instance),
0x5beddb781791773f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#on_query(
&self,
mut resource_type: ResourceType,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<ServiceSubscriberOnQueryRequest, fidl::encoding::EmptyPayload>(
(resource_type,),
0x1d0496189fdb23f5,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct ServiceSubscriberProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ServiceSubscriberProxy {
type Protocol = ServiceSubscriberMarker;
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 ServiceSubscriberProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<ServiceSubscriberMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ServiceSubscriberEventStream {
ServiceSubscriberEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#on_instance_discovered(
&self,
mut instance: &ServiceInstance,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
ServiceSubscriberProxyInterface::r#on_instance_discovered(self, instance)
}
pub fn r#on_instance_changed(
&self,
mut instance: &ServiceInstance,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
ServiceSubscriberProxyInterface::r#on_instance_changed(self, instance)
}
pub fn r#on_instance_lost(
&self,
mut service: &str,
mut instance: &str,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
ServiceSubscriberProxyInterface::r#on_instance_lost(self, service, instance)
}
pub fn r#on_query(
&self,
mut resource_type: ResourceType,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
ServiceSubscriberProxyInterface::r#on_query(self, resource_type)
}
}
impl ServiceSubscriberProxyInterface for ServiceSubscriberProxy {
type OnInstanceDiscoveredResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#on_instance_discovered(
&self,
mut instance: &ServiceInstance,
) -> Self::OnInstanceDiscoveredResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x74aa039fd81dcab2,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<ServiceSubscriberOnInstanceDiscoveredRequest, ()>(
(instance,),
0x74aa039fd81dcab2,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type OnInstanceChangedResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#on_instance_changed(
&self,
mut instance: &ServiceInstance,
) -> Self::OnInstanceChangedResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x24da258aad929434,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<ServiceSubscriberOnInstanceChangedRequest, ()>(
(instance,),
0x24da258aad929434,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type OnInstanceLostResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#on_instance_lost(
&self,
mut service: &str,
mut instance: &str,
) -> Self::OnInstanceLostResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x5beddb781791773f,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<ServiceSubscriberOnInstanceLostRequest, ()>(
(service, instance),
0x5beddb781791773f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type OnQueryResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#on_query(&self, mut resource_type: ResourceType) -> Self::OnQueryResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x1d0496189fdb23f5,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<ServiceSubscriberOnQueryRequest, ()>(
(resource_type,),
0x1d0496189fdb23f5,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct ServiceSubscriberEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ServiceSubscriberEventStream {}
impl futures::stream::FusedStream for ServiceSubscriberEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ServiceSubscriberEventStream {
type Item = Result<ServiceSubscriberEvent, 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(ServiceSubscriberEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ServiceSubscriberEvent {}
impl ServiceSubscriberEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ServiceSubscriberEvent, 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:
<ServiceSubscriberMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ServiceSubscriberRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ServiceSubscriberRequestStream {}
impl futures::stream::FusedStream for ServiceSubscriberRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ServiceSubscriberRequestStream {
type Protocol = ServiceSubscriberMarker;
type ControlHandle = ServiceSubscriberControlHandle;
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 {
ServiceSubscriberControlHandle { 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 ServiceSubscriberRequestStream {
type Item = Result<ServiceSubscriberRequest, 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 ServiceSubscriberRequestStream 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 {
0x74aa039fd81dcab2 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ServiceSubscriberOnInstanceDiscoveredRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceSubscriberOnInstanceDiscoveredRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
ServiceSubscriberControlHandle { inner: this.inner.clone() };
Ok(ServiceSubscriberRequest::OnInstanceDiscovered {
instance: req.instance,
responder: ServiceSubscriberOnInstanceDiscoveredResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x24da258aad929434 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ServiceSubscriberOnInstanceChangedRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceSubscriberOnInstanceChangedRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
ServiceSubscriberControlHandle { inner: this.inner.clone() };
Ok(ServiceSubscriberRequest::OnInstanceChanged {
instance: req.instance,
responder: ServiceSubscriberOnInstanceChangedResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x5beddb781791773f => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ServiceSubscriberOnInstanceLostRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceSubscriberOnInstanceLostRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
ServiceSubscriberControlHandle { inner: this.inner.clone() };
Ok(ServiceSubscriberRequest::OnInstanceLost {
service: req.service,
instance: req.instance,
responder: ServiceSubscriberOnInstanceLostResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x1d0496189fdb23f5 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ServiceSubscriberOnQueryRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceSubscriberOnQueryRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
ServiceSubscriberControlHandle { inner: this.inner.clone() };
Ok(ServiceSubscriberRequest::OnQuery {
resource_type: req.resource_type,
responder: ServiceSubscriberOnQueryResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ServiceSubscriberMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ServiceSubscriberRequest {
OnInstanceDiscovered {
instance: ServiceInstance,
responder: ServiceSubscriberOnInstanceDiscoveredResponder,
},
OnInstanceChanged {
instance: ServiceInstance,
responder: ServiceSubscriberOnInstanceChangedResponder,
},
OnInstanceLost {
service: String,
instance: String,
responder: ServiceSubscriberOnInstanceLostResponder,
},
OnQuery { resource_type: ResourceType, responder: ServiceSubscriberOnQueryResponder },
}
impl ServiceSubscriberRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_on_instance_discovered(
self,
) -> Option<(ServiceInstance, ServiceSubscriberOnInstanceDiscoveredResponder)> {
if let ServiceSubscriberRequest::OnInstanceDiscovered { instance, responder } = self {
Some((instance, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_instance_changed(
self,
) -> Option<(ServiceInstance, ServiceSubscriberOnInstanceChangedResponder)> {
if let ServiceSubscriberRequest::OnInstanceChanged { instance, responder } = self {
Some((instance, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_instance_lost(
self,
) -> Option<(String, String, ServiceSubscriberOnInstanceLostResponder)> {
if let ServiceSubscriberRequest::OnInstanceLost { service, instance, responder } = self {
Some((service, instance, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_query(self) -> Option<(ResourceType, ServiceSubscriberOnQueryResponder)> {
if let ServiceSubscriberRequest::OnQuery { resource_type, responder } = self {
Some((resource_type, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ServiceSubscriberRequest::OnInstanceDiscovered { .. } => "on_instance_discovered",
ServiceSubscriberRequest::OnInstanceChanged { .. } => "on_instance_changed",
ServiceSubscriberRequest::OnInstanceLost { .. } => "on_instance_lost",
ServiceSubscriberRequest::OnQuery { .. } => "on_query",
}
}
}
#[derive(Debug, Clone)]
pub struct ServiceSubscriberControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ServiceSubscriberControlHandle {
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 ServiceSubscriberControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ServiceSubscriberOnInstanceDiscoveredResponder {
control_handle: std::mem::ManuallyDrop<ServiceSubscriberControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ServiceSubscriberOnInstanceDiscoveredResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ServiceSubscriberOnInstanceDiscoveredResponder {
type ControlHandle = ServiceSubscriberControlHandle;
fn control_handle(&self) -> &ServiceSubscriberControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ServiceSubscriberOnInstanceDiscoveredResponder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x74aa039fd81dcab2,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ServiceSubscriberOnInstanceChangedResponder {
control_handle: std::mem::ManuallyDrop<ServiceSubscriberControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ServiceSubscriberOnInstanceChangedResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ServiceSubscriberOnInstanceChangedResponder {
type ControlHandle = ServiceSubscriberControlHandle;
fn control_handle(&self) -> &ServiceSubscriberControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ServiceSubscriberOnInstanceChangedResponder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x24da258aad929434,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ServiceSubscriberOnInstanceLostResponder {
control_handle: std::mem::ManuallyDrop<ServiceSubscriberControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ServiceSubscriberOnInstanceLostResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ServiceSubscriberOnInstanceLostResponder {
type ControlHandle = ServiceSubscriberControlHandle;
fn control_handle(&self) -> &ServiceSubscriberControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ServiceSubscriberOnInstanceLostResponder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x5beddb781791773f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ServiceSubscriberOnQueryResponder {
control_handle: std::mem::ManuallyDrop<ServiceSubscriberControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ServiceSubscriberOnQueryResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ServiceSubscriberOnQueryResponder {
type ControlHandle = ServiceSubscriberControlHandle;
fn control_handle(&self) -> &ServiceSubscriberControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ServiceSubscriberOnQueryResponder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x1d0496189fdb23f5,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ServiceSubscriber2Marker;
impl fidl::endpoints::ProtocolMarker for ServiceSubscriber2Marker {
type Proxy = ServiceSubscriber2Proxy;
type RequestStream = ServiceSubscriber2RequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ServiceSubscriber2SynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.net.mdns.ServiceSubscriber2";
}
impl fidl::endpoints::DiscoverableProtocolMarker for ServiceSubscriber2Marker {}
pub trait ServiceSubscriber2ProxyInterface: Send + Sync {
fn r#subscribe_to_service(
&self,
service: &str,
options: &ServiceSubscriptionOptions,
listener: fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
) -> Result<(), fidl::Error>;
fn r#subscribe_to_all_services(
&self,
options: &ServiceSubscriptionOptions,
listener: fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ServiceSubscriber2SynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ServiceSubscriber2SynchronousProxy {
type Proxy = ServiceSubscriber2Proxy;
type Protocol = ServiceSubscriber2Marker;
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 ServiceSubscriber2SynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<ServiceSubscriber2Marker 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<ServiceSubscriber2Event, fidl::Error> {
ServiceSubscriber2Event::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#subscribe_to_service(
&self,
mut service: &str,
mut options: &ServiceSubscriptionOptions,
mut listener: fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<ServiceSubscriber2SubscribeToServiceRequest>(
(service, options, listener),
0x78f713d88dcf34aa,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#subscribe_to_all_services(
&self,
mut options: &ServiceSubscriptionOptions,
mut listener: fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<ServiceSubscriber2SubscribeToAllServicesRequest>(
(options, listener),
0x7c5192d46e380468,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct ServiceSubscriber2Proxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ServiceSubscriber2Proxy {
type Protocol = ServiceSubscriber2Marker;
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 ServiceSubscriber2Proxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<ServiceSubscriber2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ServiceSubscriber2EventStream {
ServiceSubscriber2EventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#subscribe_to_service(
&self,
mut service: &str,
mut options: &ServiceSubscriptionOptions,
mut listener: fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
) -> Result<(), fidl::Error> {
ServiceSubscriber2ProxyInterface::r#subscribe_to_service(self, service, options, listener)
}
pub fn r#subscribe_to_all_services(
&self,
mut options: &ServiceSubscriptionOptions,
mut listener: fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
) -> Result<(), fidl::Error> {
ServiceSubscriber2ProxyInterface::r#subscribe_to_all_services(self, options, listener)
}
}
impl ServiceSubscriber2ProxyInterface for ServiceSubscriber2Proxy {
fn r#subscribe_to_service(
&self,
mut service: &str,
mut options: &ServiceSubscriptionOptions,
mut listener: fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<ServiceSubscriber2SubscribeToServiceRequest>(
(service, options, listener),
0x78f713d88dcf34aa,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#subscribe_to_all_services(
&self,
mut options: &ServiceSubscriptionOptions,
mut listener: fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<ServiceSubscriber2SubscribeToAllServicesRequest>(
(options, listener),
0x7c5192d46e380468,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct ServiceSubscriber2EventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ServiceSubscriber2EventStream {}
impl futures::stream::FusedStream for ServiceSubscriber2EventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ServiceSubscriber2EventStream {
type Item = Result<ServiceSubscriber2Event, 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(ServiceSubscriber2Event::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ServiceSubscriber2Event {}
impl ServiceSubscriber2Event {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ServiceSubscriber2Event, 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:
<ServiceSubscriber2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ServiceSubscriber2RequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ServiceSubscriber2RequestStream {}
impl futures::stream::FusedStream for ServiceSubscriber2RequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ServiceSubscriber2RequestStream {
type Protocol = ServiceSubscriber2Marker;
type ControlHandle = ServiceSubscriber2ControlHandle;
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 {
ServiceSubscriber2ControlHandle { 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 ServiceSubscriber2RequestStream {
type Item = Result<ServiceSubscriber2Request, 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 ServiceSubscriber2RequestStream 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 {
0x78f713d88dcf34aa => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(ServiceSubscriber2SubscribeToServiceRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceSubscriber2SubscribeToServiceRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ServiceSubscriber2ControlHandle {
inner: this.inner.clone(),
};
Ok(ServiceSubscriber2Request::SubscribeToService {service: req.service,
options: req.options,
listener: req.listener,
control_handle,
})
}
0x7c5192d46e380468 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(ServiceSubscriber2SubscribeToAllServicesRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceSubscriber2SubscribeToAllServicesRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ServiceSubscriber2ControlHandle {
inner: this.inner.clone(),
};
Ok(ServiceSubscriber2Request::SubscribeToAllServices {options: req.options,
listener: req.listener,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <ServiceSubscriber2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ServiceSubscriber2Request {
SubscribeToService {
service: String,
options: ServiceSubscriptionOptions,
listener: fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
control_handle: ServiceSubscriber2ControlHandle,
},
SubscribeToAllServices {
options: ServiceSubscriptionOptions,
listener: fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
control_handle: ServiceSubscriber2ControlHandle,
},
}
impl ServiceSubscriber2Request {
#[allow(irrefutable_let_patterns)]
pub fn into_subscribe_to_service(
self,
) -> Option<(
String,
ServiceSubscriptionOptions,
fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
ServiceSubscriber2ControlHandle,
)> {
if let ServiceSubscriber2Request::SubscribeToService {
service,
options,
listener,
control_handle,
} = self
{
Some((service, options, listener, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_subscribe_to_all_services(
self,
) -> Option<(
ServiceSubscriptionOptions,
fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
ServiceSubscriber2ControlHandle,
)> {
if let ServiceSubscriber2Request::SubscribeToAllServices {
options,
listener,
control_handle,
} = self
{
Some((options, listener, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ServiceSubscriber2Request::SubscribeToService { .. } => "subscribe_to_service",
ServiceSubscriber2Request::SubscribeToAllServices { .. } => "subscribe_to_all_services",
}
}
}
#[derive(Debug, Clone)]
pub struct ServiceSubscriber2ControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ServiceSubscriber2ControlHandle {
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 ServiceSubscriber2ControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ServiceSubscriptionListenerMarker;
impl fidl::endpoints::ProtocolMarker for ServiceSubscriptionListenerMarker {
type Proxy = ServiceSubscriptionListenerProxy;
type RequestStream = ServiceSubscriptionListenerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ServiceSubscriptionListenerSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) ServiceSubscriptionListener";
}
pub trait ServiceSubscriptionListenerProxyInterface: Send + Sync {
type OnInstanceDiscoveredResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
+ Send;
fn r#on_instance_discovered(
&self,
instance: &ServiceInstance,
) -> Self::OnInstanceDiscoveredResponseFut;
type OnInstanceChangedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#on_instance_changed(
&self,
instance: &ServiceInstance,
) -> Self::OnInstanceChangedResponseFut;
type OnInstanceLostResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#on_instance_lost(&self, service: &str, instance: &str) -> Self::OnInstanceLostResponseFut;
type OnQueryResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#on_query(&self, resource_type: ResourceType) -> Self::OnQueryResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ServiceSubscriptionListenerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ServiceSubscriptionListenerSynchronousProxy {
type Proxy = ServiceSubscriptionListenerProxy;
type Protocol = ServiceSubscriptionListenerMarker;
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 ServiceSubscriptionListenerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<ServiceSubscriptionListenerMarker 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<ServiceSubscriptionListenerEvent, fidl::Error> {
ServiceSubscriptionListenerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#on_instance_discovered(
&self,
mut instance: &ServiceInstance,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self.client.send_query::<
ServiceSubscriptionListenerOnInstanceDiscoveredRequest,
fidl::encoding::EmptyPayload,
>(
(instance,),
0x82f861e0b26a186,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#on_instance_changed(
&self,
mut instance: &ServiceInstance,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self.client.send_query::<
ServiceSubscriptionListenerOnInstanceChangedRequest,
fidl::encoding::EmptyPayload,
>(
(instance,),
0x7da325aa758d8929,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#on_instance_lost(
&self,
mut service: &str,
mut instance: &str,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self.client.send_query::<
ServiceSubscriptionListenerOnInstanceLostRequest,
fidl::encoding::EmptyPayload,
>(
(service, instance,),
0x2ecb2f1600c5c6dc,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#on_query(
&self,
mut resource_type: ResourceType,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<ServiceSubscriptionListenerOnQueryRequest, fidl::encoding::EmptyPayload>(
(resource_type,),
0x4f4eb8e3d10db611,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct ServiceSubscriptionListenerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ServiceSubscriptionListenerProxy {
type Protocol = ServiceSubscriptionListenerMarker;
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 ServiceSubscriptionListenerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<ServiceSubscriptionListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ServiceSubscriptionListenerEventStream {
ServiceSubscriptionListenerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#on_instance_discovered(
&self,
mut instance: &ServiceInstance,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
ServiceSubscriptionListenerProxyInterface::r#on_instance_discovered(self, instance)
}
pub fn r#on_instance_changed(
&self,
mut instance: &ServiceInstance,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
ServiceSubscriptionListenerProxyInterface::r#on_instance_changed(self, instance)
}
pub fn r#on_instance_lost(
&self,
mut service: &str,
mut instance: &str,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
ServiceSubscriptionListenerProxyInterface::r#on_instance_lost(self, service, instance)
}
pub fn r#on_query(
&self,
mut resource_type: ResourceType,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
ServiceSubscriptionListenerProxyInterface::r#on_query(self, resource_type)
}
}
impl ServiceSubscriptionListenerProxyInterface for ServiceSubscriptionListenerProxy {
type OnInstanceDiscoveredResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#on_instance_discovered(
&self,
mut instance: &ServiceInstance,
) -> Self::OnInstanceDiscoveredResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x82f861e0b26a186,
>(_buf?)?;
Ok(_response)
}
self.client
.send_query_and_decode::<ServiceSubscriptionListenerOnInstanceDiscoveredRequest, ()>(
(instance,),
0x82f861e0b26a186,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type OnInstanceChangedResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#on_instance_changed(
&self,
mut instance: &ServiceInstance,
) -> Self::OnInstanceChangedResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x7da325aa758d8929,
>(_buf?)?;
Ok(_response)
}
self.client
.send_query_and_decode::<ServiceSubscriptionListenerOnInstanceChangedRequest, ()>(
(instance,),
0x7da325aa758d8929,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type OnInstanceLostResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#on_instance_lost(
&self,
mut service: &str,
mut instance: &str,
) -> Self::OnInstanceLostResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2ecb2f1600c5c6dc,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<ServiceSubscriptionListenerOnInstanceLostRequest, ()>(
(service, instance),
0x2ecb2f1600c5c6dc,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type OnQueryResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#on_query(&self, mut resource_type: ResourceType) -> Self::OnQueryResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x4f4eb8e3d10db611,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<ServiceSubscriptionListenerOnQueryRequest, ()>(
(resource_type,),
0x4f4eb8e3d10db611,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct ServiceSubscriptionListenerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ServiceSubscriptionListenerEventStream {}
impl futures::stream::FusedStream for ServiceSubscriptionListenerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ServiceSubscriptionListenerEventStream {
type Item = Result<ServiceSubscriptionListenerEvent, 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(ServiceSubscriptionListenerEvent::decode(buf)))
}
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ServiceSubscriptionListenerEvent {}
impl ServiceSubscriptionListenerEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ServiceSubscriptionListenerEvent, 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: <ServiceSubscriptionListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
})
}
}
}
pub struct ServiceSubscriptionListenerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ServiceSubscriptionListenerRequestStream {}
impl futures::stream::FusedStream for ServiceSubscriptionListenerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ServiceSubscriptionListenerRequestStream {
type Protocol = ServiceSubscriptionListenerMarker;
type ControlHandle = ServiceSubscriptionListenerControlHandle;
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 {
ServiceSubscriptionListenerControlHandle { 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 ServiceSubscriptionListenerRequestStream {
type Item = Result<ServiceSubscriptionListenerRequest, 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 ServiceSubscriptionListenerRequestStream 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 {
0x82f861e0b26a186 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(ServiceSubscriptionListenerOnInstanceDiscoveredRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceSubscriptionListenerOnInstanceDiscoveredRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ServiceSubscriptionListenerControlHandle {
inner: this.inner.clone(),
};
Ok(ServiceSubscriptionListenerRequest::OnInstanceDiscovered {instance: req.instance,
responder: ServiceSubscriptionListenerOnInstanceDiscoveredResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x7da325aa758d8929 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(ServiceSubscriptionListenerOnInstanceChangedRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceSubscriptionListenerOnInstanceChangedRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ServiceSubscriptionListenerControlHandle {
inner: this.inner.clone(),
};
Ok(ServiceSubscriptionListenerRequest::OnInstanceChanged {instance: req.instance,
responder: ServiceSubscriptionListenerOnInstanceChangedResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2ecb2f1600c5c6dc => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(ServiceSubscriptionListenerOnInstanceLostRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceSubscriptionListenerOnInstanceLostRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ServiceSubscriptionListenerControlHandle {
inner: this.inner.clone(),
};
Ok(ServiceSubscriptionListenerRequest::OnInstanceLost {service: req.service,
instance: req.instance,
responder: ServiceSubscriptionListenerOnInstanceLostResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x4f4eb8e3d10db611 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(ServiceSubscriptionListenerOnQueryRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceSubscriptionListenerOnQueryRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ServiceSubscriptionListenerControlHandle {
inner: this.inner.clone(),
};
Ok(ServiceSubscriptionListenerRequest::OnQuery {resource_type: req.resource_type,
responder: ServiceSubscriptionListenerOnQueryResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <ServiceSubscriptionListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ServiceSubscriptionListenerRequest {
OnInstanceDiscovered {
instance: ServiceInstance,
responder: ServiceSubscriptionListenerOnInstanceDiscoveredResponder,
},
OnInstanceChanged {
instance: ServiceInstance,
responder: ServiceSubscriptionListenerOnInstanceChangedResponder,
},
OnInstanceLost {
service: String,
instance: String,
responder: ServiceSubscriptionListenerOnInstanceLostResponder,
},
OnQuery { resource_type: ResourceType, responder: ServiceSubscriptionListenerOnQueryResponder },
}
impl ServiceSubscriptionListenerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_on_instance_discovered(
self,
) -> Option<(ServiceInstance, ServiceSubscriptionListenerOnInstanceDiscoveredResponder)> {
if let ServiceSubscriptionListenerRequest::OnInstanceDiscovered { instance, responder } =
self
{
Some((instance, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_instance_changed(
self,
) -> Option<(ServiceInstance, ServiceSubscriptionListenerOnInstanceChangedResponder)> {
if let ServiceSubscriptionListenerRequest::OnInstanceChanged { instance, responder } = self
{
Some((instance, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_instance_lost(
self,
) -> Option<(String, String, ServiceSubscriptionListenerOnInstanceLostResponder)> {
if let ServiceSubscriptionListenerRequest::OnInstanceLost { service, instance, responder } =
self
{
Some((service, instance, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_query(
self,
) -> Option<(ResourceType, ServiceSubscriptionListenerOnQueryResponder)> {
if let ServiceSubscriptionListenerRequest::OnQuery { resource_type, responder } = self {
Some((resource_type, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ServiceSubscriptionListenerRequest::OnInstanceDiscovered { .. } => {
"on_instance_discovered"
}
ServiceSubscriptionListenerRequest::OnInstanceChanged { .. } => "on_instance_changed",
ServiceSubscriptionListenerRequest::OnInstanceLost { .. } => "on_instance_lost",
ServiceSubscriptionListenerRequest::OnQuery { .. } => "on_query",
}
}
}
#[derive(Debug, Clone)]
pub struct ServiceSubscriptionListenerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ServiceSubscriptionListenerControlHandle {
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 ServiceSubscriptionListenerControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ServiceSubscriptionListenerOnInstanceDiscoveredResponder {
control_handle: std::mem::ManuallyDrop<ServiceSubscriptionListenerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ServiceSubscriptionListenerOnInstanceDiscoveredResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ServiceSubscriptionListenerOnInstanceDiscoveredResponder {
type ControlHandle = ServiceSubscriptionListenerControlHandle;
fn control_handle(&self) -> &ServiceSubscriptionListenerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ServiceSubscriptionListenerOnInstanceDiscoveredResponder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x82f861e0b26a186,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ServiceSubscriptionListenerOnInstanceChangedResponder {
control_handle: std::mem::ManuallyDrop<ServiceSubscriptionListenerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ServiceSubscriptionListenerOnInstanceChangedResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ServiceSubscriptionListenerOnInstanceChangedResponder {
type ControlHandle = ServiceSubscriptionListenerControlHandle;
fn control_handle(&self) -> &ServiceSubscriptionListenerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ServiceSubscriptionListenerOnInstanceChangedResponder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x7da325aa758d8929,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ServiceSubscriptionListenerOnInstanceLostResponder {
control_handle: std::mem::ManuallyDrop<ServiceSubscriptionListenerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ServiceSubscriptionListenerOnInstanceLostResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ServiceSubscriptionListenerOnInstanceLostResponder {
type ControlHandle = ServiceSubscriptionListenerControlHandle;
fn control_handle(&self) -> &ServiceSubscriptionListenerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ServiceSubscriptionListenerOnInstanceLostResponder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x2ecb2f1600c5c6dc,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ServiceSubscriptionListenerOnQueryResponder {
control_handle: std::mem::ManuallyDrop<ServiceSubscriptionListenerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ServiceSubscriptionListenerOnQueryResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ServiceSubscriptionListenerOnQueryResponder {
type ControlHandle = ServiceSubscriptionListenerControlHandle;
fn control_handle(&self) -> &ServiceSubscriptionListenerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ServiceSubscriptionListenerOnQueryResponder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x4f4eb8e3d10db611,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct SubscriberMarker;
impl fidl::endpoints::ProtocolMarker for SubscriberMarker {
type Proxy = SubscriberProxy;
type RequestStream = SubscriberRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = SubscriberSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.net.mdns.Subscriber";
}
impl fidl::endpoints::DiscoverableProtocolMarker for SubscriberMarker {}
pub trait SubscriberProxyInterface: Send + Sync {
fn r#subscribe_to_service(
&self,
service: &str,
subscriber: fidl::endpoints::ClientEnd<ServiceSubscriberMarker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct SubscriberSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for SubscriberSynchronousProxy {
type Proxy = SubscriberProxy;
type Protocol = SubscriberMarker;
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 SubscriberSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <SubscriberMarker 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<SubscriberEvent, fidl::Error> {
SubscriberEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#subscribe_to_service(
&self,
mut service: &str,
mut subscriber: fidl::endpoints::ClientEnd<ServiceSubscriberMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<SubscriberSubscribeToServiceRequest>(
(service, subscriber),
0x3a1a3b02c1809e3f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct SubscriberProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for SubscriberProxy {
type Protocol = SubscriberMarker;
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 SubscriberProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <SubscriberMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> SubscriberEventStream {
SubscriberEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#subscribe_to_service(
&self,
mut service: &str,
mut subscriber: fidl::endpoints::ClientEnd<ServiceSubscriberMarker>,
) -> Result<(), fidl::Error> {
SubscriberProxyInterface::r#subscribe_to_service(self, service, subscriber)
}
}
impl SubscriberProxyInterface for SubscriberProxy {
fn r#subscribe_to_service(
&self,
mut service: &str,
mut subscriber: fidl::endpoints::ClientEnd<ServiceSubscriberMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<SubscriberSubscribeToServiceRequest>(
(service, subscriber),
0x3a1a3b02c1809e3f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct SubscriberEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for SubscriberEventStream {}
impl futures::stream::FusedStream for SubscriberEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for SubscriberEventStream {
type Item = Result<SubscriberEvent, 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(SubscriberEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum SubscriberEvent {}
impl SubscriberEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<SubscriberEvent, 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: <SubscriberMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct SubscriberRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for SubscriberRequestStream {}
impl futures::stream::FusedStream for SubscriberRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for SubscriberRequestStream {
type Protocol = SubscriberMarker;
type ControlHandle = SubscriberControlHandle;
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 {
SubscriberControlHandle { 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 SubscriberRequestStream {
type Item = Result<SubscriberRequest, 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 SubscriberRequestStream 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 {
0x3a1a3b02c1809e3f => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
SubscriberSubscribeToServiceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SubscriberSubscribeToServiceRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = SubscriberControlHandle { inner: this.inner.clone() };
Ok(SubscriberRequest::SubscribeToService {
service: req.service,
subscriber: req.subscriber,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<SubscriberMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum SubscriberRequest {
SubscribeToService {
service: String,
subscriber: fidl::endpoints::ClientEnd<ServiceSubscriberMarker>,
control_handle: SubscriberControlHandle,
},
}
impl SubscriberRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_subscribe_to_service(
self,
) -> Option<(
String,
fidl::endpoints::ClientEnd<ServiceSubscriberMarker>,
SubscriberControlHandle,
)> {
if let SubscriberRequest::SubscribeToService { service, subscriber, control_handle } = self
{
Some((service, subscriber, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
SubscriberRequest::SubscribeToService { .. } => "subscribe_to_service",
}
}
}
#[derive(Debug, Clone)]
pub struct SubscriberControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for SubscriberControlHandle {
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 SubscriberControlHandle {}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for IpVersions {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
impl fidl::encoding::ValueTypeMarker for IpVersions {
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 IpVersions {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
if self.bits() & Self::all().bits() != self.bits() {
return Err(fidl::Error::InvalidBitsValue);
}
encoder.write_num(self.bits(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for IpVersions {
#[inline(always)]
fn new_empty() -> Self {
Self::empty()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for Media {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
impl fidl::encoding::ValueTypeMarker for Media {
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 Media {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
if self.bits() & Self::all().bits() != self.bits() {
return Err(fidl::Error::InvalidBitsValue);
}
encoder.write_num(self.bits(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Media {
#[inline(always)]
fn new_empty() -> Self {
Self::empty()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for Error {
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 Error {
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 Error {
#[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 Error {
#[inline(always)]
fn new_empty() -> Self {
Self::InvalidServiceName
}
#[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(())
}
}
unsafe impl fidl::encoding::TypeMarker for OnPublicationError {
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 OnPublicationError {
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 OnPublicationError
{
#[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 OnPublicationError {
#[inline(always)]
fn new_empty() -> Self {
Self::DoNotRespond
}
#[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(())
}
}
unsafe impl fidl::encoding::TypeMarker for PublicationCause {
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 PublicationCause {
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 PublicationCause
{
#[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 PublicationCause {
#[inline(always)]
fn new_empty() -> Self {
Self::Announcement
}
#[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(())
}
}
unsafe impl fidl::encoding::TypeMarker for PublishProxyHostError {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for PublishProxyHostError {
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 PublishProxyHostError
{
#[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 PublishProxyHostError {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for PublishServiceInstanceError {
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 PublishServiceInstanceError {
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 PublishServiceInstanceError
{
#[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 PublishServiceInstanceError
{
#[inline(always)]
fn new_empty() -> Self {
Self::AlreadyPublishedLocally
}
#[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(())
}
}
unsafe impl fidl::encoding::TypeMarker for ResourceType {
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 ResourceType {
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 ResourceType {
#[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 ResourceType {
#[inline(always)]
fn new_empty() -> Self {
Self::Ptr
}
#[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(())
}
}
unsafe impl fidl::encoding::TypeMarker for ServiceInstancePublicationCause {
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 ServiceInstancePublicationCause {
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 ServiceInstancePublicationCause
{
#[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 ServiceInstancePublicationCause
{
#[inline(always)]
fn new_empty() -> Self {
Self::Announcement
}
#[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 HostAddress {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HostAddress {
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<HostAddress, D>
for &HostAddress
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostAddress>(offset);
fidl::encoding::Encode::<HostAddress, D>::encode(
(
<fidl_fuchsia_net::IpAddress as fidl::encoding::ValueTypeMarker>::borrow(
&self.address,
),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.interface),
<i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.ttl),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_net::IpAddress, D>,
T1: fidl::encoding::Encode<u64, D>,
T2: fidl::encoding::Encode<i64, D>,
> fidl::encoding::Encode<HostAddress, D> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostAddress>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 24, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HostAddress {
#[inline(always)]
fn new_empty() -> Self {
Self {
address: fidl::new_empty!(fidl_fuchsia_net::IpAddress, D),
interface: fidl::new_empty!(u64, D),
ttl: fidl::new_empty!(i64, 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.address,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(u64, D, &mut self.interface, decoder, offset + 16, _depth)?;
fidl::decode!(i64, D, &mut self.ttl, decoder, offset + 24, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for HostNameResolverResolveHostNameRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HostNameResolverResolveHostNameRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<HostNameResolverResolveHostNameRequest, D>
for &HostNameResolverResolveHostNameRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostNameResolverResolveHostNameRequest>(offset);
fidl::encoding::Encode::<HostNameResolverResolveHostNameRequest, D>::encode(
(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
&self.host,
),
<i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.timeout),
<HostNameResolutionOptions 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<i64, D>,
T2: fidl::encoding::Encode<HostNameResolutionOptions, D>,
> fidl::encoding::Encode<HostNameResolverResolveHostNameRequest, D> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostNameResolverResolveHostNameRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 24, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for HostNameResolverResolveHostNameRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
host: fidl::new_empty!(fidl::encoding::BoundedString<255>, D),
timeout: fidl::new_empty!(i64, D),
options: fidl::new_empty!(HostNameResolutionOptions, 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.host,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(i64, D, &mut self.timeout, decoder, offset + 16, _depth)?;
fidl::decode!(
HostNameResolutionOptions,
D,
&mut self.options,
decoder,
offset + 24,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for HostNameResolverResolveHostNameResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HostNameResolverResolveHostNameResponse {
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<HostNameResolverResolveHostNameResponse, D>
for &HostNameResolverResolveHostNameResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostNameResolverResolveHostNameResponse>(offset);
fidl::encoding::Encode::<HostNameResolverResolveHostNameResponse, D>::encode(
(
<fidl::encoding::Vector<HostAddress, 64> as fidl::encoding::ValueTypeMarker>::borrow(&self.addresses),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<HostAddress, 64>, D>,
> fidl::encoding::Encode<HostNameResolverResolveHostNameResponse, 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::<HostNameResolverResolveHostNameResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for HostNameResolverResolveHostNameResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { addresses: fidl::new_empty!(fidl::encoding::Vector<HostAddress, 64>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::Vector<HostAddress, 64>, D, &mut self.addresses, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for HostNameSubscriberSubscribeToHostNameRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HostNameSubscriberSubscribeToHostNameRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
unsafe impl
fidl::encoding::Encode<
HostNameSubscriberSubscribeToHostNameRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut HostNameSubscriberSubscribeToHostNameRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostNameSubscriberSubscribeToHostNameRequest>(offset);
fidl::encoding::Encode::<
HostNameSubscriberSubscribeToHostNameRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
&self.host,
),
<HostNameSubscriptionOptions as fidl::encoding::ValueTypeMarker>::borrow(
&self.options,
),
<fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<HostNameSubscriptionListenerMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.listener
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::BoundedString<255>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
HostNameSubscriptionOptions,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T2: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<HostNameSubscriptionListenerMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
HostNameSubscriberSubscribeToHostNameRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostNameSubscriberSubscribeToHostNameRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 32, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for HostNameSubscriberSubscribeToHostNameRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
host: fidl::new_empty!(
fidl::encoding::BoundedString<255>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
options: fidl::new_empty!(
HostNameSubscriptionOptions,
fidl::encoding::DefaultFuchsiaResourceDialect
),
listener: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<HostNameSubscriptionListenerMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::BoundedString<255>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.host,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
HostNameSubscriptionOptions,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.options,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<HostNameSubscriptionListenerMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.listener,
decoder,
offset + 32,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for HostNameSubscriptionListenerOnAddressesChangedRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HostNameSubscriptionListenerOnAddressesChangedRequest {
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<HostNameSubscriptionListenerOnAddressesChangedRequest, D>
for &HostNameSubscriptionListenerOnAddressesChangedRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostNameSubscriptionListenerOnAddressesChangedRequest>(
offset,
);
fidl::encoding::Encode::<HostNameSubscriptionListenerOnAddressesChangedRequest, D>::encode(
(
<fidl::encoding::Vector<HostAddress, 64> as fidl::encoding::ValueTypeMarker>::borrow(&self.addresses),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<HostAddress, 64>, D>,
> fidl::encoding::Encode<HostNameSubscriptionListenerOnAddressesChangedRequest, 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::<HostNameSubscriptionListenerOnAddressesChangedRequest>(
offset,
);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for HostNameSubscriptionListenerOnAddressesChangedRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { addresses: fidl::new_empty!(fidl::encoding::Vector<HostAddress, 64>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::Vector<HostAddress, 64>, D, &mut self.addresses, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for ProxyHostPublisherPublishProxyHostRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ProxyHostPublisherPublishProxyHostRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
56
}
}
unsafe impl
fidl::encoding::Encode<
ProxyHostPublisherPublishProxyHostRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ProxyHostPublisherPublishProxyHostRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProxyHostPublisherPublishProxyHostRequest>(offset);
fidl::encoding::Encode::<ProxyHostPublisherPublishProxyHostRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(&self.host),
<fidl::encoding::Vector<fidl_fuchsia_net::IpAddress, 64> as fidl::encoding::ValueTypeMarker>::borrow(&self.addresses),
<ProxyHostPublicationOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ServiceInstancePublisherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.service_instance_publisher),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::BoundedString<255>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::Vector<fidl_fuchsia_net::IpAddress, 64>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T2: fidl::encoding::Encode<
ProxyHostPublicationOptions,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T3: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<ServiceInstancePublisherMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
ProxyHostPublisherPublishProxyHostRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1, T2, T3)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProxyHostPublisherPublishProxyHostRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(48);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 32, depth)?;
self.3.encode(encoder, offset + 48, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for ProxyHostPublisherPublishProxyHostRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
host: fidl::new_empty!(
fidl::encoding::BoundedString<255>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
addresses: fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_net::IpAddress, 64>, fidl::encoding::DefaultFuchsiaResourceDialect),
options: fidl::new_empty!(
ProxyHostPublicationOptions,
fidl::encoding::DefaultFuchsiaResourceDialect
),
service_instance_publisher: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<ServiceInstancePublisherMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(48) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 48 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::BoundedString<255>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.host,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_net::IpAddress, 64>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.addresses, decoder, offset + 16, _depth)?;
fidl::decode!(
ProxyHostPublicationOptions,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.options,
decoder,
offset + 32,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<ServiceInstancePublisherMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.service_instance_publisher,
decoder,
offset + 48,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Publication {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Publication {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
56
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Publication, D>
for &Publication
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Publication>(offset);
fidl::encoding::Encode::<Publication, D>::encode(
(
<u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.port),
<fidl::encoding::Vector<fidl::encoding::BoundedString<255>, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.text),
<u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.srv_priority),
<u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.srv_weight),
<i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.ptr_ttl),
<i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.srv_ttl),
<i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.txt_ttl),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u16, D>,
T1: fidl::encoding::Encode<
fidl::encoding::Vector<fidl::encoding::BoundedString<255>, 256>,
D,
>,
T2: fidl::encoding::Encode<u16, D>,
T3: fidl::encoding::Encode<u16, D>,
T4: fidl::encoding::Encode<i64, D>,
T5: fidl::encoding::Encode<i64, D>,
T6: fidl::encoding::Encode<i64, D>,
> fidl::encoding::Encode<Publication, D> for (T0, T1, T2, T3, T4, T5, T6)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Publication>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 24, depth)?;
self.3.encode(encoder, offset + 26, depth)?;
self.4.encode(encoder, offset + 32, depth)?;
self.5.encode(encoder, offset + 40, depth)?;
self.6.encode(encoder, offset + 48, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Publication {
#[inline(always)]
fn new_empty() -> Self {
Self {
port: fidl::new_empty!(u16, D),
text: fidl::new_empty!(
fidl::encoding::Vector<fidl::encoding::BoundedString<255>, 256>,
D
),
srv_priority: fidl::new_empty!(u16, D),
srv_weight: fidl::new_empty!(u16, D),
ptr_ttl: fidl::new_empty!(i64, D),
srv_ttl: fidl::new_empty!(i64, D),
txt_ttl: fidl::new_empty!(i64, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffff0000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(u16, D, &mut self.port, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::Vector<fidl::encoding::BoundedString<255>, 256>,
D,
&mut self.text,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(u16, D, &mut self.srv_priority, decoder, offset + 24, _depth)?;
fidl::decode!(u16, D, &mut self.srv_weight, decoder, offset + 26, _depth)?;
fidl::decode!(i64, D, &mut self.ptr_ttl, decoder, offset + 32, _depth)?;
fidl::decode!(i64, D, &mut self.srv_ttl, decoder, offset + 40, _depth)?;
fidl::decode!(i64, D, &mut self.txt_ttl, decoder, offset + 48, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PublicationResponderOnPublicationRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PublicationResponderOnPublicationRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PublicationResponderOnPublicationRequest, D>
for &PublicationResponderOnPublicationRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PublicationResponderOnPublicationRequest>(offset);
fidl::encoding::Encode::<PublicationResponderOnPublicationRequest, D>::encode(
(
<PublicationCause as fidl::encoding::ValueTypeMarker>::borrow(&self.publication_cause),
<fidl::encoding::Optional<fidl::encoding::BoundedString<63>> as fidl::encoding::ValueTypeMarker>::borrow(&self.subtype),
<fidl::encoding::Vector<fidl_fuchsia_net::IpAddress, 64> as fidl::encoding::ValueTypeMarker>::borrow(&self.source_addresses),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<PublicationCause, D>,
T1: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<63>>, D>,
T2: fidl::encoding::Encode<fidl::encoding::Vector<fidl_fuchsia_net::IpAddress, 64>, D>,
> fidl::encoding::Encode<PublicationResponderOnPublicationRequest, D> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PublicationResponderOnPublicationRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 24, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PublicationResponderOnPublicationRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
publication_cause: fidl::new_empty!(PublicationCause, D),
subtype: fidl::new_empty!(
fidl::encoding::Optional<fidl::encoding::BoundedString<63>>,
D
),
source_addresses: fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_net::IpAddress, 64>, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
PublicationCause,
D,
&mut self.publication_cause,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Optional<fidl::encoding::BoundedString<63>>,
D,
&mut self.subtype,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_net::IpAddress, 64>, D, &mut self.source_addresses, decoder, offset + 24, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PublicationResponderOnPublicationResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PublicationResponderOnPublicationResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PublicationResponderOnPublicationResponse, D>
for &PublicationResponderOnPublicationResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PublicationResponderOnPublicationResponse>(offset);
fidl::encoding::Encode::<PublicationResponderOnPublicationResponse, D>::encode(
(<fidl::encoding::Boxed<Publication> as fidl::encoding::ValueTypeMarker>::borrow(
&self.publication,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Boxed<Publication>, D>,
> fidl::encoding::Encode<PublicationResponderOnPublicationResponse, 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::<PublicationResponderOnPublicationResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PublicationResponderOnPublicationResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { publication: fidl::new_empty!(fidl::encoding::Boxed<Publication>, 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::Boxed<Publication>,
D,
&mut self.publication,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PublicationResponderSetSubtypesRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PublicationResponderSetSubtypesRequest {
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<PublicationResponderSetSubtypesRequest, D>
for &PublicationResponderSetSubtypesRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PublicationResponderSetSubtypesRequest>(offset);
fidl::encoding::Encode::<PublicationResponderSetSubtypesRequest, D>::encode(
(
<fidl::encoding::Vector<fidl::encoding::BoundedString<63>, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.subtypes),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<
fidl::encoding::Vector<fidl::encoding::BoundedString<63>, 256>,
D,
>,
> fidl::encoding::Encode<PublicationResponderSetSubtypesRequest, 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::<PublicationResponderSetSubtypesRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PublicationResponderSetSubtypesRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
subtypes: fidl::new_empty!(
fidl::encoding::Vector<fidl::encoding::BoundedString<63>, 256>,
D
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Vector<fidl::encoding::BoundedString<63>, 256>,
D,
&mut self.subtypes,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for PublisherPublishServiceInstanceRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PublisherPublishServiceInstanceRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
48
}
}
unsafe impl
fidl::encoding::Encode<
PublisherPublishServiceInstanceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut PublisherPublishServiceInstanceRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PublisherPublishServiceInstanceRequest>(offset);
fidl::encoding::Encode::<
PublisherPublishServiceInstanceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<fidl::encoding::BoundedString<22> as fidl::encoding::ValueTypeMarker>::borrow(
&self.service,
),
<fidl::encoding::BoundedString<63> as fidl::encoding::ValueTypeMarker>::borrow(
&self.instance,
),
<Media as fidl::encoding::ValueTypeMarker>::borrow(&self.media),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.perform_probe),
<fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<PublicationResponder_Marker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.publication_responder,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::BoundedString<22>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::BoundedString<63>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T2: fidl::encoding::Encode<Media, fidl::encoding::DefaultFuchsiaResourceDialect>,
T3: fidl::encoding::Encode<bool, fidl::encoding::DefaultFuchsiaResourceDialect>,
T4: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PublicationResponder_Marker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
PublisherPublishServiceInstanceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1, T2, T3, T4)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PublisherPublishServiceInstanceRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
(ptr as *mut u64).write_unaligned(0);
}
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 32, depth)?;
self.3.encode(encoder, offset + 36, depth)?;
self.4.encode(encoder, offset + 40, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for PublisherPublishServiceInstanceRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
service: fidl::new_empty!(
fidl::encoding::BoundedString<22>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
instance: fidl::new_empty!(
fidl::encoding::BoundedString<63>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
media: fidl::new_empty!(Media, fidl::encoding::DefaultFuchsiaResourceDialect),
perform_probe: fidl::new_empty!(
bool,
fidl::encoding::DefaultFuchsiaResourceDialect
),
publication_responder: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<PublicationResponder_Marker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffff0000000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::BoundedString<22>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.service,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::BoundedString<63>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.instance,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(
Media,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.media,
decoder,
offset + 32,
_depth
)?;
fidl::decode!(
bool,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.perform_probe,
decoder,
offset + 36,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PublicationResponder_Marker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.publication_responder,
decoder,
offset + 40,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ResolverResolveHostNameRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ResolverResolveHostNameRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<ResolverResolveHostNameRequest, D>
for &ResolverResolveHostNameRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ResolverResolveHostNameRequest>(offset);
fidl::encoding::Encode::<ResolverResolveHostNameRequest, D>::encode(
(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
&self.host,
),
<i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.timeout),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>, D>,
T1: fidl::encoding::Encode<i64, D>,
> fidl::encoding::Encode<ResolverResolveHostNameRequest, 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::<ResolverResolveHostNameRequest>(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 ResolverResolveHostNameRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
host: fidl::new_empty!(fidl::encoding::BoundedString<255>, D),
timeout: fidl::new_empty!(i64, 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.host,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(i64, D, &mut self.timeout, decoder, offset + 16, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ResolverResolveHostNameResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ResolverResolveHostNameResponse {
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<ResolverResolveHostNameResponse, D>
for &ResolverResolveHostNameResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ResolverResolveHostNameResponse>(offset);
fidl::encoding::Encode::<ResolverResolveHostNameResponse, D>::encode(
(
<fidl::encoding::Boxed<fidl_fuchsia_net::Ipv4Address> as fidl::encoding::ValueTypeMarker>::borrow(&self.v4_address),
<fidl::encoding::Boxed<fidl_fuchsia_net::Ipv6Address> as fidl::encoding::ValueTypeMarker>::borrow(&self.v6_address),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Boxed<fidl_fuchsia_net::Ipv4Address>, D>,
T1: fidl::encoding::Encode<fidl::encoding::Boxed<fidl_fuchsia_net::Ipv6Address>, D>,
> fidl::encoding::Encode<ResolverResolveHostNameResponse, 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::<ResolverResolveHostNameResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ResolverResolveHostNameResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
v4_address: fidl::new_empty!(
fidl::encoding::Boxed<fidl_fuchsia_net::Ipv4Address>,
D
),
v6_address: fidl::new_empty!(
fidl::encoding::Boxed<fidl_fuchsia_net::Ipv6Address>,
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::Boxed<fidl_fuchsia_net::Ipv4Address>,
D,
&mut self.v4_address,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Boxed<fidl_fuchsia_net::Ipv6Address>,
D,
&mut self.v6_address,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ServiceInstancePublicationResponderOnPublicationRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ServiceInstancePublicationResponderOnPublicationRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<ServiceInstancePublicationResponderOnPublicationRequest, D>
for &ServiceInstancePublicationResponderOnPublicationRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ServiceInstancePublicationResponderOnPublicationRequest>(
offset,
);
fidl::encoding::Encode::<ServiceInstancePublicationResponderOnPublicationRequest, D>::encode(
(
<ServiceInstancePublicationCause as fidl::encoding::ValueTypeMarker>::borrow(&self.publication_cause),
<fidl::encoding::Optional<fidl::encoding::BoundedString<63>> as fidl::encoding::ValueTypeMarker>::borrow(&self.subtype),
<fidl::encoding::Vector<fidl_fuchsia_net::IpAddress, 64> as fidl::encoding::ValueTypeMarker>::borrow(&self.source_addresses),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<ServiceInstancePublicationCause, D>,
T1: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<63>>, D>,
T2: fidl::encoding::Encode<fidl::encoding::Vector<fidl_fuchsia_net::IpAddress, 64>, D>,
> fidl::encoding::Encode<ServiceInstancePublicationResponderOnPublicationRequest, D>
for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ServiceInstancePublicationResponderOnPublicationRequest>(
offset,
);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 24, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ServiceInstancePublicationResponderOnPublicationRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
publication_cause: fidl::new_empty!(ServiceInstancePublicationCause, D),
subtype: fidl::new_empty!(
fidl::encoding::Optional<fidl::encoding::BoundedString<63>>,
D
),
source_addresses: fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_net::IpAddress, 64>, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
ServiceInstancePublicationCause,
D,
&mut self.publication_cause,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Optional<fidl::encoding::BoundedString<63>>,
D,
&mut self.subtype,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_net::IpAddress, 64>, D, &mut self.source_addresses, decoder, offset + 24, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ServiceInstancePublicationResponderSetSubtypesRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ServiceInstancePublicationResponderSetSubtypesRequest {
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<ServiceInstancePublicationResponderSetSubtypesRequest, D>
for &ServiceInstancePublicationResponderSetSubtypesRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ServiceInstancePublicationResponderSetSubtypesRequest>(
offset,
);
fidl::encoding::Encode::<ServiceInstancePublicationResponderSetSubtypesRequest, D>::encode(
(
<fidl::encoding::Vector<fidl::encoding::BoundedString<63>, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.subtypes),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<
fidl::encoding::Vector<fidl::encoding::BoundedString<63>, 256>,
D,
>,
> fidl::encoding::Encode<ServiceInstancePublicationResponderSetSubtypesRequest, 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::<ServiceInstancePublicationResponderSetSubtypesRequest>(
offset,
);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ServiceInstancePublicationResponderSetSubtypesRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
subtypes: fidl::new_empty!(
fidl::encoding::Vector<fidl::encoding::BoundedString<63>, 256>,
D
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Vector<fidl::encoding::BoundedString<63>, 256>,
D,
&mut self.subtypes,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ServiceInstancePublicationResponderOnPublicationResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker
for ServiceInstancePublicationResponderOnPublicationResponse
{
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<ServiceInstancePublicationResponderOnPublicationResponse, D>
for &ServiceInstancePublicationResponderOnPublicationResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ServiceInstancePublicationResponderOnPublicationResponse>(
offset,
);
fidl::encoding::Encode::<ServiceInstancePublicationResponderOnPublicationResponse, D>::encode(
(
<ServiceInstancePublication as fidl::encoding::ValueTypeMarker>::borrow(&self.publication),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<ServiceInstancePublication, D>,
> fidl::encoding::Encode<ServiceInstancePublicationResponderOnPublicationResponse, 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::<ServiceInstancePublicationResponderOnPublicationResponse>(
offset,
);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ServiceInstancePublicationResponderOnPublicationResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { publication: fidl::new_empty!(ServiceInstancePublication, 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!(
ServiceInstancePublication,
D,
&mut self.publication,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for ServiceInstancePublisherPublishServiceInstanceRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ServiceInstancePublisherPublishServiceInstanceRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
56
}
}
unsafe impl
fidl::encoding::Encode<
ServiceInstancePublisherPublishServiceInstanceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ServiceInstancePublisherPublishServiceInstanceRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ServiceInstancePublisherPublishServiceInstanceRequest>(
offset,
);
fidl::encoding::Encode::<
ServiceInstancePublisherPublishServiceInstanceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<fidl::encoding::BoundedString<22> as fidl::encoding::ValueTypeMarker>::borrow(
&self.service,
),
<fidl::encoding::BoundedString<63> as fidl::encoding::ValueTypeMarker>::borrow(
&self.instance,
),
<ServiceInstancePublicationOptions as fidl::encoding::ValueTypeMarker>::borrow(
&self.options,
),
<fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<ServiceInstancePublicationResponder_Marker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.publication_responder,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::BoundedString<22>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::BoundedString<63>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T2: fidl::encoding::Encode<
ServiceInstancePublicationOptions,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T3: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<ServiceInstancePublicationResponder_Marker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
ServiceInstancePublisherPublishServiceInstanceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1, T2, T3)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ServiceInstancePublisherPublishServiceInstanceRequest>(
offset,
);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(48);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 32, depth)?;
self.3.encode(encoder, offset + 48, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for ServiceInstancePublisherPublishServiceInstanceRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
service: fidl::new_empty!(
fidl::encoding::BoundedString<22>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
instance: fidl::new_empty!(
fidl::encoding::BoundedString<63>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
options: fidl::new_empty!(
ServiceInstancePublicationOptions,
fidl::encoding::DefaultFuchsiaResourceDialect
),
publication_responder: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<ServiceInstancePublicationResponder_Marker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(48) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 48 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::BoundedString<22>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.service,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::BoundedString<63>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.instance,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(
ServiceInstancePublicationOptions,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.options,
decoder,
offset + 32,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<ServiceInstancePublicationResponder_Marker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.publication_responder,
decoder,
offset + 48,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ServiceInstanceResolverResolveServiceInstanceRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ServiceInstanceResolverResolveServiceInstanceRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
56
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<ServiceInstanceResolverResolveServiceInstanceRequest, D>
for &ServiceInstanceResolverResolveServiceInstanceRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder
.debug_check_bounds::<ServiceInstanceResolverResolveServiceInstanceRequest>(offset);
fidl::encoding::Encode::<ServiceInstanceResolverResolveServiceInstanceRequest, D>::encode(
(
<fidl::encoding::BoundedString<22> as fidl::encoding::ValueTypeMarker>::borrow(&self.service),
<fidl::encoding::BoundedString<63> as fidl::encoding::ValueTypeMarker>::borrow(&self.instance),
<i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.timeout),
<ServiceInstanceResolutionOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<22>, D>,
T1: fidl::encoding::Encode<fidl::encoding::BoundedString<63>, D>,
T2: fidl::encoding::Encode<i64, D>,
T3: fidl::encoding::Encode<ServiceInstanceResolutionOptions, D>,
> fidl::encoding::Encode<ServiceInstanceResolverResolveServiceInstanceRequest, D>
for (T0, T1, T2, T3)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder
.debug_check_bounds::<ServiceInstanceResolverResolveServiceInstanceRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 32, depth)?;
self.3.encode(encoder, offset + 40, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ServiceInstanceResolverResolveServiceInstanceRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
service: fidl::new_empty!(fidl::encoding::BoundedString<22>, D),
instance: fidl::new_empty!(fidl::encoding::BoundedString<63>, D),
timeout: fidl::new_empty!(i64, D),
options: fidl::new_empty!(ServiceInstanceResolutionOptions, 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<22>,
D,
&mut self.service,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::BoundedString<63>,
D,
&mut self.instance,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(i64, D, &mut self.timeout, decoder, offset + 32, _depth)?;
fidl::decode!(
ServiceInstanceResolutionOptions,
D,
&mut self.options,
decoder,
offset + 40,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ServiceInstanceResolverResolveServiceInstanceResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ServiceInstanceResolverResolveServiceInstanceResponse {
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<ServiceInstanceResolverResolveServiceInstanceResponse, D>
for &ServiceInstanceResolverResolveServiceInstanceResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ServiceInstanceResolverResolveServiceInstanceResponse>(
offset,
);
fidl::encoding::Encode::<ServiceInstanceResolverResolveServiceInstanceResponse, D>::encode(
(
<ServiceInstance as fidl::encoding::ValueTypeMarker>::borrow(&self.instance),
),
encoder, offset, _depth
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<ServiceInstance, D>>
fidl::encoding::Encode<ServiceInstanceResolverResolveServiceInstanceResponse, 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::<ServiceInstanceResolverResolveServiceInstanceResponse>(
offset,
);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ServiceInstanceResolverResolveServiceInstanceResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { instance: fidl::new_empty!(ServiceInstance, 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!(ServiceInstance, D, &mut self.instance, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for ServiceSubscriber2SubscribeToAllServicesRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ServiceSubscriber2SubscribeToAllServicesRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl
fidl::encoding::Encode<
ServiceSubscriber2SubscribeToAllServicesRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ServiceSubscriber2SubscribeToAllServicesRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ServiceSubscriber2SubscribeToAllServicesRequest>(offset);
fidl::encoding::Encode::<
ServiceSubscriber2SubscribeToAllServicesRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<ServiceSubscriptionOptions as fidl::encoding::ValueTypeMarker>::borrow(
&self.options,
),
<fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.listener
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
ServiceSubscriptionOptions,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
ServiceSubscriber2SubscribeToAllServicesRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ServiceSubscriber2SubscribeToAllServicesRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for ServiceSubscriber2SubscribeToAllServicesRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
options: fidl::new_empty!(
ServiceSubscriptionOptions,
fidl::encoding::DefaultFuchsiaResourceDialect
),
listener: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
ServiceSubscriptionOptions,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.options,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.listener,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for ServiceSubscriber2SubscribeToServiceRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ServiceSubscriber2SubscribeToServiceRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
unsafe impl
fidl::encoding::Encode<
ServiceSubscriber2SubscribeToServiceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ServiceSubscriber2SubscribeToServiceRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ServiceSubscriber2SubscribeToServiceRequest>(offset);
fidl::encoding::Encode::<
ServiceSubscriber2SubscribeToServiceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<fidl::encoding::BoundedString<22> as fidl::encoding::ValueTypeMarker>::borrow(
&self.service,
),
<ServiceSubscriptionOptions as fidl::encoding::ValueTypeMarker>::borrow(
&self.options,
),
<fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.listener
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::BoundedString<22>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
ServiceSubscriptionOptions,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T2: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
ServiceSubscriber2SubscribeToServiceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ServiceSubscriber2SubscribeToServiceRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 32, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for ServiceSubscriber2SubscribeToServiceRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
service: fidl::new_empty!(
fidl::encoding::BoundedString<22>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
options: fidl::new_empty!(
ServiceSubscriptionOptions,
fidl::encoding::DefaultFuchsiaResourceDialect
),
listener: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::BoundedString<22>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.service,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
ServiceSubscriptionOptions,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.options,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.listener,
decoder,
offset + 32,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ServiceSubscriberOnInstanceChangedRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ServiceSubscriberOnInstanceChangedRequest {
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<ServiceSubscriberOnInstanceChangedRequest, D>
for &ServiceSubscriberOnInstanceChangedRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ServiceSubscriberOnInstanceChangedRequest>(offset);
fidl::encoding::Encode::<ServiceSubscriberOnInstanceChangedRequest, D>::encode(
(<ServiceInstance as fidl::encoding::ValueTypeMarker>::borrow(&self.instance),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<ServiceInstance, D>>
fidl::encoding::Encode<ServiceSubscriberOnInstanceChangedRequest, 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::<ServiceSubscriberOnInstanceChangedRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ServiceSubscriberOnInstanceChangedRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { instance: fidl::new_empty!(ServiceInstance, 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!(ServiceInstance, D, &mut self.instance, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ServiceSubscriberOnInstanceDiscoveredRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ServiceSubscriberOnInstanceDiscoveredRequest {
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<ServiceSubscriberOnInstanceDiscoveredRequest, D>
for &ServiceSubscriberOnInstanceDiscoveredRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ServiceSubscriberOnInstanceDiscoveredRequest>(offset);
fidl::encoding::Encode::<ServiceSubscriberOnInstanceDiscoveredRequest, D>::encode(
(<ServiceInstance as fidl::encoding::ValueTypeMarker>::borrow(&self.instance),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<ServiceInstance, D>>
fidl::encoding::Encode<ServiceSubscriberOnInstanceDiscoveredRequest, 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::<ServiceSubscriberOnInstanceDiscoveredRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ServiceSubscriberOnInstanceDiscoveredRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { instance: fidl::new_empty!(ServiceInstance, 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!(ServiceInstance, D, &mut self.instance, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ServiceSubscriberOnInstanceLostRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ServiceSubscriberOnInstanceLostRequest {
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<ServiceSubscriberOnInstanceLostRequest, D>
for &ServiceSubscriberOnInstanceLostRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ServiceSubscriberOnInstanceLostRequest>(offset);
fidl::encoding::Encode::<ServiceSubscriberOnInstanceLostRequest, D>::encode(
(
<fidl::encoding::BoundedString<22> as fidl::encoding::ValueTypeMarker>::borrow(
&self.service,
),
<fidl::encoding::BoundedString<63> as fidl::encoding::ValueTypeMarker>::borrow(
&self.instance,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<22>, D>,
T1: fidl::encoding::Encode<fidl::encoding::BoundedString<63>, D>,
> fidl::encoding::Encode<ServiceSubscriberOnInstanceLostRequest, 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::<ServiceSubscriberOnInstanceLostRequest>(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 ServiceSubscriberOnInstanceLostRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
service: fidl::new_empty!(fidl::encoding::BoundedString<22>, D),
instance: fidl::new_empty!(fidl::encoding::BoundedString<63>, 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<22>,
D,
&mut self.service,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::BoundedString<63>,
D,
&mut self.instance,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ServiceSubscriberOnQueryRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ServiceSubscriberOnQueryRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<ServiceSubscriberOnQueryRequest, D>
for &ServiceSubscriberOnQueryRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ServiceSubscriberOnQueryRequest>(offset);
fidl::encoding::Encode::<ServiceSubscriberOnQueryRequest, D>::encode(
(<ResourceType as fidl::encoding::ValueTypeMarker>::borrow(&self.resource_type),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<ResourceType, D>>
fidl::encoding::Encode<ServiceSubscriberOnQueryRequest, 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::<ServiceSubscriberOnQueryRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ServiceSubscriberOnQueryRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { resource_type: fidl::new_empty!(ResourceType, 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!(ResourceType, D, &mut self.resource_type, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ServiceSubscriptionListenerOnInstanceChangedRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ServiceSubscriptionListenerOnInstanceChangedRequest {
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<ServiceSubscriptionListenerOnInstanceChangedRequest, D>
for &ServiceSubscriptionListenerOnInstanceChangedRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder
.debug_check_bounds::<ServiceSubscriptionListenerOnInstanceChangedRequest>(offset);
fidl::encoding::Encode::<ServiceSubscriptionListenerOnInstanceChangedRequest, D>::encode(
(<ServiceInstance as fidl::encoding::ValueTypeMarker>::borrow(&self.instance),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<ServiceInstance, D>>
fidl::encoding::Encode<ServiceSubscriptionListenerOnInstanceChangedRequest, 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::<ServiceSubscriptionListenerOnInstanceChangedRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ServiceSubscriptionListenerOnInstanceChangedRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { instance: fidl::new_empty!(ServiceInstance, 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!(ServiceInstance, D, &mut self.instance, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ServiceSubscriptionListenerOnInstanceDiscoveredRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ServiceSubscriptionListenerOnInstanceDiscoveredRequest {
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<ServiceSubscriptionListenerOnInstanceDiscoveredRequest, D>
for &ServiceSubscriptionListenerOnInstanceDiscoveredRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ServiceSubscriptionListenerOnInstanceDiscoveredRequest>(
offset,
);
fidl::encoding::Encode::<ServiceSubscriptionListenerOnInstanceDiscoveredRequest, D>::encode(
(
<ServiceInstance as fidl::encoding::ValueTypeMarker>::borrow(&self.instance),
),
encoder, offset, _depth
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<ServiceInstance, D>>
fidl::encoding::Encode<ServiceSubscriptionListenerOnInstanceDiscoveredRequest, 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::<ServiceSubscriptionListenerOnInstanceDiscoveredRequest>(
offset,
);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ServiceSubscriptionListenerOnInstanceDiscoveredRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { instance: fidl::new_empty!(ServiceInstance, 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!(ServiceInstance, D, &mut self.instance, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ServiceSubscriptionListenerOnInstanceLostRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ServiceSubscriptionListenerOnInstanceLostRequest {
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<ServiceSubscriptionListenerOnInstanceLostRequest, D>
for &ServiceSubscriptionListenerOnInstanceLostRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ServiceSubscriptionListenerOnInstanceLostRequest>(offset);
fidl::encoding::Encode::<ServiceSubscriptionListenerOnInstanceLostRequest, D>::encode(
(
<fidl::encoding::BoundedString<22> as fidl::encoding::ValueTypeMarker>::borrow(
&self.service,
),
<fidl::encoding::BoundedString<63> as fidl::encoding::ValueTypeMarker>::borrow(
&self.instance,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<22>, D>,
T1: fidl::encoding::Encode<fidl::encoding::BoundedString<63>, D>,
> fidl::encoding::Encode<ServiceSubscriptionListenerOnInstanceLostRequest, 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::<ServiceSubscriptionListenerOnInstanceLostRequest>(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 ServiceSubscriptionListenerOnInstanceLostRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
service: fidl::new_empty!(fidl::encoding::BoundedString<22>, D),
instance: fidl::new_empty!(fidl::encoding::BoundedString<63>, 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<22>,
D,
&mut self.service,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::BoundedString<63>,
D,
&mut self.instance,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ServiceSubscriptionListenerOnQueryRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ServiceSubscriptionListenerOnQueryRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<ServiceSubscriptionListenerOnQueryRequest, D>
for &ServiceSubscriptionListenerOnQueryRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ServiceSubscriptionListenerOnQueryRequest>(offset);
fidl::encoding::Encode::<ServiceSubscriptionListenerOnQueryRequest, D>::encode(
(<ResourceType as fidl::encoding::ValueTypeMarker>::borrow(&self.resource_type),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<ResourceType, D>>
fidl::encoding::Encode<ServiceSubscriptionListenerOnQueryRequest, 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::<ServiceSubscriptionListenerOnQueryRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ServiceSubscriptionListenerOnQueryRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { resource_type: fidl::new_empty!(ResourceType, 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!(ResourceType, D, &mut self.resource_type, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for SubscriberSubscribeToServiceRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SubscriberSubscribeToServiceRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl
fidl::encoding::Encode<
SubscriberSubscribeToServiceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut SubscriberSubscribeToServiceRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SubscriberSubscribeToServiceRequest>(offset);
fidl::encoding::Encode::<SubscriberSubscribeToServiceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::BoundedString<22> as fidl::encoding::ValueTypeMarker>::borrow(&self.service),
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ServiceSubscriberMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.subscriber),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::BoundedString<22>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ServiceSubscriberMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
SubscriberSubscribeToServiceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SubscriberSubscribeToServiceRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for SubscriberSubscribeToServiceRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
service: fidl::new_empty!(
fidl::encoding::BoundedString<22>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
subscriber: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ServiceSubscriberMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::BoundedString<22>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.service,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ServiceSubscriberMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.subscriber,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl HostNameResolutionOptions {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.exclude_local_proxies {
return 4;
}
if let Some(_) = self.exclude_local {
return 3;
}
if let Some(_) = self.ip_versions {
return 2;
}
if let Some(_) = self.media {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for HostNameResolutionOptions {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HostNameResolutionOptions {
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<HostNameResolutionOptions, D> for &HostNameResolutionOptions
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostNameResolutionOptions>(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::<Media, D>(
self.media.as_ref().map(<Media 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::<IpVersions, D>(
self.ip_versions
.as_ref()
.map(<IpVersions 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.exclude_local.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.exclude_local_proxies
.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 HostNameResolutionOptions
{
#[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 =
<Media 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.media.get_or_insert_with(|| fidl::new_empty!(Media, D));
fidl::decode!(Media, 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 =
<IpVersions 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.ip_versions.get_or_insert_with(|| fidl::new_empty!(IpVersions, D));
fidl::decode!(IpVersions, 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.exclude_local.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.exclude_local_proxies.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 HostNameSubscriptionOptions {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.exclude_local_proxies {
return 4;
}
if let Some(_) = self.exclude_local {
return 3;
}
if let Some(_) = self.ip_versions {
return 2;
}
if let Some(_) = self.media {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for HostNameSubscriptionOptions {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HostNameSubscriptionOptions {
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<HostNameSubscriptionOptions, D> for &HostNameSubscriptionOptions
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostNameSubscriptionOptions>(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::<Media, D>(
self.media.as_ref().map(<Media 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::<IpVersions, D>(
self.ip_versions
.as_ref()
.map(<IpVersions 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.exclude_local.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.exclude_local_proxies
.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 HostNameSubscriptionOptions
{
#[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 =
<Media 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.media.get_or_insert_with(|| fidl::new_empty!(Media, D));
fidl::decode!(Media, 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 =
<IpVersions 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.ip_versions.get_or_insert_with(|| fidl::new_empty!(IpVersions, D));
fidl::decode!(IpVersions, 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.exclude_local.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.exclude_local_proxies.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 ProxyHostPublicationOptions {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.perform_probe {
return 3;
}
if let Some(_) = self.ip_versions {
return 2;
}
if let Some(_) = self.media {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for ProxyHostPublicationOptions {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ProxyHostPublicationOptions {
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<ProxyHostPublicationOptions, D> for &ProxyHostPublicationOptions
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProxyHostPublicationOptions>(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::<Media, D>(
self.media.as_ref().map(<Media 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::<IpVersions, D>(
self.ip_versions
.as_ref()
.map(<IpVersions 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.perform_probe.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 ProxyHostPublicationOptions
{
#[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 =
<Media 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.media.get_or_insert_with(|| fidl::new_empty!(Media, D));
fidl::decode!(Media, 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 =
<IpVersions 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.ip_versions.get_or_insert_with(|| fidl::new_empty!(IpVersions, D));
fidl::decode!(IpVersions, 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.perform_probe.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 ServiceInstance {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.text_strings {
return 10;
}
if let Some(_) = self.addresses {
return 9;
}
if let Some(_) = self.target {
return 8;
}
if let Some(_) = self.srv_weight {
return 7;
}
if let Some(_) = self.srv_priority {
return 6;
}
if let Some(_) = self.text {
return 5;
}
if let Some(_) = self.ipv6_endpoint {
return 4;
}
if let Some(_) = self.ipv4_endpoint {
return 3;
}
if let Some(_) = self.instance {
return 2;
}
if let Some(_) = self.service {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for ServiceInstance {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ServiceInstance {
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<ServiceInstance, D>
for &ServiceInstance
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ServiceInstance>(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::BoundedString<22>, D>(
self.service.as_ref().map(
<fidl::encoding::BoundedString<22> 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<63>, D>(
self.instance.as_ref().map(
<fidl::encoding::BoundedString<63> 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::<fidl_fuchsia_net::Ipv4SocketAddress, D>(
self.ipv4_endpoint.as_ref().map(<fidl_fuchsia_net::Ipv4SocketAddress as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
if 4 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (4 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net::Ipv6SocketAddress, D>(
self.ipv6_endpoint.as_ref().map(<fidl_fuchsia_net::Ipv6SocketAddress as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
if 5 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (5 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl::encoding::BoundedString<255>, 256>, D>(
self.text.as_ref().map(<fidl::encoding::Vector<fidl::encoding::BoundedString<255>, 256> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
if 6 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (6 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u16, D>(
self.srv_priority.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 7 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (7 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u16, D>(
self.srv_weight.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 8 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (8 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<255>, D>(
self.target.as_ref().map(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 9 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (9 - 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::SocketAddress, 64>, D>(
self.addresses.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_net::SocketAddress, 64> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
if 10 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (10 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl::encoding::Vector<u8, 255>, 256>, D>(
self.text_strings.as_ref().map(<fidl::encoding::Vector<fidl::encoding::Vector<u8, 255>, 256> 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 ServiceInstance {
#[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::BoundedString<22> 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
.service
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<22>, D));
fidl::decode!(
fidl::encoding::BoundedString<22>,
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<63> 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
.instance
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<63>, D));
fidl::decode!(
fidl::encoding::BoundedString<63>,
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 = <fidl_fuchsia_net::Ipv4SocketAddress 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_endpoint.get_or_insert_with(|| {
fidl::new_empty!(fidl_fuchsia_net::Ipv4SocketAddress, D)
});
fidl::decode!(
fidl_fuchsia_net::Ipv4SocketAddress,
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 = <fidl_fuchsia_net::Ipv6SocketAddress 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_endpoint.get_or_insert_with(|| {
fidl::new_empty!(fidl_fuchsia_net::Ipv6SocketAddress, D)
});
fidl::decode!(
fidl_fuchsia_net::Ipv6SocketAddress,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 5 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::Vector<
fidl::encoding::BoundedString<255>,
256,
> 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.text.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::Vector<fidl::encoding::BoundedString<255>, 256>,
D
)
});
fidl::decode!(
fidl::encoding::Vector<fidl::encoding::BoundedString<255>, 256>,
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 < 6 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u16 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.srv_priority.get_or_insert_with(|| fidl::new_empty!(u16, D));
fidl::decode!(u16, 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 < 7 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u16 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.srv_weight.get_or_insert_with(|| fidl::new_empty!(u16, D));
fidl::decode!(u16, 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 < 8 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::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
.target
.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;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 9 {
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::SocketAddress,
64,
> 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::SocketAddress, 64>, D));
fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_net::SocketAddress, 64>, 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 < 10 {
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::encoding::Vector<u8, 255>,
256,
> 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.text_strings.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::Vector<fidl::encoding::Vector<u8, 255>, 256>,
D
)
});
fidl::decode!(
fidl::encoding::Vector<fidl::encoding::Vector<u8, 255>, 256>,
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 ServiceInstancePublication {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.txt_ttl {
return 7;
}
if let Some(_) = self.srv_ttl {
return 6;
}
if let Some(_) = self.ptr_ttl {
return 5;
}
if let Some(_) = self.srv_weight {
return 4;
}
if let Some(_) = self.srv_priority {
return 3;
}
if let Some(_) = self.text {
return 2;
}
if let Some(_) = self.port {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for ServiceInstancePublication {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ServiceInstancePublication {
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<ServiceInstancePublication, D> for &ServiceInstancePublication
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ServiceInstancePublication>(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::<u16, D>(
self.port.as_ref().map(<u16 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::Vector<fidl::encoding::Vector<u8, 255>, 256>, D>(
self.text.as_ref().map(<fidl::encoding::Vector<fidl::encoding::Vector<u8, 255>, 256> 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::<u16, D>(
self.srv_priority.as_ref().map(<u16 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::<u16, D>(
self.srv_weight.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 5 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (5 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<i64, D>(
self.ptr_ttl.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 6 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (6 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<i64, D>(
self.srv_ttl.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 7 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (7 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<i64, D>(
self.txt_ttl.as_ref().map(<i64 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 ServiceInstancePublication
{
#[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 =
<u16 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.port.get_or_insert_with(|| fidl::new_empty!(u16, D));
fidl::decode!(u16, 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::Vector<
fidl::encoding::Vector<u8, 255>,
256,
> 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.text.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::Vector<fidl::encoding::Vector<u8, 255>, 256>,
D
)
});
fidl::decode!(
fidl::encoding::Vector<fidl::encoding::Vector<u8, 255>, 256>,
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 =
<u16 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.srv_priority.get_or_insert_with(|| fidl::new_empty!(u16, D));
fidl::decode!(u16, 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 =
<u16 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.srv_weight.get_or_insert_with(|| fidl::new_empty!(u16, D));
fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 5 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<i64 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.ptr_ttl.get_or_insert_with(|| fidl::new_empty!(i64, D));
fidl::decode!(i64, 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 < 6 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<i64 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.srv_ttl.get_or_insert_with(|| fidl::new_empty!(i64, D));
fidl::decode!(i64, 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 < 7 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<i64 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.txt_ttl.get_or_insert_with(|| fidl::new_empty!(i64, D));
fidl::decode!(i64, 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 ServiceInstancePublicationOptions {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.perform_probe {
return 3;
}
if let Some(_) = self.ip_versions {
return 2;
}
if let Some(_) = self.media {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for ServiceInstancePublicationOptions {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ServiceInstancePublicationOptions {
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<ServiceInstancePublicationOptions, D>
for &ServiceInstancePublicationOptions
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ServiceInstancePublicationOptions>(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::<Media, D>(
self.media.as_ref().map(<Media 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::<IpVersions, D>(
self.ip_versions
.as_ref()
.map(<IpVersions 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.perform_probe.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 ServiceInstancePublicationOptions
{
#[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 =
<Media 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.media.get_or_insert_with(|| fidl::new_empty!(Media, D));
fidl::decode!(Media, 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 =
<IpVersions 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.ip_versions.get_or_insert_with(|| fidl::new_empty!(IpVersions, D));
fidl::decode!(IpVersions, 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.perform_probe.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 ServiceInstanceResolutionOptions {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.exclude_local_proxies {
return 4;
}
if let Some(_) = self.exclude_local {
return 3;
}
if let Some(_) = self.ip_versions {
return 2;
}
if let Some(_) = self.media {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for ServiceInstanceResolutionOptions {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ServiceInstanceResolutionOptions {
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<ServiceInstanceResolutionOptions, D>
for &ServiceInstanceResolutionOptions
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ServiceInstanceResolutionOptions>(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::<Media, D>(
self.media.as_ref().map(<Media 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::<IpVersions, D>(
self.ip_versions
.as_ref()
.map(<IpVersions 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.exclude_local.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.exclude_local_proxies
.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 ServiceInstanceResolutionOptions
{
#[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 =
<Media 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.media.get_or_insert_with(|| fidl::new_empty!(Media, D));
fidl::decode!(Media, 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 =
<IpVersions 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.ip_versions.get_or_insert_with(|| fidl::new_empty!(IpVersions, D));
fidl::decode!(IpVersions, 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.exclude_local.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.exclude_local_proxies.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 ServiceSubscriptionOptions {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.exclude_local_proxies {
return 4;
}
if let Some(_) = self.exclude_local {
return 3;
}
if let Some(_) = self.ip_versions {
return 2;
}
if let Some(_) = self.media {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for ServiceSubscriptionOptions {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ServiceSubscriptionOptions {
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<ServiceSubscriptionOptions, D> for &ServiceSubscriptionOptions
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ServiceSubscriptionOptions>(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::<Media, D>(
self.media.as_ref().map(<Media 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::<IpVersions, D>(
self.ip_versions
.as_ref()
.map(<IpVersions 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.exclude_local.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.exclude_local_proxies
.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 ServiceSubscriptionOptions
{
#[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 =
<Media 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.media.get_or_insert_with(|| fidl::new_empty!(Media, D));
fidl::decode!(Media, 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 =
<IpVersions 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.ip_versions.get_or_insert_with(|| fidl::new_empty!(IpVersions, D));
fidl::decode!(IpVersions, 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.exclude_local.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.exclude_local_proxies.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(())
}
}
}