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_session_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct LauncherMarker;
16
17impl fidl::endpoints::ProtocolMarker for LauncherMarker {
18 type Proxy = LauncherProxy;
19 type RequestStream = LauncherRequestStream;
20 #[cfg(target_os = "fuchsia")]
21 type SynchronousProxy = LauncherSynchronousProxy;
22
23 const DEBUG_NAME: &'static str = "fuchsia.session.Launcher";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for LauncherMarker {}
26pub type LauncherLaunchResult = Result<(), LaunchError>;
27
28pub trait LauncherProxyInterface: Send + Sync {
29 type LaunchResponseFut: std::future::Future<Output = Result<LauncherLaunchResult, fidl::Error>>
30 + Send;
31 fn r#launch(&self, configuration: &LaunchConfiguration) -> Self::LaunchResponseFut;
32}
33#[derive(Debug)]
34#[cfg(target_os = "fuchsia")]
35pub struct LauncherSynchronousProxy {
36 client: fidl::client::sync::Client,
37}
38
39#[cfg(target_os = "fuchsia")]
40impl fidl::endpoints::SynchronousProxy for LauncherSynchronousProxy {
41 type Proxy = LauncherProxy;
42 type Protocol = LauncherMarker;
43
44 fn from_channel(inner: fidl::Channel) -> Self {
45 Self::new(inner)
46 }
47
48 fn into_channel(self) -> fidl::Channel {
49 self.client.into_channel()
50 }
51
52 fn as_channel(&self) -> &fidl::Channel {
53 self.client.as_channel()
54 }
55}
56
57#[cfg(target_os = "fuchsia")]
58impl LauncherSynchronousProxy {
59 pub fn new(channel: fidl::Channel) -> Self {
60 let protocol_name = <LauncherMarker 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<LauncherEvent, fidl::Error> {
74 LauncherEvent::decode(self.client.wait_for_event(deadline)?)
75 }
76
77 pub fn r#launch(
91 &self,
92 mut configuration: &LaunchConfiguration,
93 ___deadline: zx::MonotonicInstant,
94 ) -> Result<LauncherLaunchResult, fidl::Error> {
95 let _response = self.client.send_query::<
96 LauncherLaunchRequest,
97 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, LaunchError>,
98 >(
99 (configuration,),
100 0x7674a4287f8a385a,
101 fidl::encoding::DynamicFlags::empty(),
102 ___deadline,
103 )?;
104 Ok(_response.map(|x| x))
105 }
106}
107
108#[derive(Debug, Clone)]
109pub struct LauncherProxy {
110 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
111}
112
113impl fidl::endpoints::Proxy for LauncherProxy {
114 type Protocol = LauncherMarker;
115
116 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
117 Self::new(inner)
118 }
119
120 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
121 self.client.into_channel().map_err(|client| Self { client })
122 }
123
124 fn as_channel(&self) -> &::fidl::AsyncChannel {
125 self.client.as_channel()
126 }
127}
128
129impl LauncherProxy {
130 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
132 let protocol_name = <LauncherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
133 Self { client: fidl::client::Client::new(channel, protocol_name) }
134 }
135
136 pub fn take_event_stream(&self) -> LauncherEventStream {
142 LauncherEventStream { event_receiver: self.client.take_event_receiver() }
143 }
144
145 pub fn r#launch(
159 &self,
160 mut configuration: &LaunchConfiguration,
161 ) -> fidl::client::QueryResponseFut<
162 LauncherLaunchResult,
163 fidl::encoding::DefaultFuchsiaResourceDialect,
164 > {
165 LauncherProxyInterface::r#launch(self, configuration)
166 }
167}
168
169impl LauncherProxyInterface for LauncherProxy {
170 type LaunchResponseFut = fidl::client::QueryResponseFut<
171 LauncherLaunchResult,
172 fidl::encoding::DefaultFuchsiaResourceDialect,
173 >;
174 fn r#launch(&self, mut configuration: &LaunchConfiguration) -> Self::LaunchResponseFut {
175 fn _decode(
176 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
177 ) -> Result<LauncherLaunchResult, fidl::Error> {
178 let _response = fidl::client::decode_transaction_body::<
179 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, LaunchError>,
180 fidl::encoding::DefaultFuchsiaResourceDialect,
181 0x7674a4287f8a385a,
182 >(_buf?)?;
183 Ok(_response.map(|x| x))
184 }
185 self.client.send_query_and_decode::<LauncherLaunchRequest, LauncherLaunchResult>(
186 (configuration,),
187 0x7674a4287f8a385a,
188 fidl::encoding::DynamicFlags::empty(),
189 _decode,
190 )
191 }
192}
193
194pub struct LauncherEventStream {
195 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
196}
197
198impl std::marker::Unpin for LauncherEventStream {}
199
200impl futures::stream::FusedStream for LauncherEventStream {
201 fn is_terminated(&self) -> bool {
202 self.event_receiver.is_terminated()
203 }
204}
205
206impl futures::Stream for LauncherEventStream {
207 type Item = Result<LauncherEvent, fidl::Error>;
208
209 fn poll_next(
210 mut self: std::pin::Pin<&mut Self>,
211 cx: &mut std::task::Context<'_>,
212 ) -> std::task::Poll<Option<Self::Item>> {
213 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
214 &mut self.event_receiver,
215 cx
216 )?) {
217 Some(buf) => std::task::Poll::Ready(Some(LauncherEvent::decode(buf))),
218 None => std::task::Poll::Ready(None),
219 }
220 }
221}
222
223#[derive(Debug)]
224pub enum LauncherEvent {}
225
226impl LauncherEvent {
227 fn decode(
229 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
230 ) -> Result<LauncherEvent, fidl::Error> {
231 let (bytes, _handles) = buf.split_mut();
232 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
233 debug_assert_eq!(tx_header.tx_id, 0);
234 match tx_header.ordinal {
235 _ => Err(fidl::Error::UnknownOrdinal {
236 ordinal: tx_header.ordinal,
237 protocol_name: <LauncherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
238 }),
239 }
240 }
241}
242
243pub struct LauncherRequestStream {
245 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
246 is_terminated: bool,
247}
248
249impl std::marker::Unpin for LauncherRequestStream {}
250
251impl futures::stream::FusedStream for LauncherRequestStream {
252 fn is_terminated(&self) -> bool {
253 self.is_terminated
254 }
255}
256
257impl fidl::endpoints::RequestStream for LauncherRequestStream {
258 type Protocol = LauncherMarker;
259 type ControlHandle = LauncherControlHandle;
260
261 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
262 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
263 }
264
265 fn control_handle(&self) -> Self::ControlHandle {
266 LauncherControlHandle { inner: self.inner.clone() }
267 }
268
269 fn into_inner(
270 self,
271 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
272 {
273 (self.inner, self.is_terminated)
274 }
275
276 fn from_inner(
277 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
278 is_terminated: bool,
279 ) -> Self {
280 Self { inner, is_terminated }
281 }
282}
283
284impl futures::Stream for LauncherRequestStream {
285 type Item = Result<LauncherRequest, fidl::Error>;
286
287 fn poll_next(
288 mut self: std::pin::Pin<&mut Self>,
289 cx: &mut std::task::Context<'_>,
290 ) -> std::task::Poll<Option<Self::Item>> {
291 let this = &mut *self;
292 if this.inner.check_shutdown(cx) {
293 this.is_terminated = true;
294 return std::task::Poll::Ready(None);
295 }
296 if this.is_terminated {
297 panic!("polled LauncherRequestStream after completion");
298 }
299 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
300 |bytes, handles| {
301 match this.inner.channel().read_etc(cx, bytes, handles) {
302 std::task::Poll::Ready(Ok(())) => {}
303 std::task::Poll::Pending => return std::task::Poll::Pending,
304 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
305 this.is_terminated = true;
306 return std::task::Poll::Ready(None);
307 }
308 std::task::Poll::Ready(Err(e)) => {
309 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
310 e.into(),
311 ))))
312 }
313 }
314
315 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
317
318 std::task::Poll::Ready(Some(match header.ordinal {
319 0x7674a4287f8a385a => {
320 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
321 let mut req = fidl::new_empty!(
322 LauncherLaunchRequest,
323 fidl::encoding::DefaultFuchsiaResourceDialect
324 );
325 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LauncherLaunchRequest>(&header, _body_bytes, handles, &mut req)?;
326 let control_handle = LauncherControlHandle { inner: this.inner.clone() };
327 Ok(LauncherRequest::Launch {
328 configuration: req.configuration,
329
330 responder: LauncherLaunchResponder {
331 control_handle: std::mem::ManuallyDrop::new(control_handle),
332 tx_id: header.tx_id,
333 },
334 })
335 }
336 _ => Err(fidl::Error::UnknownOrdinal {
337 ordinal: header.ordinal,
338 protocol_name:
339 <LauncherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
340 }),
341 }))
342 },
343 )
344 }
345}
346
347#[derive(Debug)]
349pub enum LauncherRequest {
350 Launch { configuration: LaunchConfiguration, responder: LauncherLaunchResponder },
364}
365
366impl LauncherRequest {
367 #[allow(irrefutable_let_patterns)]
368 pub fn into_launch(self) -> Option<(LaunchConfiguration, LauncherLaunchResponder)> {
369 if let LauncherRequest::Launch { configuration, responder } = self {
370 Some((configuration, responder))
371 } else {
372 None
373 }
374 }
375
376 pub fn method_name(&self) -> &'static str {
378 match *self {
379 LauncherRequest::Launch { .. } => "launch",
380 }
381 }
382}
383
384#[derive(Debug, Clone)]
385pub struct LauncherControlHandle {
386 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
387}
388
389impl fidl::endpoints::ControlHandle for LauncherControlHandle {
390 fn shutdown(&self) {
391 self.inner.shutdown()
392 }
393 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
394 self.inner.shutdown_with_epitaph(status)
395 }
396
397 fn is_closed(&self) -> bool {
398 self.inner.channel().is_closed()
399 }
400 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
401 self.inner.channel().on_closed()
402 }
403
404 #[cfg(target_os = "fuchsia")]
405 fn signal_peer(
406 &self,
407 clear_mask: zx::Signals,
408 set_mask: zx::Signals,
409 ) -> Result<(), zx_status::Status> {
410 use fidl::Peered;
411 self.inner.channel().signal_peer(clear_mask, set_mask)
412 }
413}
414
415impl LauncherControlHandle {}
416
417#[must_use = "FIDL methods require a response to be sent"]
418#[derive(Debug)]
419pub struct LauncherLaunchResponder {
420 control_handle: std::mem::ManuallyDrop<LauncherControlHandle>,
421 tx_id: u32,
422}
423
424impl std::ops::Drop for LauncherLaunchResponder {
428 fn drop(&mut self) {
429 self.control_handle.shutdown();
430 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
432 }
433}
434
435impl fidl::endpoints::Responder for LauncherLaunchResponder {
436 type ControlHandle = LauncherControlHandle;
437
438 fn control_handle(&self) -> &LauncherControlHandle {
439 &self.control_handle
440 }
441
442 fn drop_without_shutdown(mut self) {
443 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
445 std::mem::forget(self);
447 }
448}
449
450impl LauncherLaunchResponder {
451 pub fn send(self, mut result: Result<(), LaunchError>) -> Result<(), fidl::Error> {
455 let _result = self.send_raw(result);
456 if _result.is_err() {
457 self.control_handle.shutdown();
458 }
459 self.drop_without_shutdown();
460 _result
461 }
462
463 pub fn send_no_shutdown_on_err(
465 self,
466 mut result: Result<(), LaunchError>,
467 ) -> Result<(), fidl::Error> {
468 let _result = self.send_raw(result);
469 self.drop_without_shutdown();
470 _result
471 }
472
473 fn send_raw(&self, mut result: Result<(), LaunchError>) -> Result<(), fidl::Error> {
474 self.control_handle.inner.send::<fidl::encoding::ResultType<
475 fidl::encoding::EmptyStruct,
476 LaunchError,
477 >>(
478 result,
479 self.tx_id,
480 0x7674a4287f8a385a,
481 fidl::encoding::DynamicFlags::empty(),
482 )
483 }
484}
485
486#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
487pub struct LifecycleMarker;
488
489impl fidl::endpoints::ProtocolMarker for LifecycleMarker {
490 type Proxy = LifecycleProxy;
491 type RequestStream = LifecycleRequestStream;
492 #[cfg(target_os = "fuchsia")]
493 type SynchronousProxy = LifecycleSynchronousProxy;
494
495 const DEBUG_NAME: &'static str = "fuchsia.session.Lifecycle";
496}
497impl fidl::endpoints::DiscoverableProtocolMarker for LifecycleMarker {}
498pub type LifecycleStartResult = Result<(), LifecycleError>;
499pub type LifecycleStopResult = Result<(), LifecycleError>;
500pub type LifecycleRestartResult = Result<(), LifecycleError>;
501
502pub trait LifecycleProxyInterface: Send + Sync {
503 type StartResponseFut: std::future::Future<Output = Result<LifecycleStartResult, fidl::Error>>
504 + Send;
505 fn r#start(&self, payload: &LifecycleStartRequest) -> Self::StartResponseFut;
506 type StopResponseFut: std::future::Future<Output = Result<LifecycleStopResult, fidl::Error>>
507 + Send;
508 fn r#stop(&self) -> Self::StopResponseFut;
509 type RestartResponseFut: std::future::Future<Output = Result<LifecycleRestartResult, fidl::Error>>
510 + Send;
511 fn r#restart(&self) -> Self::RestartResponseFut;
512}
513#[derive(Debug)]
514#[cfg(target_os = "fuchsia")]
515pub struct LifecycleSynchronousProxy {
516 client: fidl::client::sync::Client,
517}
518
519#[cfg(target_os = "fuchsia")]
520impl fidl::endpoints::SynchronousProxy for LifecycleSynchronousProxy {
521 type Proxy = LifecycleProxy;
522 type Protocol = LifecycleMarker;
523
524 fn from_channel(inner: fidl::Channel) -> Self {
525 Self::new(inner)
526 }
527
528 fn into_channel(self) -> fidl::Channel {
529 self.client.into_channel()
530 }
531
532 fn as_channel(&self) -> &fidl::Channel {
533 self.client.as_channel()
534 }
535}
536
537#[cfg(target_os = "fuchsia")]
538impl LifecycleSynchronousProxy {
539 pub fn new(channel: fidl::Channel) -> Self {
540 let protocol_name = <LifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
541 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
542 }
543
544 pub fn into_channel(self) -> fidl::Channel {
545 self.client.into_channel()
546 }
547
548 pub fn wait_for_event(
551 &self,
552 deadline: zx::MonotonicInstant,
553 ) -> Result<LifecycleEvent, fidl::Error> {
554 LifecycleEvent::decode(self.client.wait_for_event(deadline)?)
555 }
556
557 pub fn r#start(
571 &self,
572 mut payload: &LifecycleStartRequest,
573 ___deadline: zx::MonotonicInstant,
574 ) -> Result<LifecycleStartResult, fidl::Error> {
575 let _response = self.client.send_query::<
576 LifecycleStartRequest,
577 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, LifecycleError>,
578 >(
579 payload,
580 0x2fda381d2cc41ce0,
581 fidl::encoding::DynamicFlags::FLEXIBLE,
582 ___deadline,
583 )?
584 .into_result::<LifecycleMarker>("start")?;
585 Ok(_response.map(|x| x))
586 }
587
588 pub fn r#stop(
597 &self,
598 ___deadline: zx::MonotonicInstant,
599 ) -> Result<LifecycleStopResult, fidl::Error> {
600 let _response = self.client.send_query::<
601 fidl::encoding::EmptyPayload,
602 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, LifecycleError>,
603 >(
604 (),
605 0x453a9158431b4a2,
606 fidl::encoding::DynamicFlags::FLEXIBLE,
607 ___deadline,
608 )?
609 .into_result::<LifecycleMarker>("stop")?;
610 Ok(_response.map(|x| x))
611 }
612
613 pub fn r#restart(
629 &self,
630 ___deadline: zx::MonotonicInstant,
631 ) -> Result<LifecycleRestartResult, fidl::Error> {
632 let _response = self.client.send_query::<
633 fidl::encoding::EmptyPayload,
634 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, LifecycleError>,
635 >(
636 (),
637 0x31faeac257bf1abb,
638 fidl::encoding::DynamicFlags::FLEXIBLE,
639 ___deadline,
640 )?
641 .into_result::<LifecycleMarker>("restart")?;
642 Ok(_response.map(|x| x))
643 }
644}
645
646#[derive(Debug, Clone)]
647pub struct LifecycleProxy {
648 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
649}
650
651impl fidl::endpoints::Proxy for LifecycleProxy {
652 type Protocol = LifecycleMarker;
653
654 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
655 Self::new(inner)
656 }
657
658 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
659 self.client.into_channel().map_err(|client| Self { client })
660 }
661
662 fn as_channel(&self) -> &::fidl::AsyncChannel {
663 self.client.as_channel()
664 }
665}
666
667impl LifecycleProxy {
668 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
670 let protocol_name = <LifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
671 Self { client: fidl::client::Client::new(channel, protocol_name) }
672 }
673
674 pub fn take_event_stream(&self) -> LifecycleEventStream {
680 LifecycleEventStream { event_receiver: self.client.take_event_receiver() }
681 }
682
683 pub fn r#start(
697 &self,
698 mut payload: &LifecycleStartRequest,
699 ) -> fidl::client::QueryResponseFut<
700 LifecycleStartResult,
701 fidl::encoding::DefaultFuchsiaResourceDialect,
702 > {
703 LifecycleProxyInterface::r#start(self, payload)
704 }
705
706 pub fn r#stop(
715 &self,
716 ) -> fidl::client::QueryResponseFut<
717 LifecycleStopResult,
718 fidl::encoding::DefaultFuchsiaResourceDialect,
719 > {
720 LifecycleProxyInterface::r#stop(self)
721 }
722
723 pub fn r#restart(
739 &self,
740 ) -> fidl::client::QueryResponseFut<
741 LifecycleRestartResult,
742 fidl::encoding::DefaultFuchsiaResourceDialect,
743 > {
744 LifecycleProxyInterface::r#restart(self)
745 }
746}
747
748impl LifecycleProxyInterface for LifecycleProxy {
749 type StartResponseFut = fidl::client::QueryResponseFut<
750 LifecycleStartResult,
751 fidl::encoding::DefaultFuchsiaResourceDialect,
752 >;
753 fn r#start(&self, mut payload: &LifecycleStartRequest) -> Self::StartResponseFut {
754 fn _decode(
755 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
756 ) -> Result<LifecycleStartResult, fidl::Error> {
757 let _response = fidl::client::decode_transaction_body::<
758 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, LifecycleError>,
759 fidl::encoding::DefaultFuchsiaResourceDialect,
760 0x2fda381d2cc41ce0,
761 >(_buf?)?
762 .into_result::<LifecycleMarker>("start")?;
763 Ok(_response.map(|x| x))
764 }
765 self.client.send_query_and_decode::<LifecycleStartRequest, LifecycleStartResult>(
766 payload,
767 0x2fda381d2cc41ce0,
768 fidl::encoding::DynamicFlags::FLEXIBLE,
769 _decode,
770 )
771 }
772
773 type StopResponseFut = fidl::client::QueryResponseFut<
774 LifecycleStopResult,
775 fidl::encoding::DefaultFuchsiaResourceDialect,
776 >;
777 fn r#stop(&self) -> Self::StopResponseFut {
778 fn _decode(
779 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
780 ) -> Result<LifecycleStopResult, fidl::Error> {
781 let _response = fidl::client::decode_transaction_body::<
782 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, LifecycleError>,
783 fidl::encoding::DefaultFuchsiaResourceDialect,
784 0x453a9158431b4a2,
785 >(_buf?)?
786 .into_result::<LifecycleMarker>("stop")?;
787 Ok(_response.map(|x| x))
788 }
789 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, LifecycleStopResult>(
790 (),
791 0x453a9158431b4a2,
792 fidl::encoding::DynamicFlags::FLEXIBLE,
793 _decode,
794 )
795 }
796
797 type RestartResponseFut = fidl::client::QueryResponseFut<
798 LifecycleRestartResult,
799 fidl::encoding::DefaultFuchsiaResourceDialect,
800 >;
801 fn r#restart(&self) -> Self::RestartResponseFut {
802 fn _decode(
803 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
804 ) -> Result<LifecycleRestartResult, fidl::Error> {
805 let _response = fidl::client::decode_transaction_body::<
806 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, LifecycleError>,
807 fidl::encoding::DefaultFuchsiaResourceDialect,
808 0x31faeac257bf1abb,
809 >(_buf?)?
810 .into_result::<LifecycleMarker>("restart")?;
811 Ok(_response.map(|x| x))
812 }
813 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, LifecycleRestartResult>(
814 (),
815 0x31faeac257bf1abb,
816 fidl::encoding::DynamicFlags::FLEXIBLE,
817 _decode,
818 )
819 }
820}
821
822pub struct LifecycleEventStream {
823 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
824}
825
826impl std::marker::Unpin for LifecycleEventStream {}
827
828impl futures::stream::FusedStream for LifecycleEventStream {
829 fn is_terminated(&self) -> bool {
830 self.event_receiver.is_terminated()
831 }
832}
833
834impl futures::Stream for LifecycleEventStream {
835 type Item = Result<LifecycleEvent, fidl::Error>;
836
837 fn poll_next(
838 mut self: std::pin::Pin<&mut Self>,
839 cx: &mut std::task::Context<'_>,
840 ) -> std::task::Poll<Option<Self::Item>> {
841 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
842 &mut self.event_receiver,
843 cx
844 )?) {
845 Some(buf) => std::task::Poll::Ready(Some(LifecycleEvent::decode(buf))),
846 None => std::task::Poll::Ready(None),
847 }
848 }
849}
850
851#[derive(Debug)]
852pub enum LifecycleEvent {
853 #[non_exhaustive]
854 _UnknownEvent {
855 ordinal: u64,
857 },
858}
859
860impl LifecycleEvent {
861 fn decode(
863 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
864 ) -> Result<LifecycleEvent, fidl::Error> {
865 let (bytes, _handles) = buf.split_mut();
866 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
867 debug_assert_eq!(tx_header.tx_id, 0);
868 match tx_header.ordinal {
869 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
870 Ok(LifecycleEvent::_UnknownEvent { ordinal: tx_header.ordinal })
871 }
872 _ => Err(fidl::Error::UnknownOrdinal {
873 ordinal: tx_header.ordinal,
874 protocol_name: <LifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
875 }),
876 }
877 }
878}
879
880pub struct LifecycleRequestStream {
882 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
883 is_terminated: bool,
884}
885
886impl std::marker::Unpin for LifecycleRequestStream {}
887
888impl futures::stream::FusedStream for LifecycleRequestStream {
889 fn is_terminated(&self) -> bool {
890 self.is_terminated
891 }
892}
893
894impl fidl::endpoints::RequestStream for LifecycleRequestStream {
895 type Protocol = LifecycleMarker;
896 type ControlHandle = LifecycleControlHandle;
897
898 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
899 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
900 }
901
902 fn control_handle(&self) -> Self::ControlHandle {
903 LifecycleControlHandle { inner: self.inner.clone() }
904 }
905
906 fn into_inner(
907 self,
908 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
909 {
910 (self.inner, self.is_terminated)
911 }
912
913 fn from_inner(
914 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
915 is_terminated: bool,
916 ) -> Self {
917 Self { inner, is_terminated }
918 }
919}
920
921impl futures::Stream for LifecycleRequestStream {
922 type Item = Result<LifecycleRequest, fidl::Error>;
923
924 fn poll_next(
925 mut self: std::pin::Pin<&mut Self>,
926 cx: &mut std::task::Context<'_>,
927 ) -> std::task::Poll<Option<Self::Item>> {
928 let this = &mut *self;
929 if this.inner.check_shutdown(cx) {
930 this.is_terminated = true;
931 return std::task::Poll::Ready(None);
932 }
933 if this.is_terminated {
934 panic!("polled LifecycleRequestStream after completion");
935 }
936 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
937 |bytes, handles| {
938 match this.inner.channel().read_etc(cx, bytes, handles) {
939 std::task::Poll::Ready(Ok(())) => {}
940 std::task::Poll::Pending => return std::task::Poll::Pending,
941 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
942 this.is_terminated = true;
943 return std::task::Poll::Ready(None);
944 }
945 std::task::Poll::Ready(Err(e)) => {
946 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
947 e.into(),
948 ))))
949 }
950 }
951
952 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
954
955 std::task::Poll::Ready(Some(match header.ordinal {
956 0x2fda381d2cc41ce0 => {
957 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
958 let mut req = fidl::new_empty!(
959 LifecycleStartRequest,
960 fidl::encoding::DefaultFuchsiaResourceDialect
961 );
962 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LifecycleStartRequest>(&header, _body_bytes, handles, &mut req)?;
963 let control_handle = LifecycleControlHandle { inner: this.inner.clone() };
964 Ok(LifecycleRequest::Start {
965 payload: req,
966 responder: LifecycleStartResponder {
967 control_handle: std::mem::ManuallyDrop::new(control_handle),
968 tx_id: header.tx_id,
969 },
970 })
971 }
972 0x453a9158431b4a2 => {
973 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
974 let mut req = fidl::new_empty!(
975 fidl::encoding::EmptyPayload,
976 fidl::encoding::DefaultFuchsiaResourceDialect
977 );
978 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
979 let control_handle = LifecycleControlHandle { inner: this.inner.clone() };
980 Ok(LifecycleRequest::Stop {
981 responder: LifecycleStopResponder {
982 control_handle: std::mem::ManuallyDrop::new(control_handle),
983 tx_id: header.tx_id,
984 },
985 })
986 }
987 0x31faeac257bf1abb => {
988 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
989 let mut req = fidl::new_empty!(
990 fidl::encoding::EmptyPayload,
991 fidl::encoding::DefaultFuchsiaResourceDialect
992 );
993 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
994 let control_handle = LifecycleControlHandle { inner: this.inner.clone() };
995 Ok(LifecycleRequest::Restart {
996 responder: LifecycleRestartResponder {
997 control_handle: std::mem::ManuallyDrop::new(control_handle),
998 tx_id: header.tx_id,
999 },
1000 })
1001 }
1002 _ if header.tx_id == 0
1003 && header
1004 .dynamic_flags()
1005 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1006 {
1007 Ok(LifecycleRequest::_UnknownMethod {
1008 ordinal: header.ordinal,
1009 control_handle: LifecycleControlHandle { inner: this.inner.clone() },
1010 method_type: fidl::MethodType::OneWay,
1011 })
1012 }
1013 _ if header
1014 .dynamic_flags()
1015 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1016 {
1017 this.inner.send_framework_err(
1018 fidl::encoding::FrameworkErr::UnknownMethod,
1019 header.tx_id,
1020 header.ordinal,
1021 header.dynamic_flags(),
1022 (bytes, handles),
1023 )?;
1024 Ok(LifecycleRequest::_UnknownMethod {
1025 ordinal: header.ordinal,
1026 control_handle: LifecycleControlHandle { inner: this.inner.clone() },
1027 method_type: fidl::MethodType::TwoWay,
1028 })
1029 }
1030 _ => Err(fidl::Error::UnknownOrdinal {
1031 ordinal: header.ordinal,
1032 protocol_name:
1033 <LifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1034 }),
1035 }))
1036 },
1037 )
1038 }
1039}
1040
1041#[derive(Debug)]
1043pub enum LifecycleRequest {
1044 Start { payload: LifecycleStartRequest, responder: LifecycleStartResponder },
1058 Stop { responder: LifecycleStopResponder },
1067 Restart { responder: LifecycleRestartResponder },
1083 #[non_exhaustive]
1085 _UnknownMethod {
1086 ordinal: u64,
1088 control_handle: LifecycleControlHandle,
1089 method_type: fidl::MethodType,
1090 },
1091}
1092
1093impl LifecycleRequest {
1094 #[allow(irrefutable_let_patterns)]
1095 pub fn into_start(self) -> Option<(LifecycleStartRequest, LifecycleStartResponder)> {
1096 if let LifecycleRequest::Start { payload, responder } = self {
1097 Some((payload, responder))
1098 } else {
1099 None
1100 }
1101 }
1102
1103 #[allow(irrefutable_let_patterns)]
1104 pub fn into_stop(self) -> Option<(LifecycleStopResponder)> {
1105 if let LifecycleRequest::Stop { responder } = self {
1106 Some((responder))
1107 } else {
1108 None
1109 }
1110 }
1111
1112 #[allow(irrefutable_let_patterns)]
1113 pub fn into_restart(self) -> Option<(LifecycleRestartResponder)> {
1114 if let LifecycleRequest::Restart { responder } = self {
1115 Some((responder))
1116 } else {
1117 None
1118 }
1119 }
1120
1121 pub fn method_name(&self) -> &'static str {
1123 match *self {
1124 LifecycleRequest::Start { .. } => "start",
1125 LifecycleRequest::Stop { .. } => "stop",
1126 LifecycleRequest::Restart { .. } => "restart",
1127 LifecycleRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1128 "unknown one-way method"
1129 }
1130 LifecycleRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1131 "unknown two-way method"
1132 }
1133 }
1134 }
1135}
1136
1137#[derive(Debug, Clone)]
1138pub struct LifecycleControlHandle {
1139 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1140}
1141
1142impl fidl::endpoints::ControlHandle for LifecycleControlHandle {
1143 fn shutdown(&self) {
1144 self.inner.shutdown()
1145 }
1146 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1147 self.inner.shutdown_with_epitaph(status)
1148 }
1149
1150 fn is_closed(&self) -> bool {
1151 self.inner.channel().is_closed()
1152 }
1153 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1154 self.inner.channel().on_closed()
1155 }
1156
1157 #[cfg(target_os = "fuchsia")]
1158 fn signal_peer(
1159 &self,
1160 clear_mask: zx::Signals,
1161 set_mask: zx::Signals,
1162 ) -> Result<(), zx_status::Status> {
1163 use fidl::Peered;
1164 self.inner.channel().signal_peer(clear_mask, set_mask)
1165 }
1166}
1167
1168impl LifecycleControlHandle {}
1169
1170#[must_use = "FIDL methods require a response to be sent"]
1171#[derive(Debug)]
1172pub struct LifecycleStartResponder {
1173 control_handle: std::mem::ManuallyDrop<LifecycleControlHandle>,
1174 tx_id: u32,
1175}
1176
1177impl std::ops::Drop for LifecycleStartResponder {
1181 fn drop(&mut self) {
1182 self.control_handle.shutdown();
1183 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1185 }
1186}
1187
1188impl fidl::endpoints::Responder for LifecycleStartResponder {
1189 type ControlHandle = LifecycleControlHandle;
1190
1191 fn control_handle(&self) -> &LifecycleControlHandle {
1192 &self.control_handle
1193 }
1194
1195 fn drop_without_shutdown(mut self) {
1196 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1198 std::mem::forget(self);
1200 }
1201}
1202
1203impl LifecycleStartResponder {
1204 pub fn send(self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1208 let _result = self.send_raw(result);
1209 if _result.is_err() {
1210 self.control_handle.shutdown();
1211 }
1212 self.drop_without_shutdown();
1213 _result
1214 }
1215
1216 pub fn send_no_shutdown_on_err(
1218 self,
1219 mut result: Result<(), LifecycleError>,
1220 ) -> Result<(), fidl::Error> {
1221 let _result = self.send_raw(result);
1222 self.drop_without_shutdown();
1223 _result
1224 }
1225
1226 fn send_raw(&self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1227 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1228 fidl::encoding::EmptyStruct,
1229 LifecycleError,
1230 >>(
1231 fidl::encoding::FlexibleResult::new(result),
1232 self.tx_id,
1233 0x2fda381d2cc41ce0,
1234 fidl::encoding::DynamicFlags::FLEXIBLE,
1235 )
1236 }
1237}
1238
1239#[must_use = "FIDL methods require a response to be sent"]
1240#[derive(Debug)]
1241pub struct LifecycleStopResponder {
1242 control_handle: std::mem::ManuallyDrop<LifecycleControlHandle>,
1243 tx_id: u32,
1244}
1245
1246impl std::ops::Drop for LifecycleStopResponder {
1250 fn drop(&mut self) {
1251 self.control_handle.shutdown();
1252 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1254 }
1255}
1256
1257impl fidl::endpoints::Responder for LifecycleStopResponder {
1258 type ControlHandle = LifecycleControlHandle;
1259
1260 fn control_handle(&self) -> &LifecycleControlHandle {
1261 &self.control_handle
1262 }
1263
1264 fn drop_without_shutdown(mut self) {
1265 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1267 std::mem::forget(self);
1269 }
1270}
1271
1272impl LifecycleStopResponder {
1273 pub fn send(self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1277 let _result = self.send_raw(result);
1278 if _result.is_err() {
1279 self.control_handle.shutdown();
1280 }
1281 self.drop_without_shutdown();
1282 _result
1283 }
1284
1285 pub fn send_no_shutdown_on_err(
1287 self,
1288 mut result: Result<(), LifecycleError>,
1289 ) -> Result<(), fidl::Error> {
1290 let _result = self.send_raw(result);
1291 self.drop_without_shutdown();
1292 _result
1293 }
1294
1295 fn send_raw(&self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1296 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1297 fidl::encoding::EmptyStruct,
1298 LifecycleError,
1299 >>(
1300 fidl::encoding::FlexibleResult::new(result),
1301 self.tx_id,
1302 0x453a9158431b4a2,
1303 fidl::encoding::DynamicFlags::FLEXIBLE,
1304 )
1305 }
1306}
1307
1308#[must_use = "FIDL methods require a response to be sent"]
1309#[derive(Debug)]
1310pub struct LifecycleRestartResponder {
1311 control_handle: std::mem::ManuallyDrop<LifecycleControlHandle>,
1312 tx_id: u32,
1313}
1314
1315impl std::ops::Drop for LifecycleRestartResponder {
1319 fn drop(&mut self) {
1320 self.control_handle.shutdown();
1321 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1323 }
1324}
1325
1326impl fidl::endpoints::Responder for LifecycleRestartResponder {
1327 type ControlHandle = LifecycleControlHandle;
1328
1329 fn control_handle(&self) -> &LifecycleControlHandle {
1330 &self.control_handle
1331 }
1332
1333 fn drop_without_shutdown(mut self) {
1334 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1336 std::mem::forget(self);
1338 }
1339}
1340
1341impl LifecycleRestartResponder {
1342 pub fn send(self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1346 let _result = self.send_raw(result);
1347 if _result.is_err() {
1348 self.control_handle.shutdown();
1349 }
1350 self.drop_without_shutdown();
1351 _result
1352 }
1353
1354 pub fn send_no_shutdown_on_err(
1356 self,
1357 mut result: Result<(), LifecycleError>,
1358 ) -> Result<(), fidl::Error> {
1359 let _result = self.send_raw(result);
1360 self.drop_without_shutdown();
1361 _result
1362 }
1363
1364 fn send_raw(&self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1365 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1366 fidl::encoding::EmptyStruct,
1367 LifecycleError,
1368 >>(
1369 fidl::encoding::FlexibleResult::new(result),
1370 self.tx_id,
1371 0x31faeac257bf1abb,
1372 fidl::encoding::DynamicFlags::FLEXIBLE,
1373 )
1374 }
1375}
1376
1377#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1378pub struct RestarterMarker;
1379
1380impl fidl::endpoints::ProtocolMarker for RestarterMarker {
1381 type Proxy = RestarterProxy;
1382 type RequestStream = RestarterRequestStream;
1383 #[cfg(target_os = "fuchsia")]
1384 type SynchronousProxy = RestarterSynchronousProxy;
1385
1386 const DEBUG_NAME: &'static str = "fuchsia.session.Restarter";
1387}
1388impl fidl::endpoints::DiscoverableProtocolMarker for RestarterMarker {}
1389pub type RestarterRestartResult = Result<(), RestartError>;
1390
1391pub trait RestarterProxyInterface: Send + Sync {
1392 type RestartResponseFut: std::future::Future<Output = Result<RestarterRestartResult, fidl::Error>>
1393 + Send;
1394 fn r#restart(&self) -> Self::RestartResponseFut;
1395}
1396#[derive(Debug)]
1397#[cfg(target_os = "fuchsia")]
1398pub struct RestarterSynchronousProxy {
1399 client: fidl::client::sync::Client,
1400}
1401
1402#[cfg(target_os = "fuchsia")]
1403impl fidl::endpoints::SynchronousProxy for RestarterSynchronousProxy {
1404 type Proxy = RestarterProxy;
1405 type Protocol = RestarterMarker;
1406
1407 fn from_channel(inner: fidl::Channel) -> Self {
1408 Self::new(inner)
1409 }
1410
1411 fn into_channel(self) -> fidl::Channel {
1412 self.client.into_channel()
1413 }
1414
1415 fn as_channel(&self) -> &fidl::Channel {
1416 self.client.as_channel()
1417 }
1418}
1419
1420#[cfg(target_os = "fuchsia")]
1421impl RestarterSynchronousProxy {
1422 pub fn new(channel: fidl::Channel) -> Self {
1423 let protocol_name = <RestarterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1424 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1425 }
1426
1427 pub fn into_channel(self) -> fidl::Channel {
1428 self.client.into_channel()
1429 }
1430
1431 pub fn wait_for_event(
1434 &self,
1435 deadline: zx::MonotonicInstant,
1436 ) -> Result<RestarterEvent, fidl::Error> {
1437 RestarterEvent::decode(self.client.wait_for_event(deadline)?)
1438 }
1439
1440 pub fn r#restart(
1449 &self,
1450 ___deadline: zx::MonotonicInstant,
1451 ) -> Result<RestarterRestartResult, fidl::Error> {
1452 let _response = self.client.send_query::<
1453 fidl::encoding::EmptyPayload,
1454 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RestartError>,
1455 >(
1456 (),
1457 0x50cd09e53189e5ae,
1458 fidl::encoding::DynamicFlags::empty(),
1459 ___deadline,
1460 )?;
1461 Ok(_response.map(|x| x))
1462 }
1463}
1464
1465#[derive(Debug, Clone)]
1466pub struct RestarterProxy {
1467 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1468}
1469
1470impl fidl::endpoints::Proxy for RestarterProxy {
1471 type Protocol = RestarterMarker;
1472
1473 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1474 Self::new(inner)
1475 }
1476
1477 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1478 self.client.into_channel().map_err(|client| Self { client })
1479 }
1480
1481 fn as_channel(&self) -> &::fidl::AsyncChannel {
1482 self.client.as_channel()
1483 }
1484}
1485
1486impl RestarterProxy {
1487 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1489 let protocol_name = <RestarterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1490 Self { client: fidl::client::Client::new(channel, protocol_name) }
1491 }
1492
1493 pub fn take_event_stream(&self) -> RestarterEventStream {
1499 RestarterEventStream { event_receiver: self.client.take_event_receiver() }
1500 }
1501
1502 pub fn r#restart(
1511 &self,
1512 ) -> fidl::client::QueryResponseFut<
1513 RestarterRestartResult,
1514 fidl::encoding::DefaultFuchsiaResourceDialect,
1515 > {
1516 RestarterProxyInterface::r#restart(self)
1517 }
1518}
1519
1520impl RestarterProxyInterface for RestarterProxy {
1521 type RestartResponseFut = fidl::client::QueryResponseFut<
1522 RestarterRestartResult,
1523 fidl::encoding::DefaultFuchsiaResourceDialect,
1524 >;
1525 fn r#restart(&self) -> Self::RestartResponseFut {
1526 fn _decode(
1527 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1528 ) -> Result<RestarterRestartResult, fidl::Error> {
1529 let _response = fidl::client::decode_transaction_body::<
1530 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RestartError>,
1531 fidl::encoding::DefaultFuchsiaResourceDialect,
1532 0x50cd09e53189e5ae,
1533 >(_buf?)?;
1534 Ok(_response.map(|x| x))
1535 }
1536 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, RestarterRestartResult>(
1537 (),
1538 0x50cd09e53189e5ae,
1539 fidl::encoding::DynamicFlags::empty(),
1540 _decode,
1541 )
1542 }
1543}
1544
1545pub struct RestarterEventStream {
1546 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1547}
1548
1549impl std::marker::Unpin for RestarterEventStream {}
1550
1551impl futures::stream::FusedStream for RestarterEventStream {
1552 fn is_terminated(&self) -> bool {
1553 self.event_receiver.is_terminated()
1554 }
1555}
1556
1557impl futures::Stream for RestarterEventStream {
1558 type Item = Result<RestarterEvent, fidl::Error>;
1559
1560 fn poll_next(
1561 mut self: std::pin::Pin<&mut Self>,
1562 cx: &mut std::task::Context<'_>,
1563 ) -> std::task::Poll<Option<Self::Item>> {
1564 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1565 &mut self.event_receiver,
1566 cx
1567 )?) {
1568 Some(buf) => std::task::Poll::Ready(Some(RestarterEvent::decode(buf))),
1569 None => std::task::Poll::Ready(None),
1570 }
1571 }
1572}
1573
1574#[derive(Debug)]
1575pub enum RestarterEvent {}
1576
1577impl RestarterEvent {
1578 fn decode(
1580 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1581 ) -> Result<RestarterEvent, fidl::Error> {
1582 let (bytes, _handles) = buf.split_mut();
1583 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1584 debug_assert_eq!(tx_header.tx_id, 0);
1585 match tx_header.ordinal {
1586 _ => Err(fidl::Error::UnknownOrdinal {
1587 ordinal: tx_header.ordinal,
1588 protocol_name: <RestarterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1589 }),
1590 }
1591 }
1592}
1593
1594pub struct RestarterRequestStream {
1596 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1597 is_terminated: bool,
1598}
1599
1600impl std::marker::Unpin for RestarterRequestStream {}
1601
1602impl futures::stream::FusedStream for RestarterRequestStream {
1603 fn is_terminated(&self) -> bool {
1604 self.is_terminated
1605 }
1606}
1607
1608impl fidl::endpoints::RequestStream for RestarterRequestStream {
1609 type Protocol = RestarterMarker;
1610 type ControlHandle = RestarterControlHandle;
1611
1612 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1613 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1614 }
1615
1616 fn control_handle(&self) -> Self::ControlHandle {
1617 RestarterControlHandle { inner: self.inner.clone() }
1618 }
1619
1620 fn into_inner(
1621 self,
1622 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1623 {
1624 (self.inner, self.is_terminated)
1625 }
1626
1627 fn from_inner(
1628 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1629 is_terminated: bool,
1630 ) -> Self {
1631 Self { inner, is_terminated }
1632 }
1633}
1634
1635impl futures::Stream for RestarterRequestStream {
1636 type Item = Result<RestarterRequest, fidl::Error>;
1637
1638 fn poll_next(
1639 mut self: std::pin::Pin<&mut Self>,
1640 cx: &mut std::task::Context<'_>,
1641 ) -> std::task::Poll<Option<Self::Item>> {
1642 let this = &mut *self;
1643 if this.inner.check_shutdown(cx) {
1644 this.is_terminated = true;
1645 return std::task::Poll::Ready(None);
1646 }
1647 if this.is_terminated {
1648 panic!("polled RestarterRequestStream after completion");
1649 }
1650 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1651 |bytes, handles| {
1652 match this.inner.channel().read_etc(cx, bytes, handles) {
1653 std::task::Poll::Ready(Ok(())) => {}
1654 std::task::Poll::Pending => return std::task::Poll::Pending,
1655 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1656 this.is_terminated = true;
1657 return std::task::Poll::Ready(None);
1658 }
1659 std::task::Poll::Ready(Err(e)) => {
1660 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1661 e.into(),
1662 ))))
1663 }
1664 }
1665
1666 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1668
1669 std::task::Poll::Ready(Some(match header.ordinal {
1670 0x50cd09e53189e5ae => {
1671 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1672 let mut req = fidl::new_empty!(
1673 fidl::encoding::EmptyPayload,
1674 fidl::encoding::DefaultFuchsiaResourceDialect
1675 );
1676 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1677 let control_handle = RestarterControlHandle { inner: this.inner.clone() };
1678 Ok(RestarterRequest::Restart {
1679 responder: RestarterRestartResponder {
1680 control_handle: std::mem::ManuallyDrop::new(control_handle),
1681 tx_id: header.tx_id,
1682 },
1683 })
1684 }
1685 _ => Err(fidl::Error::UnknownOrdinal {
1686 ordinal: header.ordinal,
1687 protocol_name:
1688 <RestarterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1689 }),
1690 }))
1691 },
1692 )
1693 }
1694}
1695
1696#[derive(Debug)]
1698pub enum RestarterRequest {
1699 Restart { responder: RestarterRestartResponder },
1708}
1709
1710impl RestarterRequest {
1711 #[allow(irrefutable_let_patterns)]
1712 pub fn into_restart(self) -> Option<(RestarterRestartResponder)> {
1713 if let RestarterRequest::Restart { responder } = self {
1714 Some((responder))
1715 } else {
1716 None
1717 }
1718 }
1719
1720 pub fn method_name(&self) -> &'static str {
1722 match *self {
1723 RestarterRequest::Restart { .. } => "restart",
1724 }
1725 }
1726}
1727
1728#[derive(Debug, Clone)]
1729pub struct RestarterControlHandle {
1730 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1731}
1732
1733impl fidl::endpoints::ControlHandle for RestarterControlHandle {
1734 fn shutdown(&self) {
1735 self.inner.shutdown()
1736 }
1737 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1738 self.inner.shutdown_with_epitaph(status)
1739 }
1740
1741 fn is_closed(&self) -> bool {
1742 self.inner.channel().is_closed()
1743 }
1744 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1745 self.inner.channel().on_closed()
1746 }
1747
1748 #[cfg(target_os = "fuchsia")]
1749 fn signal_peer(
1750 &self,
1751 clear_mask: zx::Signals,
1752 set_mask: zx::Signals,
1753 ) -> Result<(), zx_status::Status> {
1754 use fidl::Peered;
1755 self.inner.channel().signal_peer(clear_mask, set_mask)
1756 }
1757}
1758
1759impl RestarterControlHandle {}
1760
1761#[must_use = "FIDL methods require a response to be sent"]
1762#[derive(Debug)]
1763pub struct RestarterRestartResponder {
1764 control_handle: std::mem::ManuallyDrop<RestarterControlHandle>,
1765 tx_id: u32,
1766}
1767
1768impl std::ops::Drop for RestarterRestartResponder {
1772 fn drop(&mut self) {
1773 self.control_handle.shutdown();
1774 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1776 }
1777}
1778
1779impl fidl::endpoints::Responder for RestarterRestartResponder {
1780 type ControlHandle = RestarterControlHandle;
1781
1782 fn control_handle(&self) -> &RestarterControlHandle {
1783 &self.control_handle
1784 }
1785
1786 fn drop_without_shutdown(mut self) {
1787 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1789 std::mem::forget(self);
1791 }
1792}
1793
1794impl RestarterRestartResponder {
1795 pub fn send(self, mut result: Result<(), RestartError>) -> Result<(), fidl::Error> {
1799 let _result = self.send_raw(result);
1800 if _result.is_err() {
1801 self.control_handle.shutdown();
1802 }
1803 self.drop_without_shutdown();
1804 _result
1805 }
1806
1807 pub fn send_no_shutdown_on_err(
1809 self,
1810 mut result: Result<(), RestartError>,
1811 ) -> Result<(), fidl::Error> {
1812 let _result = self.send_raw(result);
1813 self.drop_without_shutdown();
1814 _result
1815 }
1816
1817 fn send_raw(&self, mut result: Result<(), RestartError>) -> Result<(), fidl::Error> {
1818 self.control_handle.inner.send::<fidl::encoding::ResultType<
1819 fidl::encoding::EmptyStruct,
1820 RestartError,
1821 >>(
1822 result,
1823 self.tx_id,
1824 0x50cd09e53189e5ae,
1825 fidl::encoding::DynamicFlags::empty(),
1826 )
1827 }
1828}
1829
1830mod internal {
1831 use super::*;
1832}