#![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 RegionCode = String;
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RegulatoryRegionConfiguratorSetRegionRequest {
pub region: String,
}
impl fidl::Persistable for RegulatoryRegionConfiguratorSetRegionRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RegulatoryRegionWatcherGetRegionUpdateResponse {
pub new_region: Option<String>,
}
impl fidl::Persistable for RegulatoryRegionWatcherGetRegionUpdateResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RegulatoryRegionWatcherGetUpdateResponse {
pub new_region: String,
}
impl fidl::Persistable for RegulatoryRegionWatcherGetUpdateResponse {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct RegulatoryRegionConfiguratorMarker;
impl fidl::endpoints::ProtocolMarker for RegulatoryRegionConfiguratorMarker {
type Proxy = RegulatoryRegionConfiguratorProxy;
type RequestStream = RegulatoryRegionConfiguratorRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = RegulatoryRegionConfiguratorSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.location.namedplace.RegulatoryRegionConfigurator";
}
impl fidl::endpoints::DiscoverableProtocolMarker for RegulatoryRegionConfiguratorMarker {}
pub trait RegulatoryRegionConfiguratorProxyInterface: Send + Sync {
fn r#set_region(&self, region: &str) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct RegulatoryRegionConfiguratorSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for RegulatoryRegionConfiguratorSynchronousProxy {
type Proxy = RegulatoryRegionConfiguratorProxy;
type Protocol = RegulatoryRegionConfiguratorMarker;
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 RegulatoryRegionConfiguratorSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<RegulatoryRegionConfiguratorMarker 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<RegulatoryRegionConfiguratorEvent, fidl::Error> {
RegulatoryRegionConfiguratorEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#set_region(&self, mut region: &str) -> Result<(), fidl::Error> {
self.client.send::<RegulatoryRegionConfiguratorSetRegionRequest>(
(region,),
0x677e15debe2d6910,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct RegulatoryRegionConfiguratorProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for RegulatoryRegionConfiguratorProxy {
type Protocol = RegulatoryRegionConfiguratorMarker;
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 RegulatoryRegionConfiguratorProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<RegulatoryRegionConfiguratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> RegulatoryRegionConfiguratorEventStream {
RegulatoryRegionConfiguratorEventStream {
event_receiver: self.client.take_event_receiver(),
}
}
pub fn r#set_region(&self, mut region: &str) -> Result<(), fidl::Error> {
RegulatoryRegionConfiguratorProxyInterface::r#set_region(self, region)
}
}
impl RegulatoryRegionConfiguratorProxyInterface for RegulatoryRegionConfiguratorProxy {
fn r#set_region(&self, mut region: &str) -> Result<(), fidl::Error> {
self.client.send::<RegulatoryRegionConfiguratorSetRegionRequest>(
(region,),
0x677e15debe2d6910,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct RegulatoryRegionConfiguratorEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for RegulatoryRegionConfiguratorEventStream {}
impl futures::stream::FusedStream for RegulatoryRegionConfiguratorEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for RegulatoryRegionConfiguratorEventStream {
type Item = Result<RegulatoryRegionConfiguratorEvent, 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(RegulatoryRegionConfiguratorEvent::decode(buf)))
}
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum RegulatoryRegionConfiguratorEvent {}
impl RegulatoryRegionConfiguratorEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<RegulatoryRegionConfiguratorEvent, 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: <RegulatoryRegionConfiguratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
})
}
}
}
pub struct RegulatoryRegionConfiguratorRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for RegulatoryRegionConfiguratorRequestStream {}
impl futures::stream::FusedStream for RegulatoryRegionConfiguratorRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for RegulatoryRegionConfiguratorRequestStream {
type Protocol = RegulatoryRegionConfiguratorMarker;
type ControlHandle = RegulatoryRegionConfiguratorControlHandle;
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 {
RegulatoryRegionConfiguratorControlHandle { 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 RegulatoryRegionConfiguratorRequestStream {
type Item = Result<RegulatoryRegionConfiguratorRequest, 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 RegulatoryRegionConfiguratorRequestStream 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 {
0x677e15debe2d6910 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(RegulatoryRegionConfiguratorSetRegionRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RegulatoryRegionConfiguratorSetRegionRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = RegulatoryRegionConfiguratorControlHandle {
inner: this.inner.clone(),
};
Ok(RegulatoryRegionConfiguratorRequest::SetRegion {region: req.region,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <RegulatoryRegionConfiguratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum RegulatoryRegionConfiguratorRequest {
SetRegion { region: String, control_handle: RegulatoryRegionConfiguratorControlHandle },
}
impl RegulatoryRegionConfiguratorRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_set_region(self) -> Option<(String, RegulatoryRegionConfiguratorControlHandle)> {
if let RegulatoryRegionConfiguratorRequest::SetRegion { region, control_handle } = self {
Some((region, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
RegulatoryRegionConfiguratorRequest::SetRegion { .. } => "set_region",
}
}
}
#[derive(Debug, Clone)]
pub struct RegulatoryRegionConfiguratorControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for RegulatoryRegionConfiguratorControlHandle {
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 RegulatoryRegionConfiguratorControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct RegulatoryRegionWatcherMarker;
impl fidl::endpoints::ProtocolMarker for RegulatoryRegionWatcherMarker {
type Proxy = RegulatoryRegionWatcherProxy;
type RequestStream = RegulatoryRegionWatcherRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = RegulatoryRegionWatcherSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.location.namedplace.RegulatoryRegionWatcher";
}
impl fidl::endpoints::DiscoverableProtocolMarker for RegulatoryRegionWatcherMarker {}
pub trait RegulatoryRegionWatcherProxyInterface: Send + Sync {
type GetUpdateResponseFut: std::future::Future<Output = Result<String, fidl::Error>> + Send;
fn r#get_update(&self) -> Self::GetUpdateResponseFut;
type GetRegionUpdateResponseFut: std::future::Future<Output = Result<Option<String>, fidl::Error>>
+ Send;
fn r#get_region_update(&self) -> Self::GetRegionUpdateResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct RegulatoryRegionWatcherSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for RegulatoryRegionWatcherSynchronousProxy {
type Proxy = RegulatoryRegionWatcherProxy;
type Protocol = RegulatoryRegionWatcherMarker;
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 RegulatoryRegionWatcherSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<RegulatoryRegionWatcherMarker 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<RegulatoryRegionWatcherEvent, fidl::Error> {
RegulatoryRegionWatcherEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_update(&self, ___deadline: zx::MonotonicInstant) -> Result<String, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, RegulatoryRegionWatcherGetUpdateResponse>(
(),
0xaf6dec156c31687,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.new_region)
}
pub fn r#get_region_update(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<Option<String>, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
RegulatoryRegionWatcherGetRegionUpdateResponse,
>(
(),
0x28c47004aed3ff0d,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.new_region)
}
}
#[derive(Debug, Clone)]
pub struct RegulatoryRegionWatcherProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for RegulatoryRegionWatcherProxy {
type Protocol = RegulatoryRegionWatcherMarker;
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 RegulatoryRegionWatcherProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<RegulatoryRegionWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> RegulatoryRegionWatcherEventStream {
RegulatoryRegionWatcherEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_update(
&self,
) -> fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect> {
RegulatoryRegionWatcherProxyInterface::r#get_update(self)
}
pub fn r#get_region_update(
&self,
) -> fidl::client::QueryResponseFut<Option<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
{
RegulatoryRegionWatcherProxyInterface::r#get_region_update(self)
}
}
impl RegulatoryRegionWatcherProxyInterface for RegulatoryRegionWatcherProxy {
type GetUpdateResponseFut =
fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get_update(&self) -> Self::GetUpdateResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<String, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
RegulatoryRegionWatcherGetUpdateResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0xaf6dec156c31687,
>(_buf?)?;
Ok(_response.new_region)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, String>(
(),
0xaf6dec156c31687,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetRegionUpdateResponseFut = fidl::client::QueryResponseFut<
Option<String>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_region_update(&self) -> Self::GetRegionUpdateResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Option<String>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
RegulatoryRegionWatcherGetRegionUpdateResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x28c47004aed3ff0d,
>(_buf?)?;
Ok(_response.new_region)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Option<String>>(
(),
0x28c47004aed3ff0d,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct RegulatoryRegionWatcherEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for RegulatoryRegionWatcherEventStream {}
impl futures::stream::FusedStream for RegulatoryRegionWatcherEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for RegulatoryRegionWatcherEventStream {
type Item = Result<RegulatoryRegionWatcherEvent, 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(RegulatoryRegionWatcherEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum RegulatoryRegionWatcherEvent {}
impl RegulatoryRegionWatcherEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<RegulatoryRegionWatcherEvent, 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:
<RegulatoryRegionWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct RegulatoryRegionWatcherRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for RegulatoryRegionWatcherRequestStream {}
impl futures::stream::FusedStream for RegulatoryRegionWatcherRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for RegulatoryRegionWatcherRequestStream {
type Protocol = RegulatoryRegionWatcherMarker;
type ControlHandle = RegulatoryRegionWatcherControlHandle;
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 {
RegulatoryRegionWatcherControlHandle { 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 RegulatoryRegionWatcherRequestStream {
type Item = Result<RegulatoryRegionWatcherRequest, 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 RegulatoryRegionWatcherRequestStream 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 {
0xaf6dec156c31687 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = RegulatoryRegionWatcherControlHandle {
inner: this.inner.clone(),
};
Ok(RegulatoryRegionWatcherRequest::GetUpdate {
responder: RegulatoryRegionWatcherGetUpdateResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x28c47004aed3ff0d => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = RegulatoryRegionWatcherControlHandle {
inner: this.inner.clone(),
};
Ok(RegulatoryRegionWatcherRequest::GetRegionUpdate {
responder: RegulatoryRegionWatcherGetRegionUpdateResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <RegulatoryRegionWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum RegulatoryRegionWatcherRequest {
GetUpdate { responder: RegulatoryRegionWatcherGetUpdateResponder },
GetRegionUpdate { responder: RegulatoryRegionWatcherGetRegionUpdateResponder },
}
impl RegulatoryRegionWatcherRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_update(self) -> Option<(RegulatoryRegionWatcherGetUpdateResponder)> {
if let RegulatoryRegionWatcherRequest::GetUpdate { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_region_update(
self,
) -> Option<(RegulatoryRegionWatcherGetRegionUpdateResponder)> {
if let RegulatoryRegionWatcherRequest::GetRegionUpdate { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
RegulatoryRegionWatcherRequest::GetUpdate { .. } => "get_update",
RegulatoryRegionWatcherRequest::GetRegionUpdate { .. } => "get_region_update",
}
}
}
#[derive(Debug, Clone)]
pub struct RegulatoryRegionWatcherControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for RegulatoryRegionWatcherControlHandle {
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 RegulatoryRegionWatcherControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RegulatoryRegionWatcherGetUpdateResponder {
control_handle: std::mem::ManuallyDrop<RegulatoryRegionWatcherControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RegulatoryRegionWatcherGetUpdateResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RegulatoryRegionWatcherGetUpdateResponder {
type ControlHandle = RegulatoryRegionWatcherControlHandle;
fn control_handle(&self) -> &RegulatoryRegionWatcherControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RegulatoryRegionWatcherGetUpdateResponder {
pub fn send(self, mut new_region: &str) -> Result<(), fidl::Error> {
let _result = self.send_raw(new_region);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut new_region: &str) -> Result<(), fidl::Error> {
let _result = self.send_raw(new_region);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut new_region: &str) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<RegulatoryRegionWatcherGetUpdateResponse>(
(new_region,),
self.tx_id,
0xaf6dec156c31687,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RegulatoryRegionWatcherGetRegionUpdateResponder {
control_handle: std::mem::ManuallyDrop<RegulatoryRegionWatcherControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RegulatoryRegionWatcherGetRegionUpdateResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RegulatoryRegionWatcherGetRegionUpdateResponder {
type ControlHandle = RegulatoryRegionWatcherControlHandle;
fn control_handle(&self) -> &RegulatoryRegionWatcherControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RegulatoryRegionWatcherGetRegionUpdateResponder {
pub fn send(self, mut new_region: Option<&str>) -> Result<(), fidl::Error> {
let _result = self.send_raw(new_region);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut new_region: Option<&str>) -> Result<(), fidl::Error> {
let _result = self.send_raw(new_region);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut new_region: Option<&str>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<RegulatoryRegionWatcherGetRegionUpdateResponse>(
(new_region,),
self.tx_id,
0x28c47004aed3ff0d,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
impl fidl::encoding::ValueTypeMarker for RegulatoryRegionConfiguratorSetRegionRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RegulatoryRegionConfiguratorSetRegionRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<RegulatoryRegionConfiguratorSetRegionRequest, D>
for &RegulatoryRegionConfiguratorSetRegionRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RegulatoryRegionConfiguratorSetRegionRequest>(offset);
fidl::encoding::Encode::<RegulatoryRegionConfiguratorSetRegionRequest, D>::encode(
(<fidl::encoding::BoundedString<2> as fidl::encoding::ValueTypeMarker>::borrow(
&self.region,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<2>, D>,
> fidl::encoding::Encode<RegulatoryRegionConfiguratorSetRegionRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RegulatoryRegionConfiguratorSetRegionRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for RegulatoryRegionConfiguratorSetRegionRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { region: fidl::new_empty!(fidl::encoding::BoundedString<2>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<2>,
D,
&mut self.region,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for RegulatoryRegionWatcherGetRegionUpdateResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RegulatoryRegionWatcherGetRegionUpdateResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<RegulatoryRegionWatcherGetRegionUpdateResponse, D>
for &RegulatoryRegionWatcherGetRegionUpdateResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RegulatoryRegionWatcherGetRegionUpdateResponse>(offset);
fidl::encoding::Encode::<RegulatoryRegionWatcherGetRegionUpdateResponse, D>::encode(
(
<fidl::encoding::Optional<fidl::encoding::BoundedString<2>> as fidl::encoding::ValueTypeMarker>::borrow(&self.new_region),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<2>>, D>,
> fidl::encoding::Encode<RegulatoryRegionWatcherGetRegionUpdateResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RegulatoryRegionWatcherGetRegionUpdateResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for RegulatoryRegionWatcherGetRegionUpdateResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
new_region: fidl::new_empty!(
fidl::encoding::Optional<fidl::encoding::BoundedString<2>>,
D
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Optional<fidl::encoding::BoundedString<2>>,
D,
&mut self.new_region,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for RegulatoryRegionWatcherGetUpdateResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RegulatoryRegionWatcherGetUpdateResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<RegulatoryRegionWatcherGetUpdateResponse, D>
for &RegulatoryRegionWatcherGetUpdateResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RegulatoryRegionWatcherGetUpdateResponse>(offset);
fidl::encoding::Encode::<RegulatoryRegionWatcherGetUpdateResponse, D>::encode(
(<fidl::encoding::BoundedString<2> as fidl::encoding::ValueTypeMarker>::borrow(
&self.new_region,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<2>, D>,
> fidl::encoding::Encode<RegulatoryRegionWatcherGetUpdateResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RegulatoryRegionWatcherGetUpdateResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for RegulatoryRegionWatcherGetUpdateResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { new_region: fidl::new_empty!(fidl::encoding::BoundedString<2>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<2>,
D,
&mut self.new_region,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
}