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_update_config_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct OptOutMarker;
16
17impl fidl::endpoints::ProtocolMarker for OptOutMarker {
18 type Proxy = OptOutProxy;
19 type RequestStream = OptOutRequestStream;
20 #[cfg(target_os = "fuchsia")]
21 type SynchronousProxy = OptOutSynchronousProxy;
22
23 const DEBUG_NAME: &'static str = "fuchsia.update.config.OptOut";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for OptOutMarker {}
26
27pub trait OptOutProxyInterface: Send + Sync {
28 type GetResponseFut: std::future::Future<Output = Result<OptOutPreference, fidl::Error>> + Send;
29 fn r#get(&self) -> Self::GetResponseFut;
30}
31#[derive(Debug)]
32#[cfg(target_os = "fuchsia")]
33pub struct OptOutSynchronousProxy {
34 client: fidl::client::sync::Client,
35}
36
37#[cfg(target_os = "fuchsia")]
38impl fidl::endpoints::SynchronousProxy for OptOutSynchronousProxy {
39 type Proxy = OptOutProxy;
40 type Protocol = OptOutMarker;
41
42 fn from_channel(inner: fidl::Channel) -> Self {
43 Self::new(inner)
44 }
45
46 fn into_channel(self) -> fidl::Channel {
47 self.client.into_channel()
48 }
49
50 fn as_channel(&self) -> &fidl::Channel {
51 self.client.as_channel()
52 }
53}
54
55#[cfg(target_os = "fuchsia")]
56impl OptOutSynchronousProxy {
57 pub fn new(channel: fidl::Channel) -> Self {
58 Self { client: fidl::client::sync::Client::new(channel) }
59 }
60
61 pub fn into_channel(self) -> fidl::Channel {
62 self.client.into_channel()
63 }
64
65 pub fn wait_for_event(
68 &self,
69 deadline: zx::MonotonicInstant,
70 ) -> Result<OptOutEvent, fidl::Error> {
71 OptOutEvent::decode(self.client.wait_for_event::<OptOutMarker>(deadline)?)
72 }
73
74 pub fn r#get(
78 &self,
79 ___deadline: zx::MonotonicInstant,
80 ) -> Result<OptOutPreference, fidl::Error> {
81 let _response = self
82 .client
83 .send_query::<fidl::encoding::EmptyPayload, OptOutGetResponse, OptOutMarker>(
84 (),
85 0x7d905c32077a3cd8,
86 fidl::encoding::DynamicFlags::empty(),
87 ___deadline,
88 )?;
89 Ok(_response.value)
90 }
91}
92
93#[cfg(target_os = "fuchsia")]
94impl From<OptOutSynchronousProxy> for zx::NullableHandle {
95 fn from(value: OptOutSynchronousProxy) -> Self {
96 value.into_channel().into()
97 }
98}
99
100#[cfg(target_os = "fuchsia")]
101impl From<fidl::Channel> for OptOutSynchronousProxy {
102 fn from(value: fidl::Channel) -> Self {
103 Self::new(value)
104 }
105}
106
107#[cfg(target_os = "fuchsia")]
108impl fidl::endpoints::FromClient for OptOutSynchronousProxy {
109 type Protocol = OptOutMarker;
110
111 fn from_client(value: fidl::endpoints::ClientEnd<OptOutMarker>) -> Self {
112 Self::new(value.into_channel())
113 }
114}
115
116#[derive(Debug, Clone)]
117pub struct OptOutProxy {
118 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
119}
120
121impl fidl::endpoints::Proxy for OptOutProxy {
122 type Protocol = OptOutMarker;
123
124 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
125 Self::new(inner)
126 }
127
128 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
129 self.client.into_channel().map_err(|client| Self { client })
130 }
131
132 fn as_channel(&self) -> &::fidl::AsyncChannel {
133 self.client.as_channel()
134 }
135}
136
137impl OptOutProxy {
138 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
140 let protocol_name = <OptOutMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
141 Self { client: fidl::client::Client::new(channel, protocol_name) }
142 }
143
144 pub fn take_event_stream(&self) -> OptOutEventStream {
150 OptOutEventStream { event_receiver: self.client.take_event_receiver() }
151 }
152
153 pub fn r#get(
157 &self,
158 ) -> fidl::client::QueryResponseFut<
159 OptOutPreference,
160 fidl::encoding::DefaultFuchsiaResourceDialect,
161 > {
162 OptOutProxyInterface::r#get(self)
163 }
164}
165
166impl OptOutProxyInterface for OptOutProxy {
167 type GetResponseFut = fidl::client::QueryResponseFut<
168 OptOutPreference,
169 fidl::encoding::DefaultFuchsiaResourceDialect,
170 >;
171 fn r#get(&self) -> Self::GetResponseFut {
172 fn _decode(
173 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
174 ) -> Result<OptOutPreference, fidl::Error> {
175 let _response = fidl::client::decode_transaction_body::<
176 OptOutGetResponse,
177 fidl::encoding::DefaultFuchsiaResourceDialect,
178 0x7d905c32077a3cd8,
179 >(_buf?)?;
180 Ok(_response.value)
181 }
182 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, OptOutPreference>(
183 (),
184 0x7d905c32077a3cd8,
185 fidl::encoding::DynamicFlags::empty(),
186 _decode,
187 )
188 }
189}
190
191pub struct OptOutEventStream {
192 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
193}
194
195impl std::marker::Unpin for OptOutEventStream {}
196
197impl futures::stream::FusedStream for OptOutEventStream {
198 fn is_terminated(&self) -> bool {
199 self.event_receiver.is_terminated()
200 }
201}
202
203impl futures::Stream for OptOutEventStream {
204 type Item = Result<OptOutEvent, fidl::Error>;
205
206 fn poll_next(
207 mut self: std::pin::Pin<&mut Self>,
208 cx: &mut std::task::Context<'_>,
209 ) -> std::task::Poll<Option<Self::Item>> {
210 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
211 &mut self.event_receiver,
212 cx
213 )?) {
214 Some(buf) => std::task::Poll::Ready(Some(OptOutEvent::decode(buf))),
215 None => std::task::Poll::Ready(None),
216 }
217 }
218}
219
220#[derive(Debug)]
221pub enum OptOutEvent {}
222
223impl OptOutEvent {
224 fn decode(
226 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
227 ) -> Result<OptOutEvent, fidl::Error> {
228 let (bytes, _handles) = buf.split_mut();
229 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
230 debug_assert_eq!(tx_header.tx_id, 0);
231 match tx_header.ordinal {
232 _ => Err(fidl::Error::UnknownOrdinal {
233 ordinal: tx_header.ordinal,
234 protocol_name: <OptOutMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
235 }),
236 }
237 }
238}
239
240pub struct OptOutRequestStream {
242 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
243 is_terminated: bool,
244}
245
246impl std::marker::Unpin for OptOutRequestStream {}
247
248impl futures::stream::FusedStream for OptOutRequestStream {
249 fn is_terminated(&self) -> bool {
250 self.is_terminated
251 }
252}
253
254impl fidl::endpoints::RequestStream for OptOutRequestStream {
255 type Protocol = OptOutMarker;
256 type ControlHandle = OptOutControlHandle;
257
258 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
259 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
260 }
261
262 fn control_handle(&self) -> Self::ControlHandle {
263 OptOutControlHandle { inner: self.inner.clone() }
264 }
265
266 fn into_inner(
267 self,
268 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
269 {
270 (self.inner, self.is_terminated)
271 }
272
273 fn from_inner(
274 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
275 is_terminated: bool,
276 ) -> Self {
277 Self { inner, is_terminated }
278 }
279}
280
281impl futures::Stream for OptOutRequestStream {
282 type Item = Result<OptOutRequest, fidl::Error>;
283
284 fn poll_next(
285 mut self: std::pin::Pin<&mut Self>,
286 cx: &mut std::task::Context<'_>,
287 ) -> std::task::Poll<Option<Self::Item>> {
288 let this = &mut *self;
289 if this.inner.check_shutdown(cx) {
290 this.is_terminated = true;
291 return std::task::Poll::Ready(None);
292 }
293 if this.is_terminated {
294 panic!("polled OptOutRequestStream after completion");
295 }
296 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
297 |bytes, handles| {
298 match this.inner.channel().read_etc(cx, bytes, handles) {
299 std::task::Poll::Ready(Ok(())) => {}
300 std::task::Poll::Pending => return std::task::Poll::Pending,
301 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
302 this.is_terminated = true;
303 return std::task::Poll::Ready(None);
304 }
305 std::task::Poll::Ready(Err(e)) => {
306 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
307 e.into(),
308 ))));
309 }
310 }
311
312 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
314
315 std::task::Poll::Ready(Some(match header.ordinal {
316 0x7d905c32077a3cd8 => {
317 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
318 let mut req = fidl::new_empty!(
319 fidl::encoding::EmptyPayload,
320 fidl::encoding::DefaultFuchsiaResourceDialect
321 );
322 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
323 let control_handle = OptOutControlHandle { inner: this.inner.clone() };
324 Ok(OptOutRequest::Get {
325 responder: OptOutGetResponder {
326 control_handle: std::mem::ManuallyDrop::new(control_handle),
327 tx_id: header.tx_id,
328 },
329 })
330 }
331 _ => Err(fidl::Error::UnknownOrdinal {
332 ordinal: header.ordinal,
333 protocol_name:
334 <OptOutMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
335 }),
336 }))
337 },
338 )
339 }
340}
341
342#[derive(Debug)]
344pub enum OptOutRequest {
345 Get { responder: OptOutGetResponder },
349}
350
351impl OptOutRequest {
352 #[allow(irrefutable_let_patterns)]
353 pub fn into_get(self) -> Option<(OptOutGetResponder)> {
354 if let OptOutRequest::Get { responder } = self { Some((responder)) } else { None }
355 }
356
357 pub fn method_name(&self) -> &'static str {
359 match *self {
360 OptOutRequest::Get { .. } => "get",
361 }
362 }
363}
364
365#[derive(Debug, Clone)]
366pub struct OptOutControlHandle {
367 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
368}
369
370impl OptOutControlHandle {
371 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
372 self.inner.shutdown_with_epitaph(status.into())
373 }
374}
375
376impl fidl::endpoints::ControlHandle for OptOutControlHandle {
377 fn shutdown(&self) {
378 self.inner.shutdown()
379 }
380
381 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
382 self.inner.shutdown_with_epitaph(status)
383 }
384
385 fn is_closed(&self) -> bool {
386 self.inner.channel().is_closed()
387 }
388 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
389 self.inner.channel().on_closed()
390 }
391
392 #[cfg(target_os = "fuchsia")]
393 fn signal_peer(
394 &self,
395 clear_mask: zx::Signals,
396 set_mask: zx::Signals,
397 ) -> Result<(), zx_status::Status> {
398 use fidl::Peered;
399 self.inner.channel().signal_peer(clear_mask, set_mask)
400 }
401}
402
403impl OptOutControlHandle {}
404
405#[must_use = "FIDL methods require a response to be sent"]
406#[derive(Debug)]
407pub struct OptOutGetResponder {
408 control_handle: std::mem::ManuallyDrop<OptOutControlHandle>,
409 tx_id: u32,
410}
411
412impl std::ops::Drop for OptOutGetResponder {
416 fn drop(&mut self) {
417 self.control_handle.shutdown();
418 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
420 }
421}
422
423impl fidl::endpoints::Responder for OptOutGetResponder {
424 type ControlHandle = OptOutControlHandle;
425
426 fn control_handle(&self) -> &OptOutControlHandle {
427 &self.control_handle
428 }
429
430 fn drop_without_shutdown(mut self) {
431 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
433 std::mem::forget(self);
435 }
436}
437
438impl OptOutGetResponder {
439 pub fn send(self, mut value: OptOutPreference) -> Result<(), fidl::Error> {
443 let _result = self.send_raw(value);
444 if _result.is_err() {
445 self.control_handle.shutdown();
446 }
447 self.drop_without_shutdown();
448 _result
449 }
450
451 pub fn send_no_shutdown_on_err(self, mut value: OptOutPreference) -> Result<(), fidl::Error> {
453 let _result = self.send_raw(value);
454 self.drop_without_shutdown();
455 _result
456 }
457
458 fn send_raw(&self, mut value: OptOutPreference) -> Result<(), fidl::Error> {
459 self.control_handle.inner.send::<OptOutGetResponse>(
460 (value,),
461 self.tx_id,
462 0x7d905c32077a3cd8,
463 fidl::encoding::DynamicFlags::empty(),
464 )
465 }
466}
467
468#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
469pub struct OptOutAdminMarker;
470
471impl fidl::endpoints::ProtocolMarker for OptOutAdminMarker {
472 type Proxy = OptOutAdminProxy;
473 type RequestStream = OptOutAdminRequestStream;
474 #[cfg(target_os = "fuchsia")]
475 type SynchronousProxy = OptOutAdminSynchronousProxy;
476
477 const DEBUG_NAME: &'static str = "fuchsia.update.config.OptOutAdmin";
478}
479impl fidl::endpoints::DiscoverableProtocolMarker for OptOutAdminMarker {}
480pub type OptOutAdminSetResult = Result<(), OptOutAdminError>;
481
482pub trait OptOutAdminProxyInterface: Send + Sync {
483 type SetResponseFut: std::future::Future<Output = Result<OptOutAdminSetResult, fidl::Error>>
484 + Send;
485 fn r#set(&self, value: OptOutPreference) -> Self::SetResponseFut;
486}
487#[derive(Debug)]
488#[cfg(target_os = "fuchsia")]
489pub struct OptOutAdminSynchronousProxy {
490 client: fidl::client::sync::Client,
491}
492
493#[cfg(target_os = "fuchsia")]
494impl fidl::endpoints::SynchronousProxy for OptOutAdminSynchronousProxy {
495 type Proxy = OptOutAdminProxy;
496 type Protocol = OptOutAdminMarker;
497
498 fn from_channel(inner: fidl::Channel) -> Self {
499 Self::new(inner)
500 }
501
502 fn into_channel(self) -> fidl::Channel {
503 self.client.into_channel()
504 }
505
506 fn as_channel(&self) -> &fidl::Channel {
507 self.client.as_channel()
508 }
509}
510
511#[cfg(target_os = "fuchsia")]
512impl OptOutAdminSynchronousProxy {
513 pub fn new(channel: fidl::Channel) -> Self {
514 Self { client: fidl::client::sync::Client::new(channel) }
515 }
516
517 pub fn into_channel(self) -> fidl::Channel {
518 self.client.into_channel()
519 }
520
521 pub fn wait_for_event(
524 &self,
525 deadline: zx::MonotonicInstant,
526 ) -> Result<OptOutAdminEvent, fidl::Error> {
527 OptOutAdminEvent::decode(self.client.wait_for_event::<OptOutAdminMarker>(deadline)?)
528 }
529
530 pub fn r#set(
536 &self,
537 mut value: OptOutPreference,
538 ___deadline: zx::MonotonicInstant,
539 ) -> Result<OptOutAdminSetResult, fidl::Error> {
540 let _response = self.client.send_query::<
541 OptOutAdminSetRequest,
542 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, OptOutAdminError>,
543 OptOutAdminMarker,
544 >(
545 (value,),
546 0x7c990c7f64cfff27,
547 fidl::encoding::DynamicFlags::empty(),
548 ___deadline,
549 )?;
550 Ok(_response.map(|x| x))
551 }
552}
553
554#[cfg(target_os = "fuchsia")]
555impl From<OptOutAdminSynchronousProxy> for zx::NullableHandle {
556 fn from(value: OptOutAdminSynchronousProxy) -> Self {
557 value.into_channel().into()
558 }
559}
560
561#[cfg(target_os = "fuchsia")]
562impl From<fidl::Channel> for OptOutAdminSynchronousProxy {
563 fn from(value: fidl::Channel) -> Self {
564 Self::new(value)
565 }
566}
567
568#[cfg(target_os = "fuchsia")]
569impl fidl::endpoints::FromClient for OptOutAdminSynchronousProxy {
570 type Protocol = OptOutAdminMarker;
571
572 fn from_client(value: fidl::endpoints::ClientEnd<OptOutAdminMarker>) -> Self {
573 Self::new(value.into_channel())
574 }
575}
576
577#[derive(Debug, Clone)]
578pub struct OptOutAdminProxy {
579 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
580}
581
582impl fidl::endpoints::Proxy for OptOutAdminProxy {
583 type Protocol = OptOutAdminMarker;
584
585 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
586 Self::new(inner)
587 }
588
589 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
590 self.client.into_channel().map_err(|client| Self { client })
591 }
592
593 fn as_channel(&self) -> &::fidl::AsyncChannel {
594 self.client.as_channel()
595 }
596}
597
598impl OptOutAdminProxy {
599 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
601 let protocol_name = <OptOutAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
602 Self { client: fidl::client::Client::new(channel, protocol_name) }
603 }
604
605 pub fn take_event_stream(&self) -> OptOutAdminEventStream {
611 OptOutAdminEventStream { event_receiver: self.client.take_event_receiver() }
612 }
613
614 pub fn r#set(
620 &self,
621 mut value: OptOutPreference,
622 ) -> fidl::client::QueryResponseFut<
623 OptOutAdminSetResult,
624 fidl::encoding::DefaultFuchsiaResourceDialect,
625 > {
626 OptOutAdminProxyInterface::r#set(self, value)
627 }
628}
629
630impl OptOutAdminProxyInterface for OptOutAdminProxy {
631 type SetResponseFut = fidl::client::QueryResponseFut<
632 OptOutAdminSetResult,
633 fidl::encoding::DefaultFuchsiaResourceDialect,
634 >;
635 fn r#set(&self, mut value: OptOutPreference) -> Self::SetResponseFut {
636 fn _decode(
637 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
638 ) -> Result<OptOutAdminSetResult, fidl::Error> {
639 let _response = fidl::client::decode_transaction_body::<
640 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, OptOutAdminError>,
641 fidl::encoding::DefaultFuchsiaResourceDialect,
642 0x7c990c7f64cfff27,
643 >(_buf?)?;
644 Ok(_response.map(|x| x))
645 }
646 self.client.send_query_and_decode::<OptOutAdminSetRequest, OptOutAdminSetResult>(
647 (value,),
648 0x7c990c7f64cfff27,
649 fidl::encoding::DynamicFlags::empty(),
650 _decode,
651 )
652 }
653}
654
655pub struct OptOutAdminEventStream {
656 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
657}
658
659impl std::marker::Unpin for OptOutAdminEventStream {}
660
661impl futures::stream::FusedStream for OptOutAdminEventStream {
662 fn is_terminated(&self) -> bool {
663 self.event_receiver.is_terminated()
664 }
665}
666
667impl futures::Stream for OptOutAdminEventStream {
668 type Item = Result<OptOutAdminEvent, fidl::Error>;
669
670 fn poll_next(
671 mut self: std::pin::Pin<&mut Self>,
672 cx: &mut std::task::Context<'_>,
673 ) -> std::task::Poll<Option<Self::Item>> {
674 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
675 &mut self.event_receiver,
676 cx
677 )?) {
678 Some(buf) => std::task::Poll::Ready(Some(OptOutAdminEvent::decode(buf))),
679 None => std::task::Poll::Ready(None),
680 }
681 }
682}
683
684#[derive(Debug)]
685pub enum OptOutAdminEvent {}
686
687impl OptOutAdminEvent {
688 fn decode(
690 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
691 ) -> Result<OptOutAdminEvent, fidl::Error> {
692 let (bytes, _handles) = buf.split_mut();
693 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
694 debug_assert_eq!(tx_header.tx_id, 0);
695 match tx_header.ordinal {
696 _ => Err(fidl::Error::UnknownOrdinal {
697 ordinal: tx_header.ordinal,
698 protocol_name: <OptOutAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
699 }),
700 }
701 }
702}
703
704pub struct OptOutAdminRequestStream {
706 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
707 is_terminated: bool,
708}
709
710impl std::marker::Unpin for OptOutAdminRequestStream {}
711
712impl futures::stream::FusedStream for OptOutAdminRequestStream {
713 fn is_terminated(&self) -> bool {
714 self.is_terminated
715 }
716}
717
718impl fidl::endpoints::RequestStream for OptOutAdminRequestStream {
719 type Protocol = OptOutAdminMarker;
720 type ControlHandle = OptOutAdminControlHandle;
721
722 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
723 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
724 }
725
726 fn control_handle(&self) -> Self::ControlHandle {
727 OptOutAdminControlHandle { inner: self.inner.clone() }
728 }
729
730 fn into_inner(
731 self,
732 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
733 {
734 (self.inner, self.is_terminated)
735 }
736
737 fn from_inner(
738 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
739 is_terminated: bool,
740 ) -> Self {
741 Self { inner, is_terminated }
742 }
743}
744
745impl futures::Stream for OptOutAdminRequestStream {
746 type Item = Result<OptOutAdminRequest, fidl::Error>;
747
748 fn poll_next(
749 mut self: std::pin::Pin<&mut Self>,
750 cx: &mut std::task::Context<'_>,
751 ) -> std::task::Poll<Option<Self::Item>> {
752 let this = &mut *self;
753 if this.inner.check_shutdown(cx) {
754 this.is_terminated = true;
755 return std::task::Poll::Ready(None);
756 }
757 if this.is_terminated {
758 panic!("polled OptOutAdminRequestStream after completion");
759 }
760 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
761 |bytes, handles| {
762 match this.inner.channel().read_etc(cx, bytes, handles) {
763 std::task::Poll::Ready(Ok(())) => {}
764 std::task::Poll::Pending => return std::task::Poll::Pending,
765 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
766 this.is_terminated = true;
767 return std::task::Poll::Ready(None);
768 }
769 std::task::Poll::Ready(Err(e)) => {
770 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
771 e.into(),
772 ))));
773 }
774 }
775
776 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
778
779 std::task::Poll::Ready(Some(match header.ordinal {
780 0x7c990c7f64cfff27 => {
781 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
782 let mut req = fidl::new_empty!(
783 OptOutAdminSetRequest,
784 fidl::encoding::DefaultFuchsiaResourceDialect
785 );
786 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<OptOutAdminSetRequest>(&header, _body_bytes, handles, &mut req)?;
787 let control_handle = OptOutAdminControlHandle { inner: this.inner.clone() };
788 Ok(OptOutAdminRequest::Set {
789 value: req.value,
790
791 responder: OptOutAdminSetResponder {
792 control_handle: std::mem::ManuallyDrop::new(control_handle),
793 tx_id: header.tx_id,
794 },
795 })
796 }
797 _ => Err(fidl::Error::UnknownOrdinal {
798 ordinal: header.ordinal,
799 protocol_name:
800 <OptOutAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
801 }),
802 }))
803 },
804 )
805 }
806}
807
808#[derive(Debug)]
810pub enum OptOutAdminRequest {
811 Set { value: OptOutPreference, responder: OptOutAdminSetResponder },
817}
818
819impl OptOutAdminRequest {
820 #[allow(irrefutable_let_patterns)]
821 pub fn into_set(self) -> Option<(OptOutPreference, OptOutAdminSetResponder)> {
822 if let OptOutAdminRequest::Set { value, responder } = self {
823 Some((value, responder))
824 } else {
825 None
826 }
827 }
828
829 pub fn method_name(&self) -> &'static str {
831 match *self {
832 OptOutAdminRequest::Set { .. } => "set",
833 }
834 }
835}
836
837#[derive(Debug, Clone)]
838pub struct OptOutAdminControlHandle {
839 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
840}
841
842impl OptOutAdminControlHandle {
843 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
844 self.inner.shutdown_with_epitaph(status.into())
845 }
846}
847
848impl fidl::endpoints::ControlHandle for OptOutAdminControlHandle {
849 fn shutdown(&self) {
850 self.inner.shutdown()
851 }
852
853 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
854 self.inner.shutdown_with_epitaph(status)
855 }
856
857 fn is_closed(&self) -> bool {
858 self.inner.channel().is_closed()
859 }
860 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
861 self.inner.channel().on_closed()
862 }
863
864 #[cfg(target_os = "fuchsia")]
865 fn signal_peer(
866 &self,
867 clear_mask: zx::Signals,
868 set_mask: zx::Signals,
869 ) -> Result<(), zx_status::Status> {
870 use fidl::Peered;
871 self.inner.channel().signal_peer(clear_mask, set_mask)
872 }
873}
874
875impl OptOutAdminControlHandle {}
876
877#[must_use = "FIDL methods require a response to be sent"]
878#[derive(Debug)]
879pub struct OptOutAdminSetResponder {
880 control_handle: std::mem::ManuallyDrop<OptOutAdminControlHandle>,
881 tx_id: u32,
882}
883
884impl std::ops::Drop for OptOutAdminSetResponder {
888 fn drop(&mut self) {
889 self.control_handle.shutdown();
890 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
892 }
893}
894
895impl fidl::endpoints::Responder for OptOutAdminSetResponder {
896 type ControlHandle = OptOutAdminControlHandle;
897
898 fn control_handle(&self) -> &OptOutAdminControlHandle {
899 &self.control_handle
900 }
901
902 fn drop_without_shutdown(mut self) {
903 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
905 std::mem::forget(self);
907 }
908}
909
910impl OptOutAdminSetResponder {
911 pub fn send(self, mut result: Result<(), OptOutAdminError>) -> Result<(), fidl::Error> {
915 let _result = self.send_raw(result);
916 if _result.is_err() {
917 self.control_handle.shutdown();
918 }
919 self.drop_without_shutdown();
920 _result
921 }
922
923 pub fn send_no_shutdown_on_err(
925 self,
926 mut result: Result<(), OptOutAdminError>,
927 ) -> Result<(), fidl::Error> {
928 let _result = self.send_raw(result);
929 self.drop_without_shutdown();
930 _result
931 }
932
933 fn send_raw(&self, mut result: Result<(), OptOutAdminError>) -> Result<(), fidl::Error> {
934 self.control_handle.inner.send::<fidl::encoding::ResultType<
935 fidl::encoding::EmptyStruct,
936 OptOutAdminError,
937 >>(
938 result,
939 self.tx_id,
940 0x7c990c7f64cfff27,
941 fidl::encoding::DynamicFlags::empty(),
942 )
943 }
944}
945
946mod internal {
947 use super::*;
948}