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 LauncherControlHandle {
413 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
414 self.inner.shutdown_with_epitaph(status.into())
415 }
416}
417
418impl fidl::endpoints::ControlHandle for LauncherControlHandle {
419 fn shutdown(&self) {
420 self.inner.shutdown()
421 }
422
423 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
424 self.inner.shutdown_with_epitaph(status)
425 }
426
427 fn is_closed(&self) -> bool {
428 self.inner.channel().is_closed()
429 }
430 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
431 self.inner.channel().on_closed()
432 }
433
434 #[cfg(target_os = "fuchsia")]
435 fn signal_peer(
436 &self,
437 clear_mask: zx::Signals,
438 set_mask: zx::Signals,
439 ) -> Result<(), zx_status::Status> {
440 use fidl::Peered;
441 self.inner.channel().signal_peer(clear_mask, set_mask)
442 }
443}
444
445impl LauncherControlHandle {}
446
447#[must_use = "FIDL methods require a response to be sent"]
448#[derive(Debug)]
449pub struct LauncherLaunchResponder {
450 control_handle: std::mem::ManuallyDrop<LauncherControlHandle>,
451 tx_id: u32,
452}
453
454impl std::ops::Drop for LauncherLaunchResponder {
458 fn drop(&mut self) {
459 self.control_handle.shutdown();
460 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
462 }
463}
464
465impl fidl::endpoints::Responder for LauncherLaunchResponder {
466 type ControlHandle = LauncherControlHandle;
467
468 fn control_handle(&self) -> &LauncherControlHandle {
469 &self.control_handle
470 }
471
472 fn drop_without_shutdown(mut self) {
473 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
475 std::mem::forget(self);
477 }
478}
479
480impl LauncherLaunchResponder {
481 pub fn send(self, mut result: Result<(), LaunchError>) -> Result<(), fidl::Error> {
485 let _result = self.send_raw(result);
486 if _result.is_err() {
487 self.control_handle.shutdown();
488 }
489 self.drop_without_shutdown();
490 _result
491 }
492
493 pub fn send_no_shutdown_on_err(
495 self,
496 mut result: Result<(), LaunchError>,
497 ) -> Result<(), fidl::Error> {
498 let _result = self.send_raw(result);
499 self.drop_without_shutdown();
500 _result
501 }
502
503 fn send_raw(&self, mut result: Result<(), LaunchError>) -> Result<(), fidl::Error> {
504 self.control_handle.inner.send::<fidl::encoding::ResultType<
505 fidl::encoding::EmptyStruct,
506 LaunchError,
507 >>(
508 result,
509 self.tx_id,
510 0x7674a4287f8a385a,
511 fidl::encoding::DynamicFlags::empty(),
512 )
513 }
514}
515
516#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
517pub struct LifecycleMarker;
518
519impl fidl::endpoints::ProtocolMarker for LifecycleMarker {
520 type Proxy = LifecycleProxy;
521 type RequestStream = LifecycleRequestStream;
522 #[cfg(target_os = "fuchsia")]
523 type SynchronousProxy = LifecycleSynchronousProxy;
524
525 const DEBUG_NAME: &'static str = "fuchsia.session.Lifecycle";
526}
527impl fidl::endpoints::DiscoverableProtocolMarker for LifecycleMarker {}
528pub type LifecycleStartResult = Result<(), LifecycleError>;
529pub type LifecycleStopResult = Result<(), LifecycleError>;
530pub type LifecycleRestartResult = Result<(), LifecycleError>;
531
532pub trait LifecycleProxyInterface: Send + Sync {
533 type StartResponseFut: std::future::Future<Output = Result<LifecycleStartResult, fidl::Error>>
534 + Send;
535 fn r#start(&self, payload: &LifecycleStartRequest) -> Self::StartResponseFut;
536 type StopResponseFut: std::future::Future<Output = Result<LifecycleStopResult, fidl::Error>>
537 + Send;
538 fn r#stop(&self) -> Self::StopResponseFut;
539 type RestartResponseFut: std::future::Future<Output = Result<LifecycleRestartResult, fidl::Error>>
540 + Send;
541 fn r#restart(&self) -> Self::RestartResponseFut;
542}
543#[derive(Debug)]
544#[cfg(target_os = "fuchsia")]
545pub struct LifecycleSynchronousProxy {
546 client: fidl::client::sync::Client,
547}
548
549#[cfg(target_os = "fuchsia")]
550impl fidl::endpoints::SynchronousProxy for LifecycleSynchronousProxy {
551 type Proxy = LifecycleProxy;
552 type Protocol = LifecycleMarker;
553
554 fn from_channel(inner: fidl::Channel) -> Self {
555 Self::new(inner)
556 }
557
558 fn into_channel(self) -> fidl::Channel {
559 self.client.into_channel()
560 }
561
562 fn as_channel(&self) -> &fidl::Channel {
563 self.client.as_channel()
564 }
565}
566
567#[cfg(target_os = "fuchsia")]
568impl LifecycleSynchronousProxy {
569 pub fn new(channel: fidl::Channel) -> Self {
570 Self { client: fidl::client::sync::Client::new(channel) }
571 }
572
573 pub fn into_channel(self) -> fidl::Channel {
574 self.client.into_channel()
575 }
576
577 pub fn wait_for_event(
580 &self,
581 deadline: zx::MonotonicInstant,
582 ) -> Result<LifecycleEvent, fidl::Error> {
583 LifecycleEvent::decode(self.client.wait_for_event::<LifecycleMarker>(deadline)?)
584 }
585
586 pub fn r#start(
600 &self,
601 mut payload: &LifecycleStartRequest,
602 ___deadline: zx::MonotonicInstant,
603 ) -> Result<LifecycleStartResult, fidl::Error> {
604 let _response = self.client.send_query::<
605 LifecycleStartRequest,
606 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, LifecycleError>,
607 LifecycleMarker,
608 >(
609 payload,
610 0x2fda381d2cc41ce0,
611 fidl::encoding::DynamicFlags::FLEXIBLE,
612 ___deadline,
613 )?
614 .into_result::<LifecycleMarker>("start")?;
615 Ok(_response.map(|x| x))
616 }
617
618 pub fn r#stop(
627 &self,
628 ___deadline: zx::MonotonicInstant,
629 ) -> Result<LifecycleStopResult, fidl::Error> {
630 let _response = self.client.send_query::<
631 fidl::encoding::EmptyPayload,
632 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, LifecycleError>,
633 LifecycleMarker,
634 >(
635 (),
636 0x453a9158431b4a2,
637 fidl::encoding::DynamicFlags::FLEXIBLE,
638 ___deadline,
639 )?
640 .into_result::<LifecycleMarker>("stop")?;
641 Ok(_response.map(|x| x))
642 }
643
644 pub fn r#restart(
660 &self,
661 ___deadline: zx::MonotonicInstant,
662 ) -> Result<LifecycleRestartResult, fidl::Error> {
663 let _response = self.client.send_query::<
664 fidl::encoding::EmptyPayload,
665 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, LifecycleError>,
666 LifecycleMarker,
667 >(
668 (),
669 0x31faeac257bf1abb,
670 fidl::encoding::DynamicFlags::FLEXIBLE,
671 ___deadline,
672 )?
673 .into_result::<LifecycleMarker>("restart")?;
674 Ok(_response.map(|x| x))
675 }
676}
677
678#[cfg(target_os = "fuchsia")]
679impl From<LifecycleSynchronousProxy> for zx::NullableHandle {
680 fn from(value: LifecycleSynchronousProxy) -> Self {
681 value.into_channel().into()
682 }
683}
684
685#[cfg(target_os = "fuchsia")]
686impl From<fidl::Channel> for LifecycleSynchronousProxy {
687 fn from(value: fidl::Channel) -> Self {
688 Self::new(value)
689 }
690}
691
692#[cfg(target_os = "fuchsia")]
693impl fidl::endpoints::FromClient for LifecycleSynchronousProxy {
694 type Protocol = LifecycleMarker;
695
696 fn from_client(value: fidl::endpoints::ClientEnd<LifecycleMarker>) -> Self {
697 Self::new(value.into_channel())
698 }
699}
700
701#[derive(Debug, Clone)]
702pub struct LifecycleProxy {
703 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
704}
705
706impl fidl::endpoints::Proxy for LifecycleProxy {
707 type Protocol = LifecycleMarker;
708
709 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
710 Self::new(inner)
711 }
712
713 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
714 self.client.into_channel().map_err(|client| Self { client })
715 }
716
717 fn as_channel(&self) -> &::fidl::AsyncChannel {
718 self.client.as_channel()
719 }
720}
721
722impl LifecycleProxy {
723 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
725 let protocol_name = <LifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
726 Self { client: fidl::client::Client::new(channel, protocol_name) }
727 }
728
729 pub fn take_event_stream(&self) -> LifecycleEventStream {
735 LifecycleEventStream { event_receiver: self.client.take_event_receiver() }
736 }
737
738 pub fn r#start(
752 &self,
753 mut payload: &LifecycleStartRequest,
754 ) -> fidl::client::QueryResponseFut<
755 LifecycleStartResult,
756 fidl::encoding::DefaultFuchsiaResourceDialect,
757 > {
758 LifecycleProxyInterface::r#start(self, payload)
759 }
760
761 pub fn r#stop(
770 &self,
771 ) -> fidl::client::QueryResponseFut<
772 LifecycleStopResult,
773 fidl::encoding::DefaultFuchsiaResourceDialect,
774 > {
775 LifecycleProxyInterface::r#stop(self)
776 }
777
778 pub fn r#restart(
794 &self,
795 ) -> fidl::client::QueryResponseFut<
796 LifecycleRestartResult,
797 fidl::encoding::DefaultFuchsiaResourceDialect,
798 > {
799 LifecycleProxyInterface::r#restart(self)
800 }
801}
802
803impl LifecycleProxyInterface for LifecycleProxy {
804 type StartResponseFut = fidl::client::QueryResponseFut<
805 LifecycleStartResult,
806 fidl::encoding::DefaultFuchsiaResourceDialect,
807 >;
808 fn r#start(&self, mut payload: &LifecycleStartRequest) -> Self::StartResponseFut {
809 fn _decode(
810 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
811 ) -> Result<LifecycleStartResult, fidl::Error> {
812 let _response = fidl::client::decode_transaction_body::<
813 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, LifecycleError>,
814 fidl::encoding::DefaultFuchsiaResourceDialect,
815 0x2fda381d2cc41ce0,
816 >(_buf?)?
817 .into_result::<LifecycleMarker>("start")?;
818 Ok(_response.map(|x| x))
819 }
820 self.client.send_query_and_decode::<LifecycleStartRequest, LifecycleStartResult>(
821 payload,
822 0x2fda381d2cc41ce0,
823 fidl::encoding::DynamicFlags::FLEXIBLE,
824 _decode,
825 )
826 }
827
828 type StopResponseFut = fidl::client::QueryResponseFut<
829 LifecycleStopResult,
830 fidl::encoding::DefaultFuchsiaResourceDialect,
831 >;
832 fn r#stop(&self) -> Self::StopResponseFut {
833 fn _decode(
834 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
835 ) -> Result<LifecycleStopResult, fidl::Error> {
836 let _response = fidl::client::decode_transaction_body::<
837 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, LifecycleError>,
838 fidl::encoding::DefaultFuchsiaResourceDialect,
839 0x453a9158431b4a2,
840 >(_buf?)?
841 .into_result::<LifecycleMarker>("stop")?;
842 Ok(_response.map(|x| x))
843 }
844 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, LifecycleStopResult>(
845 (),
846 0x453a9158431b4a2,
847 fidl::encoding::DynamicFlags::FLEXIBLE,
848 _decode,
849 )
850 }
851
852 type RestartResponseFut = fidl::client::QueryResponseFut<
853 LifecycleRestartResult,
854 fidl::encoding::DefaultFuchsiaResourceDialect,
855 >;
856 fn r#restart(&self) -> Self::RestartResponseFut {
857 fn _decode(
858 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
859 ) -> Result<LifecycleRestartResult, fidl::Error> {
860 let _response = fidl::client::decode_transaction_body::<
861 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, LifecycleError>,
862 fidl::encoding::DefaultFuchsiaResourceDialect,
863 0x31faeac257bf1abb,
864 >(_buf?)?
865 .into_result::<LifecycleMarker>("restart")?;
866 Ok(_response.map(|x| x))
867 }
868 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, LifecycleRestartResult>(
869 (),
870 0x31faeac257bf1abb,
871 fidl::encoding::DynamicFlags::FLEXIBLE,
872 _decode,
873 )
874 }
875}
876
877pub struct LifecycleEventStream {
878 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
879}
880
881impl std::marker::Unpin for LifecycleEventStream {}
882
883impl futures::stream::FusedStream for LifecycleEventStream {
884 fn is_terminated(&self) -> bool {
885 self.event_receiver.is_terminated()
886 }
887}
888
889impl futures::Stream for LifecycleEventStream {
890 type Item = Result<LifecycleEvent, fidl::Error>;
891
892 fn poll_next(
893 mut self: std::pin::Pin<&mut Self>,
894 cx: &mut std::task::Context<'_>,
895 ) -> std::task::Poll<Option<Self::Item>> {
896 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
897 &mut self.event_receiver,
898 cx
899 )?) {
900 Some(buf) => std::task::Poll::Ready(Some(LifecycleEvent::decode(buf))),
901 None => std::task::Poll::Ready(None),
902 }
903 }
904}
905
906#[derive(Debug)]
907pub enum LifecycleEvent {
908 #[non_exhaustive]
909 _UnknownEvent {
910 ordinal: u64,
912 },
913}
914
915impl LifecycleEvent {
916 fn decode(
918 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
919 ) -> Result<LifecycleEvent, fidl::Error> {
920 let (bytes, _handles) = buf.split_mut();
921 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
922 debug_assert_eq!(tx_header.tx_id, 0);
923 match tx_header.ordinal {
924 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
925 Ok(LifecycleEvent::_UnknownEvent { ordinal: tx_header.ordinal })
926 }
927 _ => Err(fidl::Error::UnknownOrdinal {
928 ordinal: tx_header.ordinal,
929 protocol_name: <LifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
930 }),
931 }
932 }
933}
934
935pub struct LifecycleRequestStream {
937 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
938 is_terminated: bool,
939}
940
941impl std::marker::Unpin for LifecycleRequestStream {}
942
943impl futures::stream::FusedStream for LifecycleRequestStream {
944 fn is_terminated(&self) -> bool {
945 self.is_terminated
946 }
947}
948
949impl fidl::endpoints::RequestStream for LifecycleRequestStream {
950 type Protocol = LifecycleMarker;
951 type ControlHandle = LifecycleControlHandle;
952
953 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
954 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
955 }
956
957 fn control_handle(&self) -> Self::ControlHandle {
958 LifecycleControlHandle { inner: self.inner.clone() }
959 }
960
961 fn into_inner(
962 self,
963 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
964 {
965 (self.inner, self.is_terminated)
966 }
967
968 fn from_inner(
969 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
970 is_terminated: bool,
971 ) -> Self {
972 Self { inner, is_terminated }
973 }
974}
975
976impl futures::Stream for LifecycleRequestStream {
977 type Item = Result<LifecycleRequest, fidl::Error>;
978
979 fn poll_next(
980 mut self: std::pin::Pin<&mut Self>,
981 cx: &mut std::task::Context<'_>,
982 ) -> std::task::Poll<Option<Self::Item>> {
983 let this = &mut *self;
984 if this.inner.check_shutdown(cx) {
985 this.is_terminated = true;
986 return std::task::Poll::Ready(None);
987 }
988 if this.is_terminated {
989 panic!("polled LifecycleRequestStream after completion");
990 }
991 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
992 |bytes, handles| {
993 match this.inner.channel().read_etc(cx, bytes, handles) {
994 std::task::Poll::Ready(Ok(())) => {}
995 std::task::Poll::Pending => return std::task::Poll::Pending,
996 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
997 this.is_terminated = true;
998 return std::task::Poll::Ready(None);
999 }
1000 std::task::Poll::Ready(Err(e)) => {
1001 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1002 e.into(),
1003 ))));
1004 }
1005 }
1006
1007 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1009
1010 std::task::Poll::Ready(Some(match header.ordinal {
1011 0x2fda381d2cc41ce0 => {
1012 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1013 let mut req = fidl::new_empty!(
1014 LifecycleStartRequest,
1015 fidl::encoding::DefaultFuchsiaResourceDialect
1016 );
1017 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LifecycleStartRequest>(&header, _body_bytes, handles, &mut req)?;
1018 let control_handle = LifecycleControlHandle { inner: this.inner.clone() };
1019 Ok(LifecycleRequest::Start {
1020 payload: req,
1021 responder: LifecycleStartResponder {
1022 control_handle: std::mem::ManuallyDrop::new(control_handle),
1023 tx_id: header.tx_id,
1024 },
1025 })
1026 }
1027 0x453a9158431b4a2 => {
1028 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1029 let mut req = fidl::new_empty!(
1030 fidl::encoding::EmptyPayload,
1031 fidl::encoding::DefaultFuchsiaResourceDialect
1032 );
1033 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1034 let control_handle = LifecycleControlHandle { inner: this.inner.clone() };
1035 Ok(LifecycleRequest::Stop {
1036 responder: LifecycleStopResponder {
1037 control_handle: std::mem::ManuallyDrop::new(control_handle),
1038 tx_id: header.tx_id,
1039 },
1040 })
1041 }
1042 0x31faeac257bf1abb => {
1043 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1044 let mut req = fidl::new_empty!(
1045 fidl::encoding::EmptyPayload,
1046 fidl::encoding::DefaultFuchsiaResourceDialect
1047 );
1048 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1049 let control_handle = LifecycleControlHandle { inner: this.inner.clone() };
1050 Ok(LifecycleRequest::Restart {
1051 responder: LifecycleRestartResponder {
1052 control_handle: std::mem::ManuallyDrop::new(control_handle),
1053 tx_id: header.tx_id,
1054 },
1055 })
1056 }
1057 _ if header.tx_id == 0
1058 && header
1059 .dynamic_flags()
1060 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1061 {
1062 Ok(LifecycleRequest::_UnknownMethod {
1063 ordinal: header.ordinal,
1064 control_handle: LifecycleControlHandle { inner: this.inner.clone() },
1065 method_type: fidl::MethodType::OneWay,
1066 })
1067 }
1068 _ if header
1069 .dynamic_flags()
1070 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1071 {
1072 this.inner.send_framework_err(
1073 fidl::encoding::FrameworkErr::UnknownMethod,
1074 header.tx_id,
1075 header.ordinal,
1076 header.dynamic_flags(),
1077 (bytes, handles),
1078 )?;
1079 Ok(LifecycleRequest::_UnknownMethod {
1080 ordinal: header.ordinal,
1081 control_handle: LifecycleControlHandle { inner: this.inner.clone() },
1082 method_type: fidl::MethodType::TwoWay,
1083 })
1084 }
1085 _ => Err(fidl::Error::UnknownOrdinal {
1086 ordinal: header.ordinal,
1087 protocol_name:
1088 <LifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1089 }),
1090 }))
1091 },
1092 )
1093 }
1094}
1095
1096#[derive(Debug)]
1098pub enum LifecycleRequest {
1099 Start { payload: LifecycleStartRequest, responder: LifecycleStartResponder },
1113 Stop { responder: LifecycleStopResponder },
1122 Restart { responder: LifecycleRestartResponder },
1138 #[non_exhaustive]
1140 _UnknownMethod {
1141 ordinal: u64,
1143 control_handle: LifecycleControlHandle,
1144 method_type: fidl::MethodType,
1145 },
1146}
1147
1148impl LifecycleRequest {
1149 #[allow(irrefutable_let_patterns)]
1150 pub fn into_start(self) -> Option<(LifecycleStartRequest, LifecycleStartResponder)> {
1151 if let LifecycleRequest::Start { payload, responder } = self {
1152 Some((payload, responder))
1153 } else {
1154 None
1155 }
1156 }
1157
1158 #[allow(irrefutable_let_patterns)]
1159 pub fn into_stop(self) -> Option<(LifecycleStopResponder)> {
1160 if let LifecycleRequest::Stop { responder } = self { Some((responder)) } else { None }
1161 }
1162
1163 #[allow(irrefutable_let_patterns)]
1164 pub fn into_restart(self) -> Option<(LifecycleRestartResponder)> {
1165 if let LifecycleRequest::Restart { responder } = self { Some((responder)) } else { None }
1166 }
1167
1168 pub fn method_name(&self) -> &'static str {
1170 match *self {
1171 LifecycleRequest::Start { .. } => "start",
1172 LifecycleRequest::Stop { .. } => "stop",
1173 LifecycleRequest::Restart { .. } => "restart",
1174 LifecycleRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1175 "unknown one-way method"
1176 }
1177 LifecycleRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1178 "unknown two-way method"
1179 }
1180 }
1181 }
1182}
1183
1184#[derive(Debug, Clone)]
1185pub struct LifecycleControlHandle {
1186 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1187}
1188
1189impl LifecycleControlHandle {
1190 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1191 self.inner.shutdown_with_epitaph(status.into())
1192 }
1193}
1194
1195impl fidl::endpoints::ControlHandle for LifecycleControlHandle {
1196 fn shutdown(&self) {
1197 self.inner.shutdown()
1198 }
1199
1200 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1201 self.inner.shutdown_with_epitaph(status)
1202 }
1203
1204 fn is_closed(&self) -> bool {
1205 self.inner.channel().is_closed()
1206 }
1207 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1208 self.inner.channel().on_closed()
1209 }
1210
1211 #[cfg(target_os = "fuchsia")]
1212 fn signal_peer(
1213 &self,
1214 clear_mask: zx::Signals,
1215 set_mask: zx::Signals,
1216 ) -> Result<(), zx_status::Status> {
1217 use fidl::Peered;
1218 self.inner.channel().signal_peer(clear_mask, set_mask)
1219 }
1220}
1221
1222impl LifecycleControlHandle {}
1223
1224#[must_use = "FIDL methods require a response to be sent"]
1225#[derive(Debug)]
1226pub struct LifecycleStartResponder {
1227 control_handle: std::mem::ManuallyDrop<LifecycleControlHandle>,
1228 tx_id: u32,
1229}
1230
1231impl std::ops::Drop for LifecycleStartResponder {
1235 fn drop(&mut self) {
1236 self.control_handle.shutdown();
1237 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1239 }
1240}
1241
1242impl fidl::endpoints::Responder for LifecycleStartResponder {
1243 type ControlHandle = LifecycleControlHandle;
1244
1245 fn control_handle(&self) -> &LifecycleControlHandle {
1246 &self.control_handle
1247 }
1248
1249 fn drop_without_shutdown(mut self) {
1250 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1252 std::mem::forget(self);
1254 }
1255}
1256
1257impl LifecycleStartResponder {
1258 pub fn send(self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1262 let _result = self.send_raw(result);
1263 if _result.is_err() {
1264 self.control_handle.shutdown();
1265 }
1266 self.drop_without_shutdown();
1267 _result
1268 }
1269
1270 pub fn send_no_shutdown_on_err(
1272 self,
1273 mut result: Result<(), LifecycleError>,
1274 ) -> Result<(), fidl::Error> {
1275 let _result = self.send_raw(result);
1276 self.drop_without_shutdown();
1277 _result
1278 }
1279
1280 fn send_raw(&self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1281 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1282 fidl::encoding::EmptyStruct,
1283 LifecycleError,
1284 >>(
1285 fidl::encoding::FlexibleResult::new(result),
1286 self.tx_id,
1287 0x2fda381d2cc41ce0,
1288 fidl::encoding::DynamicFlags::FLEXIBLE,
1289 )
1290 }
1291}
1292
1293#[must_use = "FIDL methods require a response to be sent"]
1294#[derive(Debug)]
1295pub struct LifecycleStopResponder {
1296 control_handle: std::mem::ManuallyDrop<LifecycleControlHandle>,
1297 tx_id: u32,
1298}
1299
1300impl std::ops::Drop for LifecycleStopResponder {
1304 fn drop(&mut self) {
1305 self.control_handle.shutdown();
1306 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1308 }
1309}
1310
1311impl fidl::endpoints::Responder for LifecycleStopResponder {
1312 type ControlHandle = LifecycleControlHandle;
1313
1314 fn control_handle(&self) -> &LifecycleControlHandle {
1315 &self.control_handle
1316 }
1317
1318 fn drop_without_shutdown(mut self) {
1319 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1321 std::mem::forget(self);
1323 }
1324}
1325
1326impl LifecycleStopResponder {
1327 pub fn send(self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1331 let _result = self.send_raw(result);
1332 if _result.is_err() {
1333 self.control_handle.shutdown();
1334 }
1335 self.drop_without_shutdown();
1336 _result
1337 }
1338
1339 pub fn send_no_shutdown_on_err(
1341 self,
1342 mut result: Result<(), LifecycleError>,
1343 ) -> Result<(), fidl::Error> {
1344 let _result = self.send_raw(result);
1345 self.drop_without_shutdown();
1346 _result
1347 }
1348
1349 fn send_raw(&self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1350 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1351 fidl::encoding::EmptyStruct,
1352 LifecycleError,
1353 >>(
1354 fidl::encoding::FlexibleResult::new(result),
1355 self.tx_id,
1356 0x453a9158431b4a2,
1357 fidl::encoding::DynamicFlags::FLEXIBLE,
1358 )
1359 }
1360}
1361
1362#[must_use = "FIDL methods require a response to be sent"]
1363#[derive(Debug)]
1364pub struct LifecycleRestartResponder {
1365 control_handle: std::mem::ManuallyDrop<LifecycleControlHandle>,
1366 tx_id: u32,
1367}
1368
1369impl std::ops::Drop for LifecycleRestartResponder {
1373 fn drop(&mut self) {
1374 self.control_handle.shutdown();
1375 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1377 }
1378}
1379
1380impl fidl::endpoints::Responder for LifecycleRestartResponder {
1381 type ControlHandle = LifecycleControlHandle;
1382
1383 fn control_handle(&self) -> &LifecycleControlHandle {
1384 &self.control_handle
1385 }
1386
1387 fn drop_without_shutdown(mut self) {
1388 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1390 std::mem::forget(self);
1392 }
1393}
1394
1395impl LifecycleRestartResponder {
1396 pub fn send(self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1400 let _result = self.send_raw(result);
1401 if _result.is_err() {
1402 self.control_handle.shutdown();
1403 }
1404 self.drop_without_shutdown();
1405 _result
1406 }
1407
1408 pub fn send_no_shutdown_on_err(
1410 self,
1411 mut result: Result<(), LifecycleError>,
1412 ) -> Result<(), fidl::Error> {
1413 let _result = self.send_raw(result);
1414 self.drop_without_shutdown();
1415 _result
1416 }
1417
1418 fn send_raw(&self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1419 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1420 fidl::encoding::EmptyStruct,
1421 LifecycleError,
1422 >>(
1423 fidl::encoding::FlexibleResult::new(result),
1424 self.tx_id,
1425 0x31faeac257bf1abb,
1426 fidl::encoding::DynamicFlags::FLEXIBLE,
1427 )
1428 }
1429}
1430
1431#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1432pub struct RestarterMarker;
1433
1434impl fidl::endpoints::ProtocolMarker for RestarterMarker {
1435 type Proxy = RestarterProxy;
1436 type RequestStream = RestarterRequestStream;
1437 #[cfg(target_os = "fuchsia")]
1438 type SynchronousProxy = RestarterSynchronousProxy;
1439
1440 const DEBUG_NAME: &'static str = "fuchsia.session.Restarter";
1441}
1442impl fidl::endpoints::DiscoverableProtocolMarker for RestarterMarker {}
1443pub type RestarterRestartResult = Result<(), RestartError>;
1444
1445pub trait RestarterProxyInterface: Send + Sync {
1446 type RestartResponseFut: std::future::Future<Output = Result<RestarterRestartResult, fidl::Error>>
1447 + Send;
1448 fn r#restart(&self) -> Self::RestartResponseFut;
1449}
1450#[derive(Debug)]
1451#[cfg(target_os = "fuchsia")]
1452pub struct RestarterSynchronousProxy {
1453 client: fidl::client::sync::Client,
1454}
1455
1456#[cfg(target_os = "fuchsia")]
1457impl fidl::endpoints::SynchronousProxy for RestarterSynchronousProxy {
1458 type Proxy = RestarterProxy;
1459 type Protocol = RestarterMarker;
1460
1461 fn from_channel(inner: fidl::Channel) -> Self {
1462 Self::new(inner)
1463 }
1464
1465 fn into_channel(self) -> fidl::Channel {
1466 self.client.into_channel()
1467 }
1468
1469 fn as_channel(&self) -> &fidl::Channel {
1470 self.client.as_channel()
1471 }
1472}
1473
1474#[cfg(target_os = "fuchsia")]
1475impl RestarterSynchronousProxy {
1476 pub fn new(channel: fidl::Channel) -> Self {
1477 Self { client: fidl::client::sync::Client::new(channel) }
1478 }
1479
1480 pub fn into_channel(self) -> fidl::Channel {
1481 self.client.into_channel()
1482 }
1483
1484 pub fn wait_for_event(
1487 &self,
1488 deadline: zx::MonotonicInstant,
1489 ) -> Result<RestarterEvent, fidl::Error> {
1490 RestarterEvent::decode(self.client.wait_for_event::<RestarterMarker>(deadline)?)
1491 }
1492
1493 pub fn r#restart(
1502 &self,
1503 ___deadline: zx::MonotonicInstant,
1504 ) -> Result<RestarterRestartResult, fidl::Error> {
1505 let _response = self.client.send_query::<
1506 fidl::encoding::EmptyPayload,
1507 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RestartError>,
1508 RestarterMarker,
1509 >(
1510 (),
1511 0x50cd09e53189e5ae,
1512 fidl::encoding::DynamicFlags::empty(),
1513 ___deadline,
1514 )?;
1515 Ok(_response.map(|x| x))
1516 }
1517}
1518
1519#[cfg(target_os = "fuchsia")]
1520impl From<RestarterSynchronousProxy> for zx::NullableHandle {
1521 fn from(value: RestarterSynchronousProxy) -> Self {
1522 value.into_channel().into()
1523 }
1524}
1525
1526#[cfg(target_os = "fuchsia")]
1527impl From<fidl::Channel> for RestarterSynchronousProxy {
1528 fn from(value: fidl::Channel) -> Self {
1529 Self::new(value)
1530 }
1531}
1532
1533#[cfg(target_os = "fuchsia")]
1534impl fidl::endpoints::FromClient for RestarterSynchronousProxy {
1535 type Protocol = RestarterMarker;
1536
1537 fn from_client(value: fidl::endpoints::ClientEnd<RestarterMarker>) -> Self {
1538 Self::new(value.into_channel())
1539 }
1540}
1541
1542#[derive(Debug, Clone)]
1543pub struct RestarterProxy {
1544 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1545}
1546
1547impl fidl::endpoints::Proxy for RestarterProxy {
1548 type Protocol = RestarterMarker;
1549
1550 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1551 Self::new(inner)
1552 }
1553
1554 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1555 self.client.into_channel().map_err(|client| Self { client })
1556 }
1557
1558 fn as_channel(&self) -> &::fidl::AsyncChannel {
1559 self.client.as_channel()
1560 }
1561}
1562
1563impl RestarterProxy {
1564 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1566 let protocol_name = <RestarterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1567 Self { client: fidl::client::Client::new(channel, protocol_name) }
1568 }
1569
1570 pub fn take_event_stream(&self) -> RestarterEventStream {
1576 RestarterEventStream { event_receiver: self.client.take_event_receiver() }
1577 }
1578
1579 pub fn r#restart(
1588 &self,
1589 ) -> fidl::client::QueryResponseFut<
1590 RestarterRestartResult,
1591 fidl::encoding::DefaultFuchsiaResourceDialect,
1592 > {
1593 RestarterProxyInterface::r#restart(self)
1594 }
1595}
1596
1597impl RestarterProxyInterface for RestarterProxy {
1598 type RestartResponseFut = fidl::client::QueryResponseFut<
1599 RestarterRestartResult,
1600 fidl::encoding::DefaultFuchsiaResourceDialect,
1601 >;
1602 fn r#restart(&self) -> Self::RestartResponseFut {
1603 fn _decode(
1604 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1605 ) -> Result<RestarterRestartResult, fidl::Error> {
1606 let _response = fidl::client::decode_transaction_body::<
1607 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RestartError>,
1608 fidl::encoding::DefaultFuchsiaResourceDialect,
1609 0x50cd09e53189e5ae,
1610 >(_buf?)?;
1611 Ok(_response.map(|x| x))
1612 }
1613 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, RestarterRestartResult>(
1614 (),
1615 0x50cd09e53189e5ae,
1616 fidl::encoding::DynamicFlags::empty(),
1617 _decode,
1618 )
1619 }
1620}
1621
1622pub struct RestarterEventStream {
1623 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1624}
1625
1626impl std::marker::Unpin for RestarterEventStream {}
1627
1628impl futures::stream::FusedStream for RestarterEventStream {
1629 fn is_terminated(&self) -> bool {
1630 self.event_receiver.is_terminated()
1631 }
1632}
1633
1634impl futures::Stream for RestarterEventStream {
1635 type Item = Result<RestarterEvent, fidl::Error>;
1636
1637 fn poll_next(
1638 mut self: std::pin::Pin<&mut Self>,
1639 cx: &mut std::task::Context<'_>,
1640 ) -> std::task::Poll<Option<Self::Item>> {
1641 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1642 &mut self.event_receiver,
1643 cx
1644 )?) {
1645 Some(buf) => std::task::Poll::Ready(Some(RestarterEvent::decode(buf))),
1646 None => std::task::Poll::Ready(None),
1647 }
1648 }
1649}
1650
1651#[derive(Debug)]
1652pub enum RestarterEvent {}
1653
1654impl RestarterEvent {
1655 fn decode(
1657 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1658 ) -> Result<RestarterEvent, fidl::Error> {
1659 let (bytes, _handles) = buf.split_mut();
1660 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1661 debug_assert_eq!(tx_header.tx_id, 0);
1662 match tx_header.ordinal {
1663 _ => Err(fidl::Error::UnknownOrdinal {
1664 ordinal: tx_header.ordinal,
1665 protocol_name: <RestarterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1666 }),
1667 }
1668 }
1669}
1670
1671pub struct RestarterRequestStream {
1673 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1674 is_terminated: bool,
1675}
1676
1677impl std::marker::Unpin for RestarterRequestStream {}
1678
1679impl futures::stream::FusedStream for RestarterRequestStream {
1680 fn is_terminated(&self) -> bool {
1681 self.is_terminated
1682 }
1683}
1684
1685impl fidl::endpoints::RequestStream for RestarterRequestStream {
1686 type Protocol = RestarterMarker;
1687 type ControlHandle = RestarterControlHandle;
1688
1689 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1690 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1691 }
1692
1693 fn control_handle(&self) -> Self::ControlHandle {
1694 RestarterControlHandle { inner: self.inner.clone() }
1695 }
1696
1697 fn into_inner(
1698 self,
1699 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1700 {
1701 (self.inner, self.is_terminated)
1702 }
1703
1704 fn from_inner(
1705 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1706 is_terminated: bool,
1707 ) -> Self {
1708 Self { inner, is_terminated }
1709 }
1710}
1711
1712impl futures::Stream for RestarterRequestStream {
1713 type Item = Result<RestarterRequest, fidl::Error>;
1714
1715 fn poll_next(
1716 mut self: std::pin::Pin<&mut Self>,
1717 cx: &mut std::task::Context<'_>,
1718 ) -> std::task::Poll<Option<Self::Item>> {
1719 let this = &mut *self;
1720 if this.inner.check_shutdown(cx) {
1721 this.is_terminated = true;
1722 return std::task::Poll::Ready(None);
1723 }
1724 if this.is_terminated {
1725 panic!("polled RestarterRequestStream after completion");
1726 }
1727 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1728 |bytes, handles| {
1729 match this.inner.channel().read_etc(cx, bytes, handles) {
1730 std::task::Poll::Ready(Ok(())) => {}
1731 std::task::Poll::Pending => return std::task::Poll::Pending,
1732 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1733 this.is_terminated = true;
1734 return std::task::Poll::Ready(None);
1735 }
1736 std::task::Poll::Ready(Err(e)) => {
1737 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1738 e.into(),
1739 ))));
1740 }
1741 }
1742
1743 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1745
1746 std::task::Poll::Ready(Some(match header.ordinal {
1747 0x50cd09e53189e5ae => {
1748 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1749 let mut req = fidl::new_empty!(
1750 fidl::encoding::EmptyPayload,
1751 fidl::encoding::DefaultFuchsiaResourceDialect
1752 );
1753 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1754 let control_handle = RestarterControlHandle { inner: this.inner.clone() };
1755 Ok(RestarterRequest::Restart {
1756 responder: RestarterRestartResponder {
1757 control_handle: std::mem::ManuallyDrop::new(control_handle),
1758 tx_id: header.tx_id,
1759 },
1760 })
1761 }
1762 _ => Err(fidl::Error::UnknownOrdinal {
1763 ordinal: header.ordinal,
1764 protocol_name:
1765 <RestarterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1766 }),
1767 }))
1768 },
1769 )
1770 }
1771}
1772
1773#[derive(Debug)]
1775pub enum RestarterRequest {
1776 Restart { responder: RestarterRestartResponder },
1785}
1786
1787impl RestarterRequest {
1788 #[allow(irrefutable_let_patterns)]
1789 pub fn into_restart(self) -> Option<(RestarterRestartResponder)> {
1790 if let RestarterRequest::Restart { responder } = self { Some((responder)) } else { None }
1791 }
1792
1793 pub fn method_name(&self) -> &'static str {
1795 match *self {
1796 RestarterRequest::Restart { .. } => "restart",
1797 }
1798 }
1799}
1800
1801#[derive(Debug, Clone)]
1802pub struct RestarterControlHandle {
1803 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1804}
1805
1806impl RestarterControlHandle {
1807 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1808 self.inner.shutdown_with_epitaph(status.into())
1809 }
1810}
1811
1812impl fidl::endpoints::ControlHandle for RestarterControlHandle {
1813 fn shutdown(&self) {
1814 self.inner.shutdown()
1815 }
1816
1817 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1818 self.inner.shutdown_with_epitaph(status)
1819 }
1820
1821 fn is_closed(&self) -> bool {
1822 self.inner.channel().is_closed()
1823 }
1824 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1825 self.inner.channel().on_closed()
1826 }
1827
1828 #[cfg(target_os = "fuchsia")]
1829 fn signal_peer(
1830 &self,
1831 clear_mask: zx::Signals,
1832 set_mask: zx::Signals,
1833 ) -> Result<(), zx_status::Status> {
1834 use fidl::Peered;
1835 self.inner.channel().signal_peer(clear_mask, set_mask)
1836 }
1837}
1838
1839impl RestarterControlHandle {}
1840
1841#[must_use = "FIDL methods require a response to be sent"]
1842#[derive(Debug)]
1843pub struct RestarterRestartResponder {
1844 control_handle: std::mem::ManuallyDrop<RestarterControlHandle>,
1845 tx_id: u32,
1846}
1847
1848impl std::ops::Drop for RestarterRestartResponder {
1852 fn drop(&mut self) {
1853 self.control_handle.shutdown();
1854 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1856 }
1857}
1858
1859impl fidl::endpoints::Responder for RestarterRestartResponder {
1860 type ControlHandle = RestarterControlHandle;
1861
1862 fn control_handle(&self) -> &RestarterControlHandle {
1863 &self.control_handle
1864 }
1865
1866 fn drop_without_shutdown(mut self) {
1867 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1869 std::mem::forget(self);
1871 }
1872}
1873
1874impl RestarterRestartResponder {
1875 pub fn send(self, mut result: Result<(), RestartError>) -> Result<(), fidl::Error> {
1879 let _result = self.send_raw(result);
1880 if _result.is_err() {
1881 self.control_handle.shutdown();
1882 }
1883 self.drop_without_shutdown();
1884 _result
1885 }
1886
1887 pub fn send_no_shutdown_on_err(
1889 self,
1890 mut result: Result<(), RestartError>,
1891 ) -> Result<(), fidl::Error> {
1892 let _result = self.send_raw(result);
1893 self.drop_without_shutdown();
1894 _result
1895 }
1896
1897 fn send_raw(&self, mut result: Result<(), RestartError>) -> Result<(), fidl::Error> {
1898 self.control_handle.inner.send::<fidl::encoding::ResultType<
1899 fidl::encoding::EmptyStruct,
1900 RestartError,
1901 >>(
1902 result,
1903 self.tx_id,
1904 0x50cd09e53189e5ae,
1905 fidl::encoding::DynamicFlags::empty(),
1906 )
1907 }
1908}
1909
1910mod internal {
1911 use super::*;
1912}