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_recovery_ui_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct FactoryResetCountdownMarker;
16
17impl fidl::endpoints::ProtocolMarker for FactoryResetCountdownMarker {
18 type Proxy = FactoryResetCountdownProxy;
19 type RequestStream = FactoryResetCountdownRequestStream;
20 #[cfg(target_os = "fuchsia")]
21 type SynchronousProxy = FactoryResetCountdownSynchronousProxy;
22
23 const DEBUG_NAME: &'static str = "fuchsia.recovery.ui.FactoryResetCountdown";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for FactoryResetCountdownMarker {}
26
27pub trait FactoryResetCountdownProxyInterface: Send + Sync {
28 type WatchResponseFut: std::future::Future<Output = Result<FactoryResetCountdownState, fidl::Error>>
29 + Send;
30 fn r#watch(&self) -> Self::WatchResponseFut;
31}
32#[derive(Debug)]
33#[cfg(target_os = "fuchsia")]
34pub struct FactoryResetCountdownSynchronousProxy {
35 client: fidl::client::sync::Client,
36}
37
38#[cfg(target_os = "fuchsia")]
39impl fidl::endpoints::SynchronousProxy for FactoryResetCountdownSynchronousProxy {
40 type Proxy = FactoryResetCountdownProxy;
41 type Protocol = FactoryResetCountdownMarker;
42
43 fn from_channel(inner: fidl::Channel) -> Self {
44 Self::new(inner)
45 }
46
47 fn into_channel(self) -> fidl::Channel {
48 self.client.into_channel()
49 }
50
51 fn as_channel(&self) -> &fidl::Channel {
52 self.client.as_channel()
53 }
54}
55
56#[cfg(target_os = "fuchsia")]
57impl FactoryResetCountdownSynchronousProxy {
58 pub fn new(channel: fidl::Channel) -> Self {
59 let protocol_name =
60 <FactoryResetCountdownMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
61 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
62 }
63
64 pub fn into_channel(self) -> fidl::Channel {
65 self.client.into_channel()
66 }
67
68 pub fn wait_for_event(
71 &self,
72 deadline: zx::MonotonicInstant,
73 ) -> Result<FactoryResetCountdownEvent, fidl::Error> {
74 FactoryResetCountdownEvent::decode(self.client.wait_for_event(deadline)?)
75 }
76
77 pub fn r#watch(
81 &self,
82 ___deadline: zx::MonotonicInstant,
83 ) -> Result<FactoryResetCountdownState, fidl::Error> {
84 let _response = self
85 .client
86 .send_query::<fidl::encoding::EmptyPayload, FactoryResetCountdownWatchResponse>(
87 (),
88 0x1d486a7889bc943a,
89 fidl::encoding::DynamicFlags::empty(),
90 ___deadline,
91 )?;
92 Ok(_response.state)
93 }
94}
95
96#[cfg(target_os = "fuchsia")]
97impl From<FactoryResetCountdownSynchronousProxy> for zx::Handle {
98 fn from(value: FactoryResetCountdownSynchronousProxy) -> Self {
99 value.into_channel().into()
100 }
101}
102
103#[cfg(target_os = "fuchsia")]
104impl From<fidl::Channel> for FactoryResetCountdownSynchronousProxy {
105 fn from(value: fidl::Channel) -> Self {
106 Self::new(value)
107 }
108}
109
110#[derive(Debug, Clone)]
111pub struct FactoryResetCountdownProxy {
112 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
113}
114
115impl fidl::endpoints::Proxy for FactoryResetCountdownProxy {
116 type Protocol = FactoryResetCountdownMarker;
117
118 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
119 Self::new(inner)
120 }
121
122 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
123 self.client.into_channel().map_err(|client| Self { client })
124 }
125
126 fn as_channel(&self) -> &::fidl::AsyncChannel {
127 self.client.as_channel()
128 }
129}
130
131impl FactoryResetCountdownProxy {
132 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
134 let protocol_name =
135 <FactoryResetCountdownMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
136 Self { client: fidl::client::Client::new(channel, protocol_name) }
137 }
138
139 pub fn take_event_stream(&self) -> FactoryResetCountdownEventStream {
145 FactoryResetCountdownEventStream { event_receiver: self.client.take_event_receiver() }
146 }
147
148 pub fn r#watch(
152 &self,
153 ) -> fidl::client::QueryResponseFut<
154 FactoryResetCountdownState,
155 fidl::encoding::DefaultFuchsiaResourceDialect,
156 > {
157 FactoryResetCountdownProxyInterface::r#watch(self)
158 }
159}
160
161impl FactoryResetCountdownProxyInterface for FactoryResetCountdownProxy {
162 type WatchResponseFut = fidl::client::QueryResponseFut<
163 FactoryResetCountdownState,
164 fidl::encoding::DefaultFuchsiaResourceDialect,
165 >;
166 fn r#watch(&self) -> Self::WatchResponseFut {
167 fn _decode(
168 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
169 ) -> Result<FactoryResetCountdownState, fidl::Error> {
170 let _response = fidl::client::decode_transaction_body::<
171 FactoryResetCountdownWatchResponse,
172 fidl::encoding::DefaultFuchsiaResourceDialect,
173 0x1d486a7889bc943a,
174 >(_buf?)?;
175 Ok(_response.state)
176 }
177 self.client
178 .send_query_and_decode::<fidl::encoding::EmptyPayload, FactoryResetCountdownState>(
179 (),
180 0x1d486a7889bc943a,
181 fidl::encoding::DynamicFlags::empty(),
182 _decode,
183 )
184 }
185}
186
187pub struct FactoryResetCountdownEventStream {
188 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
189}
190
191impl std::marker::Unpin for FactoryResetCountdownEventStream {}
192
193impl futures::stream::FusedStream for FactoryResetCountdownEventStream {
194 fn is_terminated(&self) -> bool {
195 self.event_receiver.is_terminated()
196 }
197}
198
199impl futures::Stream for FactoryResetCountdownEventStream {
200 type Item = Result<FactoryResetCountdownEvent, fidl::Error>;
201
202 fn poll_next(
203 mut self: std::pin::Pin<&mut Self>,
204 cx: &mut std::task::Context<'_>,
205 ) -> std::task::Poll<Option<Self::Item>> {
206 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
207 &mut self.event_receiver,
208 cx
209 )?) {
210 Some(buf) => std::task::Poll::Ready(Some(FactoryResetCountdownEvent::decode(buf))),
211 None => std::task::Poll::Ready(None),
212 }
213 }
214}
215
216#[derive(Debug)]
217pub enum FactoryResetCountdownEvent {}
218
219impl FactoryResetCountdownEvent {
220 fn decode(
222 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
223 ) -> Result<FactoryResetCountdownEvent, fidl::Error> {
224 let (bytes, _handles) = buf.split_mut();
225 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
226 debug_assert_eq!(tx_header.tx_id, 0);
227 match tx_header.ordinal {
228 _ => Err(fidl::Error::UnknownOrdinal {
229 ordinal: tx_header.ordinal,
230 protocol_name:
231 <FactoryResetCountdownMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
232 }),
233 }
234 }
235}
236
237pub struct FactoryResetCountdownRequestStream {
239 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
240 is_terminated: bool,
241}
242
243impl std::marker::Unpin for FactoryResetCountdownRequestStream {}
244
245impl futures::stream::FusedStream for FactoryResetCountdownRequestStream {
246 fn is_terminated(&self) -> bool {
247 self.is_terminated
248 }
249}
250
251impl fidl::endpoints::RequestStream for FactoryResetCountdownRequestStream {
252 type Protocol = FactoryResetCountdownMarker;
253 type ControlHandle = FactoryResetCountdownControlHandle;
254
255 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
256 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
257 }
258
259 fn control_handle(&self) -> Self::ControlHandle {
260 FactoryResetCountdownControlHandle { inner: self.inner.clone() }
261 }
262
263 fn into_inner(
264 self,
265 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
266 {
267 (self.inner, self.is_terminated)
268 }
269
270 fn from_inner(
271 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
272 is_terminated: bool,
273 ) -> Self {
274 Self { inner, is_terminated }
275 }
276}
277
278impl futures::Stream for FactoryResetCountdownRequestStream {
279 type Item = Result<FactoryResetCountdownRequest, fidl::Error>;
280
281 fn poll_next(
282 mut self: std::pin::Pin<&mut Self>,
283 cx: &mut std::task::Context<'_>,
284 ) -> std::task::Poll<Option<Self::Item>> {
285 let this = &mut *self;
286 if this.inner.check_shutdown(cx) {
287 this.is_terminated = true;
288 return std::task::Poll::Ready(None);
289 }
290 if this.is_terminated {
291 panic!("polled FactoryResetCountdownRequestStream after completion");
292 }
293 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
294 |bytes, handles| {
295 match this.inner.channel().read_etc(cx, bytes, handles) {
296 std::task::Poll::Ready(Ok(())) => {}
297 std::task::Poll::Pending => return std::task::Poll::Pending,
298 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
299 this.is_terminated = true;
300 return std::task::Poll::Ready(None);
301 }
302 std::task::Poll::Ready(Err(e)) => {
303 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
304 e.into(),
305 ))))
306 }
307 }
308
309 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
311
312 std::task::Poll::Ready(Some(match header.ordinal {
313 0x1d486a7889bc943a => {
314 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
315 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
316 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
317 let control_handle = FactoryResetCountdownControlHandle {
318 inner: this.inner.clone(),
319 };
320 Ok(FactoryResetCountdownRequest::Watch {
321 responder: FactoryResetCountdownWatchResponder {
322 control_handle: std::mem::ManuallyDrop::new(control_handle),
323 tx_id: header.tx_id,
324 },
325 })
326 }
327 _ => Err(fidl::Error::UnknownOrdinal {
328 ordinal: header.ordinal,
329 protocol_name: <FactoryResetCountdownMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
330 }),
331 }))
332 },
333 )
334 }
335}
336
337#[derive(Debug)]
340pub enum FactoryResetCountdownRequest {
341 Watch { responder: FactoryResetCountdownWatchResponder },
345}
346
347impl FactoryResetCountdownRequest {
348 #[allow(irrefutable_let_patterns)]
349 pub fn into_watch(self) -> Option<(FactoryResetCountdownWatchResponder)> {
350 if let FactoryResetCountdownRequest::Watch { responder } = self {
351 Some((responder))
352 } else {
353 None
354 }
355 }
356
357 pub fn method_name(&self) -> &'static str {
359 match *self {
360 FactoryResetCountdownRequest::Watch { .. } => "watch",
361 }
362 }
363}
364
365#[derive(Debug, Clone)]
366pub struct FactoryResetCountdownControlHandle {
367 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
368}
369
370impl fidl::endpoints::ControlHandle for FactoryResetCountdownControlHandle {
371 fn shutdown(&self) {
372 self.inner.shutdown()
373 }
374 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
375 self.inner.shutdown_with_epitaph(status)
376 }
377
378 fn is_closed(&self) -> bool {
379 self.inner.channel().is_closed()
380 }
381 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
382 self.inner.channel().on_closed()
383 }
384
385 #[cfg(target_os = "fuchsia")]
386 fn signal_peer(
387 &self,
388 clear_mask: zx::Signals,
389 set_mask: zx::Signals,
390 ) -> Result<(), zx_status::Status> {
391 use fidl::Peered;
392 self.inner.channel().signal_peer(clear_mask, set_mask)
393 }
394}
395
396impl FactoryResetCountdownControlHandle {}
397
398#[must_use = "FIDL methods require a response to be sent"]
399#[derive(Debug)]
400pub struct FactoryResetCountdownWatchResponder {
401 control_handle: std::mem::ManuallyDrop<FactoryResetCountdownControlHandle>,
402 tx_id: u32,
403}
404
405impl std::ops::Drop for FactoryResetCountdownWatchResponder {
409 fn drop(&mut self) {
410 self.control_handle.shutdown();
411 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
413 }
414}
415
416impl fidl::endpoints::Responder for FactoryResetCountdownWatchResponder {
417 type ControlHandle = FactoryResetCountdownControlHandle;
418
419 fn control_handle(&self) -> &FactoryResetCountdownControlHandle {
420 &self.control_handle
421 }
422
423 fn drop_without_shutdown(mut self) {
424 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
426 std::mem::forget(self);
428 }
429}
430
431impl FactoryResetCountdownWatchResponder {
432 pub fn send(self, mut state: &FactoryResetCountdownState) -> Result<(), fidl::Error> {
436 let _result = self.send_raw(state);
437 if _result.is_err() {
438 self.control_handle.shutdown();
439 }
440 self.drop_without_shutdown();
441 _result
442 }
443
444 pub fn send_no_shutdown_on_err(
446 self,
447 mut state: &FactoryResetCountdownState,
448 ) -> Result<(), fidl::Error> {
449 let _result = self.send_raw(state);
450 self.drop_without_shutdown();
451 _result
452 }
453
454 fn send_raw(&self, mut state: &FactoryResetCountdownState) -> Result<(), fidl::Error> {
455 self.control_handle.inner.send::<FactoryResetCountdownWatchResponse>(
456 (state,),
457 self.tx_id,
458 0x1d486a7889bc943a,
459 fidl::encoding::DynamicFlags::empty(),
460 )
461 }
462}
463
464#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
465pub struct ProgressRendererMarker;
466
467impl fidl::endpoints::ProtocolMarker for ProgressRendererMarker {
468 type Proxy = ProgressRendererProxy;
469 type RequestStream = ProgressRendererRequestStream;
470 #[cfg(target_os = "fuchsia")]
471 type SynchronousProxy = ProgressRendererSynchronousProxy;
472
473 const DEBUG_NAME: &'static str = "fuchsia.recovery.ui.ProgressRenderer";
474}
475impl fidl::endpoints::DiscoverableProtocolMarker for ProgressRendererMarker {}
476
477pub trait ProgressRendererProxyInterface: Send + Sync {
478 type RenderResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
479 fn r#render(&self, status: Status, percent_complete: f32) -> Self::RenderResponseFut;
480 type Render2ResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
481 fn r#render2(&self, payload: &ProgressRendererRender2Request) -> Self::Render2ResponseFut;
482}
483#[derive(Debug)]
484#[cfg(target_os = "fuchsia")]
485pub struct ProgressRendererSynchronousProxy {
486 client: fidl::client::sync::Client,
487}
488
489#[cfg(target_os = "fuchsia")]
490impl fidl::endpoints::SynchronousProxy for ProgressRendererSynchronousProxy {
491 type Proxy = ProgressRendererProxy;
492 type Protocol = ProgressRendererMarker;
493
494 fn from_channel(inner: fidl::Channel) -> Self {
495 Self::new(inner)
496 }
497
498 fn into_channel(self) -> fidl::Channel {
499 self.client.into_channel()
500 }
501
502 fn as_channel(&self) -> &fidl::Channel {
503 self.client.as_channel()
504 }
505}
506
507#[cfg(target_os = "fuchsia")]
508impl ProgressRendererSynchronousProxy {
509 pub fn new(channel: fidl::Channel) -> Self {
510 let protocol_name = <ProgressRendererMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
511 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
512 }
513
514 pub fn into_channel(self) -> fidl::Channel {
515 self.client.into_channel()
516 }
517
518 pub fn wait_for_event(
521 &self,
522 deadline: zx::MonotonicInstant,
523 ) -> Result<ProgressRendererEvent, fidl::Error> {
524 ProgressRendererEvent::decode(self.client.wait_for_event(deadline)?)
525 }
526
527 pub fn r#render(
532 &self,
533 mut status: Status,
534 mut percent_complete: f32,
535 ___deadline: zx::MonotonicInstant,
536 ) -> Result<(), fidl::Error> {
537 let _response =
538 self.client.send_query::<ProgressRendererRenderRequest, fidl::encoding::EmptyPayload>(
539 (status, percent_complete),
540 0x68f03b362c8c1a54,
541 fidl::encoding::DynamicFlags::empty(),
542 ___deadline,
543 )?;
544 Ok(_response)
545 }
546
547 pub fn r#render2(
555 &self,
556 mut payload: &ProgressRendererRender2Request,
557 ___deadline: zx::MonotonicInstant,
558 ) -> Result<(), fidl::Error> {
559 let _response = self
560 .client
561 .send_query::<ProgressRendererRender2Request, fidl::encoding::EmptyPayload>(
562 payload,
563 0x218acc9beba72126,
564 fidl::encoding::DynamicFlags::empty(),
565 ___deadline,
566 )?;
567 Ok(_response)
568 }
569}
570
571#[cfg(target_os = "fuchsia")]
572impl From<ProgressRendererSynchronousProxy> for zx::Handle {
573 fn from(value: ProgressRendererSynchronousProxy) -> Self {
574 value.into_channel().into()
575 }
576}
577
578#[cfg(target_os = "fuchsia")]
579impl From<fidl::Channel> for ProgressRendererSynchronousProxy {
580 fn from(value: fidl::Channel) -> Self {
581 Self::new(value)
582 }
583}
584
585#[derive(Debug, Clone)]
586pub struct ProgressRendererProxy {
587 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
588}
589
590impl fidl::endpoints::Proxy for ProgressRendererProxy {
591 type Protocol = ProgressRendererMarker;
592
593 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
594 Self::new(inner)
595 }
596
597 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
598 self.client.into_channel().map_err(|client| Self { client })
599 }
600
601 fn as_channel(&self) -> &::fidl::AsyncChannel {
602 self.client.as_channel()
603 }
604}
605
606impl ProgressRendererProxy {
607 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
609 let protocol_name = <ProgressRendererMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
610 Self { client: fidl::client::Client::new(channel, protocol_name) }
611 }
612
613 pub fn take_event_stream(&self) -> ProgressRendererEventStream {
619 ProgressRendererEventStream { event_receiver: self.client.take_event_receiver() }
620 }
621
622 pub fn r#render(
627 &self,
628 mut status: Status,
629 mut percent_complete: f32,
630 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
631 ProgressRendererProxyInterface::r#render(self, status, percent_complete)
632 }
633
634 pub fn r#render2(
642 &self,
643 mut payload: &ProgressRendererRender2Request,
644 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
645 ProgressRendererProxyInterface::r#render2(self, payload)
646 }
647}
648
649impl ProgressRendererProxyInterface for ProgressRendererProxy {
650 type RenderResponseFut =
651 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
652 fn r#render(&self, mut status: Status, mut percent_complete: f32) -> Self::RenderResponseFut {
653 fn _decode(
654 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
655 ) -> Result<(), fidl::Error> {
656 let _response = fidl::client::decode_transaction_body::<
657 fidl::encoding::EmptyPayload,
658 fidl::encoding::DefaultFuchsiaResourceDialect,
659 0x68f03b362c8c1a54,
660 >(_buf?)?;
661 Ok(_response)
662 }
663 self.client.send_query_and_decode::<ProgressRendererRenderRequest, ()>(
664 (status, percent_complete),
665 0x68f03b362c8c1a54,
666 fidl::encoding::DynamicFlags::empty(),
667 _decode,
668 )
669 }
670
671 type Render2ResponseFut =
672 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
673 fn r#render2(&self, mut payload: &ProgressRendererRender2Request) -> Self::Render2ResponseFut {
674 fn _decode(
675 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
676 ) -> Result<(), fidl::Error> {
677 let _response = fidl::client::decode_transaction_body::<
678 fidl::encoding::EmptyPayload,
679 fidl::encoding::DefaultFuchsiaResourceDialect,
680 0x218acc9beba72126,
681 >(_buf?)?;
682 Ok(_response)
683 }
684 self.client.send_query_and_decode::<ProgressRendererRender2Request, ()>(
685 payload,
686 0x218acc9beba72126,
687 fidl::encoding::DynamicFlags::empty(),
688 _decode,
689 )
690 }
691}
692
693pub struct ProgressRendererEventStream {
694 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
695}
696
697impl std::marker::Unpin for ProgressRendererEventStream {}
698
699impl futures::stream::FusedStream for ProgressRendererEventStream {
700 fn is_terminated(&self) -> bool {
701 self.event_receiver.is_terminated()
702 }
703}
704
705impl futures::Stream for ProgressRendererEventStream {
706 type Item = Result<ProgressRendererEvent, fidl::Error>;
707
708 fn poll_next(
709 mut self: std::pin::Pin<&mut Self>,
710 cx: &mut std::task::Context<'_>,
711 ) -> std::task::Poll<Option<Self::Item>> {
712 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
713 &mut self.event_receiver,
714 cx
715 )?) {
716 Some(buf) => std::task::Poll::Ready(Some(ProgressRendererEvent::decode(buf))),
717 None => std::task::Poll::Ready(None),
718 }
719 }
720}
721
722#[derive(Debug)]
723pub enum ProgressRendererEvent {}
724
725impl ProgressRendererEvent {
726 fn decode(
728 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
729 ) -> Result<ProgressRendererEvent, fidl::Error> {
730 let (bytes, _handles) = buf.split_mut();
731 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
732 debug_assert_eq!(tx_header.tx_id, 0);
733 match tx_header.ordinal {
734 _ => Err(fidl::Error::UnknownOrdinal {
735 ordinal: tx_header.ordinal,
736 protocol_name:
737 <ProgressRendererMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
738 }),
739 }
740 }
741}
742
743pub struct ProgressRendererRequestStream {
745 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
746 is_terminated: bool,
747}
748
749impl std::marker::Unpin for ProgressRendererRequestStream {}
750
751impl futures::stream::FusedStream for ProgressRendererRequestStream {
752 fn is_terminated(&self) -> bool {
753 self.is_terminated
754 }
755}
756
757impl fidl::endpoints::RequestStream for ProgressRendererRequestStream {
758 type Protocol = ProgressRendererMarker;
759 type ControlHandle = ProgressRendererControlHandle;
760
761 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
762 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
763 }
764
765 fn control_handle(&self) -> Self::ControlHandle {
766 ProgressRendererControlHandle { inner: self.inner.clone() }
767 }
768
769 fn into_inner(
770 self,
771 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
772 {
773 (self.inner, self.is_terminated)
774 }
775
776 fn from_inner(
777 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
778 is_terminated: bool,
779 ) -> Self {
780 Self { inner, is_terminated }
781 }
782}
783
784impl futures::Stream for ProgressRendererRequestStream {
785 type Item = Result<ProgressRendererRequest, fidl::Error>;
786
787 fn poll_next(
788 mut self: std::pin::Pin<&mut Self>,
789 cx: &mut std::task::Context<'_>,
790 ) -> std::task::Poll<Option<Self::Item>> {
791 let this = &mut *self;
792 if this.inner.check_shutdown(cx) {
793 this.is_terminated = true;
794 return std::task::Poll::Ready(None);
795 }
796 if this.is_terminated {
797 panic!("polled ProgressRendererRequestStream after completion");
798 }
799 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
800 |bytes, handles| {
801 match this.inner.channel().read_etc(cx, bytes, handles) {
802 std::task::Poll::Ready(Ok(())) => {}
803 std::task::Poll::Pending => return std::task::Poll::Pending,
804 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
805 this.is_terminated = true;
806 return std::task::Poll::Ready(None);
807 }
808 std::task::Poll::Ready(Err(e)) => {
809 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
810 e.into(),
811 ))))
812 }
813 }
814
815 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
817
818 std::task::Poll::Ready(Some(match header.ordinal {
819 0x68f03b362c8c1a54 => {
820 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
821 let mut req = fidl::new_empty!(
822 ProgressRendererRenderRequest,
823 fidl::encoding::DefaultFuchsiaResourceDialect
824 );
825 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProgressRendererRenderRequest>(&header, _body_bytes, handles, &mut req)?;
826 let control_handle =
827 ProgressRendererControlHandle { inner: this.inner.clone() };
828 Ok(ProgressRendererRequest::Render {
829 status: req.status,
830 percent_complete: req.percent_complete,
831
832 responder: ProgressRendererRenderResponder {
833 control_handle: std::mem::ManuallyDrop::new(control_handle),
834 tx_id: header.tx_id,
835 },
836 })
837 }
838 0x218acc9beba72126 => {
839 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
840 let mut req = fidl::new_empty!(
841 ProgressRendererRender2Request,
842 fidl::encoding::DefaultFuchsiaResourceDialect
843 );
844 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProgressRendererRender2Request>(&header, _body_bytes, handles, &mut req)?;
845 let control_handle =
846 ProgressRendererControlHandle { inner: this.inner.clone() };
847 Ok(ProgressRendererRequest::Render2 {
848 payload: req,
849 responder: ProgressRendererRender2Responder {
850 control_handle: std::mem::ManuallyDrop::new(control_handle),
851 tx_id: header.tx_id,
852 },
853 })
854 }
855 _ => Err(fidl::Error::UnknownOrdinal {
856 ordinal: header.ordinal,
857 protocol_name:
858 <ProgressRendererMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
859 }),
860 }))
861 },
862 )
863 }
864}
865
866#[derive(Debug)]
868pub enum ProgressRendererRequest {
869 Render { status: Status, percent_complete: f32, responder: ProgressRendererRenderResponder },
874 Render2 { payload: ProgressRendererRender2Request, responder: ProgressRendererRender2Responder },
882}
883
884impl ProgressRendererRequest {
885 #[allow(irrefutable_let_patterns)]
886 pub fn into_render(self) -> Option<(Status, f32, ProgressRendererRenderResponder)> {
887 if let ProgressRendererRequest::Render { status, percent_complete, responder } = self {
888 Some((status, percent_complete, responder))
889 } else {
890 None
891 }
892 }
893
894 #[allow(irrefutable_let_patterns)]
895 pub fn into_render2(
896 self,
897 ) -> Option<(ProgressRendererRender2Request, ProgressRendererRender2Responder)> {
898 if let ProgressRendererRequest::Render2 { payload, responder } = self {
899 Some((payload, responder))
900 } else {
901 None
902 }
903 }
904
905 pub fn method_name(&self) -> &'static str {
907 match *self {
908 ProgressRendererRequest::Render { .. } => "render",
909 ProgressRendererRequest::Render2 { .. } => "render2",
910 }
911 }
912}
913
914#[derive(Debug, Clone)]
915pub struct ProgressRendererControlHandle {
916 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
917}
918
919impl fidl::endpoints::ControlHandle for ProgressRendererControlHandle {
920 fn shutdown(&self) {
921 self.inner.shutdown()
922 }
923 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
924 self.inner.shutdown_with_epitaph(status)
925 }
926
927 fn is_closed(&self) -> bool {
928 self.inner.channel().is_closed()
929 }
930 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
931 self.inner.channel().on_closed()
932 }
933
934 #[cfg(target_os = "fuchsia")]
935 fn signal_peer(
936 &self,
937 clear_mask: zx::Signals,
938 set_mask: zx::Signals,
939 ) -> Result<(), zx_status::Status> {
940 use fidl::Peered;
941 self.inner.channel().signal_peer(clear_mask, set_mask)
942 }
943}
944
945impl ProgressRendererControlHandle {}
946
947#[must_use = "FIDL methods require a response to be sent"]
948#[derive(Debug)]
949pub struct ProgressRendererRenderResponder {
950 control_handle: std::mem::ManuallyDrop<ProgressRendererControlHandle>,
951 tx_id: u32,
952}
953
954impl std::ops::Drop for ProgressRendererRenderResponder {
958 fn drop(&mut self) {
959 self.control_handle.shutdown();
960 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
962 }
963}
964
965impl fidl::endpoints::Responder for ProgressRendererRenderResponder {
966 type ControlHandle = ProgressRendererControlHandle;
967
968 fn control_handle(&self) -> &ProgressRendererControlHandle {
969 &self.control_handle
970 }
971
972 fn drop_without_shutdown(mut self) {
973 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
975 std::mem::forget(self);
977 }
978}
979
980impl ProgressRendererRenderResponder {
981 pub fn send(self) -> Result<(), fidl::Error> {
985 let _result = self.send_raw();
986 if _result.is_err() {
987 self.control_handle.shutdown();
988 }
989 self.drop_without_shutdown();
990 _result
991 }
992
993 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
995 let _result = self.send_raw();
996 self.drop_without_shutdown();
997 _result
998 }
999
1000 fn send_raw(&self) -> Result<(), fidl::Error> {
1001 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1002 (),
1003 self.tx_id,
1004 0x68f03b362c8c1a54,
1005 fidl::encoding::DynamicFlags::empty(),
1006 )
1007 }
1008}
1009
1010#[must_use = "FIDL methods require a response to be sent"]
1011#[derive(Debug)]
1012pub struct ProgressRendererRender2Responder {
1013 control_handle: std::mem::ManuallyDrop<ProgressRendererControlHandle>,
1014 tx_id: u32,
1015}
1016
1017impl std::ops::Drop for ProgressRendererRender2Responder {
1021 fn drop(&mut self) {
1022 self.control_handle.shutdown();
1023 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1025 }
1026}
1027
1028impl fidl::endpoints::Responder for ProgressRendererRender2Responder {
1029 type ControlHandle = ProgressRendererControlHandle;
1030
1031 fn control_handle(&self) -> &ProgressRendererControlHandle {
1032 &self.control_handle
1033 }
1034
1035 fn drop_without_shutdown(mut self) {
1036 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1038 std::mem::forget(self);
1040 }
1041}
1042
1043impl ProgressRendererRender2Responder {
1044 pub fn send(self) -> Result<(), fidl::Error> {
1048 let _result = self.send_raw();
1049 if _result.is_err() {
1050 self.control_handle.shutdown();
1051 }
1052 self.drop_without_shutdown();
1053 _result
1054 }
1055
1056 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1058 let _result = self.send_raw();
1059 self.drop_without_shutdown();
1060 _result
1061 }
1062
1063 fn send_raw(&self) -> Result<(), fidl::Error> {
1064 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1065 (),
1066 self.tx_id,
1067 0x218acc9beba72126,
1068 fidl::encoding::DynamicFlags::empty(),
1069 )
1070 }
1071}
1072
1073mod internal {
1074 use super::*;
1075}