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 fidl::endpoints::ControlHandle for OptOutControlHandle {
371 fn shutdown(&self) {
372 self.inner.shutdown()
373 }
374
375 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
376 self.inner.shutdown_with_epitaph(status)
377 }
378
379 fn is_closed(&self) -> bool {
380 self.inner.channel().is_closed()
381 }
382 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
383 self.inner.channel().on_closed()
384 }
385
386 #[cfg(target_os = "fuchsia")]
387 fn signal_peer(
388 &self,
389 clear_mask: zx::Signals,
390 set_mask: zx::Signals,
391 ) -> Result<(), zx_status::Status> {
392 use fidl::Peered;
393 self.inner.channel().signal_peer(clear_mask, set_mask)
394 }
395}
396
397impl OptOutControlHandle {}
398
399#[must_use = "FIDL methods require a response to be sent"]
400#[derive(Debug)]
401pub struct OptOutGetResponder {
402 control_handle: std::mem::ManuallyDrop<OptOutControlHandle>,
403 tx_id: u32,
404}
405
406impl std::ops::Drop for OptOutGetResponder {
410 fn drop(&mut self) {
411 self.control_handle.shutdown();
412 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
414 }
415}
416
417impl fidl::endpoints::Responder for OptOutGetResponder {
418 type ControlHandle = OptOutControlHandle;
419
420 fn control_handle(&self) -> &OptOutControlHandle {
421 &self.control_handle
422 }
423
424 fn drop_without_shutdown(mut self) {
425 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
427 std::mem::forget(self);
429 }
430}
431
432impl OptOutGetResponder {
433 pub fn send(self, mut value: OptOutPreference) -> Result<(), fidl::Error> {
437 let _result = self.send_raw(value);
438 if _result.is_err() {
439 self.control_handle.shutdown();
440 }
441 self.drop_without_shutdown();
442 _result
443 }
444
445 pub fn send_no_shutdown_on_err(self, mut value: OptOutPreference) -> Result<(), fidl::Error> {
447 let _result = self.send_raw(value);
448 self.drop_without_shutdown();
449 _result
450 }
451
452 fn send_raw(&self, mut value: OptOutPreference) -> Result<(), fidl::Error> {
453 self.control_handle.inner.send::<OptOutGetResponse>(
454 (value,),
455 self.tx_id,
456 0x7d905c32077a3cd8,
457 fidl::encoding::DynamicFlags::empty(),
458 )
459 }
460}
461
462#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
463pub struct OptOutAdminMarker;
464
465impl fidl::endpoints::ProtocolMarker for OptOutAdminMarker {
466 type Proxy = OptOutAdminProxy;
467 type RequestStream = OptOutAdminRequestStream;
468 #[cfg(target_os = "fuchsia")]
469 type SynchronousProxy = OptOutAdminSynchronousProxy;
470
471 const DEBUG_NAME: &'static str = "fuchsia.update.config.OptOutAdmin";
472}
473impl fidl::endpoints::DiscoverableProtocolMarker for OptOutAdminMarker {}
474pub type OptOutAdminSetResult = Result<(), OptOutAdminError>;
475
476pub trait OptOutAdminProxyInterface: Send + Sync {
477 type SetResponseFut: std::future::Future<Output = Result<OptOutAdminSetResult, fidl::Error>>
478 + Send;
479 fn r#set(&self, value: OptOutPreference) -> Self::SetResponseFut;
480}
481#[derive(Debug)]
482#[cfg(target_os = "fuchsia")]
483pub struct OptOutAdminSynchronousProxy {
484 client: fidl::client::sync::Client,
485}
486
487#[cfg(target_os = "fuchsia")]
488impl fidl::endpoints::SynchronousProxy for OptOutAdminSynchronousProxy {
489 type Proxy = OptOutAdminProxy;
490 type Protocol = OptOutAdminMarker;
491
492 fn from_channel(inner: fidl::Channel) -> Self {
493 Self::new(inner)
494 }
495
496 fn into_channel(self) -> fidl::Channel {
497 self.client.into_channel()
498 }
499
500 fn as_channel(&self) -> &fidl::Channel {
501 self.client.as_channel()
502 }
503}
504
505#[cfg(target_os = "fuchsia")]
506impl OptOutAdminSynchronousProxy {
507 pub fn new(channel: fidl::Channel) -> Self {
508 Self { client: fidl::client::sync::Client::new(channel) }
509 }
510
511 pub fn into_channel(self) -> fidl::Channel {
512 self.client.into_channel()
513 }
514
515 pub fn wait_for_event(
518 &self,
519 deadline: zx::MonotonicInstant,
520 ) -> Result<OptOutAdminEvent, fidl::Error> {
521 OptOutAdminEvent::decode(self.client.wait_for_event::<OptOutAdminMarker>(deadline)?)
522 }
523
524 pub fn r#set(
530 &self,
531 mut value: OptOutPreference,
532 ___deadline: zx::MonotonicInstant,
533 ) -> Result<OptOutAdminSetResult, fidl::Error> {
534 let _response = self.client.send_query::<
535 OptOutAdminSetRequest,
536 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, OptOutAdminError>,
537 OptOutAdminMarker,
538 >(
539 (value,),
540 0x7c990c7f64cfff27,
541 fidl::encoding::DynamicFlags::empty(),
542 ___deadline,
543 )?;
544 Ok(_response.map(|x| x))
545 }
546}
547
548#[cfg(target_os = "fuchsia")]
549impl From<OptOutAdminSynchronousProxy> for zx::NullableHandle {
550 fn from(value: OptOutAdminSynchronousProxy) -> Self {
551 value.into_channel().into()
552 }
553}
554
555#[cfg(target_os = "fuchsia")]
556impl From<fidl::Channel> for OptOutAdminSynchronousProxy {
557 fn from(value: fidl::Channel) -> Self {
558 Self::new(value)
559 }
560}
561
562#[cfg(target_os = "fuchsia")]
563impl fidl::endpoints::FromClient for OptOutAdminSynchronousProxy {
564 type Protocol = OptOutAdminMarker;
565
566 fn from_client(value: fidl::endpoints::ClientEnd<OptOutAdminMarker>) -> Self {
567 Self::new(value.into_channel())
568 }
569}
570
571#[derive(Debug, Clone)]
572pub struct OptOutAdminProxy {
573 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
574}
575
576impl fidl::endpoints::Proxy for OptOutAdminProxy {
577 type Protocol = OptOutAdminMarker;
578
579 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
580 Self::new(inner)
581 }
582
583 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
584 self.client.into_channel().map_err(|client| Self { client })
585 }
586
587 fn as_channel(&self) -> &::fidl::AsyncChannel {
588 self.client.as_channel()
589 }
590}
591
592impl OptOutAdminProxy {
593 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
595 let protocol_name = <OptOutAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
596 Self { client: fidl::client::Client::new(channel, protocol_name) }
597 }
598
599 pub fn take_event_stream(&self) -> OptOutAdminEventStream {
605 OptOutAdminEventStream { event_receiver: self.client.take_event_receiver() }
606 }
607
608 pub fn r#set(
614 &self,
615 mut value: OptOutPreference,
616 ) -> fidl::client::QueryResponseFut<
617 OptOutAdminSetResult,
618 fidl::encoding::DefaultFuchsiaResourceDialect,
619 > {
620 OptOutAdminProxyInterface::r#set(self, value)
621 }
622}
623
624impl OptOutAdminProxyInterface for OptOutAdminProxy {
625 type SetResponseFut = fidl::client::QueryResponseFut<
626 OptOutAdminSetResult,
627 fidl::encoding::DefaultFuchsiaResourceDialect,
628 >;
629 fn r#set(&self, mut value: OptOutPreference) -> Self::SetResponseFut {
630 fn _decode(
631 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
632 ) -> Result<OptOutAdminSetResult, fidl::Error> {
633 let _response = fidl::client::decode_transaction_body::<
634 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, OptOutAdminError>,
635 fidl::encoding::DefaultFuchsiaResourceDialect,
636 0x7c990c7f64cfff27,
637 >(_buf?)?;
638 Ok(_response.map(|x| x))
639 }
640 self.client.send_query_and_decode::<OptOutAdminSetRequest, OptOutAdminSetResult>(
641 (value,),
642 0x7c990c7f64cfff27,
643 fidl::encoding::DynamicFlags::empty(),
644 _decode,
645 )
646 }
647}
648
649pub struct OptOutAdminEventStream {
650 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
651}
652
653impl std::marker::Unpin for OptOutAdminEventStream {}
654
655impl futures::stream::FusedStream for OptOutAdminEventStream {
656 fn is_terminated(&self) -> bool {
657 self.event_receiver.is_terminated()
658 }
659}
660
661impl futures::Stream for OptOutAdminEventStream {
662 type Item = Result<OptOutAdminEvent, fidl::Error>;
663
664 fn poll_next(
665 mut self: std::pin::Pin<&mut Self>,
666 cx: &mut std::task::Context<'_>,
667 ) -> std::task::Poll<Option<Self::Item>> {
668 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
669 &mut self.event_receiver,
670 cx
671 )?) {
672 Some(buf) => std::task::Poll::Ready(Some(OptOutAdminEvent::decode(buf))),
673 None => std::task::Poll::Ready(None),
674 }
675 }
676}
677
678#[derive(Debug)]
679pub enum OptOutAdminEvent {}
680
681impl OptOutAdminEvent {
682 fn decode(
684 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
685 ) -> Result<OptOutAdminEvent, fidl::Error> {
686 let (bytes, _handles) = buf.split_mut();
687 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
688 debug_assert_eq!(tx_header.tx_id, 0);
689 match tx_header.ordinal {
690 _ => Err(fidl::Error::UnknownOrdinal {
691 ordinal: tx_header.ordinal,
692 protocol_name: <OptOutAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
693 }),
694 }
695 }
696}
697
698pub struct OptOutAdminRequestStream {
700 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
701 is_terminated: bool,
702}
703
704impl std::marker::Unpin for OptOutAdminRequestStream {}
705
706impl futures::stream::FusedStream for OptOutAdminRequestStream {
707 fn is_terminated(&self) -> bool {
708 self.is_terminated
709 }
710}
711
712impl fidl::endpoints::RequestStream for OptOutAdminRequestStream {
713 type Protocol = OptOutAdminMarker;
714 type ControlHandle = OptOutAdminControlHandle;
715
716 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
717 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
718 }
719
720 fn control_handle(&self) -> Self::ControlHandle {
721 OptOutAdminControlHandle { inner: self.inner.clone() }
722 }
723
724 fn into_inner(
725 self,
726 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
727 {
728 (self.inner, self.is_terminated)
729 }
730
731 fn from_inner(
732 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
733 is_terminated: bool,
734 ) -> Self {
735 Self { inner, is_terminated }
736 }
737}
738
739impl futures::Stream for OptOutAdminRequestStream {
740 type Item = Result<OptOutAdminRequest, fidl::Error>;
741
742 fn poll_next(
743 mut self: std::pin::Pin<&mut Self>,
744 cx: &mut std::task::Context<'_>,
745 ) -> std::task::Poll<Option<Self::Item>> {
746 let this = &mut *self;
747 if this.inner.check_shutdown(cx) {
748 this.is_terminated = true;
749 return std::task::Poll::Ready(None);
750 }
751 if this.is_terminated {
752 panic!("polled OptOutAdminRequestStream after completion");
753 }
754 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
755 |bytes, handles| {
756 match this.inner.channel().read_etc(cx, bytes, handles) {
757 std::task::Poll::Ready(Ok(())) => {}
758 std::task::Poll::Pending => return std::task::Poll::Pending,
759 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
760 this.is_terminated = true;
761 return std::task::Poll::Ready(None);
762 }
763 std::task::Poll::Ready(Err(e)) => {
764 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
765 e.into(),
766 ))));
767 }
768 }
769
770 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
772
773 std::task::Poll::Ready(Some(match header.ordinal {
774 0x7c990c7f64cfff27 => {
775 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
776 let mut req = fidl::new_empty!(
777 OptOutAdminSetRequest,
778 fidl::encoding::DefaultFuchsiaResourceDialect
779 );
780 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<OptOutAdminSetRequest>(&header, _body_bytes, handles, &mut req)?;
781 let control_handle = OptOutAdminControlHandle { inner: this.inner.clone() };
782 Ok(OptOutAdminRequest::Set {
783 value: req.value,
784
785 responder: OptOutAdminSetResponder {
786 control_handle: std::mem::ManuallyDrop::new(control_handle),
787 tx_id: header.tx_id,
788 },
789 })
790 }
791 _ => Err(fidl::Error::UnknownOrdinal {
792 ordinal: header.ordinal,
793 protocol_name:
794 <OptOutAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
795 }),
796 }))
797 },
798 )
799 }
800}
801
802#[derive(Debug)]
804pub enum OptOutAdminRequest {
805 Set { value: OptOutPreference, responder: OptOutAdminSetResponder },
811}
812
813impl OptOutAdminRequest {
814 #[allow(irrefutable_let_patterns)]
815 pub fn into_set(self) -> Option<(OptOutPreference, OptOutAdminSetResponder)> {
816 if let OptOutAdminRequest::Set { value, responder } = self {
817 Some((value, responder))
818 } else {
819 None
820 }
821 }
822
823 pub fn method_name(&self) -> &'static str {
825 match *self {
826 OptOutAdminRequest::Set { .. } => "set",
827 }
828 }
829}
830
831#[derive(Debug, Clone)]
832pub struct OptOutAdminControlHandle {
833 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
834}
835
836impl fidl::endpoints::ControlHandle for OptOutAdminControlHandle {
837 fn shutdown(&self) {
838 self.inner.shutdown()
839 }
840
841 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
842 self.inner.shutdown_with_epitaph(status)
843 }
844
845 fn is_closed(&self) -> bool {
846 self.inner.channel().is_closed()
847 }
848 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
849 self.inner.channel().on_closed()
850 }
851
852 #[cfg(target_os = "fuchsia")]
853 fn signal_peer(
854 &self,
855 clear_mask: zx::Signals,
856 set_mask: zx::Signals,
857 ) -> Result<(), zx_status::Status> {
858 use fidl::Peered;
859 self.inner.channel().signal_peer(clear_mask, set_mask)
860 }
861}
862
863impl OptOutAdminControlHandle {}
864
865#[must_use = "FIDL methods require a response to be sent"]
866#[derive(Debug)]
867pub struct OptOutAdminSetResponder {
868 control_handle: std::mem::ManuallyDrop<OptOutAdminControlHandle>,
869 tx_id: u32,
870}
871
872impl std::ops::Drop for OptOutAdminSetResponder {
876 fn drop(&mut self) {
877 self.control_handle.shutdown();
878 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
880 }
881}
882
883impl fidl::endpoints::Responder for OptOutAdminSetResponder {
884 type ControlHandle = OptOutAdminControlHandle;
885
886 fn control_handle(&self) -> &OptOutAdminControlHandle {
887 &self.control_handle
888 }
889
890 fn drop_without_shutdown(mut self) {
891 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
893 std::mem::forget(self);
895 }
896}
897
898impl OptOutAdminSetResponder {
899 pub fn send(self, mut result: Result<(), OptOutAdminError>) -> Result<(), fidl::Error> {
903 let _result = self.send_raw(result);
904 if _result.is_err() {
905 self.control_handle.shutdown();
906 }
907 self.drop_without_shutdown();
908 _result
909 }
910
911 pub fn send_no_shutdown_on_err(
913 self,
914 mut result: Result<(), OptOutAdminError>,
915 ) -> Result<(), fidl::Error> {
916 let _result = self.send_raw(result);
917 self.drop_without_shutdown();
918 _result
919 }
920
921 fn send_raw(&self, mut result: Result<(), OptOutAdminError>) -> Result<(), fidl::Error> {
922 self.control_handle.inner.send::<fidl::encoding::ResultType<
923 fidl::encoding::EmptyStruct,
924 OptOutAdminError,
925 >>(
926 result,
927 self.tx_id,
928 0x7c990c7f64cfff27,
929 fidl::encoding::DynamicFlags::empty(),
930 )
931 }
932}
933
934mod internal {
935 use super::*;
936}