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#[cfg(target_os = "fuchsia")]
109impl From<LauncherSynchronousProxy> for zx::NullableHandle {
110 fn from(value: LauncherSynchronousProxy) -> Self {
111 value.into_channel().into()
112 }
113}
114
115#[cfg(target_os = "fuchsia")]
116impl From<fidl::Channel> for LauncherSynchronousProxy {
117 fn from(value: fidl::Channel) -> Self {
118 Self::new(value)
119 }
120}
121
122#[cfg(target_os = "fuchsia")]
123impl fidl::endpoints::FromClient for LauncherSynchronousProxy {
124 type Protocol = LauncherMarker;
125
126 fn from_client(value: fidl::endpoints::ClientEnd<LauncherMarker>) -> Self {
127 Self::new(value.into_channel())
128 }
129}
130
131#[derive(Debug, Clone)]
132pub struct LauncherProxy {
133 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
134}
135
136impl fidl::endpoints::Proxy for LauncherProxy {
137 type Protocol = LauncherMarker;
138
139 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
140 Self::new(inner)
141 }
142
143 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
144 self.client.into_channel().map_err(|client| Self { client })
145 }
146
147 fn as_channel(&self) -> &::fidl::AsyncChannel {
148 self.client.as_channel()
149 }
150}
151
152impl LauncherProxy {
153 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
155 let protocol_name = <LauncherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
156 Self { client: fidl::client::Client::new(channel, protocol_name) }
157 }
158
159 pub fn take_event_stream(&self) -> LauncherEventStream {
165 LauncherEventStream { event_receiver: self.client.take_event_receiver() }
166 }
167
168 pub fn r#launch(
182 &self,
183 mut configuration: &LaunchConfiguration,
184 ) -> fidl::client::QueryResponseFut<
185 LauncherLaunchResult,
186 fidl::encoding::DefaultFuchsiaResourceDialect,
187 > {
188 LauncherProxyInterface::r#launch(self, configuration)
189 }
190}
191
192impl LauncherProxyInterface for LauncherProxy {
193 type LaunchResponseFut = fidl::client::QueryResponseFut<
194 LauncherLaunchResult,
195 fidl::encoding::DefaultFuchsiaResourceDialect,
196 >;
197 fn r#launch(&self, mut configuration: &LaunchConfiguration) -> Self::LaunchResponseFut {
198 fn _decode(
199 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
200 ) -> Result<LauncherLaunchResult, fidl::Error> {
201 let _response = fidl::client::decode_transaction_body::<
202 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, LaunchError>,
203 fidl::encoding::DefaultFuchsiaResourceDialect,
204 0x7674a4287f8a385a,
205 >(_buf?)?;
206 Ok(_response.map(|x| x))
207 }
208 self.client.send_query_and_decode::<LauncherLaunchRequest, LauncherLaunchResult>(
209 (configuration,),
210 0x7674a4287f8a385a,
211 fidl::encoding::DynamicFlags::empty(),
212 _decode,
213 )
214 }
215}
216
217pub struct LauncherEventStream {
218 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
219}
220
221impl std::marker::Unpin for LauncherEventStream {}
222
223impl futures::stream::FusedStream for LauncherEventStream {
224 fn is_terminated(&self) -> bool {
225 self.event_receiver.is_terminated()
226 }
227}
228
229impl futures::Stream for LauncherEventStream {
230 type Item = Result<LauncherEvent, fidl::Error>;
231
232 fn poll_next(
233 mut self: std::pin::Pin<&mut Self>,
234 cx: &mut std::task::Context<'_>,
235 ) -> std::task::Poll<Option<Self::Item>> {
236 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
237 &mut self.event_receiver,
238 cx
239 )?) {
240 Some(buf) => std::task::Poll::Ready(Some(LauncherEvent::decode(buf))),
241 None => std::task::Poll::Ready(None),
242 }
243 }
244}
245
246#[derive(Debug)]
247pub enum LauncherEvent {}
248
249impl LauncherEvent {
250 fn decode(
252 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
253 ) -> Result<LauncherEvent, fidl::Error> {
254 let (bytes, _handles) = buf.split_mut();
255 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
256 debug_assert_eq!(tx_header.tx_id, 0);
257 match tx_header.ordinal {
258 _ => Err(fidl::Error::UnknownOrdinal {
259 ordinal: tx_header.ordinal,
260 protocol_name: <LauncherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
261 }),
262 }
263 }
264}
265
266pub struct LauncherRequestStream {
268 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
269 is_terminated: bool,
270}
271
272impl std::marker::Unpin for LauncherRequestStream {}
273
274impl futures::stream::FusedStream for LauncherRequestStream {
275 fn is_terminated(&self) -> bool {
276 self.is_terminated
277 }
278}
279
280impl fidl::endpoints::RequestStream for LauncherRequestStream {
281 type Protocol = LauncherMarker;
282 type ControlHandle = LauncherControlHandle;
283
284 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
285 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
286 }
287
288 fn control_handle(&self) -> Self::ControlHandle {
289 LauncherControlHandle { inner: self.inner.clone() }
290 }
291
292 fn into_inner(
293 self,
294 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
295 {
296 (self.inner, self.is_terminated)
297 }
298
299 fn from_inner(
300 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
301 is_terminated: bool,
302 ) -> Self {
303 Self { inner, is_terminated }
304 }
305}
306
307impl futures::Stream for LauncherRequestStream {
308 type Item = Result<LauncherRequest, fidl::Error>;
309
310 fn poll_next(
311 mut self: std::pin::Pin<&mut Self>,
312 cx: &mut std::task::Context<'_>,
313 ) -> std::task::Poll<Option<Self::Item>> {
314 let this = &mut *self;
315 if this.inner.check_shutdown(cx) {
316 this.is_terminated = true;
317 return std::task::Poll::Ready(None);
318 }
319 if this.is_terminated {
320 panic!("polled LauncherRequestStream after completion");
321 }
322 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
323 |bytes, handles| {
324 match this.inner.channel().read_etc(cx, bytes, handles) {
325 std::task::Poll::Ready(Ok(())) => {}
326 std::task::Poll::Pending => return std::task::Poll::Pending,
327 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
328 this.is_terminated = true;
329 return std::task::Poll::Ready(None);
330 }
331 std::task::Poll::Ready(Err(e)) => {
332 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
333 e.into(),
334 ))));
335 }
336 }
337
338 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
340
341 std::task::Poll::Ready(Some(match header.ordinal {
342 0x7674a4287f8a385a => {
343 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
344 let mut req = fidl::new_empty!(
345 LauncherLaunchRequest,
346 fidl::encoding::DefaultFuchsiaResourceDialect
347 );
348 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LauncherLaunchRequest>(&header, _body_bytes, handles, &mut req)?;
349 let control_handle = LauncherControlHandle { inner: this.inner.clone() };
350 Ok(LauncherRequest::Launch {
351 configuration: req.configuration,
352
353 responder: LauncherLaunchResponder {
354 control_handle: std::mem::ManuallyDrop::new(control_handle),
355 tx_id: header.tx_id,
356 },
357 })
358 }
359 _ => Err(fidl::Error::UnknownOrdinal {
360 ordinal: header.ordinal,
361 protocol_name:
362 <LauncherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
363 }),
364 }))
365 },
366 )
367 }
368}
369
370#[derive(Debug)]
372pub enum LauncherRequest {
373 Launch { configuration: LaunchConfiguration, responder: LauncherLaunchResponder },
387}
388
389impl LauncherRequest {
390 #[allow(irrefutable_let_patterns)]
391 pub fn into_launch(self) -> Option<(LaunchConfiguration, LauncherLaunchResponder)> {
392 if let LauncherRequest::Launch { configuration, responder } = self {
393 Some((configuration, responder))
394 } else {
395 None
396 }
397 }
398
399 pub fn method_name(&self) -> &'static str {
401 match *self {
402 LauncherRequest::Launch { .. } => "launch",
403 }
404 }
405}
406
407#[derive(Debug, Clone)]
408pub struct LauncherControlHandle {
409 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
410}
411
412impl fidl::endpoints::ControlHandle for LauncherControlHandle {
413 fn shutdown(&self) {
414 self.inner.shutdown()
415 }
416
417 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
418 self.inner.shutdown_with_epitaph(status)
419 }
420
421 fn is_closed(&self) -> bool {
422 self.inner.channel().is_closed()
423 }
424 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
425 self.inner.channel().on_closed()
426 }
427
428 #[cfg(target_os = "fuchsia")]
429 fn signal_peer(
430 &self,
431 clear_mask: zx::Signals,
432 set_mask: zx::Signals,
433 ) -> Result<(), zx_status::Status> {
434 use fidl::Peered;
435 self.inner.channel().signal_peer(clear_mask, set_mask)
436 }
437}
438
439impl LauncherControlHandle {}
440
441#[must_use = "FIDL methods require a response to be sent"]
442#[derive(Debug)]
443pub struct LauncherLaunchResponder {
444 control_handle: std::mem::ManuallyDrop<LauncherControlHandle>,
445 tx_id: u32,
446}
447
448impl std::ops::Drop for LauncherLaunchResponder {
452 fn drop(&mut self) {
453 self.control_handle.shutdown();
454 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
456 }
457}
458
459impl fidl::endpoints::Responder for LauncherLaunchResponder {
460 type ControlHandle = LauncherControlHandle;
461
462 fn control_handle(&self) -> &LauncherControlHandle {
463 &self.control_handle
464 }
465
466 fn drop_without_shutdown(mut self) {
467 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
469 std::mem::forget(self);
471 }
472}
473
474impl LauncherLaunchResponder {
475 pub fn send(self, mut result: Result<(), LaunchError>) -> Result<(), fidl::Error> {
479 let _result = self.send_raw(result);
480 if _result.is_err() {
481 self.control_handle.shutdown();
482 }
483 self.drop_without_shutdown();
484 _result
485 }
486
487 pub fn send_no_shutdown_on_err(
489 self,
490 mut result: Result<(), LaunchError>,
491 ) -> Result<(), fidl::Error> {
492 let _result = self.send_raw(result);
493 self.drop_without_shutdown();
494 _result
495 }
496
497 fn send_raw(&self, mut result: Result<(), LaunchError>) -> Result<(), fidl::Error> {
498 self.control_handle.inner.send::<fidl::encoding::ResultType<
499 fidl::encoding::EmptyStruct,
500 LaunchError,
501 >>(
502 result,
503 self.tx_id,
504 0x7674a4287f8a385a,
505 fidl::encoding::DynamicFlags::empty(),
506 )
507 }
508}
509
510#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
511pub struct LifecycleMarker;
512
513impl fidl::endpoints::ProtocolMarker for LifecycleMarker {
514 type Proxy = LifecycleProxy;
515 type RequestStream = LifecycleRequestStream;
516 #[cfg(target_os = "fuchsia")]
517 type SynchronousProxy = LifecycleSynchronousProxy;
518
519 const DEBUG_NAME: &'static str = "fuchsia.session.Lifecycle";
520}
521impl fidl::endpoints::DiscoverableProtocolMarker for LifecycleMarker {}
522pub type LifecycleStartResult = Result<(), LifecycleError>;
523pub type LifecycleStopResult = Result<(), LifecycleError>;
524pub type LifecycleRestartResult = Result<(), LifecycleError>;
525
526pub trait LifecycleProxyInterface: Send + Sync {
527 type StartResponseFut: std::future::Future<Output = Result<LifecycleStartResult, fidl::Error>>
528 + Send;
529 fn r#start(&self, payload: &LifecycleStartRequest) -> Self::StartResponseFut;
530 type StopResponseFut: std::future::Future<Output = Result<LifecycleStopResult, fidl::Error>>
531 + Send;
532 fn r#stop(&self) -> Self::StopResponseFut;
533 type RestartResponseFut: std::future::Future<Output = Result<LifecycleRestartResult, fidl::Error>>
534 + Send;
535 fn r#restart(&self) -> Self::RestartResponseFut;
536}
537#[derive(Debug)]
538#[cfg(target_os = "fuchsia")]
539pub struct LifecycleSynchronousProxy {
540 client: fidl::client::sync::Client,
541}
542
543#[cfg(target_os = "fuchsia")]
544impl fidl::endpoints::SynchronousProxy for LifecycleSynchronousProxy {
545 type Proxy = LifecycleProxy;
546 type Protocol = LifecycleMarker;
547
548 fn from_channel(inner: fidl::Channel) -> Self {
549 Self::new(inner)
550 }
551
552 fn into_channel(self) -> fidl::Channel {
553 self.client.into_channel()
554 }
555
556 fn as_channel(&self) -> &fidl::Channel {
557 self.client.as_channel()
558 }
559}
560
561#[cfg(target_os = "fuchsia")]
562impl LifecycleSynchronousProxy {
563 pub fn new(channel: fidl::Channel) -> Self {
564 let protocol_name = <LifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
565 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
566 }
567
568 pub fn into_channel(self) -> fidl::Channel {
569 self.client.into_channel()
570 }
571
572 pub fn wait_for_event(
575 &self,
576 deadline: zx::MonotonicInstant,
577 ) -> Result<LifecycleEvent, fidl::Error> {
578 LifecycleEvent::decode(self.client.wait_for_event(deadline)?)
579 }
580
581 pub fn r#start(
595 &self,
596 mut payload: &LifecycleStartRequest,
597 ___deadline: zx::MonotonicInstant,
598 ) -> Result<LifecycleStartResult, fidl::Error> {
599 let _response = self.client.send_query::<
600 LifecycleStartRequest,
601 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, LifecycleError>,
602 >(
603 payload,
604 0x2fda381d2cc41ce0,
605 fidl::encoding::DynamicFlags::FLEXIBLE,
606 ___deadline,
607 )?
608 .into_result::<LifecycleMarker>("start")?;
609 Ok(_response.map(|x| x))
610 }
611
612 pub fn r#stop(
621 &self,
622 ___deadline: zx::MonotonicInstant,
623 ) -> Result<LifecycleStopResult, fidl::Error> {
624 let _response = self.client.send_query::<
625 fidl::encoding::EmptyPayload,
626 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, LifecycleError>,
627 >(
628 (),
629 0x453a9158431b4a2,
630 fidl::encoding::DynamicFlags::FLEXIBLE,
631 ___deadline,
632 )?
633 .into_result::<LifecycleMarker>("stop")?;
634 Ok(_response.map(|x| x))
635 }
636
637 pub fn r#restart(
653 &self,
654 ___deadline: zx::MonotonicInstant,
655 ) -> Result<LifecycleRestartResult, fidl::Error> {
656 let _response = self.client.send_query::<
657 fidl::encoding::EmptyPayload,
658 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, LifecycleError>,
659 >(
660 (),
661 0x31faeac257bf1abb,
662 fidl::encoding::DynamicFlags::FLEXIBLE,
663 ___deadline,
664 )?
665 .into_result::<LifecycleMarker>("restart")?;
666 Ok(_response.map(|x| x))
667 }
668}
669
670#[cfg(target_os = "fuchsia")]
671impl From<LifecycleSynchronousProxy> for zx::NullableHandle {
672 fn from(value: LifecycleSynchronousProxy) -> Self {
673 value.into_channel().into()
674 }
675}
676
677#[cfg(target_os = "fuchsia")]
678impl From<fidl::Channel> for LifecycleSynchronousProxy {
679 fn from(value: fidl::Channel) -> Self {
680 Self::new(value)
681 }
682}
683
684#[cfg(target_os = "fuchsia")]
685impl fidl::endpoints::FromClient for LifecycleSynchronousProxy {
686 type Protocol = LifecycleMarker;
687
688 fn from_client(value: fidl::endpoints::ClientEnd<LifecycleMarker>) -> Self {
689 Self::new(value.into_channel())
690 }
691}
692
693#[derive(Debug, Clone)]
694pub struct LifecycleProxy {
695 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
696}
697
698impl fidl::endpoints::Proxy for LifecycleProxy {
699 type Protocol = LifecycleMarker;
700
701 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
702 Self::new(inner)
703 }
704
705 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
706 self.client.into_channel().map_err(|client| Self { client })
707 }
708
709 fn as_channel(&self) -> &::fidl::AsyncChannel {
710 self.client.as_channel()
711 }
712}
713
714impl LifecycleProxy {
715 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
717 let protocol_name = <LifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
718 Self { client: fidl::client::Client::new(channel, protocol_name) }
719 }
720
721 pub fn take_event_stream(&self) -> LifecycleEventStream {
727 LifecycleEventStream { event_receiver: self.client.take_event_receiver() }
728 }
729
730 pub fn r#start(
744 &self,
745 mut payload: &LifecycleStartRequest,
746 ) -> fidl::client::QueryResponseFut<
747 LifecycleStartResult,
748 fidl::encoding::DefaultFuchsiaResourceDialect,
749 > {
750 LifecycleProxyInterface::r#start(self, payload)
751 }
752
753 pub fn r#stop(
762 &self,
763 ) -> fidl::client::QueryResponseFut<
764 LifecycleStopResult,
765 fidl::encoding::DefaultFuchsiaResourceDialect,
766 > {
767 LifecycleProxyInterface::r#stop(self)
768 }
769
770 pub fn r#restart(
786 &self,
787 ) -> fidl::client::QueryResponseFut<
788 LifecycleRestartResult,
789 fidl::encoding::DefaultFuchsiaResourceDialect,
790 > {
791 LifecycleProxyInterface::r#restart(self)
792 }
793}
794
795impl LifecycleProxyInterface for LifecycleProxy {
796 type StartResponseFut = fidl::client::QueryResponseFut<
797 LifecycleStartResult,
798 fidl::encoding::DefaultFuchsiaResourceDialect,
799 >;
800 fn r#start(&self, mut payload: &LifecycleStartRequest) -> Self::StartResponseFut {
801 fn _decode(
802 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
803 ) -> Result<LifecycleStartResult, fidl::Error> {
804 let _response = fidl::client::decode_transaction_body::<
805 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, LifecycleError>,
806 fidl::encoding::DefaultFuchsiaResourceDialect,
807 0x2fda381d2cc41ce0,
808 >(_buf?)?
809 .into_result::<LifecycleMarker>("start")?;
810 Ok(_response.map(|x| x))
811 }
812 self.client.send_query_and_decode::<LifecycleStartRequest, LifecycleStartResult>(
813 payload,
814 0x2fda381d2cc41ce0,
815 fidl::encoding::DynamicFlags::FLEXIBLE,
816 _decode,
817 )
818 }
819
820 type StopResponseFut = fidl::client::QueryResponseFut<
821 LifecycleStopResult,
822 fidl::encoding::DefaultFuchsiaResourceDialect,
823 >;
824 fn r#stop(&self) -> Self::StopResponseFut {
825 fn _decode(
826 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
827 ) -> Result<LifecycleStopResult, fidl::Error> {
828 let _response = fidl::client::decode_transaction_body::<
829 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, LifecycleError>,
830 fidl::encoding::DefaultFuchsiaResourceDialect,
831 0x453a9158431b4a2,
832 >(_buf?)?
833 .into_result::<LifecycleMarker>("stop")?;
834 Ok(_response.map(|x| x))
835 }
836 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, LifecycleStopResult>(
837 (),
838 0x453a9158431b4a2,
839 fidl::encoding::DynamicFlags::FLEXIBLE,
840 _decode,
841 )
842 }
843
844 type RestartResponseFut = fidl::client::QueryResponseFut<
845 LifecycleRestartResult,
846 fidl::encoding::DefaultFuchsiaResourceDialect,
847 >;
848 fn r#restart(&self) -> Self::RestartResponseFut {
849 fn _decode(
850 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
851 ) -> Result<LifecycleRestartResult, fidl::Error> {
852 let _response = fidl::client::decode_transaction_body::<
853 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, LifecycleError>,
854 fidl::encoding::DefaultFuchsiaResourceDialect,
855 0x31faeac257bf1abb,
856 >(_buf?)?
857 .into_result::<LifecycleMarker>("restart")?;
858 Ok(_response.map(|x| x))
859 }
860 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, LifecycleRestartResult>(
861 (),
862 0x31faeac257bf1abb,
863 fidl::encoding::DynamicFlags::FLEXIBLE,
864 _decode,
865 )
866 }
867}
868
869pub struct LifecycleEventStream {
870 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
871}
872
873impl std::marker::Unpin for LifecycleEventStream {}
874
875impl futures::stream::FusedStream for LifecycleEventStream {
876 fn is_terminated(&self) -> bool {
877 self.event_receiver.is_terminated()
878 }
879}
880
881impl futures::Stream for LifecycleEventStream {
882 type Item = Result<LifecycleEvent, fidl::Error>;
883
884 fn poll_next(
885 mut self: std::pin::Pin<&mut Self>,
886 cx: &mut std::task::Context<'_>,
887 ) -> std::task::Poll<Option<Self::Item>> {
888 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
889 &mut self.event_receiver,
890 cx
891 )?) {
892 Some(buf) => std::task::Poll::Ready(Some(LifecycleEvent::decode(buf))),
893 None => std::task::Poll::Ready(None),
894 }
895 }
896}
897
898#[derive(Debug)]
899pub enum LifecycleEvent {
900 #[non_exhaustive]
901 _UnknownEvent {
902 ordinal: u64,
904 },
905}
906
907impl LifecycleEvent {
908 fn decode(
910 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
911 ) -> Result<LifecycleEvent, fidl::Error> {
912 let (bytes, _handles) = buf.split_mut();
913 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
914 debug_assert_eq!(tx_header.tx_id, 0);
915 match tx_header.ordinal {
916 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
917 Ok(LifecycleEvent::_UnknownEvent { ordinal: tx_header.ordinal })
918 }
919 _ => Err(fidl::Error::UnknownOrdinal {
920 ordinal: tx_header.ordinal,
921 protocol_name: <LifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
922 }),
923 }
924 }
925}
926
927pub struct LifecycleRequestStream {
929 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
930 is_terminated: bool,
931}
932
933impl std::marker::Unpin for LifecycleRequestStream {}
934
935impl futures::stream::FusedStream for LifecycleRequestStream {
936 fn is_terminated(&self) -> bool {
937 self.is_terminated
938 }
939}
940
941impl fidl::endpoints::RequestStream for LifecycleRequestStream {
942 type Protocol = LifecycleMarker;
943 type ControlHandle = LifecycleControlHandle;
944
945 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
946 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
947 }
948
949 fn control_handle(&self) -> Self::ControlHandle {
950 LifecycleControlHandle { inner: self.inner.clone() }
951 }
952
953 fn into_inner(
954 self,
955 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
956 {
957 (self.inner, self.is_terminated)
958 }
959
960 fn from_inner(
961 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
962 is_terminated: bool,
963 ) -> Self {
964 Self { inner, is_terminated }
965 }
966}
967
968impl futures::Stream for LifecycleRequestStream {
969 type Item = Result<LifecycleRequest, fidl::Error>;
970
971 fn poll_next(
972 mut self: std::pin::Pin<&mut Self>,
973 cx: &mut std::task::Context<'_>,
974 ) -> std::task::Poll<Option<Self::Item>> {
975 let this = &mut *self;
976 if this.inner.check_shutdown(cx) {
977 this.is_terminated = true;
978 return std::task::Poll::Ready(None);
979 }
980 if this.is_terminated {
981 panic!("polled LifecycleRequestStream after completion");
982 }
983 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
984 |bytes, handles| {
985 match this.inner.channel().read_etc(cx, bytes, handles) {
986 std::task::Poll::Ready(Ok(())) => {}
987 std::task::Poll::Pending => return std::task::Poll::Pending,
988 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
989 this.is_terminated = true;
990 return std::task::Poll::Ready(None);
991 }
992 std::task::Poll::Ready(Err(e)) => {
993 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
994 e.into(),
995 ))));
996 }
997 }
998
999 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1001
1002 std::task::Poll::Ready(Some(match header.ordinal {
1003 0x2fda381d2cc41ce0 => {
1004 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1005 let mut req = fidl::new_empty!(
1006 LifecycleStartRequest,
1007 fidl::encoding::DefaultFuchsiaResourceDialect
1008 );
1009 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LifecycleStartRequest>(&header, _body_bytes, handles, &mut req)?;
1010 let control_handle = LifecycleControlHandle { inner: this.inner.clone() };
1011 Ok(LifecycleRequest::Start {
1012 payload: req,
1013 responder: LifecycleStartResponder {
1014 control_handle: std::mem::ManuallyDrop::new(control_handle),
1015 tx_id: header.tx_id,
1016 },
1017 })
1018 }
1019 0x453a9158431b4a2 => {
1020 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1021 let mut req = fidl::new_empty!(
1022 fidl::encoding::EmptyPayload,
1023 fidl::encoding::DefaultFuchsiaResourceDialect
1024 );
1025 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1026 let control_handle = LifecycleControlHandle { inner: this.inner.clone() };
1027 Ok(LifecycleRequest::Stop {
1028 responder: LifecycleStopResponder {
1029 control_handle: std::mem::ManuallyDrop::new(control_handle),
1030 tx_id: header.tx_id,
1031 },
1032 })
1033 }
1034 0x31faeac257bf1abb => {
1035 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1036 let mut req = fidl::new_empty!(
1037 fidl::encoding::EmptyPayload,
1038 fidl::encoding::DefaultFuchsiaResourceDialect
1039 );
1040 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1041 let control_handle = LifecycleControlHandle { inner: this.inner.clone() };
1042 Ok(LifecycleRequest::Restart {
1043 responder: LifecycleRestartResponder {
1044 control_handle: std::mem::ManuallyDrop::new(control_handle),
1045 tx_id: header.tx_id,
1046 },
1047 })
1048 }
1049 _ if header.tx_id == 0
1050 && header
1051 .dynamic_flags()
1052 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1053 {
1054 Ok(LifecycleRequest::_UnknownMethod {
1055 ordinal: header.ordinal,
1056 control_handle: LifecycleControlHandle { inner: this.inner.clone() },
1057 method_type: fidl::MethodType::OneWay,
1058 })
1059 }
1060 _ if header
1061 .dynamic_flags()
1062 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1063 {
1064 this.inner.send_framework_err(
1065 fidl::encoding::FrameworkErr::UnknownMethod,
1066 header.tx_id,
1067 header.ordinal,
1068 header.dynamic_flags(),
1069 (bytes, handles),
1070 )?;
1071 Ok(LifecycleRequest::_UnknownMethod {
1072 ordinal: header.ordinal,
1073 control_handle: LifecycleControlHandle { inner: this.inner.clone() },
1074 method_type: fidl::MethodType::TwoWay,
1075 })
1076 }
1077 _ => Err(fidl::Error::UnknownOrdinal {
1078 ordinal: header.ordinal,
1079 protocol_name:
1080 <LifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1081 }),
1082 }))
1083 },
1084 )
1085 }
1086}
1087
1088#[derive(Debug)]
1090pub enum LifecycleRequest {
1091 Start { payload: LifecycleStartRequest, responder: LifecycleStartResponder },
1105 Stop { responder: LifecycleStopResponder },
1114 Restart { responder: LifecycleRestartResponder },
1130 #[non_exhaustive]
1132 _UnknownMethod {
1133 ordinal: u64,
1135 control_handle: LifecycleControlHandle,
1136 method_type: fidl::MethodType,
1137 },
1138}
1139
1140impl LifecycleRequest {
1141 #[allow(irrefutable_let_patterns)]
1142 pub fn into_start(self) -> Option<(LifecycleStartRequest, LifecycleStartResponder)> {
1143 if let LifecycleRequest::Start { payload, responder } = self {
1144 Some((payload, responder))
1145 } else {
1146 None
1147 }
1148 }
1149
1150 #[allow(irrefutable_let_patterns)]
1151 pub fn into_stop(self) -> Option<(LifecycleStopResponder)> {
1152 if let LifecycleRequest::Stop { responder } = self { Some((responder)) } else { None }
1153 }
1154
1155 #[allow(irrefutable_let_patterns)]
1156 pub fn into_restart(self) -> Option<(LifecycleRestartResponder)> {
1157 if let LifecycleRequest::Restart { responder } = self { Some((responder)) } else { None }
1158 }
1159
1160 pub fn method_name(&self) -> &'static str {
1162 match *self {
1163 LifecycleRequest::Start { .. } => "start",
1164 LifecycleRequest::Stop { .. } => "stop",
1165 LifecycleRequest::Restart { .. } => "restart",
1166 LifecycleRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1167 "unknown one-way method"
1168 }
1169 LifecycleRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1170 "unknown two-way method"
1171 }
1172 }
1173 }
1174}
1175
1176#[derive(Debug, Clone)]
1177pub struct LifecycleControlHandle {
1178 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1179}
1180
1181impl fidl::endpoints::ControlHandle for LifecycleControlHandle {
1182 fn shutdown(&self) {
1183 self.inner.shutdown()
1184 }
1185
1186 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1187 self.inner.shutdown_with_epitaph(status)
1188 }
1189
1190 fn is_closed(&self) -> bool {
1191 self.inner.channel().is_closed()
1192 }
1193 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1194 self.inner.channel().on_closed()
1195 }
1196
1197 #[cfg(target_os = "fuchsia")]
1198 fn signal_peer(
1199 &self,
1200 clear_mask: zx::Signals,
1201 set_mask: zx::Signals,
1202 ) -> Result<(), zx_status::Status> {
1203 use fidl::Peered;
1204 self.inner.channel().signal_peer(clear_mask, set_mask)
1205 }
1206}
1207
1208impl LifecycleControlHandle {}
1209
1210#[must_use = "FIDL methods require a response to be sent"]
1211#[derive(Debug)]
1212pub struct LifecycleStartResponder {
1213 control_handle: std::mem::ManuallyDrop<LifecycleControlHandle>,
1214 tx_id: u32,
1215}
1216
1217impl std::ops::Drop for LifecycleStartResponder {
1221 fn drop(&mut self) {
1222 self.control_handle.shutdown();
1223 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1225 }
1226}
1227
1228impl fidl::endpoints::Responder for LifecycleStartResponder {
1229 type ControlHandle = LifecycleControlHandle;
1230
1231 fn control_handle(&self) -> &LifecycleControlHandle {
1232 &self.control_handle
1233 }
1234
1235 fn drop_without_shutdown(mut self) {
1236 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1238 std::mem::forget(self);
1240 }
1241}
1242
1243impl LifecycleStartResponder {
1244 pub fn send(self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1248 let _result = self.send_raw(result);
1249 if _result.is_err() {
1250 self.control_handle.shutdown();
1251 }
1252 self.drop_without_shutdown();
1253 _result
1254 }
1255
1256 pub fn send_no_shutdown_on_err(
1258 self,
1259 mut result: Result<(), LifecycleError>,
1260 ) -> Result<(), fidl::Error> {
1261 let _result = self.send_raw(result);
1262 self.drop_without_shutdown();
1263 _result
1264 }
1265
1266 fn send_raw(&self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1267 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1268 fidl::encoding::EmptyStruct,
1269 LifecycleError,
1270 >>(
1271 fidl::encoding::FlexibleResult::new(result),
1272 self.tx_id,
1273 0x2fda381d2cc41ce0,
1274 fidl::encoding::DynamicFlags::FLEXIBLE,
1275 )
1276 }
1277}
1278
1279#[must_use = "FIDL methods require a response to be sent"]
1280#[derive(Debug)]
1281pub struct LifecycleStopResponder {
1282 control_handle: std::mem::ManuallyDrop<LifecycleControlHandle>,
1283 tx_id: u32,
1284}
1285
1286impl std::ops::Drop for LifecycleStopResponder {
1290 fn drop(&mut self) {
1291 self.control_handle.shutdown();
1292 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1294 }
1295}
1296
1297impl fidl::endpoints::Responder for LifecycleStopResponder {
1298 type ControlHandle = LifecycleControlHandle;
1299
1300 fn control_handle(&self) -> &LifecycleControlHandle {
1301 &self.control_handle
1302 }
1303
1304 fn drop_without_shutdown(mut self) {
1305 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1307 std::mem::forget(self);
1309 }
1310}
1311
1312impl LifecycleStopResponder {
1313 pub fn send(self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1317 let _result = self.send_raw(result);
1318 if _result.is_err() {
1319 self.control_handle.shutdown();
1320 }
1321 self.drop_without_shutdown();
1322 _result
1323 }
1324
1325 pub fn send_no_shutdown_on_err(
1327 self,
1328 mut result: Result<(), LifecycleError>,
1329 ) -> Result<(), fidl::Error> {
1330 let _result = self.send_raw(result);
1331 self.drop_without_shutdown();
1332 _result
1333 }
1334
1335 fn send_raw(&self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1336 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1337 fidl::encoding::EmptyStruct,
1338 LifecycleError,
1339 >>(
1340 fidl::encoding::FlexibleResult::new(result),
1341 self.tx_id,
1342 0x453a9158431b4a2,
1343 fidl::encoding::DynamicFlags::FLEXIBLE,
1344 )
1345 }
1346}
1347
1348#[must_use = "FIDL methods require a response to be sent"]
1349#[derive(Debug)]
1350pub struct LifecycleRestartResponder {
1351 control_handle: std::mem::ManuallyDrop<LifecycleControlHandle>,
1352 tx_id: u32,
1353}
1354
1355impl std::ops::Drop for LifecycleRestartResponder {
1359 fn drop(&mut self) {
1360 self.control_handle.shutdown();
1361 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1363 }
1364}
1365
1366impl fidl::endpoints::Responder for LifecycleRestartResponder {
1367 type ControlHandle = LifecycleControlHandle;
1368
1369 fn control_handle(&self) -> &LifecycleControlHandle {
1370 &self.control_handle
1371 }
1372
1373 fn drop_without_shutdown(mut self) {
1374 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1376 std::mem::forget(self);
1378 }
1379}
1380
1381impl LifecycleRestartResponder {
1382 pub fn send(self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1386 let _result = self.send_raw(result);
1387 if _result.is_err() {
1388 self.control_handle.shutdown();
1389 }
1390 self.drop_without_shutdown();
1391 _result
1392 }
1393
1394 pub fn send_no_shutdown_on_err(
1396 self,
1397 mut result: Result<(), LifecycleError>,
1398 ) -> Result<(), fidl::Error> {
1399 let _result = self.send_raw(result);
1400 self.drop_without_shutdown();
1401 _result
1402 }
1403
1404 fn send_raw(&self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1405 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1406 fidl::encoding::EmptyStruct,
1407 LifecycleError,
1408 >>(
1409 fidl::encoding::FlexibleResult::new(result),
1410 self.tx_id,
1411 0x31faeac257bf1abb,
1412 fidl::encoding::DynamicFlags::FLEXIBLE,
1413 )
1414 }
1415}
1416
1417#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1418pub struct RestarterMarker;
1419
1420impl fidl::endpoints::ProtocolMarker for RestarterMarker {
1421 type Proxy = RestarterProxy;
1422 type RequestStream = RestarterRequestStream;
1423 #[cfg(target_os = "fuchsia")]
1424 type SynchronousProxy = RestarterSynchronousProxy;
1425
1426 const DEBUG_NAME: &'static str = "fuchsia.session.Restarter";
1427}
1428impl fidl::endpoints::DiscoverableProtocolMarker for RestarterMarker {}
1429pub type RestarterRestartResult = Result<(), RestartError>;
1430
1431pub trait RestarterProxyInterface: Send + Sync {
1432 type RestartResponseFut: std::future::Future<Output = Result<RestarterRestartResult, fidl::Error>>
1433 + Send;
1434 fn r#restart(&self) -> Self::RestartResponseFut;
1435}
1436#[derive(Debug)]
1437#[cfg(target_os = "fuchsia")]
1438pub struct RestarterSynchronousProxy {
1439 client: fidl::client::sync::Client,
1440}
1441
1442#[cfg(target_os = "fuchsia")]
1443impl fidl::endpoints::SynchronousProxy for RestarterSynchronousProxy {
1444 type Proxy = RestarterProxy;
1445 type Protocol = RestarterMarker;
1446
1447 fn from_channel(inner: fidl::Channel) -> Self {
1448 Self::new(inner)
1449 }
1450
1451 fn into_channel(self) -> fidl::Channel {
1452 self.client.into_channel()
1453 }
1454
1455 fn as_channel(&self) -> &fidl::Channel {
1456 self.client.as_channel()
1457 }
1458}
1459
1460#[cfg(target_os = "fuchsia")]
1461impl RestarterSynchronousProxy {
1462 pub fn new(channel: fidl::Channel) -> Self {
1463 let protocol_name = <RestarterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1464 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1465 }
1466
1467 pub fn into_channel(self) -> fidl::Channel {
1468 self.client.into_channel()
1469 }
1470
1471 pub fn wait_for_event(
1474 &self,
1475 deadline: zx::MonotonicInstant,
1476 ) -> Result<RestarterEvent, fidl::Error> {
1477 RestarterEvent::decode(self.client.wait_for_event(deadline)?)
1478 }
1479
1480 pub fn r#restart(
1489 &self,
1490 ___deadline: zx::MonotonicInstant,
1491 ) -> Result<RestarterRestartResult, fidl::Error> {
1492 let _response = self.client.send_query::<
1493 fidl::encoding::EmptyPayload,
1494 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RestartError>,
1495 >(
1496 (),
1497 0x50cd09e53189e5ae,
1498 fidl::encoding::DynamicFlags::empty(),
1499 ___deadline,
1500 )?;
1501 Ok(_response.map(|x| x))
1502 }
1503}
1504
1505#[cfg(target_os = "fuchsia")]
1506impl From<RestarterSynchronousProxy> for zx::NullableHandle {
1507 fn from(value: RestarterSynchronousProxy) -> Self {
1508 value.into_channel().into()
1509 }
1510}
1511
1512#[cfg(target_os = "fuchsia")]
1513impl From<fidl::Channel> for RestarterSynchronousProxy {
1514 fn from(value: fidl::Channel) -> Self {
1515 Self::new(value)
1516 }
1517}
1518
1519#[cfg(target_os = "fuchsia")]
1520impl fidl::endpoints::FromClient for RestarterSynchronousProxy {
1521 type Protocol = RestarterMarker;
1522
1523 fn from_client(value: fidl::endpoints::ClientEnd<RestarterMarker>) -> Self {
1524 Self::new(value.into_channel())
1525 }
1526}
1527
1528#[derive(Debug, Clone)]
1529pub struct RestarterProxy {
1530 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1531}
1532
1533impl fidl::endpoints::Proxy for RestarterProxy {
1534 type Protocol = RestarterMarker;
1535
1536 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1537 Self::new(inner)
1538 }
1539
1540 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1541 self.client.into_channel().map_err(|client| Self { client })
1542 }
1543
1544 fn as_channel(&self) -> &::fidl::AsyncChannel {
1545 self.client.as_channel()
1546 }
1547}
1548
1549impl RestarterProxy {
1550 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1552 let protocol_name = <RestarterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1553 Self { client: fidl::client::Client::new(channel, protocol_name) }
1554 }
1555
1556 pub fn take_event_stream(&self) -> RestarterEventStream {
1562 RestarterEventStream { event_receiver: self.client.take_event_receiver() }
1563 }
1564
1565 pub fn r#restart(
1574 &self,
1575 ) -> fidl::client::QueryResponseFut<
1576 RestarterRestartResult,
1577 fidl::encoding::DefaultFuchsiaResourceDialect,
1578 > {
1579 RestarterProxyInterface::r#restart(self)
1580 }
1581}
1582
1583impl RestarterProxyInterface for RestarterProxy {
1584 type RestartResponseFut = fidl::client::QueryResponseFut<
1585 RestarterRestartResult,
1586 fidl::encoding::DefaultFuchsiaResourceDialect,
1587 >;
1588 fn r#restart(&self) -> Self::RestartResponseFut {
1589 fn _decode(
1590 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1591 ) -> Result<RestarterRestartResult, fidl::Error> {
1592 let _response = fidl::client::decode_transaction_body::<
1593 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RestartError>,
1594 fidl::encoding::DefaultFuchsiaResourceDialect,
1595 0x50cd09e53189e5ae,
1596 >(_buf?)?;
1597 Ok(_response.map(|x| x))
1598 }
1599 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, RestarterRestartResult>(
1600 (),
1601 0x50cd09e53189e5ae,
1602 fidl::encoding::DynamicFlags::empty(),
1603 _decode,
1604 )
1605 }
1606}
1607
1608pub struct RestarterEventStream {
1609 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1610}
1611
1612impl std::marker::Unpin for RestarterEventStream {}
1613
1614impl futures::stream::FusedStream for RestarterEventStream {
1615 fn is_terminated(&self) -> bool {
1616 self.event_receiver.is_terminated()
1617 }
1618}
1619
1620impl futures::Stream for RestarterEventStream {
1621 type Item = Result<RestarterEvent, fidl::Error>;
1622
1623 fn poll_next(
1624 mut self: std::pin::Pin<&mut Self>,
1625 cx: &mut std::task::Context<'_>,
1626 ) -> std::task::Poll<Option<Self::Item>> {
1627 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1628 &mut self.event_receiver,
1629 cx
1630 )?) {
1631 Some(buf) => std::task::Poll::Ready(Some(RestarterEvent::decode(buf))),
1632 None => std::task::Poll::Ready(None),
1633 }
1634 }
1635}
1636
1637#[derive(Debug)]
1638pub enum RestarterEvent {}
1639
1640impl RestarterEvent {
1641 fn decode(
1643 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1644 ) -> Result<RestarterEvent, fidl::Error> {
1645 let (bytes, _handles) = buf.split_mut();
1646 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1647 debug_assert_eq!(tx_header.tx_id, 0);
1648 match tx_header.ordinal {
1649 _ => Err(fidl::Error::UnknownOrdinal {
1650 ordinal: tx_header.ordinal,
1651 protocol_name: <RestarterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1652 }),
1653 }
1654 }
1655}
1656
1657pub struct RestarterRequestStream {
1659 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1660 is_terminated: bool,
1661}
1662
1663impl std::marker::Unpin for RestarterRequestStream {}
1664
1665impl futures::stream::FusedStream for RestarterRequestStream {
1666 fn is_terminated(&self) -> bool {
1667 self.is_terminated
1668 }
1669}
1670
1671impl fidl::endpoints::RequestStream for RestarterRequestStream {
1672 type Protocol = RestarterMarker;
1673 type ControlHandle = RestarterControlHandle;
1674
1675 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1676 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1677 }
1678
1679 fn control_handle(&self) -> Self::ControlHandle {
1680 RestarterControlHandle { inner: self.inner.clone() }
1681 }
1682
1683 fn into_inner(
1684 self,
1685 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1686 {
1687 (self.inner, self.is_terminated)
1688 }
1689
1690 fn from_inner(
1691 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1692 is_terminated: bool,
1693 ) -> Self {
1694 Self { inner, is_terminated }
1695 }
1696}
1697
1698impl futures::Stream for RestarterRequestStream {
1699 type Item = Result<RestarterRequest, fidl::Error>;
1700
1701 fn poll_next(
1702 mut self: std::pin::Pin<&mut Self>,
1703 cx: &mut std::task::Context<'_>,
1704 ) -> std::task::Poll<Option<Self::Item>> {
1705 let this = &mut *self;
1706 if this.inner.check_shutdown(cx) {
1707 this.is_terminated = true;
1708 return std::task::Poll::Ready(None);
1709 }
1710 if this.is_terminated {
1711 panic!("polled RestarterRequestStream after completion");
1712 }
1713 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1714 |bytes, handles| {
1715 match this.inner.channel().read_etc(cx, bytes, handles) {
1716 std::task::Poll::Ready(Ok(())) => {}
1717 std::task::Poll::Pending => return std::task::Poll::Pending,
1718 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1719 this.is_terminated = true;
1720 return std::task::Poll::Ready(None);
1721 }
1722 std::task::Poll::Ready(Err(e)) => {
1723 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1724 e.into(),
1725 ))));
1726 }
1727 }
1728
1729 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1731
1732 std::task::Poll::Ready(Some(match header.ordinal {
1733 0x50cd09e53189e5ae => {
1734 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1735 let mut req = fidl::new_empty!(
1736 fidl::encoding::EmptyPayload,
1737 fidl::encoding::DefaultFuchsiaResourceDialect
1738 );
1739 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1740 let control_handle = RestarterControlHandle { inner: this.inner.clone() };
1741 Ok(RestarterRequest::Restart {
1742 responder: RestarterRestartResponder {
1743 control_handle: std::mem::ManuallyDrop::new(control_handle),
1744 tx_id: header.tx_id,
1745 },
1746 })
1747 }
1748 _ => Err(fidl::Error::UnknownOrdinal {
1749 ordinal: header.ordinal,
1750 protocol_name:
1751 <RestarterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1752 }),
1753 }))
1754 },
1755 )
1756 }
1757}
1758
1759#[derive(Debug)]
1761pub enum RestarterRequest {
1762 Restart { responder: RestarterRestartResponder },
1771}
1772
1773impl RestarterRequest {
1774 #[allow(irrefutable_let_patterns)]
1775 pub fn into_restart(self) -> Option<(RestarterRestartResponder)> {
1776 if let RestarterRequest::Restart { responder } = self { Some((responder)) } else { None }
1777 }
1778
1779 pub fn method_name(&self) -> &'static str {
1781 match *self {
1782 RestarterRequest::Restart { .. } => "restart",
1783 }
1784 }
1785}
1786
1787#[derive(Debug, Clone)]
1788pub struct RestarterControlHandle {
1789 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1790}
1791
1792impl fidl::endpoints::ControlHandle for RestarterControlHandle {
1793 fn shutdown(&self) {
1794 self.inner.shutdown()
1795 }
1796
1797 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1798 self.inner.shutdown_with_epitaph(status)
1799 }
1800
1801 fn is_closed(&self) -> bool {
1802 self.inner.channel().is_closed()
1803 }
1804 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1805 self.inner.channel().on_closed()
1806 }
1807
1808 #[cfg(target_os = "fuchsia")]
1809 fn signal_peer(
1810 &self,
1811 clear_mask: zx::Signals,
1812 set_mask: zx::Signals,
1813 ) -> Result<(), zx_status::Status> {
1814 use fidl::Peered;
1815 self.inner.channel().signal_peer(clear_mask, set_mask)
1816 }
1817}
1818
1819impl RestarterControlHandle {}
1820
1821#[must_use = "FIDL methods require a response to be sent"]
1822#[derive(Debug)]
1823pub struct RestarterRestartResponder {
1824 control_handle: std::mem::ManuallyDrop<RestarterControlHandle>,
1825 tx_id: u32,
1826}
1827
1828impl std::ops::Drop for RestarterRestartResponder {
1832 fn drop(&mut self) {
1833 self.control_handle.shutdown();
1834 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1836 }
1837}
1838
1839impl fidl::endpoints::Responder for RestarterRestartResponder {
1840 type ControlHandle = RestarterControlHandle;
1841
1842 fn control_handle(&self) -> &RestarterControlHandle {
1843 &self.control_handle
1844 }
1845
1846 fn drop_without_shutdown(mut self) {
1847 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1849 std::mem::forget(self);
1851 }
1852}
1853
1854impl RestarterRestartResponder {
1855 pub fn send(self, mut result: Result<(), RestartError>) -> Result<(), fidl::Error> {
1859 let _result = self.send_raw(result);
1860 if _result.is_err() {
1861 self.control_handle.shutdown();
1862 }
1863 self.drop_without_shutdown();
1864 _result
1865 }
1866
1867 pub fn send_no_shutdown_on_err(
1869 self,
1870 mut result: Result<(), RestartError>,
1871 ) -> Result<(), fidl::Error> {
1872 let _result = self.send_raw(result);
1873 self.drop_without_shutdown();
1874 _result
1875 }
1876
1877 fn send_raw(&self, mut result: Result<(), RestartError>) -> Result<(), fidl::Error> {
1878 self.control_handle.inner.send::<fidl::encoding::ResultType<
1879 fidl::encoding::EmptyStruct,
1880 RestartError,
1881 >>(
1882 result,
1883 self.tx_id,
1884 0x50cd09e53189e5ae,
1885 fidl::encoding::DynamicFlags::empty(),
1886 )
1887 }
1888}
1889
1890mod internal {
1891 use super::*;
1892}