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 let protocol_name =
58 <RegulatoryRegionConfiguratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
59 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
60 }
61
62 pub fn into_channel(self) -> fidl::Channel {
63 self.client.into_channel()
64 }
65
66 pub fn wait_for_event(
69 &self,
70 deadline: zx::MonotonicInstant,
71 ) -> Result<RegulatoryRegionConfiguratorEvent, fidl::Error> {
72 RegulatoryRegionConfiguratorEvent::decode(self.client.wait_for_event(deadline)?)
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::Handle {
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 fidl::endpoints::ControlHandle for RegulatoryRegionConfiguratorControlHandle {
428 fn shutdown(&self) {
429 self.inner.shutdown()
430 }
431 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
432 self.inner.shutdown_with_epitaph(status)
433 }
434
435 fn is_closed(&self) -> bool {
436 self.inner.channel().is_closed()
437 }
438 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
439 self.inner.channel().on_closed()
440 }
441
442 #[cfg(target_os = "fuchsia")]
443 fn signal_peer(
444 &self,
445 clear_mask: zx::Signals,
446 set_mask: zx::Signals,
447 ) -> Result<(), zx_status::Status> {
448 use fidl::Peered;
449 self.inner.channel().signal_peer(clear_mask, set_mask)
450 }
451}
452
453impl RegulatoryRegionConfiguratorControlHandle {}
454
455#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
456pub struct RegulatoryRegionWatcherMarker;
457
458impl fidl::endpoints::ProtocolMarker for RegulatoryRegionWatcherMarker {
459 type Proxy = RegulatoryRegionWatcherProxy;
460 type RequestStream = RegulatoryRegionWatcherRequestStream;
461 #[cfg(target_os = "fuchsia")]
462 type SynchronousProxy = RegulatoryRegionWatcherSynchronousProxy;
463
464 const DEBUG_NAME: &'static str = "fuchsia.location.namedplace.RegulatoryRegionWatcher";
465}
466impl fidl::endpoints::DiscoverableProtocolMarker for RegulatoryRegionWatcherMarker {}
467
468pub trait RegulatoryRegionWatcherProxyInterface: Send + Sync {
469 type GetUpdateResponseFut: std::future::Future<Output = Result<String, fidl::Error>> + Send;
470 fn r#get_update(&self) -> Self::GetUpdateResponseFut;
471 type GetRegionUpdateResponseFut: std::future::Future<Output = Result<Option<String>, fidl::Error>>
472 + Send;
473 fn r#get_region_update(&self) -> Self::GetRegionUpdateResponseFut;
474}
475#[derive(Debug)]
476#[cfg(target_os = "fuchsia")]
477pub struct RegulatoryRegionWatcherSynchronousProxy {
478 client: fidl::client::sync::Client,
479}
480
481#[cfg(target_os = "fuchsia")]
482impl fidl::endpoints::SynchronousProxy for RegulatoryRegionWatcherSynchronousProxy {
483 type Proxy = RegulatoryRegionWatcherProxy;
484 type Protocol = RegulatoryRegionWatcherMarker;
485
486 fn from_channel(inner: fidl::Channel) -> Self {
487 Self::new(inner)
488 }
489
490 fn into_channel(self) -> fidl::Channel {
491 self.client.into_channel()
492 }
493
494 fn as_channel(&self) -> &fidl::Channel {
495 self.client.as_channel()
496 }
497}
498
499#[cfg(target_os = "fuchsia")]
500impl RegulatoryRegionWatcherSynchronousProxy {
501 pub fn new(channel: fidl::Channel) -> Self {
502 let protocol_name =
503 <RegulatoryRegionWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
504 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
505 }
506
507 pub fn into_channel(self) -> fidl::Channel {
508 self.client.into_channel()
509 }
510
511 pub fn wait_for_event(
514 &self,
515 deadline: zx::MonotonicInstant,
516 ) -> Result<RegulatoryRegionWatcherEvent, fidl::Error> {
517 RegulatoryRegionWatcherEvent::decode(self.client.wait_for_event(deadline)?)
518 }
519
520 pub fn r#get_update(&self, ___deadline: zx::MonotonicInstant) -> Result<String, fidl::Error> {
539 let _response = self
540 .client
541 .send_query::<fidl::encoding::EmptyPayload, RegulatoryRegionWatcherGetUpdateResponse>(
542 (),
543 0xaf6dec156c31687,
544 fidl::encoding::DynamicFlags::empty(),
545 ___deadline,
546 )?;
547 Ok(_response.new_region)
548 }
549
550 pub fn r#get_region_update(
567 &self,
568 ___deadline: zx::MonotonicInstant,
569 ) -> Result<Option<String>, fidl::Error> {
570 let _response = self.client.send_query::<
571 fidl::encoding::EmptyPayload,
572 RegulatoryRegionWatcherGetRegionUpdateResponse,
573 >(
574 (),
575 0x28c47004aed3ff0d,
576 fidl::encoding::DynamicFlags::empty(),
577 ___deadline,
578 )?;
579 Ok(_response.new_region)
580 }
581}
582
583#[cfg(target_os = "fuchsia")]
584impl From<RegulatoryRegionWatcherSynchronousProxy> for zx::Handle {
585 fn from(value: RegulatoryRegionWatcherSynchronousProxy) -> Self {
586 value.into_channel().into()
587 }
588}
589
590#[cfg(target_os = "fuchsia")]
591impl From<fidl::Channel> for RegulatoryRegionWatcherSynchronousProxy {
592 fn from(value: fidl::Channel) -> Self {
593 Self::new(value)
594 }
595}
596
597#[cfg(target_os = "fuchsia")]
598impl fidl::endpoints::FromClient for RegulatoryRegionWatcherSynchronousProxy {
599 type Protocol = RegulatoryRegionWatcherMarker;
600
601 fn from_client(value: fidl::endpoints::ClientEnd<RegulatoryRegionWatcherMarker>) -> Self {
602 Self::new(value.into_channel())
603 }
604}
605
606#[derive(Debug, Clone)]
607pub struct RegulatoryRegionWatcherProxy {
608 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
609}
610
611impl fidl::endpoints::Proxy for RegulatoryRegionWatcherProxy {
612 type Protocol = RegulatoryRegionWatcherMarker;
613
614 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
615 Self::new(inner)
616 }
617
618 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
619 self.client.into_channel().map_err(|client| Self { client })
620 }
621
622 fn as_channel(&self) -> &::fidl::AsyncChannel {
623 self.client.as_channel()
624 }
625}
626
627impl RegulatoryRegionWatcherProxy {
628 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
630 let protocol_name =
631 <RegulatoryRegionWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
632 Self { client: fidl::client::Client::new(channel, protocol_name) }
633 }
634
635 pub fn take_event_stream(&self) -> RegulatoryRegionWatcherEventStream {
641 RegulatoryRegionWatcherEventStream { event_receiver: self.client.take_event_receiver() }
642 }
643
644 pub fn r#get_update(
663 &self,
664 ) -> fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect> {
665 RegulatoryRegionWatcherProxyInterface::r#get_update(self)
666 }
667
668 pub fn r#get_region_update(
685 &self,
686 ) -> fidl::client::QueryResponseFut<Option<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
687 {
688 RegulatoryRegionWatcherProxyInterface::r#get_region_update(self)
689 }
690}
691
692impl RegulatoryRegionWatcherProxyInterface for RegulatoryRegionWatcherProxy {
693 type GetUpdateResponseFut =
694 fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect>;
695 fn r#get_update(&self) -> Self::GetUpdateResponseFut {
696 fn _decode(
697 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
698 ) -> Result<String, fidl::Error> {
699 let _response = fidl::client::decode_transaction_body::<
700 RegulatoryRegionWatcherGetUpdateResponse,
701 fidl::encoding::DefaultFuchsiaResourceDialect,
702 0xaf6dec156c31687,
703 >(_buf?)?;
704 Ok(_response.new_region)
705 }
706 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, String>(
707 (),
708 0xaf6dec156c31687,
709 fidl::encoding::DynamicFlags::empty(),
710 _decode,
711 )
712 }
713
714 type GetRegionUpdateResponseFut = fidl::client::QueryResponseFut<
715 Option<String>,
716 fidl::encoding::DefaultFuchsiaResourceDialect,
717 >;
718 fn r#get_region_update(&self) -> Self::GetRegionUpdateResponseFut {
719 fn _decode(
720 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
721 ) -> Result<Option<String>, fidl::Error> {
722 let _response = fidl::client::decode_transaction_body::<
723 RegulatoryRegionWatcherGetRegionUpdateResponse,
724 fidl::encoding::DefaultFuchsiaResourceDialect,
725 0x28c47004aed3ff0d,
726 >(_buf?)?;
727 Ok(_response.new_region)
728 }
729 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Option<String>>(
730 (),
731 0x28c47004aed3ff0d,
732 fidl::encoding::DynamicFlags::empty(),
733 _decode,
734 )
735 }
736}
737
738pub struct RegulatoryRegionWatcherEventStream {
739 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
740}
741
742impl std::marker::Unpin for RegulatoryRegionWatcherEventStream {}
743
744impl futures::stream::FusedStream for RegulatoryRegionWatcherEventStream {
745 fn is_terminated(&self) -> bool {
746 self.event_receiver.is_terminated()
747 }
748}
749
750impl futures::Stream for RegulatoryRegionWatcherEventStream {
751 type Item = Result<RegulatoryRegionWatcherEvent, fidl::Error>;
752
753 fn poll_next(
754 mut self: std::pin::Pin<&mut Self>,
755 cx: &mut std::task::Context<'_>,
756 ) -> std::task::Poll<Option<Self::Item>> {
757 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
758 &mut self.event_receiver,
759 cx
760 )?) {
761 Some(buf) => std::task::Poll::Ready(Some(RegulatoryRegionWatcherEvent::decode(buf))),
762 None => std::task::Poll::Ready(None),
763 }
764 }
765}
766
767#[derive(Debug)]
768pub enum RegulatoryRegionWatcherEvent {}
769
770impl RegulatoryRegionWatcherEvent {
771 fn decode(
773 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
774 ) -> Result<RegulatoryRegionWatcherEvent, fidl::Error> {
775 let (bytes, _handles) = buf.split_mut();
776 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
777 debug_assert_eq!(tx_header.tx_id, 0);
778 match tx_header.ordinal {
779 _ => Err(fidl::Error::UnknownOrdinal {
780 ordinal: tx_header.ordinal,
781 protocol_name:
782 <RegulatoryRegionWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
783 }),
784 }
785 }
786}
787
788pub struct RegulatoryRegionWatcherRequestStream {
790 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
791 is_terminated: bool,
792}
793
794impl std::marker::Unpin for RegulatoryRegionWatcherRequestStream {}
795
796impl futures::stream::FusedStream for RegulatoryRegionWatcherRequestStream {
797 fn is_terminated(&self) -> bool {
798 self.is_terminated
799 }
800}
801
802impl fidl::endpoints::RequestStream for RegulatoryRegionWatcherRequestStream {
803 type Protocol = RegulatoryRegionWatcherMarker;
804 type ControlHandle = RegulatoryRegionWatcherControlHandle;
805
806 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
807 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
808 }
809
810 fn control_handle(&self) -> Self::ControlHandle {
811 RegulatoryRegionWatcherControlHandle { inner: self.inner.clone() }
812 }
813
814 fn into_inner(
815 self,
816 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
817 {
818 (self.inner, self.is_terminated)
819 }
820
821 fn from_inner(
822 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
823 is_terminated: bool,
824 ) -> Self {
825 Self { inner, is_terminated }
826 }
827}
828
829impl futures::Stream for RegulatoryRegionWatcherRequestStream {
830 type Item = Result<RegulatoryRegionWatcherRequest, fidl::Error>;
831
832 fn poll_next(
833 mut self: std::pin::Pin<&mut Self>,
834 cx: &mut std::task::Context<'_>,
835 ) -> std::task::Poll<Option<Self::Item>> {
836 let this = &mut *self;
837 if this.inner.check_shutdown(cx) {
838 this.is_terminated = true;
839 return std::task::Poll::Ready(None);
840 }
841 if this.is_terminated {
842 panic!("polled RegulatoryRegionWatcherRequestStream after completion");
843 }
844 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
845 |bytes, handles| {
846 match this.inner.channel().read_etc(cx, bytes, handles) {
847 std::task::Poll::Ready(Ok(())) => {}
848 std::task::Poll::Pending => return std::task::Poll::Pending,
849 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
850 this.is_terminated = true;
851 return std::task::Poll::Ready(None);
852 }
853 std::task::Poll::Ready(Err(e)) => {
854 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
855 e.into(),
856 ))))
857 }
858 }
859
860 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
862
863 std::task::Poll::Ready(Some(match header.ordinal {
864 0xaf6dec156c31687 => {
865 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
866 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
867 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
868 let control_handle = RegulatoryRegionWatcherControlHandle {
869 inner: this.inner.clone(),
870 };
871 Ok(RegulatoryRegionWatcherRequest::GetUpdate {
872 responder: RegulatoryRegionWatcherGetUpdateResponder {
873 control_handle: std::mem::ManuallyDrop::new(control_handle),
874 tx_id: header.tx_id,
875 },
876 })
877 }
878 0x28c47004aed3ff0d => {
879 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
880 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
881 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
882 let control_handle = RegulatoryRegionWatcherControlHandle {
883 inner: this.inner.clone(),
884 };
885 Ok(RegulatoryRegionWatcherRequest::GetRegionUpdate {
886 responder: RegulatoryRegionWatcherGetRegionUpdateResponder {
887 control_handle: std::mem::ManuallyDrop::new(control_handle),
888 tx_id: header.tx_id,
889 },
890 })
891 }
892 _ => Err(fidl::Error::UnknownOrdinal {
893 ordinal: header.ordinal,
894 protocol_name: <RegulatoryRegionWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
895 }),
896 }))
897 },
898 )
899 }
900}
901
902#[derive(Debug)]
906pub enum RegulatoryRegionWatcherRequest {
907 GetUpdate { responder: RegulatoryRegionWatcherGetUpdateResponder },
926 GetRegionUpdate { responder: RegulatoryRegionWatcherGetRegionUpdateResponder },
943}
944
945impl RegulatoryRegionWatcherRequest {
946 #[allow(irrefutable_let_patterns)]
947 pub fn into_get_update(self) -> Option<(RegulatoryRegionWatcherGetUpdateResponder)> {
948 if let RegulatoryRegionWatcherRequest::GetUpdate { responder } = self {
949 Some((responder))
950 } else {
951 None
952 }
953 }
954
955 #[allow(irrefutable_let_patterns)]
956 pub fn into_get_region_update(
957 self,
958 ) -> Option<(RegulatoryRegionWatcherGetRegionUpdateResponder)> {
959 if let RegulatoryRegionWatcherRequest::GetRegionUpdate { responder } = self {
960 Some((responder))
961 } else {
962 None
963 }
964 }
965
966 pub fn method_name(&self) -> &'static str {
968 match *self {
969 RegulatoryRegionWatcherRequest::GetUpdate { .. } => "get_update",
970 RegulatoryRegionWatcherRequest::GetRegionUpdate { .. } => "get_region_update",
971 }
972 }
973}
974
975#[derive(Debug, Clone)]
976pub struct RegulatoryRegionWatcherControlHandle {
977 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
978}
979
980impl fidl::endpoints::ControlHandle for RegulatoryRegionWatcherControlHandle {
981 fn shutdown(&self) {
982 self.inner.shutdown()
983 }
984 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
985 self.inner.shutdown_with_epitaph(status)
986 }
987
988 fn is_closed(&self) -> bool {
989 self.inner.channel().is_closed()
990 }
991 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
992 self.inner.channel().on_closed()
993 }
994
995 #[cfg(target_os = "fuchsia")]
996 fn signal_peer(
997 &self,
998 clear_mask: zx::Signals,
999 set_mask: zx::Signals,
1000 ) -> Result<(), zx_status::Status> {
1001 use fidl::Peered;
1002 self.inner.channel().signal_peer(clear_mask, set_mask)
1003 }
1004}
1005
1006impl RegulatoryRegionWatcherControlHandle {}
1007
1008#[must_use = "FIDL methods require a response to be sent"]
1009#[derive(Debug)]
1010pub struct RegulatoryRegionWatcherGetUpdateResponder {
1011 control_handle: std::mem::ManuallyDrop<RegulatoryRegionWatcherControlHandle>,
1012 tx_id: u32,
1013}
1014
1015impl std::ops::Drop for RegulatoryRegionWatcherGetUpdateResponder {
1019 fn drop(&mut self) {
1020 self.control_handle.shutdown();
1021 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1023 }
1024}
1025
1026impl fidl::endpoints::Responder for RegulatoryRegionWatcherGetUpdateResponder {
1027 type ControlHandle = RegulatoryRegionWatcherControlHandle;
1028
1029 fn control_handle(&self) -> &RegulatoryRegionWatcherControlHandle {
1030 &self.control_handle
1031 }
1032
1033 fn drop_without_shutdown(mut self) {
1034 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1036 std::mem::forget(self);
1038 }
1039}
1040
1041impl RegulatoryRegionWatcherGetUpdateResponder {
1042 pub fn send(self, mut new_region: &str) -> Result<(), fidl::Error> {
1046 let _result = self.send_raw(new_region);
1047 if _result.is_err() {
1048 self.control_handle.shutdown();
1049 }
1050 self.drop_without_shutdown();
1051 _result
1052 }
1053
1054 pub fn send_no_shutdown_on_err(self, mut new_region: &str) -> Result<(), fidl::Error> {
1056 let _result = self.send_raw(new_region);
1057 self.drop_without_shutdown();
1058 _result
1059 }
1060
1061 fn send_raw(&self, mut new_region: &str) -> Result<(), fidl::Error> {
1062 self.control_handle.inner.send::<RegulatoryRegionWatcherGetUpdateResponse>(
1063 (new_region,),
1064 self.tx_id,
1065 0xaf6dec156c31687,
1066 fidl::encoding::DynamicFlags::empty(),
1067 )
1068 }
1069}
1070
1071#[must_use = "FIDL methods require a response to be sent"]
1072#[derive(Debug)]
1073pub struct RegulatoryRegionWatcherGetRegionUpdateResponder {
1074 control_handle: std::mem::ManuallyDrop<RegulatoryRegionWatcherControlHandle>,
1075 tx_id: u32,
1076}
1077
1078impl std::ops::Drop for RegulatoryRegionWatcherGetRegionUpdateResponder {
1082 fn drop(&mut self) {
1083 self.control_handle.shutdown();
1084 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1086 }
1087}
1088
1089impl fidl::endpoints::Responder for RegulatoryRegionWatcherGetRegionUpdateResponder {
1090 type ControlHandle = RegulatoryRegionWatcherControlHandle;
1091
1092 fn control_handle(&self) -> &RegulatoryRegionWatcherControlHandle {
1093 &self.control_handle
1094 }
1095
1096 fn drop_without_shutdown(mut self) {
1097 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1099 std::mem::forget(self);
1101 }
1102}
1103
1104impl RegulatoryRegionWatcherGetRegionUpdateResponder {
1105 pub fn send(self, mut new_region: Option<&str>) -> Result<(), fidl::Error> {
1109 let _result = self.send_raw(new_region);
1110 if _result.is_err() {
1111 self.control_handle.shutdown();
1112 }
1113 self.drop_without_shutdown();
1114 _result
1115 }
1116
1117 pub fn send_no_shutdown_on_err(self, mut new_region: Option<&str>) -> Result<(), fidl::Error> {
1119 let _result = self.send_raw(new_region);
1120 self.drop_without_shutdown();
1121 _result
1122 }
1123
1124 fn send_raw(&self, mut new_region: Option<&str>) -> Result<(), fidl::Error> {
1125 self.control_handle.inner.send::<RegulatoryRegionWatcherGetRegionUpdateResponse>(
1126 (new_region,),
1127 self.tx_id,
1128 0x28c47004aed3ff0d,
1129 fidl::encoding::DynamicFlags::empty(),
1130 )
1131 }
1132}
1133
1134mod internal {
1135 use super::*;
1136}