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#[derive(Debug, Clone)]
113pub struct RegulatoryRegionConfiguratorProxy {
114 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
115}
116
117impl fidl::endpoints::Proxy for RegulatoryRegionConfiguratorProxy {
118 type Protocol = RegulatoryRegionConfiguratorMarker;
119
120 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
121 Self::new(inner)
122 }
123
124 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
125 self.client.into_channel().map_err(|client| Self { client })
126 }
127
128 fn as_channel(&self) -> &::fidl::AsyncChannel {
129 self.client.as_channel()
130 }
131}
132
133impl RegulatoryRegionConfiguratorProxy {
134 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
136 let protocol_name =
137 <RegulatoryRegionConfiguratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
138 Self { client: fidl::client::Client::new(channel, protocol_name) }
139 }
140
141 pub fn take_event_stream(&self) -> RegulatoryRegionConfiguratorEventStream {
147 RegulatoryRegionConfiguratorEventStream {
148 event_receiver: self.client.take_event_receiver(),
149 }
150 }
151
152 pub fn r#set_region(&self, mut region: &str) -> Result<(), fidl::Error> {
181 RegulatoryRegionConfiguratorProxyInterface::r#set_region(self, region)
182 }
183}
184
185impl RegulatoryRegionConfiguratorProxyInterface for RegulatoryRegionConfiguratorProxy {
186 fn r#set_region(&self, mut region: &str) -> Result<(), fidl::Error> {
187 self.client.send::<RegulatoryRegionConfiguratorSetRegionRequest>(
188 (region,),
189 0x677e15debe2d6910,
190 fidl::encoding::DynamicFlags::empty(),
191 )
192 }
193}
194
195pub struct RegulatoryRegionConfiguratorEventStream {
196 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
197}
198
199impl std::marker::Unpin for RegulatoryRegionConfiguratorEventStream {}
200
201impl futures::stream::FusedStream for RegulatoryRegionConfiguratorEventStream {
202 fn is_terminated(&self) -> bool {
203 self.event_receiver.is_terminated()
204 }
205}
206
207impl futures::Stream for RegulatoryRegionConfiguratorEventStream {
208 type Item = Result<RegulatoryRegionConfiguratorEvent, fidl::Error>;
209
210 fn poll_next(
211 mut self: std::pin::Pin<&mut Self>,
212 cx: &mut std::task::Context<'_>,
213 ) -> std::task::Poll<Option<Self::Item>> {
214 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
215 &mut self.event_receiver,
216 cx
217 )?) {
218 Some(buf) => {
219 std::task::Poll::Ready(Some(RegulatoryRegionConfiguratorEvent::decode(buf)))
220 }
221 None => std::task::Poll::Ready(None),
222 }
223 }
224}
225
226#[derive(Debug)]
227pub enum RegulatoryRegionConfiguratorEvent {}
228
229impl RegulatoryRegionConfiguratorEvent {
230 fn decode(
232 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
233 ) -> Result<RegulatoryRegionConfiguratorEvent, fidl::Error> {
234 let (bytes, _handles) = buf.split_mut();
235 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
236 debug_assert_eq!(tx_header.tx_id, 0);
237 match tx_header.ordinal {
238 _ => Err(fidl::Error::UnknownOrdinal {
239 ordinal: tx_header.ordinal,
240 protocol_name: <RegulatoryRegionConfiguratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
241 })
242 }
243 }
244}
245
246pub struct RegulatoryRegionConfiguratorRequestStream {
248 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
249 is_terminated: bool,
250}
251
252impl std::marker::Unpin for RegulatoryRegionConfiguratorRequestStream {}
253
254impl futures::stream::FusedStream for RegulatoryRegionConfiguratorRequestStream {
255 fn is_terminated(&self) -> bool {
256 self.is_terminated
257 }
258}
259
260impl fidl::endpoints::RequestStream for RegulatoryRegionConfiguratorRequestStream {
261 type Protocol = RegulatoryRegionConfiguratorMarker;
262 type ControlHandle = RegulatoryRegionConfiguratorControlHandle;
263
264 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
265 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
266 }
267
268 fn control_handle(&self) -> Self::ControlHandle {
269 RegulatoryRegionConfiguratorControlHandle { inner: self.inner.clone() }
270 }
271
272 fn into_inner(
273 self,
274 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
275 {
276 (self.inner, self.is_terminated)
277 }
278
279 fn from_inner(
280 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
281 is_terminated: bool,
282 ) -> Self {
283 Self { inner, is_terminated }
284 }
285}
286
287impl futures::Stream for RegulatoryRegionConfiguratorRequestStream {
288 type Item = Result<RegulatoryRegionConfiguratorRequest, fidl::Error>;
289
290 fn poll_next(
291 mut self: std::pin::Pin<&mut Self>,
292 cx: &mut std::task::Context<'_>,
293 ) -> std::task::Poll<Option<Self::Item>> {
294 let this = &mut *self;
295 if this.inner.check_shutdown(cx) {
296 this.is_terminated = true;
297 return std::task::Poll::Ready(None);
298 }
299 if this.is_terminated {
300 panic!("polled RegulatoryRegionConfiguratorRequestStream after completion");
301 }
302 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
303 |bytes, handles| {
304 match this.inner.channel().read_etc(cx, bytes, handles) {
305 std::task::Poll::Ready(Ok(())) => {}
306 std::task::Poll::Pending => return std::task::Poll::Pending,
307 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
308 this.is_terminated = true;
309 return std::task::Poll::Ready(None);
310 }
311 std::task::Poll::Ready(Err(e)) => {
312 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
313 e.into(),
314 ))))
315 }
316 }
317
318 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
320
321 std::task::Poll::Ready(Some(match header.ordinal {
322 0x677e15debe2d6910 => {
323 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
324 let mut req = fidl::new_empty!(RegulatoryRegionConfiguratorSetRegionRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
325 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RegulatoryRegionConfiguratorSetRegionRequest>(&header, _body_bytes, handles, &mut req)?;
326 let control_handle = RegulatoryRegionConfiguratorControlHandle {
327 inner: this.inner.clone(),
328 };
329 Ok(RegulatoryRegionConfiguratorRequest::SetRegion {region: req.region,
330
331 control_handle,
332 })
333 }
334 _ => Err(fidl::Error::UnknownOrdinal {
335 ordinal: header.ordinal,
336 protocol_name: <RegulatoryRegionConfiguratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
337 }),
338 }))
339 },
340 )
341 }
342}
343
344#[derive(Debug)]
349pub enum RegulatoryRegionConfiguratorRequest {
350 SetRegion { region: String, control_handle: RegulatoryRegionConfiguratorControlHandle },
379}
380
381impl RegulatoryRegionConfiguratorRequest {
382 #[allow(irrefutable_let_patterns)]
383 pub fn into_set_region(self) -> Option<(String, RegulatoryRegionConfiguratorControlHandle)> {
384 if let RegulatoryRegionConfiguratorRequest::SetRegion { region, control_handle } = self {
385 Some((region, control_handle))
386 } else {
387 None
388 }
389 }
390
391 pub fn method_name(&self) -> &'static str {
393 match *self {
394 RegulatoryRegionConfiguratorRequest::SetRegion { .. } => "set_region",
395 }
396 }
397}
398
399#[derive(Debug, Clone)]
400pub struct RegulatoryRegionConfiguratorControlHandle {
401 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
402}
403
404impl fidl::endpoints::ControlHandle for RegulatoryRegionConfiguratorControlHandle {
405 fn shutdown(&self) {
406 self.inner.shutdown()
407 }
408 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
409 self.inner.shutdown_with_epitaph(status)
410 }
411
412 fn is_closed(&self) -> bool {
413 self.inner.channel().is_closed()
414 }
415 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
416 self.inner.channel().on_closed()
417 }
418
419 #[cfg(target_os = "fuchsia")]
420 fn signal_peer(
421 &self,
422 clear_mask: zx::Signals,
423 set_mask: zx::Signals,
424 ) -> Result<(), zx_status::Status> {
425 use fidl::Peered;
426 self.inner.channel().signal_peer(clear_mask, set_mask)
427 }
428}
429
430impl RegulatoryRegionConfiguratorControlHandle {}
431
432#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
433pub struct RegulatoryRegionWatcherMarker;
434
435impl fidl::endpoints::ProtocolMarker for RegulatoryRegionWatcherMarker {
436 type Proxy = RegulatoryRegionWatcherProxy;
437 type RequestStream = RegulatoryRegionWatcherRequestStream;
438 #[cfg(target_os = "fuchsia")]
439 type SynchronousProxy = RegulatoryRegionWatcherSynchronousProxy;
440
441 const DEBUG_NAME: &'static str = "fuchsia.location.namedplace.RegulatoryRegionWatcher";
442}
443impl fidl::endpoints::DiscoverableProtocolMarker for RegulatoryRegionWatcherMarker {}
444
445pub trait RegulatoryRegionWatcherProxyInterface: Send + Sync {
446 type GetUpdateResponseFut: std::future::Future<Output = Result<String, fidl::Error>> + Send;
447 fn r#get_update(&self) -> Self::GetUpdateResponseFut;
448 type GetRegionUpdateResponseFut: std::future::Future<Output = Result<Option<String>, fidl::Error>>
449 + Send;
450 fn r#get_region_update(&self) -> Self::GetRegionUpdateResponseFut;
451}
452#[derive(Debug)]
453#[cfg(target_os = "fuchsia")]
454pub struct RegulatoryRegionWatcherSynchronousProxy {
455 client: fidl::client::sync::Client,
456}
457
458#[cfg(target_os = "fuchsia")]
459impl fidl::endpoints::SynchronousProxy for RegulatoryRegionWatcherSynchronousProxy {
460 type Proxy = RegulatoryRegionWatcherProxy;
461 type Protocol = RegulatoryRegionWatcherMarker;
462
463 fn from_channel(inner: fidl::Channel) -> Self {
464 Self::new(inner)
465 }
466
467 fn into_channel(self) -> fidl::Channel {
468 self.client.into_channel()
469 }
470
471 fn as_channel(&self) -> &fidl::Channel {
472 self.client.as_channel()
473 }
474}
475
476#[cfg(target_os = "fuchsia")]
477impl RegulatoryRegionWatcherSynchronousProxy {
478 pub fn new(channel: fidl::Channel) -> Self {
479 let protocol_name =
480 <RegulatoryRegionWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
481 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
482 }
483
484 pub fn into_channel(self) -> fidl::Channel {
485 self.client.into_channel()
486 }
487
488 pub fn wait_for_event(
491 &self,
492 deadline: zx::MonotonicInstant,
493 ) -> Result<RegulatoryRegionWatcherEvent, fidl::Error> {
494 RegulatoryRegionWatcherEvent::decode(self.client.wait_for_event(deadline)?)
495 }
496
497 pub fn r#get_update(&self, ___deadline: zx::MonotonicInstant) -> Result<String, fidl::Error> {
516 let _response = self
517 .client
518 .send_query::<fidl::encoding::EmptyPayload, RegulatoryRegionWatcherGetUpdateResponse>(
519 (),
520 0xaf6dec156c31687,
521 fidl::encoding::DynamicFlags::empty(),
522 ___deadline,
523 )?;
524 Ok(_response.new_region)
525 }
526
527 pub fn r#get_region_update(
544 &self,
545 ___deadline: zx::MonotonicInstant,
546 ) -> Result<Option<String>, fidl::Error> {
547 let _response = self.client.send_query::<
548 fidl::encoding::EmptyPayload,
549 RegulatoryRegionWatcherGetRegionUpdateResponse,
550 >(
551 (),
552 0x28c47004aed3ff0d,
553 fidl::encoding::DynamicFlags::empty(),
554 ___deadline,
555 )?;
556 Ok(_response.new_region)
557 }
558}
559
560#[derive(Debug, Clone)]
561pub struct RegulatoryRegionWatcherProxy {
562 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
563}
564
565impl fidl::endpoints::Proxy for RegulatoryRegionWatcherProxy {
566 type Protocol = RegulatoryRegionWatcherMarker;
567
568 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
569 Self::new(inner)
570 }
571
572 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
573 self.client.into_channel().map_err(|client| Self { client })
574 }
575
576 fn as_channel(&self) -> &::fidl::AsyncChannel {
577 self.client.as_channel()
578 }
579}
580
581impl RegulatoryRegionWatcherProxy {
582 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
584 let protocol_name =
585 <RegulatoryRegionWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
586 Self { client: fidl::client::Client::new(channel, protocol_name) }
587 }
588
589 pub fn take_event_stream(&self) -> RegulatoryRegionWatcherEventStream {
595 RegulatoryRegionWatcherEventStream { event_receiver: self.client.take_event_receiver() }
596 }
597
598 pub fn r#get_update(
617 &self,
618 ) -> fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect> {
619 RegulatoryRegionWatcherProxyInterface::r#get_update(self)
620 }
621
622 pub fn r#get_region_update(
639 &self,
640 ) -> fidl::client::QueryResponseFut<Option<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
641 {
642 RegulatoryRegionWatcherProxyInterface::r#get_region_update(self)
643 }
644}
645
646impl RegulatoryRegionWatcherProxyInterface for RegulatoryRegionWatcherProxy {
647 type GetUpdateResponseFut =
648 fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect>;
649 fn r#get_update(&self) -> Self::GetUpdateResponseFut {
650 fn _decode(
651 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
652 ) -> Result<String, fidl::Error> {
653 let _response = fidl::client::decode_transaction_body::<
654 RegulatoryRegionWatcherGetUpdateResponse,
655 fidl::encoding::DefaultFuchsiaResourceDialect,
656 0xaf6dec156c31687,
657 >(_buf?)?;
658 Ok(_response.new_region)
659 }
660 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, String>(
661 (),
662 0xaf6dec156c31687,
663 fidl::encoding::DynamicFlags::empty(),
664 _decode,
665 )
666 }
667
668 type GetRegionUpdateResponseFut = fidl::client::QueryResponseFut<
669 Option<String>,
670 fidl::encoding::DefaultFuchsiaResourceDialect,
671 >;
672 fn r#get_region_update(&self) -> Self::GetRegionUpdateResponseFut {
673 fn _decode(
674 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
675 ) -> Result<Option<String>, fidl::Error> {
676 let _response = fidl::client::decode_transaction_body::<
677 RegulatoryRegionWatcherGetRegionUpdateResponse,
678 fidl::encoding::DefaultFuchsiaResourceDialect,
679 0x28c47004aed3ff0d,
680 >(_buf?)?;
681 Ok(_response.new_region)
682 }
683 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Option<String>>(
684 (),
685 0x28c47004aed3ff0d,
686 fidl::encoding::DynamicFlags::empty(),
687 _decode,
688 )
689 }
690}
691
692pub struct RegulatoryRegionWatcherEventStream {
693 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
694}
695
696impl std::marker::Unpin for RegulatoryRegionWatcherEventStream {}
697
698impl futures::stream::FusedStream for RegulatoryRegionWatcherEventStream {
699 fn is_terminated(&self) -> bool {
700 self.event_receiver.is_terminated()
701 }
702}
703
704impl futures::Stream for RegulatoryRegionWatcherEventStream {
705 type Item = Result<RegulatoryRegionWatcherEvent, fidl::Error>;
706
707 fn poll_next(
708 mut self: std::pin::Pin<&mut Self>,
709 cx: &mut std::task::Context<'_>,
710 ) -> std::task::Poll<Option<Self::Item>> {
711 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
712 &mut self.event_receiver,
713 cx
714 )?) {
715 Some(buf) => std::task::Poll::Ready(Some(RegulatoryRegionWatcherEvent::decode(buf))),
716 None => std::task::Poll::Ready(None),
717 }
718 }
719}
720
721#[derive(Debug)]
722pub enum RegulatoryRegionWatcherEvent {}
723
724impl RegulatoryRegionWatcherEvent {
725 fn decode(
727 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
728 ) -> Result<RegulatoryRegionWatcherEvent, fidl::Error> {
729 let (bytes, _handles) = buf.split_mut();
730 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
731 debug_assert_eq!(tx_header.tx_id, 0);
732 match tx_header.ordinal {
733 _ => Err(fidl::Error::UnknownOrdinal {
734 ordinal: tx_header.ordinal,
735 protocol_name:
736 <RegulatoryRegionWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
737 }),
738 }
739 }
740}
741
742pub struct RegulatoryRegionWatcherRequestStream {
744 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
745 is_terminated: bool,
746}
747
748impl std::marker::Unpin for RegulatoryRegionWatcherRequestStream {}
749
750impl futures::stream::FusedStream for RegulatoryRegionWatcherRequestStream {
751 fn is_terminated(&self) -> bool {
752 self.is_terminated
753 }
754}
755
756impl fidl::endpoints::RequestStream for RegulatoryRegionWatcherRequestStream {
757 type Protocol = RegulatoryRegionWatcherMarker;
758 type ControlHandle = RegulatoryRegionWatcherControlHandle;
759
760 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
761 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
762 }
763
764 fn control_handle(&self) -> Self::ControlHandle {
765 RegulatoryRegionWatcherControlHandle { inner: self.inner.clone() }
766 }
767
768 fn into_inner(
769 self,
770 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
771 {
772 (self.inner, self.is_terminated)
773 }
774
775 fn from_inner(
776 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
777 is_terminated: bool,
778 ) -> Self {
779 Self { inner, is_terminated }
780 }
781}
782
783impl futures::Stream for RegulatoryRegionWatcherRequestStream {
784 type Item = Result<RegulatoryRegionWatcherRequest, fidl::Error>;
785
786 fn poll_next(
787 mut self: std::pin::Pin<&mut Self>,
788 cx: &mut std::task::Context<'_>,
789 ) -> std::task::Poll<Option<Self::Item>> {
790 let this = &mut *self;
791 if this.inner.check_shutdown(cx) {
792 this.is_terminated = true;
793 return std::task::Poll::Ready(None);
794 }
795 if this.is_terminated {
796 panic!("polled RegulatoryRegionWatcherRequestStream after completion");
797 }
798 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
799 |bytes, handles| {
800 match this.inner.channel().read_etc(cx, bytes, handles) {
801 std::task::Poll::Ready(Ok(())) => {}
802 std::task::Poll::Pending => return std::task::Poll::Pending,
803 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
804 this.is_terminated = true;
805 return std::task::Poll::Ready(None);
806 }
807 std::task::Poll::Ready(Err(e)) => {
808 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
809 e.into(),
810 ))))
811 }
812 }
813
814 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
816
817 std::task::Poll::Ready(Some(match header.ordinal {
818 0xaf6dec156c31687 => {
819 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
820 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
821 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
822 let control_handle = RegulatoryRegionWatcherControlHandle {
823 inner: this.inner.clone(),
824 };
825 Ok(RegulatoryRegionWatcherRequest::GetUpdate {
826 responder: RegulatoryRegionWatcherGetUpdateResponder {
827 control_handle: std::mem::ManuallyDrop::new(control_handle),
828 tx_id: header.tx_id,
829 },
830 })
831 }
832 0x28c47004aed3ff0d => {
833 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
834 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
835 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
836 let control_handle = RegulatoryRegionWatcherControlHandle {
837 inner: this.inner.clone(),
838 };
839 Ok(RegulatoryRegionWatcherRequest::GetRegionUpdate {
840 responder: RegulatoryRegionWatcherGetRegionUpdateResponder {
841 control_handle: std::mem::ManuallyDrop::new(control_handle),
842 tx_id: header.tx_id,
843 },
844 })
845 }
846 _ => Err(fidl::Error::UnknownOrdinal {
847 ordinal: header.ordinal,
848 protocol_name: <RegulatoryRegionWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
849 }),
850 }))
851 },
852 )
853 }
854}
855
856#[derive(Debug)]
860pub enum RegulatoryRegionWatcherRequest {
861 GetUpdate { responder: RegulatoryRegionWatcherGetUpdateResponder },
880 GetRegionUpdate { responder: RegulatoryRegionWatcherGetRegionUpdateResponder },
897}
898
899impl RegulatoryRegionWatcherRequest {
900 #[allow(irrefutable_let_patterns)]
901 pub fn into_get_update(self) -> Option<(RegulatoryRegionWatcherGetUpdateResponder)> {
902 if let RegulatoryRegionWatcherRequest::GetUpdate { responder } = self {
903 Some((responder))
904 } else {
905 None
906 }
907 }
908
909 #[allow(irrefutable_let_patterns)]
910 pub fn into_get_region_update(
911 self,
912 ) -> Option<(RegulatoryRegionWatcherGetRegionUpdateResponder)> {
913 if let RegulatoryRegionWatcherRequest::GetRegionUpdate { responder } = self {
914 Some((responder))
915 } else {
916 None
917 }
918 }
919
920 pub fn method_name(&self) -> &'static str {
922 match *self {
923 RegulatoryRegionWatcherRequest::GetUpdate { .. } => "get_update",
924 RegulatoryRegionWatcherRequest::GetRegionUpdate { .. } => "get_region_update",
925 }
926 }
927}
928
929#[derive(Debug, Clone)]
930pub struct RegulatoryRegionWatcherControlHandle {
931 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
932}
933
934impl fidl::endpoints::ControlHandle for RegulatoryRegionWatcherControlHandle {
935 fn shutdown(&self) {
936 self.inner.shutdown()
937 }
938 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
939 self.inner.shutdown_with_epitaph(status)
940 }
941
942 fn is_closed(&self) -> bool {
943 self.inner.channel().is_closed()
944 }
945 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
946 self.inner.channel().on_closed()
947 }
948
949 #[cfg(target_os = "fuchsia")]
950 fn signal_peer(
951 &self,
952 clear_mask: zx::Signals,
953 set_mask: zx::Signals,
954 ) -> Result<(), zx_status::Status> {
955 use fidl::Peered;
956 self.inner.channel().signal_peer(clear_mask, set_mask)
957 }
958}
959
960impl RegulatoryRegionWatcherControlHandle {}
961
962#[must_use = "FIDL methods require a response to be sent"]
963#[derive(Debug)]
964pub struct RegulatoryRegionWatcherGetUpdateResponder {
965 control_handle: std::mem::ManuallyDrop<RegulatoryRegionWatcherControlHandle>,
966 tx_id: u32,
967}
968
969impl std::ops::Drop for RegulatoryRegionWatcherGetUpdateResponder {
973 fn drop(&mut self) {
974 self.control_handle.shutdown();
975 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
977 }
978}
979
980impl fidl::endpoints::Responder for RegulatoryRegionWatcherGetUpdateResponder {
981 type ControlHandle = RegulatoryRegionWatcherControlHandle;
982
983 fn control_handle(&self) -> &RegulatoryRegionWatcherControlHandle {
984 &self.control_handle
985 }
986
987 fn drop_without_shutdown(mut self) {
988 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
990 std::mem::forget(self);
992 }
993}
994
995impl RegulatoryRegionWatcherGetUpdateResponder {
996 pub fn send(self, mut new_region: &str) -> Result<(), fidl::Error> {
1000 let _result = self.send_raw(new_region);
1001 if _result.is_err() {
1002 self.control_handle.shutdown();
1003 }
1004 self.drop_without_shutdown();
1005 _result
1006 }
1007
1008 pub fn send_no_shutdown_on_err(self, mut new_region: &str) -> Result<(), fidl::Error> {
1010 let _result = self.send_raw(new_region);
1011 self.drop_without_shutdown();
1012 _result
1013 }
1014
1015 fn send_raw(&self, mut new_region: &str) -> Result<(), fidl::Error> {
1016 self.control_handle.inner.send::<RegulatoryRegionWatcherGetUpdateResponse>(
1017 (new_region,),
1018 self.tx_id,
1019 0xaf6dec156c31687,
1020 fidl::encoding::DynamicFlags::empty(),
1021 )
1022 }
1023}
1024
1025#[must_use = "FIDL methods require a response to be sent"]
1026#[derive(Debug)]
1027pub struct RegulatoryRegionWatcherGetRegionUpdateResponder {
1028 control_handle: std::mem::ManuallyDrop<RegulatoryRegionWatcherControlHandle>,
1029 tx_id: u32,
1030}
1031
1032impl std::ops::Drop for RegulatoryRegionWatcherGetRegionUpdateResponder {
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 RegulatoryRegionWatcherGetRegionUpdateResponder {
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 RegulatoryRegionWatcherGetRegionUpdateResponder {
1059 pub fn send(self, mut new_region: Option<&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: Option<&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: Option<&str>) -> Result<(), fidl::Error> {
1079 self.control_handle.inner.send::<RegulatoryRegionWatcherGetRegionUpdateResponse>(
1080 (new_region,),
1081 self.tx_id,
1082 0x28c47004aed3ff0d,
1083 fidl::encoding::DynamicFlags::empty(),
1084 )
1085 }
1086}
1087
1088mod internal {
1089 use super::*;
1090}