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 Self { client: fidl::client::sync::Client::new(channel) }
61 }
62
63 pub fn into_channel(self) -> fidl::Channel {
64 self.client.into_channel()
65 }
66
67 pub fn wait_for_event(
70 &self,
71 deadline: zx::MonotonicInstant,
72 ) -> Result<LauncherEvent, fidl::Error> {
73 LauncherEvent::decode(self.client.wait_for_event::<LauncherMarker>(deadline)?)
74 }
75
76 pub fn r#launch(
90 &self,
91 mut configuration: &LaunchConfiguration,
92 ___deadline: zx::MonotonicInstant,
93 ) -> Result<LauncherLaunchResult, fidl::Error> {
94 let _response = self.client.send_query::<
95 LauncherLaunchRequest,
96 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, LaunchError>,
97 LauncherMarker,
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 Self { client: fidl::client::sync::Client::new(channel) }
565 }
566
567 pub fn into_channel(self) -> fidl::Channel {
568 self.client.into_channel()
569 }
570
571 pub fn wait_for_event(
574 &self,
575 deadline: zx::MonotonicInstant,
576 ) -> Result<LifecycleEvent, fidl::Error> {
577 LifecycleEvent::decode(self.client.wait_for_event::<LifecycleMarker>(deadline)?)
578 }
579
580 pub fn r#start(
594 &self,
595 mut payload: &LifecycleStartRequest,
596 ___deadline: zx::MonotonicInstant,
597 ) -> Result<LifecycleStartResult, fidl::Error> {
598 let _response = self.client.send_query::<
599 LifecycleStartRequest,
600 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, LifecycleError>,
601 LifecycleMarker,
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 LifecycleMarker,
628 >(
629 (),
630 0x453a9158431b4a2,
631 fidl::encoding::DynamicFlags::FLEXIBLE,
632 ___deadline,
633 )?
634 .into_result::<LifecycleMarker>("stop")?;
635 Ok(_response.map(|x| x))
636 }
637
638 pub fn r#restart(
654 &self,
655 ___deadline: zx::MonotonicInstant,
656 ) -> Result<LifecycleRestartResult, fidl::Error> {
657 let _response = self.client.send_query::<
658 fidl::encoding::EmptyPayload,
659 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, LifecycleError>,
660 LifecycleMarker,
661 >(
662 (),
663 0x31faeac257bf1abb,
664 fidl::encoding::DynamicFlags::FLEXIBLE,
665 ___deadline,
666 )?
667 .into_result::<LifecycleMarker>("restart")?;
668 Ok(_response.map(|x| x))
669 }
670}
671
672#[cfg(target_os = "fuchsia")]
673impl From<LifecycleSynchronousProxy> for zx::NullableHandle {
674 fn from(value: LifecycleSynchronousProxy) -> Self {
675 value.into_channel().into()
676 }
677}
678
679#[cfg(target_os = "fuchsia")]
680impl From<fidl::Channel> for LifecycleSynchronousProxy {
681 fn from(value: fidl::Channel) -> Self {
682 Self::new(value)
683 }
684}
685
686#[cfg(target_os = "fuchsia")]
687impl fidl::endpoints::FromClient for LifecycleSynchronousProxy {
688 type Protocol = LifecycleMarker;
689
690 fn from_client(value: fidl::endpoints::ClientEnd<LifecycleMarker>) -> Self {
691 Self::new(value.into_channel())
692 }
693}
694
695#[derive(Debug, Clone)]
696pub struct LifecycleProxy {
697 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
698}
699
700impl fidl::endpoints::Proxy for LifecycleProxy {
701 type Protocol = LifecycleMarker;
702
703 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
704 Self::new(inner)
705 }
706
707 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
708 self.client.into_channel().map_err(|client| Self { client })
709 }
710
711 fn as_channel(&self) -> &::fidl::AsyncChannel {
712 self.client.as_channel()
713 }
714}
715
716impl LifecycleProxy {
717 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
719 let protocol_name = <LifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
720 Self { client: fidl::client::Client::new(channel, protocol_name) }
721 }
722
723 pub fn take_event_stream(&self) -> LifecycleEventStream {
729 LifecycleEventStream { event_receiver: self.client.take_event_receiver() }
730 }
731
732 pub fn r#start(
746 &self,
747 mut payload: &LifecycleStartRequest,
748 ) -> fidl::client::QueryResponseFut<
749 LifecycleStartResult,
750 fidl::encoding::DefaultFuchsiaResourceDialect,
751 > {
752 LifecycleProxyInterface::r#start(self, payload)
753 }
754
755 pub fn r#stop(
764 &self,
765 ) -> fidl::client::QueryResponseFut<
766 LifecycleStopResult,
767 fidl::encoding::DefaultFuchsiaResourceDialect,
768 > {
769 LifecycleProxyInterface::r#stop(self)
770 }
771
772 pub fn r#restart(
788 &self,
789 ) -> fidl::client::QueryResponseFut<
790 LifecycleRestartResult,
791 fidl::encoding::DefaultFuchsiaResourceDialect,
792 > {
793 LifecycleProxyInterface::r#restart(self)
794 }
795}
796
797impl LifecycleProxyInterface for LifecycleProxy {
798 type StartResponseFut = fidl::client::QueryResponseFut<
799 LifecycleStartResult,
800 fidl::encoding::DefaultFuchsiaResourceDialect,
801 >;
802 fn r#start(&self, mut payload: &LifecycleStartRequest) -> Self::StartResponseFut {
803 fn _decode(
804 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
805 ) -> Result<LifecycleStartResult, fidl::Error> {
806 let _response = fidl::client::decode_transaction_body::<
807 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, LifecycleError>,
808 fidl::encoding::DefaultFuchsiaResourceDialect,
809 0x2fda381d2cc41ce0,
810 >(_buf?)?
811 .into_result::<LifecycleMarker>("start")?;
812 Ok(_response.map(|x| x))
813 }
814 self.client.send_query_and_decode::<LifecycleStartRequest, LifecycleStartResult>(
815 payload,
816 0x2fda381d2cc41ce0,
817 fidl::encoding::DynamicFlags::FLEXIBLE,
818 _decode,
819 )
820 }
821
822 type StopResponseFut = fidl::client::QueryResponseFut<
823 LifecycleStopResult,
824 fidl::encoding::DefaultFuchsiaResourceDialect,
825 >;
826 fn r#stop(&self) -> Self::StopResponseFut {
827 fn _decode(
828 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
829 ) -> Result<LifecycleStopResult, fidl::Error> {
830 let _response = fidl::client::decode_transaction_body::<
831 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, LifecycleError>,
832 fidl::encoding::DefaultFuchsiaResourceDialect,
833 0x453a9158431b4a2,
834 >(_buf?)?
835 .into_result::<LifecycleMarker>("stop")?;
836 Ok(_response.map(|x| x))
837 }
838 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, LifecycleStopResult>(
839 (),
840 0x453a9158431b4a2,
841 fidl::encoding::DynamicFlags::FLEXIBLE,
842 _decode,
843 )
844 }
845
846 type RestartResponseFut = fidl::client::QueryResponseFut<
847 LifecycleRestartResult,
848 fidl::encoding::DefaultFuchsiaResourceDialect,
849 >;
850 fn r#restart(&self) -> Self::RestartResponseFut {
851 fn _decode(
852 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
853 ) -> Result<LifecycleRestartResult, fidl::Error> {
854 let _response = fidl::client::decode_transaction_body::<
855 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, LifecycleError>,
856 fidl::encoding::DefaultFuchsiaResourceDialect,
857 0x31faeac257bf1abb,
858 >(_buf?)?
859 .into_result::<LifecycleMarker>("restart")?;
860 Ok(_response.map(|x| x))
861 }
862 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, LifecycleRestartResult>(
863 (),
864 0x31faeac257bf1abb,
865 fidl::encoding::DynamicFlags::FLEXIBLE,
866 _decode,
867 )
868 }
869}
870
871pub struct LifecycleEventStream {
872 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
873}
874
875impl std::marker::Unpin for LifecycleEventStream {}
876
877impl futures::stream::FusedStream for LifecycleEventStream {
878 fn is_terminated(&self) -> bool {
879 self.event_receiver.is_terminated()
880 }
881}
882
883impl futures::Stream for LifecycleEventStream {
884 type Item = Result<LifecycleEvent, fidl::Error>;
885
886 fn poll_next(
887 mut self: std::pin::Pin<&mut Self>,
888 cx: &mut std::task::Context<'_>,
889 ) -> std::task::Poll<Option<Self::Item>> {
890 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
891 &mut self.event_receiver,
892 cx
893 )?) {
894 Some(buf) => std::task::Poll::Ready(Some(LifecycleEvent::decode(buf))),
895 None => std::task::Poll::Ready(None),
896 }
897 }
898}
899
900#[derive(Debug)]
901pub enum LifecycleEvent {
902 #[non_exhaustive]
903 _UnknownEvent {
904 ordinal: u64,
906 },
907}
908
909impl LifecycleEvent {
910 fn decode(
912 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
913 ) -> Result<LifecycleEvent, fidl::Error> {
914 let (bytes, _handles) = buf.split_mut();
915 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
916 debug_assert_eq!(tx_header.tx_id, 0);
917 match tx_header.ordinal {
918 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
919 Ok(LifecycleEvent::_UnknownEvent { ordinal: tx_header.ordinal })
920 }
921 _ => Err(fidl::Error::UnknownOrdinal {
922 ordinal: tx_header.ordinal,
923 protocol_name: <LifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
924 }),
925 }
926 }
927}
928
929pub struct LifecycleRequestStream {
931 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
932 is_terminated: bool,
933}
934
935impl std::marker::Unpin for LifecycleRequestStream {}
936
937impl futures::stream::FusedStream for LifecycleRequestStream {
938 fn is_terminated(&self) -> bool {
939 self.is_terminated
940 }
941}
942
943impl fidl::endpoints::RequestStream for LifecycleRequestStream {
944 type Protocol = LifecycleMarker;
945 type ControlHandle = LifecycleControlHandle;
946
947 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
948 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
949 }
950
951 fn control_handle(&self) -> Self::ControlHandle {
952 LifecycleControlHandle { inner: self.inner.clone() }
953 }
954
955 fn into_inner(
956 self,
957 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
958 {
959 (self.inner, self.is_terminated)
960 }
961
962 fn from_inner(
963 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
964 is_terminated: bool,
965 ) -> Self {
966 Self { inner, is_terminated }
967 }
968}
969
970impl futures::Stream for LifecycleRequestStream {
971 type Item = Result<LifecycleRequest, fidl::Error>;
972
973 fn poll_next(
974 mut self: std::pin::Pin<&mut Self>,
975 cx: &mut std::task::Context<'_>,
976 ) -> std::task::Poll<Option<Self::Item>> {
977 let this = &mut *self;
978 if this.inner.check_shutdown(cx) {
979 this.is_terminated = true;
980 return std::task::Poll::Ready(None);
981 }
982 if this.is_terminated {
983 panic!("polled LifecycleRequestStream after completion");
984 }
985 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
986 |bytes, handles| {
987 match this.inner.channel().read_etc(cx, bytes, handles) {
988 std::task::Poll::Ready(Ok(())) => {}
989 std::task::Poll::Pending => return std::task::Poll::Pending,
990 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
991 this.is_terminated = true;
992 return std::task::Poll::Ready(None);
993 }
994 std::task::Poll::Ready(Err(e)) => {
995 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
996 e.into(),
997 ))));
998 }
999 }
1000
1001 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1003
1004 std::task::Poll::Ready(Some(match header.ordinal {
1005 0x2fda381d2cc41ce0 => {
1006 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1007 let mut req = fidl::new_empty!(
1008 LifecycleStartRequest,
1009 fidl::encoding::DefaultFuchsiaResourceDialect
1010 );
1011 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LifecycleStartRequest>(&header, _body_bytes, handles, &mut req)?;
1012 let control_handle = LifecycleControlHandle { inner: this.inner.clone() };
1013 Ok(LifecycleRequest::Start {
1014 payload: req,
1015 responder: LifecycleStartResponder {
1016 control_handle: std::mem::ManuallyDrop::new(control_handle),
1017 tx_id: header.tx_id,
1018 },
1019 })
1020 }
1021 0x453a9158431b4a2 => {
1022 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1023 let mut req = fidl::new_empty!(
1024 fidl::encoding::EmptyPayload,
1025 fidl::encoding::DefaultFuchsiaResourceDialect
1026 );
1027 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1028 let control_handle = LifecycleControlHandle { inner: this.inner.clone() };
1029 Ok(LifecycleRequest::Stop {
1030 responder: LifecycleStopResponder {
1031 control_handle: std::mem::ManuallyDrop::new(control_handle),
1032 tx_id: header.tx_id,
1033 },
1034 })
1035 }
1036 0x31faeac257bf1abb => {
1037 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1038 let mut req = fidl::new_empty!(
1039 fidl::encoding::EmptyPayload,
1040 fidl::encoding::DefaultFuchsiaResourceDialect
1041 );
1042 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1043 let control_handle = LifecycleControlHandle { inner: this.inner.clone() };
1044 Ok(LifecycleRequest::Restart {
1045 responder: LifecycleRestartResponder {
1046 control_handle: std::mem::ManuallyDrop::new(control_handle),
1047 tx_id: header.tx_id,
1048 },
1049 })
1050 }
1051 _ if header.tx_id == 0
1052 && header
1053 .dynamic_flags()
1054 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1055 {
1056 Ok(LifecycleRequest::_UnknownMethod {
1057 ordinal: header.ordinal,
1058 control_handle: LifecycleControlHandle { inner: this.inner.clone() },
1059 method_type: fidl::MethodType::OneWay,
1060 })
1061 }
1062 _ if header
1063 .dynamic_flags()
1064 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1065 {
1066 this.inner.send_framework_err(
1067 fidl::encoding::FrameworkErr::UnknownMethod,
1068 header.tx_id,
1069 header.ordinal,
1070 header.dynamic_flags(),
1071 (bytes, handles),
1072 )?;
1073 Ok(LifecycleRequest::_UnknownMethod {
1074 ordinal: header.ordinal,
1075 control_handle: LifecycleControlHandle { inner: this.inner.clone() },
1076 method_type: fidl::MethodType::TwoWay,
1077 })
1078 }
1079 _ => Err(fidl::Error::UnknownOrdinal {
1080 ordinal: header.ordinal,
1081 protocol_name:
1082 <LifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1083 }),
1084 }))
1085 },
1086 )
1087 }
1088}
1089
1090#[derive(Debug)]
1092pub enum LifecycleRequest {
1093 Start { payload: LifecycleStartRequest, responder: LifecycleStartResponder },
1107 Stop { responder: LifecycleStopResponder },
1116 Restart { responder: LifecycleRestartResponder },
1132 #[non_exhaustive]
1134 _UnknownMethod {
1135 ordinal: u64,
1137 control_handle: LifecycleControlHandle,
1138 method_type: fidl::MethodType,
1139 },
1140}
1141
1142impl LifecycleRequest {
1143 #[allow(irrefutable_let_patterns)]
1144 pub fn into_start(self) -> Option<(LifecycleStartRequest, LifecycleStartResponder)> {
1145 if let LifecycleRequest::Start { payload, responder } = self {
1146 Some((payload, responder))
1147 } else {
1148 None
1149 }
1150 }
1151
1152 #[allow(irrefutable_let_patterns)]
1153 pub fn into_stop(self) -> Option<(LifecycleStopResponder)> {
1154 if let LifecycleRequest::Stop { responder } = self { Some((responder)) } else { None }
1155 }
1156
1157 #[allow(irrefutable_let_patterns)]
1158 pub fn into_restart(self) -> Option<(LifecycleRestartResponder)> {
1159 if let LifecycleRequest::Restart { responder } = self { Some((responder)) } else { None }
1160 }
1161
1162 pub fn method_name(&self) -> &'static str {
1164 match *self {
1165 LifecycleRequest::Start { .. } => "start",
1166 LifecycleRequest::Stop { .. } => "stop",
1167 LifecycleRequest::Restart { .. } => "restart",
1168 LifecycleRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1169 "unknown one-way method"
1170 }
1171 LifecycleRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1172 "unknown two-way method"
1173 }
1174 }
1175 }
1176}
1177
1178#[derive(Debug, Clone)]
1179pub struct LifecycleControlHandle {
1180 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1181}
1182
1183impl fidl::endpoints::ControlHandle for LifecycleControlHandle {
1184 fn shutdown(&self) {
1185 self.inner.shutdown()
1186 }
1187
1188 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1189 self.inner.shutdown_with_epitaph(status)
1190 }
1191
1192 fn is_closed(&self) -> bool {
1193 self.inner.channel().is_closed()
1194 }
1195 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1196 self.inner.channel().on_closed()
1197 }
1198
1199 #[cfg(target_os = "fuchsia")]
1200 fn signal_peer(
1201 &self,
1202 clear_mask: zx::Signals,
1203 set_mask: zx::Signals,
1204 ) -> Result<(), zx_status::Status> {
1205 use fidl::Peered;
1206 self.inner.channel().signal_peer(clear_mask, set_mask)
1207 }
1208}
1209
1210impl LifecycleControlHandle {}
1211
1212#[must_use = "FIDL methods require a response to be sent"]
1213#[derive(Debug)]
1214pub struct LifecycleStartResponder {
1215 control_handle: std::mem::ManuallyDrop<LifecycleControlHandle>,
1216 tx_id: u32,
1217}
1218
1219impl std::ops::Drop for LifecycleStartResponder {
1223 fn drop(&mut self) {
1224 self.control_handle.shutdown();
1225 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1227 }
1228}
1229
1230impl fidl::endpoints::Responder for LifecycleStartResponder {
1231 type ControlHandle = LifecycleControlHandle;
1232
1233 fn control_handle(&self) -> &LifecycleControlHandle {
1234 &self.control_handle
1235 }
1236
1237 fn drop_without_shutdown(mut self) {
1238 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1240 std::mem::forget(self);
1242 }
1243}
1244
1245impl LifecycleStartResponder {
1246 pub fn send(self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1250 let _result = self.send_raw(result);
1251 if _result.is_err() {
1252 self.control_handle.shutdown();
1253 }
1254 self.drop_without_shutdown();
1255 _result
1256 }
1257
1258 pub fn send_no_shutdown_on_err(
1260 self,
1261 mut result: Result<(), LifecycleError>,
1262 ) -> Result<(), fidl::Error> {
1263 let _result = self.send_raw(result);
1264 self.drop_without_shutdown();
1265 _result
1266 }
1267
1268 fn send_raw(&self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1269 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1270 fidl::encoding::EmptyStruct,
1271 LifecycleError,
1272 >>(
1273 fidl::encoding::FlexibleResult::new(result),
1274 self.tx_id,
1275 0x2fda381d2cc41ce0,
1276 fidl::encoding::DynamicFlags::FLEXIBLE,
1277 )
1278 }
1279}
1280
1281#[must_use = "FIDL methods require a response to be sent"]
1282#[derive(Debug)]
1283pub struct LifecycleStopResponder {
1284 control_handle: std::mem::ManuallyDrop<LifecycleControlHandle>,
1285 tx_id: u32,
1286}
1287
1288impl std::ops::Drop for LifecycleStopResponder {
1292 fn drop(&mut self) {
1293 self.control_handle.shutdown();
1294 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1296 }
1297}
1298
1299impl fidl::endpoints::Responder for LifecycleStopResponder {
1300 type ControlHandle = LifecycleControlHandle;
1301
1302 fn control_handle(&self) -> &LifecycleControlHandle {
1303 &self.control_handle
1304 }
1305
1306 fn drop_without_shutdown(mut self) {
1307 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1309 std::mem::forget(self);
1311 }
1312}
1313
1314impl LifecycleStopResponder {
1315 pub fn send(self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1319 let _result = self.send_raw(result);
1320 if _result.is_err() {
1321 self.control_handle.shutdown();
1322 }
1323 self.drop_without_shutdown();
1324 _result
1325 }
1326
1327 pub fn send_no_shutdown_on_err(
1329 self,
1330 mut result: Result<(), LifecycleError>,
1331 ) -> Result<(), fidl::Error> {
1332 let _result = self.send_raw(result);
1333 self.drop_without_shutdown();
1334 _result
1335 }
1336
1337 fn send_raw(&self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1338 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1339 fidl::encoding::EmptyStruct,
1340 LifecycleError,
1341 >>(
1342 fidl::encoding::FlexibleResult::new(result),
1343 self.tx_id,
1344 0x453a9158431b4a2,
1345 fidl::encoding::DynamicFlags::FLEXIBLE,
1346 )
1347 }
1348}
1349
1350#[must_use = "FIDL methods require a response to be sent"]
1351#[derive(Debug)]
1352pub struct LifecycleRestartResponder {
1353 control_handle: std::mem::ManuallyDrop<LifecycleControlHandle>,
1354 tx_id: u32,
1355}
1356
1357impl std::ops::Drop for LifecycleRestartResponder {
1361 fn drop(&mut self) {
1362 self.control_handle.shutdown();
1363 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1365 }
1366}
1367
1368impl fidl::endpoints::Responder for LifecycleRestartResponder {
1369 type ControlHandle = LifecycleControlHandle;
1370
1371 fn control_handle(&self) -> &LifecycleControlHandle {
1372 &self.control_handle
1373 }
1374
1375 fn drop_without_shutdown(mut self) {
1376 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1378 std::mem::forget(self);
1380 }
1381}
1382
1383impl LifecycleRestartResponder {
1384 pub fn send(self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1388 let _result = self.send_raw(result);
1389 if _result.is_err() {
1390 self.control_handle.shutdown();
1391 }
1392 self.drop_without_shutdown();
1393 _result
1394 }
1395
1396 pub fn send_no_shutdown_on_err(
1398 self,
1399 mut result: Result<(), LifecycleError>,
1400 ) -> Result<(), fidl::Error> {
1401 let _result = self.send_raw(result);
1402 self.drop_without_shutdown();
1403 _result
1404 }
1405
1406 fn send_raw(&self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1407 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1408 fidl::encoding::EmptyStruct,
1409 LifecycleError,
1410 >>(
1411 fidl::encoding::FlexibleResult::new(result),
1412 self.tx_id,
1413 0x31faeac257bf1abb,
1414 fidl::encoding::DynamicFlags::FLEXIBLE,
1415 )
1416 }
1417}
1418
1419#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1420pub struct RestarterMarker;
1421
1422impl fidl::endpoints::ProtocolMarker for RestarterMarker {
1423 type Proxy = RestarterProxy;
1424 type RequestStream = RestarterRequestStream;
1425 #[cfg(target_os = "fuchsia")]
1426 type SynchronousProxy = RestarterSynchronousProxy;
1427
1428 const DEBUG_NAME: &'static str = "fuchsia.session.Restarter";
1429}
1430impl fidl::endpoints::DiscoverableProtocolMarker for RestarterMarker {}
1431pub type RestarterRestartResult = Result<(), RestartError>;
1432
1433pub trait RestarterProxyInterface: Send + Sync {
1434 type RestartResponseFut: std::future::Future<Output = Result<RestarterRestartResult, fidl::Error>>
1435 + Send;
1436 fn r#restart(&self) -> Self::RestartResponseFut;
1437}
1438#[derive(Debug)]
1439#[cfg(target_os = "fuchsia")]
1440pub struct RestarterSynchronousProxy {
1441 client: fidl::client::sync::Client,
1442}
1443
1444#[cfg(target_os = "fuchsia")]
1445impl fidl::endpoints::SynchronousProxy for RestarterSynchronousProxy {
1446 type Proxy = RestarterProxy;
1447 type Protocol = RestarterMarker;
1448
1449 fn from_channel(inner: fidl::Channel) -> Self {
1450 Self::new(inner)
1451 }
1452
1453 fn into_channel(self) -> fidl::Channel {
1454 self.client.into_channel()
1455 }
1456
1457 fn as_channel(&self) -> &fidl::Channel {
1458 self.client.as_channel()
1459 }
1460}
1461
1462#[cfg(target_os = "fuchsia")]
1463impl RestarterSynchronousProxy {
1464 pub fn new(channel: fidl::Channel) -> Self {
1465 Self { client: fidl::client::sync::Client::new(channel) }
1466 }
1467
1468 pub fn into_channel(self) -> fidl::Channel {
1469 self.client.into_channel()
1470 }
1471
1472 pub fn wait_for_event(
1475 &self,
1476 deadline: zx::MonotonicInstant,
1477 ) -> Result<RestarterEvent, fidl::Error> {
1478 RestarterEvent::decode(self.client.wait_for_event::<RestarterMarker>(deadline)?)
1479 }
1480
1481 pub fn r#restart(
1490 &self,
1491 ___deadline: zx::MonotonicInstant,
1492 ) -> Result<RestarterRestartResult, fidl::Error> {
1493 let _response = self.client.send_query::<
1494 fidl::encoding::EmptyPayload,
1495 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RestartError>,
1496 RestarterMarker,
1497 >(
1498 (),
1499 0x50cd09e53189e5ae,
1500 fidl::encoding::DynamicFlags::empty(),
1501 ___deadline,
1502 )?;
1503 Ok(_response.map(|x| x))
1504 }
1505}
1506
1507#[cfg(target_os = "fuchsia")]
1508impl From<RestarterSynchronousProxy> for zx::NullableHandle {
1509 fn from(value: RestarterSynchronousProxy) -> Self {
1510 value.into_channel().into()
1511 }
1512}
1513
1514#[cfg(target_os = "fuchsia")]
1515impl From<fidl::Channel> for RestarterSynchronousProxy {
1516 fn from(value: fidl::Channel) -> Self {
1517 Self::new(value)
1518 }
1519}
1520
1521#[cfg(target_os = "fuchsia")]
1522impl fidl::endpoints::FromClient for RestarterSynchronousProxy {
1523 type Protocol = RestarterMarker;
1524
1525 fn from_client(value: fidl::endpoints::ClientEnd<RestarterMarker>) -> Self {
1526 Self::new(value.into_channel())
1527 }
1528}
1529
1530#[derive(Debug, Clone)]
1531pub struct RestarterProxy {
1532 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1533}
1534
1535impl fidl::endpoints::Proxy for RestarterProxy {
1536 type Protocol = RestarterMarker;
1537
1538 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1539 Self::new(inner)
1540 }
1541
1542 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1543 self.client.into_channel().map_err(|client| Self { client })
1544 }
1545
1546 fn as_channel(&self) -> &::fidl::AsyncChannel {
1547 self.client.as_channel()
1548 }
1549}
1550
1551impl RestarterProxy {
1552 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1554 let protocol_name = <RestarterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1555 Self { client: fidl::client::Client::new(channel, protocol_name) }
1556 }
1557
1558 pub fn take_event_stream(&self) -> RestarterEventStream {
1564 RestarterEventStream { event_receiver: self.client.take_event_receiver() }
1565 }
1566
1567 pub fn r#restart(
1576 &self,
1577 ) -> fidl::client::QueryResponseFut<
1578 RestarterRestartResult,
1579 fidl::encoding::DefaultFuchsiaResourceDialect,
1580 > {
1581 RestarterProxyInterface::r#restart(self)
1582 }
1583}
1584
1585impl RestarterProxyInterface for RestarterProxy {
1586 type RestartResponseFut = fidl::client::QueryResponseFut<
1587 RestarterRestartResult,
1588 fidl::encoding::DefaultFuchsiaResourceDialect,
1589 >;
1590 fn r#restart(&self) -> Self::RestartResponseFut {
1591 fn _decode(
1592 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1593 ) -> Result<RestarterRestartResult, fidl::Error> {
1594 let _response = fidl::client::decode_transaction_body::<
1595 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RestartError>,
1596 fidl::encoding::DefaultFuchsiaResourceDialect,
1597 0x50cd09e53189e5ae,
1598 >(_buf?)?;
1599 Ok(_response.map(|x| x))
1600 }
1601 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, RestarterRestartResult>(
1602 (),
1603 0x50cd09e53189e5ae,
1604 fidl::encoding::DynamicFlags::empty(),
1605 _decode,
1606 )
1607 }
1608}
1609
1610pub struct RestarterEventStream {
1611 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1612}
1613
1614impl std::marker::Unpin for RestarterEventStream {}
1615
1616impl futures::stream::FusedStream for RestarterEventStream {
1617 fn is_terminated(&self) -> bool {
1618 self.event_receiver.is_terminated()
1619 }
1620}
1621
1622impl futures::Stream for RestarterEventStream {
1623 type Item = Result<RestarterEvent, fidl::Error>;
1624
1625 fn poll_next(
1626 mut self: std::pin::Pin<&mut Self>,
1627 cx: &mut std::task::Context<'_>,
1628 ) -> std::task::Poll<Option<Self::Item>> {
1629 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1630 &mut self.event_receiver,
1631 cx
1632 )?) {
1633 Some(buf) => std::task::Poll::Ready(Some(RestarterEvent::decode(buf))),
1634 None => std::task::Poll::Ready(None),
1635 }
1636 }
1637}
1638
1639#[derive(Debug)]
1640pub enum RestarterEvent {}
1641
1642impl RestarterEvent {
1643 fn decode(
1645 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1646 ) -> Result<RestarterEvent, fidl::Error> {
1647 let (bytes, _handles) = buf.split_mut();
1648 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1649 debug_assert_eq!(tx_header.tx_id, 0);
1650 match tx_header.ordinal {
1651 _ => Err(fidl::Error::UnknownOrdinal {
1652 ordinal: tx_header.ordinal,
1653 protocol_name: <RestarterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1654 }),
1655 }
1656 }
1657}
1658
1659pub struct RestarterRequestStream {
1661 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1662 is_terminated: bool,
1663}
1664
1665impl std::marker::Unpin for RestarterRequestStream {}
1666
1667impl futures::stream::FusedStream for RestarterRequestStream {
1668 fn is_terminated(&self) -> bool {
1669 self.is_terminated
1670 }
1671}
1672
1673impl fidl::endpoints::RequestStream for RestarterRequestStream {
1674 type Protocol = RestarterMarker;
1675 type ControlHandle = RestarterControlHandle;
1676
1677 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1678 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1679 }
1680
1681 fn control_handle(&self) -> Self::ControlHandle {
1682 RestarterControlHandle { inner: self.inner.clone() }
1683 }
1684
1685 fn into_inner(
1686 self,
1687 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1688 {
1689 (self.inner, self.is_terminated)
1690 }
1691
1692 fn from_inner(
1693 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1694 is_terminated: bool,
1695 ) -> Self {
1696 Self { inner, is_terminated }
1697 }
1698}
1699
1700impl futures::Stream for RestarterRequestStream {
1701 type Item = Result<RestarterRequest, fidl::Error>;
1702
1703 fn poll_next(
1704 mut self: std::pin::Pin<&mut Self>,
1705 cx: &mut std::task::Context<'_>,
1706 ) -> std::task::Poll<Option<Self::Item>> {
1707 let this = &mut *self;
1708 if this.inner.check_shutdown(cx) {
1709 this.is_terminated = true;
1710 return std::task::Poll::Ready(None);
1711 }
1712 if this.is_terminated {
1713 panic!("polled RestarterRequestStream after completion");
1714 }
1715 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1716 |bytes, handles| {
1717 match this.inner.channel().read_etc(cx, bytes, handles) {
1718 std::task::Poll::Ready(Ok(())) => {}
1719 std::task::Poll::Pending => return std::task::Poll::Pending,
1720 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1721 this.is_terminated = true;
1722 return std::task::Poll::Ready(None);
1723 }
1724 std::task::Poll::Ready(Err(e)) => {
1725 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1726 e.into(),
1727 ))));
1728 }
1729 }
1730
1731 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1733
1734 std::task::Poll::Ready(Some(match header.ordinal {
1735 0x50cd09e53189e5ae => {
1736 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1737 let mut req = fidl::new_empty!(
1738 fidl::encoding::EmptyPayload,
1739 fidl::encoding::DefaultFuchsiaResourceDialect
1740 );
1741 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1742 let control_handle = RestarterControlHandle { inner: this.inner.clone() };
1743 Ok(RestarterRequest::Restart {
1744 responder: RestarterRestartResponder {
1745 control_handle: std::mem::ManuallyDrop::new(control_handle),
1746 tx_id: header.tx_id,
1747 },
1748 })
1749 }
1750 _ => Err(fidl::Error::UnknownOrdinal {
1751 ordinal: header.ordinal,
1752 protocol_name:
1753 <RestarterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1754 }),
1755 }))
1756 },
1757 )
1758 }
1759}
1760
1761#[derive(Debug)]
1763pub enum RestarterRequest {
1764 Restart { responder: RestarterRestartResponder },
1773}
1774
1775impl RestarterRequest {
1776 #[allow(irrefutable_let_patterns)]
1777 pub fn into_restart(self) -> Option<(RestarterRestartResponder)> {
1778 if let RestarterRequest::Restart { responder } = self { Some((responder)) } else { None }
1779 }
1780
1781 pub fn method_name(&self) -> &'static str {
1783 match *self {
1784 RestarterRequest::Restart { .. } => "restart",
1785 }
1786 }
1787}
1788
1789#[derive(Debug, Clone)]
1790pub struct RestarterControlHandle {
1791 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1792}
1793
1794impl fidl::endpoints::ControlHandle for RestarterControlHandle {
1795 fn shutdown(&self) {
1796 self.inner.shutdown()
1797 }
1798
1799 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1800 self.inner.shutdown_with_epitaph(status)
1801 }
1802
1803 fn is_closed(&self) -> bool {
1804 self.inner.channel().is_closed()
1805 }
1806 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1807 self.inner.channel().on_closed()
1808 }
1809
1810 #[cfg(target_os = "fuchsia")]
1811 fn signal_peer(
1812 &self,
1813 clear_mask: zx::Signals,
1814 set_mask: zx::Signals,
1815 ) -> Result<(), zx_status::Status> {
1816 use fidl::Peered;
1817 self.inner.channel().signal_peer(clear_mask, set_mask)
1818 }
1819}
1820
1821impl RestarterControlHandle {}
1822
1823#[must_use = "FIDL methods require a response to be sent"]
1824#[derive(Debug)]
1825pub struct RestarterRestartResponder {
1826 control_handle: std::mem::ManuallyDrop<RestarterControlHandle>,
1827 tx_id: u32,
1828}
1829
1830impl std::ops::Drop for RestarterRestartResponder {
1834 fn drop(&mut self) {
1835 self.control_handle.shutdown();
1836 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1838 }
1839}
1840
1841impl fidl::endpoints::Responder for RestarterRestartResponder {
1842 type ControlHandle = RestarterControlHandle;
1843
1844 fn control_handle(&self) -> &RestarterControlHandle {
1845 &self.control_handle
1846 }
1847
1848 fn drop_without_shutdown(mut self) {
1849 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1851 std::mem::forget(self);
1853 }
1854}
1855
1856impl RestarterRestartResponder {
1857 pub fn send(self, mut result: Result<(), RestartError>) -> Result<(), fidl::Error> {
1861 let _result = self.send_raw(result);
1862 if _result.is_err() {
1863 self.control_handle.shutdown();
1864 }
1865 self.drop_without_shutdown();
1866 _result
1867 }
1868
1869 pub fn send_no_shutdown_on_err(
1871 self,
1872 mut result: Result<(), RestartError>,
1873 ) -> Result<(), fidl::Error> {
1874 let _result = self.send_raw(result);
1875 self.drop_without_shutdown();
1876 _result
1877 }
1878
1879 fn send_raw(&self, mut result: Result<(), RestartError>) -> Result<(), fidl::Error> {
1880 self.control_handle.inner.send::<fidl::encoding::ResultType<
1881 fidl::encoding::EmptyStruct,
1882 RestartError,
1883 >>(
1884 result,
1885 self.tx_id,
1886 0x50cd09e53189e5ae,
1887 fidl::encoding::DynamicFlags::empty(),
1888 )
1889 }
1890}
1891
1892mod internal {
1893 use super::*;
1894}