#![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<'_>