1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_location_namedplace_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct RegulatoryRegionConfiguratorMarker;
16
17impl fidl::endpoints::ProtocolMarker for RegulatoryRegionConfiguratorMarker {
18 type Proxy = RegulatoryRegionConfiguratorProxy;
19 type RequestStream = RegulatoryRegionConfiguratorRequestStream;
20 #[cfg(target_os = "fuchsia")]
21 type SynchronousProxy = RegulatoryRegionConfiguratorSynchronousProxy;
22
23 const DEBUG_NAME: &'static str = "fuchsia.location.namedplace.RegulatoryRegionConfigurator";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for RegulatoryRegionConfiguratorMarker {}
26
27pub trait RegulatoryRegionConfiguratorProxyInterface: Send + Sync {
28 fn r#set_region(&self, region: &str) -> Result<(), fidl::Error>;
29}
30#[derive(Debug)]
31#[cfg(target_os = "fuchsia")]
32pub struct RegulatoryRegionConfiguratorSynchronousProxy {
33 client: fidl::client::sync::Client,
34}
35
36#[cfg(target_os = "fuchsia")]
37impl fidl::endpoints::SynchronousProxy for RegulatoryRegionConfiguratorSynchronousProxy {
38 type Proxy = RegulatoryRegionConfiguratorProxy;
39 type Protocol = RegulatoryRegionConfiguratorMarker;
40
41 fn from_channel(inner: fidl::Channel) -> Self {
42 Self::new(inner)
43 }
44
45 fn into_channel(self) -> fidl::Channel {
46 self.client.into_channel()
47 }
48
49 fn as_channel(&self) -> &fidl::Channel {
50 self.client.as_channel()
51 }
52}
53
54#[cfg(target_os = "fuchsia")]
55impl RegulatoryRegionConfiguratorSynchronousProxy {
56 pub fn new(channel: fidl::Channel) -> Self {
57 Self { client: fidl::client::sync::Client::new(channel) }
58 }
59
60 pub fn into_channel(self) -> fidl::Channel {
61 self.client.into_channel()
62 }
63
64 pub fn wait_for_event(
67 &self,
68 deadline: zx::MonotonicInstant,
69 ) -> Result<RegulatoryRegionConfiguratorEvent, fidl::Error> {
70 RegulatoryRegionConfiguratorEvent::decode(
71 self.client.wait_for_event::<RegulatoryRegionConfiguratorMarker>(deadline)?,
72 )
73 }
74
75 pub fn r#set_region(&self, mut region: &str) -> Result<(), fidl::Error> {
104 self.client.send::<RegulatoryRegionConfiguratorSetRegionRequest>(
105 (region,),
106 0x677e15debe2d6910,
107 fidl::encoding::DynamicFlags::empty(),
108 )
109 }
110}
111
112#[cfg(target_os = "fuchsia")]
113impl From<RegulatoryRegionConfiguratorSynchronousProxy> for zx::NullableHandle {
114 fn from(value: RegulatoryRegionConfiguratorSynchronousProxy) -> Self {
115 value.into_channel().into()
116 }
117}
118
119#[cfg(target_os = "fuchsia")]
120impl From<fidl::Channel> for RegulatoryRegionConfiguratorSynchronousProxy {
121 fn from(value: fidl::Channel) -> Self {
122 Self::new(value)
123 }
124}
125
126#[cfg(target_os = "fuchsia")]
127impl fidl::endpoints::FromClient for RegulatoryRegionConfiguratorSynchronousProxy {
128 type Protocol = RegulatoryRegionConfiguratorMarker;
129
130 fn from_client(value: fidl::endpoints::ClientEnd<RegulatoryRegionConfiguratorMarker>) -> Self {
131 Self::new(value.into_channel())
132 }
133}
134
135#[derive(Debug, Clone)]
136pub struct RegulatoryRegionConfiguratorProxy {
137 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
138}
139
140impl fidl::endpoints::Proxy for RegulatoryRegionConfiguratorProxy {
141 type Protocol = RegulatoryRegionConfiguratorMarker;
142
143 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
144 Self::new(inner)
145 }
146
147 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
148 self.client.into_channel().map_err(|client| Self { client })
149 }
150
151 fn as_channel(&self) -> &::fidl::AsyncChannel {
152 self.client.as_channel()
153 }
154}
155
156impl RegulatoryRegionConfiguratorProxy {
157 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
159 let protocol_name =
160 <RegulatoryRegionConfiguratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
161 Self { client: fidl::client::Client::new(channel, protocol_name) }
162 }
163
164 pub fn take_event_stream(&self) -> RegulatoryRegionConfiguratorEventStream {
170 RegulatoryRegionConfiguratorEventStream {
171 event_receiver: self.client.take_event_receiver(),
172 }
173 }
174
175 pub fn r#set_region(&self, mut region: &str) -> Result<(), fidl::Error> {
204 RegulatoryRegionConfiguratorProxyInterface::r#set_region(self, region)
205 }
206}
207
208impl RegulatoryRegionConfiguratorProxyInterface for RegulatoryRegionConfiguratorProxy {
209 fn r#set_region(&self, mut region: &str) -> Result<(), fidl::Error> {
210 self.client.send::<RegulatoryRegionConfiguratorSetRegionRequest>(
211 (region,),
212 0x677e15debe2d6910,
213 fidl::encoding::DynamicFlags::empty(),
214 )
215 }
216}
217
218pub struct RegulatoryRegionConfiguratorEventStream {
219 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
220}
221
222impl std::marker::Unpin for RegulatoryRegionConfiguratorEventStream {}
223
224impl futures::stream::FusedStream for RegulatoryRegionConfiguratorEventStream {
225 fn is_terminated(&self) -> bool {
226 self.event_receiver.is_terminated()
227 }
228}
229
230impl futures::Stream for RegulatoryRegionConfiguratorEventStream {
231 type Item = Result<RegulatoryRegionConfiguratorEvent, fidl::Error>;
232
233 fn poll_next(
234 mut self: std::pin::Pin<&mut Self>,
235 cx: &mut std::task::Context<'_>,
236 ) -> std::task::Poll<Option<Self::Item>> {
237 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
238 &mut self.event_receiver,
239 cx
240 )?) {
241 Some(buf) => {
242 std::task::Poll::Ready(Some(RegulatoryRegionConfiguratorEvent::decode(buf)))
243 }
244 None => std::task::Poll::Ready(None),
245 }
246 }
247}
248
249#[derive(Debug)]
250pub enum RegulatoryRegionConfiguratorEvent {}
251
252impl RegulatoryRegionConfiguratorEvent {
253 fn decode(
255 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
256 ) -> Result<RegulatoryRegionConfiguratorEvent, fidl::Error> {
257 let (bytes, _handles) = buf.split_mut();
258 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
259 debug_assert_eq!(tx_header.tx_id, 0);
260 match tx_header.ordinal {
261 _ => Err(fidl::Error::UnknownOrdinal {
262 ordinal: tx_header.ordinal,
263 protocol_name: <RegulatoryRegionConfiguratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
264 })
265 }
266 }
267}
268
269pub struct RegulatoryRegionConfiguratorRequestStream {
271 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
272 is_terminated: bool,
273}
274
275impl std::marker::Unpin for RegulatoryRegionConfiguratorRequestStream {}
276
277impl futures::stream::FusedStream for RegulatoryRegionConfiguratorRequestStream {
278 fn is_terminated(&self) -> bool {
279 self.is_terminated
280 }
281}
282
283impl fidl::endpoints::RequestStream for RegulatoryRegionConfiguratorRequestStream {
284 type Protocol = RegulatoryRegionConfiguratorMarker;
285 type ControlHandle = RegulatoryRegionConfiguratorControlHandle;
286
287 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
288 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
289 }
290
291 fn control_handle(&self) -> Self::ControlHandle {
292 RegulatoryRegionConfiguratorControlHandle { inner: self.inner.clone() }
293 }
294
295 fn into_inner(
296 self,
297 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
298 {
299 (self.inner, self.is_terminated)
300 }
301
302 fn from_inner(
303 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
304 is_terminated: bool,
305 ) -> Self {
306 Self { inner, is_terminated }
307 }
308}
309
310impl futures::Stream for RegulatoryRegionConfiguratorRequestStream {
311 type Item = Result<RegulatoryRegionConfiguratorRequest, fidl::Error>;
312
313 fn poll_next(
314 mut self: std::pin::Pin<&mut Self>,
315 cx: &mut std::task::Context<'_>,
316 ) -> std::task::Poll<Option<Self::Item>> {
317 let this = &mut *self;
318 if this.inner.check_shutdown(cx) {
319 this.is_terminated = true;
320 return std::task::Poll::Ready(None);
321 }
322 if this.is_terminated {
323 panic!("polled RegulatoryRegionConfiguratorRequestStream after completion");
324 }
325 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
326 |bytes, handles| {
327 match this.inner.channel().read_etc(cx, bytes, handles) {
328 std::task::Poll::Ready(Ok(())) => {}
329 std::task::Poll::Pending => return std::task::Poll::Pending,
330 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
331 this.is_terminated = true;
332 return std::task::Poll::Ready(None);
333 }
334 std::task::Poll::Ready(Err(e)) => {
335 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
336 e.into(),
337 ))));
338 }
339 }
340
341 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
343
344 std::task::Poll::Ready(Some(match header.ordinal {
345 0x677e15debe2d6910 => {
346 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
347 let mut req = fidl::new_empty!(RegulatoryRegionConfiguratorSetRegionRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
348 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RegulatoryRegionConfiguratorSetRegionRequest>(&header, _body_bytes, handles, &mut req)?;
349 let control_handle = RegulatoryRegionConfiguratorControlHandle {
350 inner: this.inner.clone(),
351 };
352 Ok(RegulatoryRegionConfiguratorRequest::SetRegion {region: req.region,
353
354 control_handle,
355 })
356 }
357 _ => Err(fidl::Error::UnknownOrdinal {
358 ordinal: header.ordinal,
359 protocol_name: <RegulatoryRegionConfiguratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
360 }),
361 }))
362 },
363 )
364 }
365}
366
367#[derive(Debug)]
372pub enum RegulatoryRegionConfiguratorRequest {
373 SetRegion { region: String, control_handle: RegulatoryRegionConfiguratorControlHandle },
402}
403
404impl RegulatoryRegionConfiguratorRequest {
405 #[allow(irrefutable_let_patterns)]
406 pub fn into_set_region(self) -> Option<(String, RegulatoryRegionConfiguratorControlHandle)> {
407 if let RegulatoryRegionConfiguratorRequest::SetRegion { region, control_handle } = self {
408 Some((region, control_handle))
409 } else {
410 None
411 }
412 }
413
414 pub fn method_name(&self) -> &'static str {
416 match *self {
417 RegulatoryRegionConfiguratorRequest::SetRegion { .. } => "set_region",
418 }
419 }
420}
421
422#[derive(Debug, Clone)]
423pub struct RegulatoryRegionConfiguratorControlHandle {
424 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
425}
426
427impl RegulatoryRegionConfiguratorControlHandle {
428 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
429 self.inner.shutdown_with_epitaph(status.into())
430 }
431}
432
433impl fidl::endpoints::ControlHandle for RegulatoryRegionConfiguratorControlHandle {
434 fn shutdown(&self) {
435 self.inner.shutdown()
436 }
437
438 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
439 self.inner.shutdown_with_epitaph(status)
440 }
441
442 fn is_closed(&self) -> bool {
443 self.inner.channel().is_closed()
444 }
445 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
446 self.inner.channel().on_closed()
447 }
448
449 #[cfg(target_os = "fuchsia")]
450 fn signal_peer(
451 &self,
452 clear_mask: zx::Signals,
453 set_mask: zx::Signals,
454 ) -> Result<(), zx_status::Status> {
455 use fidl::Peered;
456 self.inner.channel().signal_peer(clear_mask, set_mask)
457 }
458}
459
460impl RegulatoryRegionConfiguratorControlHandle {}
461
462#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
463pub struct RegulatoryRegionWatcherMarker;
464
465impl fidl::endpoints::ProtocolMarker for RegulatoryRegionWatcherMarker {
466 type Proxy = RegulatoryRegionWatcherProxy;
467 type RequestStream = RegulatoryRegionWatcherRequestStream;
468 #[cfg(target_os = "fuchsia")]
469 type SynchronousProxy = RegulatoryRegionWatcherSynchronousProxy;
470
471 const DEBUG_NAME: &'static str = "fuchsia.location.namedplace.RegulatoryRegionWatcher";
472}
473impl fidl::endpoints::DiscoverableProtocolMarker for RegulatoryRegionWatcherMarker {}
474
475pub trait RegulatoryRegionWatcherProxyInterface: Send + Sync {
476 type GetUpdateResponseFut: std::future::Future<Output = Result<String, fidl::Error>> + Send;
477 fn r#get_update(&self) -> Self::GetUpdateResponseFut;
478 type GetRegionUpdateResponseFut: std::future::Future<Output = Result<Option<String>, fidl::Error>>
479 + Send;
480 fn r#get_region_update(&self) -> Self::GetRegionUpdateResponseFut;
481}
482#[derive(Debug)]
483#[cfg(target_os = "fuchsia")]
484pub struct RegulatoryRegionWatcherSynchronousProxy {
485 client: fidl::client::sync::Client,
486}
487
488#[cfg(target_os = "fuchsia")]
489impl fidl::endpoints::SynchronousProxy for RegulatoryRegionWatcherSynchronousProxy {
490 type Proxy = RegulatoryRegionWatcherProxy;
491 type Protocol = RegulatoryRegionWatcherMarker;
492
493 fn from_channel(inner: fidl::Channel) -> Self {
494 Self::new(inner)
495 }
496
497 fn into_channel(self) -> fidl::Channel {
498 self.client.into_channel()
499 }
500
501 fn as_channel(&self) -> &fidl::Channel {
502 self.client.as_channel()
503 }
504}
505
506#[cfg(target_os = "fuchsia")]
507impl RegulatoryRegionWatcherSynchronousProxy {
508 pub fn new(channel: fidl::Channel) -> Self {
509 Self { client: fidl::client::sync::Client::new(channel) }
510 }
511
512 pub fn into_channel(self) -> fidl::Channel {
513 self.client.into_channel()
514 }
515
516 pub fn wait_for_event(
519 &self,
520 deadline: zx::MonotonicInstant,
521 ) -> Result<RegulatoryRegionWatcherEvent, fidl::Error> {
522 RegulatoryRegionWatcherEvent::decode(
523 self.client.wait_for_event::<RegulatoryRegionWatcherMarker>(deadline)?,
524 )
525 }
526
527 pub fn r#get_update(&self, ___deadline: zx::MonotonicInstant) -> Result<String, fidl::Error> {
546 let _response = self.client.send_query::<
547 fidl::encoding::EmptyPayload,
548 RegulatoryRegionWatcherGetUpdateResponse,
549 RegulatoryRegionWatcherMarker,
550 >(
551 (),
552 0xaf6dec156c31687,
553 fidl::encoding::DynamicFlags::empty(),
554 ___deadline,
555 )?;
556 Ok(_response.new_region)
557 }
558
559 pub fn r#get_region_update(
576 &self,
577 ___deadline: zx::MonotonicInstant,
578 ) -> Result<Option<String>, fidl::Error> {
579 let _response = self.client.send_query::<
580 fidl::encoding::EmptyPayload,
581 RegulatoryRegionWatcherGetRegionUpdateResponse,
582 RegulatoryRegionWatcherMarker,
583 >(
584 (),
585 0x28c47004aed3ff0d,
586 fidl::encoding::DynamicFlags::empty(),
587 ___deadline,
588 )?;
589 Ok(_response.new_region)
590 }
591}
592
593#[cfg(target_os = "fuchsia")]
594impl From<RegulatoryRegionWatcherSynchronousProxy> for zx::NullableHandle {
595 fn from(value: RegulatoryRegionWatcherSynchronousProxy) -> Self {
596 value.into_channel().into()
597 }
598}
599
600#[cfg(target_os = "fuchsia")]
601impl From<fidl::Channel> for RegulatoryRegionWatcherSynchronousProxy {
602 fn from(value: fidl::Channel) -> Self {
603 Self::new(value)
604 }
605}
606
607#[cfg(target_os = "fuchsia")]
608impl fidl::endpoints::FromClient for RegulatoryRegionWatcherSynchronousProxy {
609 type Protocol = RegulatoryRegionWatcherMarker;
610
611 fn from_client(value: fidl::endpoints::ClientEnd<RegulatoryRegionWatcherMarker>) -> Self {
612 Self::new(value.into_channel())
613 }
614}
615
616#[derive(Debug, Clone)]
617pub struct RegulatoryRegionWatcherProxy {
618 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
619}
620
621impl fidl::endpoints::Proxy for RegulatoryRegionWatcherProxy {
622 type Protocol = RegulatoryRegionWatcherMarker;
623
624 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
625 Self::new(inner)
626 }
627
628 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
629 self.client.into_channel().map_err(|client| Self { client })
630 }
631
632 fn as_channel(&self) -> &::fidl::AsyncChannel {
633 self.client.as_channel()
634 }
635}
636
637impl RegulatoryRegionWatcherProxy {
638 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
640 let protocol_name =
641 <RegulatoryRegionWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
642 Self { client: fidl::client::Client::new(channel, protocol_name) }
643 }
644
645 pub fn take_event_stream(&self) -> RegulatoryRegionWatcherEventStream {
651 RegulatoryRegionWatcherEventStream { event_receiver: self.client.take_event_receiver() }
652 }
653
654 pub fn r#get_update(
673 &self,
674 ) -> fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect> {
675 RegulatoryRegionWatcherProxyInterface::r#get_update(self)
676 }
677
678 pub fn r#get_region_update(
695 &self,
696 ) -> fidl::client::QueryResponseFut<Option<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
697 {
698 RegulatoryRegionWatcherProxyInterface::r#get_region_update(self)
699 }
700}
701
702impl RegulatoryRegionWatcherProxyInterface for RegulatoryRegionWatcherProxy {
703 type GetUpdateResponseFut =
704 fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect>;
705 fn r#get_update(&self) -> Self::GetUpdateResponseFut {
706 fn _decode(
707 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
708 ) -> Result<String, fidl::Error> {
709 let _response = fidl::client::decode_transaction_body::<
710 RegulatoryRegionWatcherGetUpdateResponse,
711 fidl::encoding::DefaultFuchsiaResourceDialect,
712 0xaf6dec156c31687,
713 >(_buf?)?;
714 Ok(_response.new_region)
715 }
716 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, String>(
717 (),
718 0xaf6dec156c31687,
719 fidl::encoding::DynamicFlags::empty(),
720 _decode,
721 )
722 }
723
724 type GetRegionUpdateResponseFut = fidl::client::QueryResponseFut<
725 Option<String>,
726 fidl::encoding::DefaultFuchsiaResourceDialect,
727 >;
728 fn r#get_region_update(&self) -> Self::GetRegionUpdateResponseFut {
729 fn _decode(
730 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
731 ) -> Result<Option<String>, fidl::Error> {
732 let _response = fidl::client::decode_transaction_body::<
733 RegulatoryRegionWatcherGetRegionUpdateResponse,
734 fidl::encoding::DefaultFuchsiaResourceDialect,
735 0x28c47004aed3ff0d,
736 >(_buf?)?;
737 Ok(_response.new_region)
738 }
739 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Option<String>>(
740 (),
741 0x28c47004aed3ff0d,
742 fidl::encoding::DynamicFlags::empty(),
743 _decode,
744 )
745 }
746}
747
748pub struct RegulatoryRegionWatcherEventStream {
749 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
750}
751
752impl std::marker::Unpin for RegulatoryRegionWatcherEventStream {}
753
754impl futures::stream::FusedStream for RegulatoryRegionWatcherEventStream {
755 fn is_terminated(&self) -> bool {
756 self.event_receiver.is_terminated()
757 }
758}
759
760impl futures::Stream for RegulatoryRegionWatcherEventStream {
761 type Item = Result<RegulatoryRegionWatcherEvent, fidl::Error>;
762
763 fn poll_next(
764 mut self: std::pin::Pin<&mut Self>,
765 cx: &mut std::task::Context<'_>,
766 ) -> std::task::Poll<Option<Self::Item>> {
767 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
768 &mut self.event_receiver,
769 cx
770 )?) {
771 Some(buf) => std::task::Poll::Ready(Some(RegulatoryRegionWatcherEvent::decode(buf))),
772 None => std::task::Poll::Ready(None),
773 }
774 }
775}
776
777#[derive(Debug)]
778pub enum RegulatoryRegionWatcherEvent {}
779
780impl RegulatoryRegionWatcherEvent {
781 fn decode(
783 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
784 ) -> Result<RegulatoryRegionWatcherEvent, fidl::Error> {
785 let (bytes, _handles) = buf.split_mut();
786 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
787 debug_assert_eq!(tx_header.tx_id, 0);
788 match tx_header.ordinal {
789 _ => Err(fidl::Error::UnknownOrdinal {
790 ordinal: tx_header.ordinal,
791 protocol_name:
792 <RegulatoryRegionWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
793 }),
794 }
795 }
796}
797
798pub struct RegulatoryRegionWatcherRequestStream {
800 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
801 is_terminated: bool,
802}
803
804impl std::marker::Unpin for RegulatoryRegionWatcherRequestStream {}
805
806impl futures::stream::FusedStream for RegulatoryRegionWatcherRequestStream {
807 fn is_terminated(&self) -> bool {
808 self.is_terminated
809 }
810}
811
812impl fidl::endpoints::RequestStream for RegulatoryRegionWatcherRequestStream {
813 type Protocol = RegulatoryRegionWatcherMarker;
814 type ControlHandle = RegulatoryRegionWatcherControlHandle;
815
816 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
817 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
818 }
819
820 fn control_handle(&self) -> Self::ControlHandle {
821 RegulatoryRegionWatcherControlHandle { inner: self.inner.clone() }
822 }
823
824 fn into_inner(
825 self,
826 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
827 {
828 (self.inner, self.is_terminated)
829 }
830
831 fn from_inner(
832 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
833 is_terminated: bool,
834 ) -> Self {
835 Self { inner, is_terminated }
836 }
837}
838
839impl futures::Stream for RegulatoryRegionWatcherRequestStream {
840 type Item = Result<RegulatoryRegionWatcherRequest, fidl::Error>;
841
842 fn poll_next(
843 mut self: std::pin::Pin<&mut Self>,
844 cx: &mut std::task::Context<'_>,
845 ) -> std::task::Poll<Option<Self::Item>> {
846 let this = &mut *self;
847 if this.inner.check_shutdown(cx) {
848 this.is_terminated = true;
849 return std::task::Poll::Ready(None);
850 }
851 if this.is_terminated {
852 panic!("polled RegulatoryRegionWatcherRequestStream after completion");
853 }
854 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
855 |bytes, handles| {
856 match this.inner.channel().read_etc(cx, bytes, handles) {
857 std::task::Poll::Ready(Ok(())) => {}
858 std::task::Poll::Pending => return std::task::Poll::Pending,
859 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
860 this.is_terminated = true;
861 return std::task::Poll::Ready(None);
862 }
863 std::task::Poll::Ready(Err(e)) => {
864 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
865 e.into(),
866 ))));
867 }
868 }
869
870 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
872
873 std::task::Poll::Ready(Some(match header.ordinal {
874 0xaf6dec156c31687 => {
875 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
876 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
877 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
878 let control_handle = RegulatoryRegionWatcherControlHandle {
879 inner: this.inner.clone(),
880 };
881 Ok(RegulatoryRegionWatcherRequest::GetUpdate {
882 responder: RegulatoryRegionWatcherGetUpdateResponder {
883 control_handle: std::mem::ManuallyDrop::new(control_handle),
884 tx_id: header.tx_id,
885 },
886 })
887 }
888 0x28c47004aed3ff0d => {
889 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
890 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
891 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
892 let control_handle = RegulatoryRegionWatcherControlHandle {
893 inner: this.inner.clone(),
894 };
895 Ok(RegulatoryRegionWatcherRequest::GetRegionUpdate {
896 responder: RegulatoryRegionWatcherGetRegionUpdateResponder {
897 control_handle: std::mem::ManuallyDrop::new(control_handle),
898 tx_id: header.tx_id,
899 },
900 })
901 }
902 _ => Err(fidl::Error::UnknownOrdinal {
903 ordinal: header.ordinal,
904 protocol_name: <RegulatoryRegionWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
905 }),
906 }))
907 },
908 )
909 }
910}
911
912#[derive(Debug)]
916pub enum RegulatoryRegionWatcherRequest {
917 GetUpdate { responder: RegulatoryRegionWatcherGetUpdateResponder },
936 GetRegionUpdate { responder: RegulatoryRegionWatcherGetRegionUpdateResponder },
953}
954
955impl RegulatoryRegionWatcherRequest {
956 #[allow(irrefutable_let_patterns)]
957 pub fn into_get_update(self) -> Option<(RegulatoryRegionWatcherGetUpdateResponder)> {
958 if let RegulatoryRegionWatcherRequest::GetUpdate { responder } = self {
959 Some((responder))
960 } else {
961 None
962 }
963 }
964
965 #[allow(irrefutable_let_patterns)]
966 pub fn into_get_region_update(
967 self,
968 ) -> Option<(RegulatoryRegionWatcherGetRegionUpdateResponder)> {
969 if let RegulatoryRegionWatcherRequest::GetRegionUpdate { responder } = self {
970 Some((responder))
971 } else {
972 None
973 }
974 }
975
976 pub fn method_name(&self) -> &'static str {
978 match *self {
979 RegulatoryRegionWatcherRequest::GetUpdate { .. } => "get_update",
980 RegulatoryRegionWatcherRequest::GetRegionUpdate { .. } => "get_region_update",
981 }
982 }
983}
984
985#[derive(Debug, Clone)]
986pub struct RegulatoryRegionWatcherControlHandle {
987 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
988}
989
990impl RegulatoryRegionWatcherControlHandle {
991 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
992 self.inner.shutdown_with_epitaph(status.into())
993 }
994}
995
996impl fidl::endpoints::ControlHandle for RegulatoryRegionWatcherControlHandle {
997 fn shutdown(&self) {
998 self.inner.shutdown()
999 }
1000
1001 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1002 self.inner.shutdown_with_epitaph(status)
1003 }
1004
1005 fn is_closed(&self) -> bool {
1006 self.inner.channel().is_closed()
1007 }
1008 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1009 self.inner.channel().on_closed()
1010 }
1011
1012 #[cfg(target_os = "fuchsia")]
1013 fn signal_peer(
1014 &self,
1015 clear_mask: zx::Signals,
1016 set_mask: zx::Signals,
1017 ) -> Result<(), zx_status::Status> {
1018 use fidl::Peered;
1019 self.inner.channel().signal_peer(clear_mask, set_mask)
1020 }
1021}
1022
1023impl RegulatoryRegionWatcherControlHandle {}
1024
1025#[must_use = "FIDL methods require a response to be sent"]
1026#[derive(Debug)]
1027pub struct RegulatoryRegionWatcherGetUpdateResponder {
1028 control_handle: std::mem::ManuallyDrop<RegulatoryRegionWatcherControlHandle>,
1029 tx_id: u32,
1030}
1031
1032impl std::ops::Drop for RegulatoryRegionWatcherGetUpdateResponder {
1036 fn drop(&mut self) {
1037 self.control_handle.shutdown();
1038 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1040 }
1041}
1042
1043impl fidl::endpoints::Responder for RegulatoryRegionWatcherGetUpdateResponder {
1044 type ControlHandle = RegulatoryRegionWatcherControlHandle;
1045
1046 fn control_handle(&self) -> &RegulatoryRegionWatcherControlHandle {
1047 &self.control_handle
1048 }
1049
1050 fn drop_without_shutdown(mut self) {
1051 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1053 std::mem::forget(self);
1055 }
1056}
1057
1058impl RegulatoryRegionWatcherGetUpdateResponder {
1059 pub fn send(self, mut new_region: &str) -> Result<(), fidl::Error> {
1063 let _result = self.send_raw(new_region);
1064 if _result.is_err() {
1065 self.control_handle.shutdown();
1066 }
1067 self.drop_without_shutdown();
1068 _result
1069 }
1070
1071 pub fn send_no_shutdown_on_err(self, mut new_region: &str) -> Result<(), fidl::Error> {
1073 let _result = self.send_raw(new_region);
1074 self.drop_without_shutdown();
1075 _result
1076 }
1077
1078 fn send_raw(&self, mut new_region: &str) -> Result<(), fidl::Error> {
1079 self.control_handle.inner.send::<RegulatoryRegionWatcherGetUpdateResponse>(
1080 (new_region,),
1081 self.tx_id,
1082 0xaf6dec156c31687,
1083 fidl::encoding::DynamicFlags::empty(),
1084 )
1085 }
1086}
1087
1088#[must_use = "FIDL methods require a response to be sent"]
1089#[derive(Debug)]
1090pub struct RegulatoryRegionWatcherGetRegionUpdateResponder {
1091 control_handle: std::mem::ManuallyDrop<RegulatoryRegionWatcherControlHandle>,
1092 tx_id: u32,
1093}
1094
1095impl std::ops::Drop for RegulatoryRegionWatcherGetRegionUpdateResponder {
1099 fn drop(&mut self) {
1100 self.control_handle.shutdown();
1101 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1103 }
1104}
1105
1106impl fidl::endpoints::Responder for RegulatoryRegionWatcherGetRegionUpdateResponder {
1107 type ControlHandle = RegulatoryRegionWatcherControlHandle;
1108
1109 fn control_handle(&self) -> &RegulatoryRegionWatcherControlHandle {
1110 &self.control_handle
1111 }
1112
1113 fn drop_without_shutdown(mut self) {
1114 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1116 std::mem::forget(self);
1118 }
1119}
1120
1121impl RegulatoryRegionWatcherGetRegionUpdateResponder {
1122 pub fn send(self, mut new_region: Option<&str>) -> Result<(), fidl::Error> {
1126 let _result = self.send_raw(new_region);
1127 if _result.is_err() {
1128 self.control_handle.shutdown();
1129 }
1130 self.drop_without_shutdown();
1131 _result
1132 }
1133
1134 pub fn send_no_shutdown_on_err(self, mut new_region: Option<&str>) -> Result<(), fidl::Error> {
1136 let _result = self.send_raw(new_region);
1137 self.drop_without_shutdown();
1138 _result
1139 }
1140
1141 fn send_raw(&self, mut new_region: Option<&str>) -> Result<(), fidl::Error> {
1142 self.control_handle.inner.send::<RegulatoryRegionWatcherGetRegionUpdateResponse>(
1143 (new_region,),
1144 self.tx_id,
1145 0x28c47004aed3ff0d,
1146 fidl::encoding::DynamicFlags::empty(),
1147 )
1148 }
1149}
1150
1151mod internal {
1152 use super::*;
1153}