1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_session__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct LauncherMarker;
16
17impl fidl::endpoints::ProtocolMarker for LauncherMarker {
18 type Proxy = LauncherProxy;
19 type RequestStream = LauncherRequestStream;
20 #[cfg(target_os = "fuchsia")]
21 type SynchronousProxy = LauncherSynchronousProxy;
22
23 const DEBUG_NAME: &'static str = "fuchsia.session.Launcher";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for LauncherMarker {}
26pub type LauncherLaunchResult = Result<(), LaunchError>;
27
28pub trait LauncherProxyInterface: Send + Sync {
29 type LaunchResponseFut: std::future::Future<Output = Result<LauncherLaunchResult, fidl::Error>>
30 + Send;
31 fn r#launch(&self, configuration: &LaunchConfiguration) -> Self::LaunchResponseFut;
32}
33#[derive(Debug)]
34#[cfg(target_os = "fuchsia")]
35pub struct LauncherSynchronousProxy {
36 client: fidl::client::sync::Client,
37}
38
39#[cfg(target_os = "fuchsia")]
40impl fidl::endpoints::SynchronousProxy for LauncherSynchronousProxy {
41 type Proxy = LauncherProxy;
42 type Protocol = LauncherMarker;
43
44 fn from_channel(inner: fidl::Channel) -> Self {
45 Self::new(inner)
46 }
47
48 fn into_channel(self) -> fidl::Channel {
49 self.client.into_channel()
50 }
51
52 fn as_channel(&self) -> &fidl::Channel {
53 self.client.as_channel()
54 }
55}
56
57#[cfg(target_os = "fuchsia")]
58impl LauncherSynchronousProxy {
59 pub fn new(channel: fidl::Channel) -> Self {
60 let protocol_name = <LauncherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
61 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
62 }
63
64 pub fn into_channel(self) -> fidl::Channel {
65 self.client.into_channel()
66 }
67
68 pub fn wait_for_event(
71 &self,
72 deadline: zx::MonotonicInstant,
73 ) -> Result<LauncherEvent, fidl::Error> {
74 LauncherEvent::decode(self.client.wait_for_event(deadline)?)
75 }
76
77 pub fn r#launch(
91 &self,
92 mut configuration: &LaunchConfiguration,
93 ___deadline: zx::MonotonicInstant,
94 ) -> Result<LauncherLaunchResult, fidl::Error> {
95 let _response = self.client.send_query::<
96 LauncherLaunchRequest,
97 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, LaunchError>,
98 >(
99 (configuration,),
100 0x7674a4287f8a385a,
101 fidl::encoding::DynamicFlags::empty(),
102 ___deadline,
103 )?;
104 Ok(_response.map(|x| x))
105 }
106}
107
108#[cfg(target_os = "fuchsia")]
109impl From<LauncherSynchronousProxy> for zx::Handle {
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 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
417 self.inner.shutdown_with_epitaph(status)
418 }
419
420 fn is_closed(&self) -> bool {
421 self.inner.channel().is_closed()
422 }
423 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
424 self.inner.channel().on_closed()
425 }
426
427 #[cfg(target_os = "fuchsia")]
428 fn signal_peer(
429 &self,
430 clear_mask: zx::Signals,
431 set_mask: zx::Signals,
432 ) -> Result<(), zx_status::Status> {
433 use fidl::Peered;
434 self.inner.channel().signal_peer(clear_mask, set_mask)
435 }
436}
437
438impl LauncherControlHandle {}
439
440#[must_use = "FIDL methods require a response to be sent"]
441#[derive(Debug)]
442pub struct LauncherLaunchResponder {
443 control_handle: std::mem::ManuallyDrop<LauncherControlHandle>,
444 tx_id: u32,
445}
446
447impl std::ops::Drop for LauncherLaunchResponder {
451 fn drop(&mut self) {
452 self.control_handle.shutdown();
453 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
455 }
456}
457
458impl fidl::endpoints::Responder for LauncherLaunchResponder {
459 type ControlHandle = LauncherControlHandle;
460
461 fn control_handle(&self) -> &LauncherControlHandle {
462 &self.control_handle
463 }
464
465 fn drop_without_shutdown(mut self) {
466 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
468 std::mem::forget(self);
470 }
471}
472
473impl LauncherLaunchResponder {
474 pub fn send(self, mut result: Result<(), LaunchError>) -> Result<(), fidl::Error> {
478 let _result = self.send_raw(result);
479 if _result.is_err() {
480 self.control_handle.shutdown();
481 }
482 self.drop_without_shutdown();
483 _result
484 }
485
486 pub fn send_no_shutdown_on_err(
488 self,
489 mut result: Result<(), LaunchError>,
490 ) -> Result<(), fidl::Error> {
491 let _result = self.send_raw(result);
492 self.drop_without_shutdown();
493 _result
494 }
495
496 fn send_raw(&self, mut result: Result<(), LaunchError>) -> Result<(), fidl::Error> {
497 self.control_handle.inner.send::<fidl::encoding::ResultType<
498 fidl::encoding::EmptyStruct,
499 LaunchError,
500 >>(
501 result,
502 self.tx_id,
503 0x7674a4287f8a385a,
504 fidl::encoding::DynamicFlags::empty(),
505 )
506 }
507}
508
509#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
510pub struct LifecycleMarker;
511
512impl fidl::endpoints::ProtocolMarker for LifecycleMarker {
513 type Proxy = LifecycleProxy;
514 type RequestStream = LifecycleRequestStream;
515 #[cfg(target_os = "fuchsia")]
516 type SynchronousProxy = LifecycleSynchronousProxy;
517
518 const DEBUG_NAME: &'static str = "fuchsia.session.Lifecycle";
519}
520impl fidl::endpoints::DiscoverableProtocolMarker for LifecycleMarker {}
521pub type LifecycleStartResult = Result<(), LifecycleError>;
522pub type LifecycleStopResult = Result<(), LifecycleError>;
523pub type LifecycleRestartResult = Result<(), LifecycleError>;
524
525pub trait LifecycleProxyInterface: Send + Sync {
526 type StartResponseFut: std::future::Future<Output = Result<LifecycleStartResult, fidl::Error>>
527 + Send;
528 fn r#start(&self, payload: &LifecycleStartRequest) -> Self::StartResponseFut;
529 type StopResponseFut: std::future::Future<Output = Result<LifecycleStopResult, fidl::Error>>
530 + Send;
531 fn r#stop(&self) -> Self::StopResponseFut;
532 type RestartResponseFut: std::future::Future<Output = Result<LifecycleRestartResult, fidl::Error>>
533 + Send;
534 fn r#restart(&self) -> Self::RestartResponseFut;
535}
536#[derive(Debug)]
537#[cfg(target_os = "fuchsia")]
538pub struct LifecycleSynchronousProxy {
539 client: fidl::client::sync::Client,
540}
541
542#[cfg(target_os = "fuchsia")]
543impl fidl::endpoints::SynchronousProxy for LifecycleSynchronousProxy {
544 type Proxy = LifecycleProxy;
545 type Protocol = LifecycleMarker;
546
547 fn from_channel(inner: fidl::Channel) -> Self {
548 Self::new(inner)
549 }
550
551 fn into_channel(self) -> fidl::Channel {
552 self.client.into_channel()
553 }
554
555 fn as_channel(&self) -> &fidl::Channel {
556 self.client.as_channel()
557 }
558}
559
560#[cfg(target_os = "fuchsia")]
561impl LifecycleSynchronousProxy {
562 pub fn new(channel: fidl::Channel) -> Self {
563 let protocol_name = <LifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
564 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
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(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 >(
602 payload,
603 0x2fda381d2cc41ce0,
604 fidl::encoding::DynamicFlags::FLEXIBLE,
605 ___deadline,
606 )?
607 .into_result::<LifecycleMarker>("start")?;
608 Ok(_response.map(|x| x))
609 }
610
611 pub fn r#stop(
620 &self,
621 ___deadline: zx::MonotonicInstant,
622 ) -> Result<LifecycleStopResult, fidl::Error> {
623 let _response = self.client.send_query::<
624 fidl::encoding::EmptyPayload,
625 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, LifecycleError>,
626 >(
627 (),
628 0x453a9158431b4a2,
629 fidl::encoding::DynamicFlags::FLEXIBLE,
630 ___deadline,
631 )?
632 .into_result::<LifecycleMarker>("stop")?;
633 Ok(_response.map(|x| x))
634 }
635
636 pub fn r#restart(
652 &self,
653 ___deadline: zx::MonotonicInstant,
654 ) -> Result<LifecycleRestartResult, fidl::Error> {
655 let _response = self.client.send_query::<
656 fidl::encoding::EmptyPayload,
657 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, LifecycleError>,
658 >(
659 (),
660 0x31faeac257bf1abb,
661 fidl::encoding::DynamicFlags::FLEXIBLE,
662 ___deadline,
663 )?
664 .into_result::<LifecycleMarker>("restart")?;
665 Ok(_response.map(|x| x))
666 }
667}
668
669#[cfg(target_os = "fuchsia")]
670impl From<LifecycleSynchronousProxy> for zx::Handle {
671 fn from(value: LifecycleSynchronousProxy) -> Self {
672 value.into_channel().into()
673 }
674}
675
676#[cfg(target_os = "fuchsia")]
677impl From<fidl::Channel> for LifecycleSynchronousProxy {
678 fn from(value: fidl::Channel) -> Self {
679 Self::new(value)
680 }
681}
682
683#[cfg(target_os = "fuchsia")]
684impl fidl::endpoints::FromClient for LifecycleSynchronousProxy {
685 type Protocol = LifecycleMarker;
686
687 fn from_client(value: fidl::endpoints::ClientEnd<LifecycleMarker>) -> Self {
688 Self::new(value.into_channel())
689 }
690}
691
692#[derive(Debug, Clone)]
693pub struct LifecycleProxy {
694 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
695}
696
697impl fidl::endpoints::Proxy for LifecycleProxy {
698 type Protocol = LifecycleMarker;
699
700 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
701 Self::new(inner)
702 }
703
704 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
705 self.client.into_channel().map_err(|client| Self { client })
706 }
707
708 fn as_channel(&self) -> &::fidl::AsyncChannel {
709 self.client.as_channel()
710 }
711}
712
713impl LifecycleProxy {
714 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
716 let protocol_name = <LifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
717 Self { client: fidl::client::Client::new(channel, protocol_name) }
718 }
719
720 pub fn take_event_stream(&self) -> LifecycleEventStream {
726 LifecycleEventStream { event_receiver: self.client.take_event_receiver() }
727 }
728
729 pub fn r#start(
743 &self,
744 mut payload: &LifecycleStartRequest,
745 ) -> fidl::client::QueryResponseFut<
746 LifecycleStartResult,
747 fidl::encoding::DefaultFuchsiaResourceDialect,
748 > {
749 LifecycleProxyInterface::r#start(self, payload)
750 }
751
752 pub fn r#stop(
761 &self,
762 ) -> fidl::client::QueryResponseFut<
763 LifecycleStopResult,
764 fidl::encoding::DefaultFuchsiaResourceDialect,
765 > {
766 LifecycleProxyInterface::r#stop(self)
767 }
768
769 pub fn r#restart(
785 &self,
786 ) -> fidl::client::QueryResponseFut<
787 LifecycleRestartResult,
788 fidl::encoding::DefaultFuchsiaResourceDialect,
789 > {
790 LifecycleProxyInterface::r#restart(self)
791 }
792}
793
794impl LifecycleProxyInterface for LifecycleProxy {
795 type StartResponseFut = fidl::client::QueryResponseFut<
796 LifecycleStartResult,
797 fidl::encoding::DefaultFuchsiaResourceDialect,
798 >;
799 fn r#start(&self, mut payload: &LifecycleStartRequest) -> Self::StartResponseFut {
800 fn _decode(
801 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
802 ) -> Result<LifecycleStartResult, fidl::Error> {
803 let _response = fidl::client::decode_transaction_body::<
804 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, LifecycleError>,
805 fidl::encoding::DefaultFuchsiaResourceDialect,
806 0x2fda381d2cc41ce0,
807 >(_buf?)?
808 .into_result::<LifecycleMarker>("start")?;
809 Ok(_response.map(|x| x))
810 }
811 self.client.send_query_and_decode::<LifecycleStartRequest, LifecycleStartResult>(
812 payload,
813 0x2fda381d2cc41ce0,
814 fidl::encoding::DynamicFlags::FLEXIBLE,
815 _decode,
816 )
817 }
818
819 type StopResponseFut = fidl::client::QueryResponseFut<
820 LifecycleStopResult,
821 fidl::encoding::DefaultFuchsiaResourceDialect,
822 >;
823 fn r#stop(&self) -> Self::StopResponseFut {
824 fn _decode(
825 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
826 ) -> Result<LifecycleStopResult, fidl::Error> {
827 let _response = fidl::client::decode_transaction_body::<
828 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, LifecycleError>,
829 fidl::encoding::DefaultFuchsiaResourceDialect,
830 0x453a9158431b4a2,
831 >(_buf?)?
832 .into_result::<LifecycleMarker>("stop")?;
833 Ok(_response.map(|x| x))
834 }
835 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, LifecycleStopResult>(
836 (),
837 0x453a9158431b4a2,
838 fidl::encoding::DynamicFlags::FLEXIBLE,
839 _decode,
840 )
841 }
842
843 type RestartResponseFut = fidl::client::QueryResponseFut<
844 LifecycleRestartResult,
845 fidl::encoding::DefaultFuchsiaResourceDialect,
846 >;
847 fn r#restart(&self) -> Self::RestartResponseFut {
848 fn _decode(
849 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
850 ) -> Result<LifecycleRestartResult, fidl::Error> {
851 let _response = fidl::client::decode_transaction_body::<
852 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, LifecycleError>,
853 fidl::encoding::DefaultFuchsiaResourceDialect,
854 0x31faeac257bf1abb,
855 >(_buf?)?
856 .into_result::<LifecycleMarker>("restart")?;
857 Ok(_response.map(|x| x))
858 }
859 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, LifecycleRestartResult>(
860 (),
861 0x31faeac257bf1abb,
862 fidl::encoding::DynamicFlags::FLEXIBLE,
863 _decode,
864 )
865 }
866}
867
868pub struct LifecycleEventStream {
869 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
870}
871
872impl std::marker::Unpin for LifecycleEventStream {}
873
874impl futures::stream::FusedStream for LifecycleEventStream {
875 fn is_terminated(&self) -> bool {
876 self.event_receiver.is_terminated()
877 }
878}
879
880impl futures::Stream for LifecycleEventStream {
881 type Item = Result<LifecycleEvent, fidl::Error>;
882
883 fn poll_next(
884 mut self: std::pin::Pin<&mut Self>,
885 cx: &mut std::task::Context<'_>,
886 ) -> std::task::Poll<Option<Self::Item>> {
887 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
888 &mut self.event_receiver,
889 cx
890 )?) {
891 Some(buf) => std::task::Poll::Ready(Some(LifecycleEvent::decode(buf))),
892 None => std::task::Poll::Ready(None),
893 }
894 }
895}
896
897#[derive(Debug)]
898pub enum LifecycleEvent {
899 #[non_exhaustive]
900 _UnknownEvent {
901 ordinal: u64,
903 },
904}
905
906impl LifecycleEvent {
907 fn decode(
909 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
910 ) -> Result<LifecycleEvent, fidl::Error> {
911 let (bytes, _handles) = buf.split_mut();
912 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
913 debug_assert_eq!(tx_header.tx_id, 0);
914 match tx_header.ordinal {
915 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
916 Ok(LifecycleEvent::_UnknownEvent { ordinal: tx_header.ordinal })
917 }
918 _ => Err(fidl::Error::UnknownOrdinal {
919 ordinal: tx_header.ordinal,
920 protocol_name: <LifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
921 }),
922 }
923 }
924}
925
926pub struct LifecycleRequestStream {
928 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
929 is_terminated: bool,
930}
931
932impl std::marker::Unpin for LifecycleRequestStream {}
933
934impl futures::stream::FusedStream for LifecycleRequestStream {
935 fn is_terminated(&self) -> bool {
936 self.is_terminated
937 }
938}
939
940impl fidl::endpoints::RequestStream for LifecycleRequestStream {
941 type Protocol = LifecycleMarker;
942 type ControlHandle = LifecycleControlHandle;
943
944 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
945 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
946 }
947
948 fn control_handle(&self) -> Self::ControlHandle {
949 LifecycleControlHandle { inner: self.inner.clone() }
950 }
951
952 fn into_inner(
953 self,
954 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
955 {
956 (self.inner, self.is_terminated)
957 }
958
959 fn from_inner(
960 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
961 is_terminated: bool,
962 ) -> Self {
963 Self { inner, is_terminated }
964 }
965}
966
967impl futures::Stream for LifecycleRequestStream {
968 type Item = Result<LifecycleRequest, fidl::Error>;
969
970 fn poll_next(
971 mut self: std::pin::Pin<&mut Self>,
972 cx: &mut std::task::Context<'_>,
973 ) -> std::task::Poll<Option<Self::Item>> {
974 let this = &mut *self;
975 if this.inner.check_shutdown(cx) {
976 this.is_terminated = true;
977 return std::task::Poll::Ready(None);
978 }
979 if this.is_terminated {
980 panic!("polled LifecycleRequestStream after completion");
981 }
982 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
983 |bytes, handles| {
984 match this.inner.channel().read_etc(cx, bytes, handles) {
985 std::task::Poll::Ready(Ok(())) => {}
986 std::task::Poll::Pending => return std::task::Poll::Pending,
987 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
988 this.is_terminated = true;
989 return std::task::Poll::Ready(None);
990 }
991 std::task::Poll::Ready(Err(e)) => {
992 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
993 e.into(),
994 ))))
995 }
996 }
997
998 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1000
1001 std::task::Poll::Ready(Some(match header.ordinal {
1002 0x2fda381d2cc41ce0 => {
1003 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1004 let mut req = fidl::new_empty!(
1005 LifecycleStartRequest,
1006 fidl::encoding::DefaultFuchsiaResourceDialect
1007 );
1008 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LifecycleStartRequest>(&header, _body_bytes, handles, &mut req)?;
1009 let control_handle = LifecycleControlHandle { inner: this.inner.clone() };
1010 Ok(LifecycleRequest::Start {
1011 payload: req,
1012 responder: LifecycleStartResponder {
1013 control_handle: std::mem::ManuallyDrop::new(control_handle),
1014 tx_id: header.tx_id,
1015 },
1016 })
1017 }
1018 0x453a9158431b4a2 => {
1019 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1020 let mut req = fidl::new_empty!(
1021 fidl::encoding::EmptyPayload,
1022 fidl::encoding::DefaultFuchsiaResourceDialect
1023 );
1024 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1025 let control_handle = LifecycleControlHandle { inner: this.inner.clone() };
1026 Ok(LifecycleRequest::Stop {
1027 responder: LifecycleStopResponder {
1028 control_handle: std::mem::ManuallyDrop::new(control_handle),
1029 tx_id: header.tx_id,
1030 },
1031 })
1032 }
1033 0x31faeac257bf1abb => {
1034 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1035 let mut req = fidl::new_empty!(
1036 fidl::encoding::EmptyPayload,
1037 fidl::encoding::DefaultFuchsiaResourceDialect
1038 );
1039 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1040 let control_handle = LifecycleControlHandle { inner: this.inner.clone() };
1041 Ok(LifecycleRequest::Restart {
1042 responder: LifecycleRestartResponder {
1043 control_handle: std::mem::ManuallyDrop::new(control_handle),
1044 tx_id: header.tx_id,
1045 },
1046 })
1047 }
1048 _ if header.tx_id == 0
1049 && header
1050 .dynamic_flags()
1051 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1052 {
1053 Ok(LifecycleRequest::_UnknownMethod {
1054 ordinal: header.ordinal,
1055 control_handle: LifecycleControlHandle { inner: this.inner.clone() },
1056 method_type: fidl::MethodType::OneWay,
1057 })
1058 }
1059 _ if header
1060 .dynamic_flags()
1061 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1062 {
1063 this.inner.send_framework_err(
1064 fidl::encoding::FrameworkErr::UnknownMethod,
1065 header.tx_id,
1066 header.ordinal,
1067 header.dynamic_flags(),
1068 (bytes, handles),
1069 )?;
1070 Ok(LifecycleRequest::_UnknownMethod {
1071 ordinal: header.ordinal,
1072 control_handle: LifecycleControlHandle { inner: this.inner.clone() },
1073 method_type: fidl::MethodType::TwoWay,
1074 })
1075 }
1076 _ => Err(fidl::Error::UnknownOrdinal {
1077 ordinal: header.ordinal,
1078 protocol_name:
1079 <LifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1080 }),
1081 }))
1082 },
1083 )
1084 }
1085}
1086
1087#[derive(Debug)]
1089pub enum LifecycleRequest {
1090 Start { payload: LifecycleStartRequest, responder: LifecycleStartResponder },
1104 Stop { responder: LifecycleStopResponder },
1113 Restart { responder: LifecycleRestartResponder },
1129 #[non_exhaustive]
1131 _UnknownMethod {
1132 ordinal: u64,
1134 control_handle: LifecycleControlHandle,
1135 method_type: fidl::MethodType,
1136 },
1137}
1138
1139impl LifecycleRequest {
1140 #[allow(irrefutable_let_patterns)]
1141 pub fn into_start(self) -> Option<(LifecycleStartRequest, LifecycleStartResponder)> {
1142 if let LifecycleRequest::Start { payload, responder } = self {
1143 Some((payload, responder))
1144 } else {
1145 None
1146 }
1147 }
1148
1149 #[allow(irrefutable_let_patterns)]
1150 pub fn into_stop(self) -> Option<(LifecycleStopResponder)> {
1151 if let LifecycleRequest::Stop { responder } = self {
1152 Some((responder))
1153 } else {
1154 None
1155 }
1156 }
1157
1158 #[allow(irrefutable_let_patterns)]
1159 pub fn into_restart(self) -> Option<(LifecycleRestartResponder)> {
1160 if let LifecycleRequest::Restart { responder } = self {
1161 Some((responder))
1162 } else {
1163 None
1164 }
1165 }
1166
1167 pub fn method_name(&self) -> &'static str {
1169 match *self {
1170 LifecycleRequest::Start { .. } => "start",
1171 LifecycleRequest::Stop { .. } => "stop",
1172 LifecycleRequest::Restart { .. } => "restart",
1173 LifecycleRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1174 "unknown one-way method"
1175 }
1176 LifecycleRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1177 "unknown two-way method"
1178 }
1179 }
1180 }
1181}
1182
1183#[derive(Debug, Clone)]
1184pub struct LifecycleControlHandle {
1185 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1186}
1187
1188impl fidl::endpoints::ControlHandle for LifecycleControlHandle {
1189 fn shutdown(&self) {
1190 self.inner.shutdown()
1191 }
1192 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1193 self.inner.shutdown_with_epitaph(status)
1194 }
1195
1196 fn is_closed(&self) -> bool {
1197 self.inner.channel().is_closed()
1198 }
1199 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1200 self.inner.channel().on_closed()
1201 }
1202
1203 #[cfg(target_os = "fuchsia")]
1204 fn signal_peer(
1205 &self,
1206 clear_mask: zx::Signals,
1207 set_mask: zx::Signals,
1208 ) -> Result<(), zx_status::Status> {
1209 use fidl::Peered;
1210 self.inner.channel().signal_peer(clear_mask, set_mask)
1211 }
1212}
1213
1214impl LifecycleControlHandle {}
1215
1216#[must_use = "FIDL methods require a response to be sent"]
1217#[derive(Debug)]
1218pub struct LifecycleStartResponder {
1219 control_handle: std::mem::ManuallyDrop<LifecycleControlHandle>,
1220 tx_id: u32,
1221}
1222
1223impl std::ops::Drop for LifecycleStartResponder {
1227 fn drop(&mut self) {
1228 self.control_handle.shutdown();
1229 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1231 }
1232}
1233
1234impl fidl::endpoints::Responder for LifecycleStartResponder {
1235 type ControlHandle = LifecycleControlHandle;
1236
1237 fn control_handle(&self) -> &LifecycleControlHandle {
1238 &self.control_handle
1239 }
1240
1241 fn drop_without_shutdown(mut self) {
1242 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1244 std::mem::forget(self);
1246 }
1247}
1248
1249impl LifecycleStartResponder {
1250 pub fn send(self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1254 let _result = self.send_raw(result);
1255 if _result.is_err() {
1256 self.control_handle.shutdown();
1257 }
1258 self.drop_without_shutdown();
1259 _result
1260 }
1261
1262 pub fn send_no_shutdown_on_err(
1264 self,
1265 mut result: Result<(), LifecycleError>,
1266 ) -> Result<(), fidl::Error> {
1267 let _result = self.send_raw(result);
1268 self.drop_without_shutdown();
1269 _result
1270 }
1271
1272 fn send_raw(&self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1273 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1274 fidl::encoding::EmptyStruct,
1275 LifecycleError,
1276 >>(
1277 fidl::encoding::FlexibleResult::new(result),
1278 self.tx_id,
1279 0x2fda381d2cc41ce0,
1280 fidl::encoding::DynamicFlags::FLEXIBLE,
1281 )
1282 }
1283}
1284
1285#[must_use = "FIDL methods require a response to be sent"]
1286#[derive(Debug)]
1287pub struct LifecycleStopResponder {
1288 control_handle: std::mem::ManuallyDrop<LifecycleControlHandle>,
1289 tx_id: u32,
1290}
1291
1292impl std::ops::Drop for LifecycleStopResponder {
1296 fn drop(&mut self) {
1297 self.control_handle.shutdown();
1298 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1300 }
1301}
1302
1303impl fidl::endpoints::Responder for LifecycleStopResponder {
1304 type ControlHandle = LifecycleControlHandle;
1305
1306 fn control_handle(&self) -> &LifecycleControlHandle {
1307 &self.control_handle
1308 }
1309
1310 fn drop_without_shutdown(mut self) {
1311 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1313 std::mem::forget(self);
1315 }
1316}
1317
1318impl LifecycleStopResponder {
1319 pub fn send(self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1323 let _result = self.send_raw(result);
1324 if _result.is_err() {
1325 self.control_handle.shutdown();
1326 }
1327 self.drop_without_shutdown();
1328 _result
1329 }
1330
1331 pub fn send_no_shutdown_on_err(
1333 self,
1334 mut result: Result<(), LifecycleError>,
1335 ) -> Result<(), fidl::Error> {
1336 let _result = self.send_raw(result);
1337 self.drop_without_shutdown();
1338 _result
1339 }
1340
1341 fn send_raw(&self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1342 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1343 fidl::encoding::EmptyStruct,
1344 LifecycleError,
1345 >>(
1346 fidl::encoding::FlexibleResult::new(result),
1347 self.tx_id,
1348 0x453a9158431b4a2,
1349 fidl::encoding::DynamicFlags::FLEXIBLE,
1350 )
1351 }
1352}
1353
1354#[must_use = "FIDL methods require a response to be sent"]
1355#[derive(Debug)]
1356pub struct LifecycleRestartResponder {
1357 control_handle: std::mem::ManuallyDrop<LifecycleControlHandle>,
1358 tx_id: u32,
1359}
1360
1361impl std::ops::Drop for LifecycleRestartResponder {
1365 fn drop(&mut self) {
1366 self.control_handle.shutdown();
1367 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1369 }
1370}
1371
1372impl fidl::endpoints::Responder for LifecycleRestartResponder {
1373 type ControlHandle = LifecycleControlHandle;
1374
1375 fn control_handle(&self) -> &LifecycleControlHandle {
1376 &self.control_handle
1377 }
1378
1379 fn drop_without_shutdown(mut self) {
1380 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1382 std::mem::forget(self);
1384 }
1385}
1386
1387impl LifecycleRestartResponder {
1388 pub fn send(self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1392 let _result = self.send_raw(result);
1393 if _result.is_err() {
1394 self.control_handle.shutdown();
1395 }
1396 self.drop_without_shutdown();
1397 _result
1398 }
1399
1400 pub fn send_no_shutdown_on_err(
1402 self,
1403 mut result: Result<(), LifecycleError>,
1404 ) -> Result<(), fidl::Error> {
1405 let _result = self.send_raw(result);
1406 self.drop_without_shutdown();
1407 _result
1408 }
1409
1410 fn send_raw(&self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1411 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1412 fidl::encoding::EmptyStruct,
1413 LifecycleError,
1414 >>(
1415 fidl::encoding::FlexibleResult::new(result),
1416 self.tx_id,
1417 0x31faeac257bf1abb,
1418 fidl::encoding::DynamicFlags::FLEXIBLE,
1419 )
1420 }
1421}
1422
1423#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1424pub struct RestarterMarker;
1425
1426impl fidl::endpoints::ProtocolMarker for RestarterMarker {
1427 type Proxy = RestarterProxy;
1428 type RequestStream = RestarterRequestStream;
1429 #[cfg(target_os = "fuchsia")]
1430 type SynchronousProxy = RestarterSynchronousProxy;
1431
1432 const DEBUG_NAME: &'static str = "fuchsia.session.Restarter";
1433}
1434impl fidl::endpoints::DiscoverableProtocolMarker for RestarterMarker {}
1435pub type RestarterRestartResult = Result<(), RestartError>;
1436
1437pub trait RestarterProxyInterface: Send + Sync {
1438 type RestartResponseFut: std::future::Future<Output = Result<RestarterRestartResult, fidl::Error>>
1439 + Send;
1440 fn r#restart(&self) -> Self::RestartResponseFut;
1441}
1442#[derive(Debug)]
1443#[cfg(target_os = "fuchsia")]
1444pub struct RestarterSynchronousProxy {
1445 client: fidl::client::sync::Client,
1446}
1447
1448#[cfg(target_os = "fuchsia")]
1449impl fidl::endpoints::SynchronousProxy for RestarterSynchronousProxy {
1450 type Proxy = RestarterProxy;
1451 type Protocol = RestarterMarker;
1452
1453 fn from_channel(inner: fidl::Channel) -> Self {
1454 Self::new(inner)
1455 }
1456
1457 fn into_channel(self) -> fidl::Channel {
1458 self.client.into_channel()
1459 }
1460
1461 fn as_channel(&self) -> &fidl::Channel {
1462 self.client.as_channel()
1463 }
1464}
1465
1466#[cfg(target_os = "fuchsia")]
1467impl RestarterSynchronousProxy {
1468 pub fn new(channel: fidl::Channel) -> Self {
1469 let protocol_name = <RestarterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1470 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1471 }
1472
1473 pub fn into_channel(self) -> fidl::Channel {
1474 self.client.into_channel()
1475 }
1476
1477 pub fn wait_for_event(
1480 &self,
1481 deadline: zx::MonotonicInstant,
1482 ) -> Result<RestarterEvent, fidl::Error> {
1483 RestarterEvent::decode(self.client.wait_for_event(deadline)?)
1484 }
1485
1486 pub fn r#restart(
1495 &self,
1496 ___deadline: zx::MonotonicInstant,
1497 ) -> Result<RestarterRestartResult, fidl::Error> {
1498 let _response = self.client.send_query::<
1499 fidl::encoding::EmptyPayload,
1500 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RestartError>,
1501 >(
1502 (),
1503 0x50cd09e53189e5ae,
1504 fidl::encoding::DynamicFlags::empty(),
1505 ___deadline,
1506 )?;
1507 Ok(_response.map(|x| x))
1508 }
1509}
1510
1511#[cfg(target_os = "fuchsia")]
1512impl From<RestarterSynchronousProxy> for zx::Handle {
1513 fn from(value: RestarterSynchronousProxy) -> Self {
1514 value.into_channel().into()
1515 }
1516}
1517
1518#[cfg(target_os = "fuchsia")]
1519impl From<fidl::Channel> for RestarterSynchronousProxy {
1520 fn from(value: fidl::Channel) -> Self {
1521 Self::new(value)
1522 }
1523}
1524
1525#[cfg(target_os = "fuchsia")]
1526impl fidl::endpoints::FromClient for RestarterSynchronousProxy {
1527 type Protocol = RestarterMarker;
1528
1529 fn from_client(value: fidl::endpoints::ClientEnd<RestarterMarker>) -> Self {
1530 Self::new(value.into_channel())
1531 }
1532}
1533
1534#[derive(Debug, Clone)]
1535pub struct RestarterProxy {
1536 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1537}
1538
1539impl fidl::endpoints::Proxy for RestarterProxy {
1540 type Protocol = RestarterMarker;
1541
1542 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1543 Self::new(inner)
1544 }
1545
1546 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1547 self.client.into_channel().map_err(|client| Self { client })
1548 }
1549
1550 fn as_channel(&self) -> &::fidl::AsyncChannel {
1551 self.client.as_channel()
1552 }
1553}
1554
1555impl RestarterProxy {
1556 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1558 let protocol_name = <RestarterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1559 Self { client: fidl::client::Client::new(channel, protocol_name) }
1560 }
1561
1562 pub fn take_event_stream(&self) -> RestarterEventStream {
1568 RestarterEventStream { event_receiver: self.client.take_event_receiver() }
1569 }
1570
1571 pub fn r#restart(
1580 &self,
1581 ) -> fidl::client::QueryResponseFut<
1582 RestarterRestartResult,
1583 fidl::encoding::DefaultFuchsiaResourceDialect,
1584 > {
1585 RestarterProxyInterface::r#restart(self)
1586 }
1587}
1588
1589impl RestarterProxyInterface for RestarterProxy {
1590 type RestartResponseFut = fidl::client::QueryResponseFut<
1591 RestarterRestartResult,
1592 fidl::encoding::DefaultFuchsiaResourceDialect,
1593 >;
1594 fn r#restart(&self) -> Self::RestartResponseFut {
1595 fn _decode(
1596 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1597 ) -> Result<RestarterRestartResult, fidl::Error> {
1598 let _response = fidl::client::decode_transaction_body::<
1599 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RestartError>,
1600 fidl::encoding::DefaultFuchsiaResourceDialect,
1601 0x50cd09e53189e5ae,
1602 >(_buf?)?;
1603 Ok(_response.map(|x| x))
1604 }
1605 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, RestarterRestartResult>(
1606 (),
1607 0x50cd09e53189e5ae,
1608 fidl::encoding::DynamicFlags::empty(),
1609 _decode,
1610 )
1611 }
1612}
1613
1614pub struct RestarterEventStream {
1615 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1616}
1617
1618impl std::marker::Unpin for RestarterEventStream {}
1619
1620impl futures::stream::FusedStream for RestarterEventStream {
1621 fn is_terminated(&self) -> bool {
1622 self.event_receiver.is_terminated()
1623 }
1624}
1625
1626impl futures::Stream for RestarterEventStream {
1627 type Item = Result<RestarterEvent, fidl::Error>;
1628
1629 fn poll_next(
1630 mut self: std::pin::Pin<&mut Self>,
1631 cx: &mut std::task::Context<'_>,
1632 ) -> std::task::Poll<Option<Self::Item>> {
1633 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1634 &mut self.event_receiver,
1635 cx
1636 )?) {
1637 Some(buf) => std::task::Poll::Ready(Some(RestarterEvent::decode(buf))),
1638 None => std::task::Poll::Ready(None),
1639 }
1640 }
1641}
1642
1643#[derive(Debug)]
1644pub enum RestarterEvent {}
1645
1646impl RestarterEvent {
1647 fn decode(
1649 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1650 ) -> Result<RestarterEvent, fidl::Error> {
1651 let (bytes, _handles) = buf.split_mut();
1652 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1653 debug_assert_eq!(tx_header.tx_id, 0);
1654 match tx_header.ordinal {
1655 _ => Err(fidl::Error::UnknownOrdinal {
1656 ordinal: tx_header.ordinal,
1657 protocol_name: <RestarterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1658 }),
1659 }
1660 }
1661}
1662
1663pub struct RestarterRequestStream {
1665 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1666 is_terminated: bool,
1667}
1668
1669impl std::marker::Unpin for RestarterRequestStream {}
1670
1671impl futures::stream::FusedStream for RestarterRequestStream {
1672 fn is_terminated(&self) -> bool {
1673 self.is_terminated
1674 }
1675}
1676
1677impl fidl::endpoints::RequestStream for RestarterRequestStream {
1678 type Protocol = RestarterMarker;
1679 type ControlHandle = RestarterControlHandle;
1680
1681 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1682 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1683 }
1684
1685 fn control_handle(&self) -> Self::ControlHandle {
1686 RestarterControlHandle { inner: self.inner.clone() }
1687 }
1688
1689 fn into_inner(
1690 self,
1691 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1692 {
1693 (self.inner, self.is_terminated)
1694 }
1695
1696 fn from_inner(
1697 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1698 is_terminated: bool,
1699 ) -> Self {
1700 Self { inner, is_terminated }
1701 }
1702}
1703
1704impl futures::Stream for RestarterRequestStream {
1705 type Item = Result<RestarterRequest, fidl::Error>;
1706
1707 fn poll_next(
1708 mut self: std::pin::Pin<&mut Self>,
1709 cx: &mut std::task::Context<'_>,
1710 ) -> std::task::Poll<Option<Self::Item>> {
1711 let this = &mut *self;
1712 if this.inner.check_shutdown(cx) {
1713 this.is_terminated = true;
1714 return std::task::Poll::Ready(None);
1715 }
1716 if this.is_terminated {
1717 panic!("polled RestarterRequestStream after completion");
1718 }
1719 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1720 |bytes, handles| {
1721 match this.inner.channel().read_etc(cx, bytes, handles) {
1722 std::task::Poll::Ready(Ok(())) => {}
1723 std::task::Poll::Pending => return std::task::Poll::Pending,
1724 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1725 this.is_terminated = true;
1726 return std::task::Poll::Ready(None);
1727 }
1728 std::task::Poll::Ready(Err(e)) => {
1729 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1730 e.into(),
1731 ))))
1732 }
1733 }
1734
1735 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1737
1738 std::task::Poll::Ready(Some(match header.ordinal {
1739 0x50cd09e53189e5ae => {
1740 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1741 let mut req = fidl::new_empty!(
1742 fidl::encoding::EmptyPayload,
1743 fidl::encoding::DefaultFuchsiaResourceDialect
1744 );
1745 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1746 let control_handle = RestarterControlHandle { inner: this.inner.clone() };
1747 Ok(RestarterRequest::Restart {
1748 responder: RestarterRestartResponder {
1749 control_handle: std::mem::ManuallyDrop::new(control_handle),
1750 tx_id: header.tx_id,
1751 },
1752 })
1753 }
1754 _ => Err(fidl::Error::UnknownOrdinal {
1755 ordinal: header.ordinal,
1756 protocol_name:
1757 <RestarterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1758 }),
1759 }))
1760 },
1761 )
1762 }
1763}
1764
1765#[derive(Debug)]
1767pub enum RestarterRequest {
1768 Restart { responder: RestarterRestartResponder },
1777}
1778
1779impl RestarterRequest {
1780 #[allow(irrefutable_let_patterns)]
1781 pub fn into_restart(self) -> Option<(RestarterRestartResponder)> {
1782 if let RestarterRequest::Restart { responder } = self {
1783 Some((responder))
1784 } else {
1785 None
1786 }
1787 }
1788
1789 pub fn method_name(&self) -> &'static str {
1791 match *self {
1792 RestarterRequest::Restart { .. } => "restart",
1793 }
1794 }
1795}
1796
1797#[derive(Debug, Clone)]
1798pub struct RestarterControlHandle {
1799 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1800}
1801
1802impl fidl::endpoints::ControlHandle for RestarterControlHandle {
1803 fn shutdown(&self) {
1804 self.inner.shutdown()
1805 }
1806 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1807 self.inner.shutdown_with_epitaph(status)
1808 }
1809
1810 fn is_closed(&self) -> bool {
1811 self.inner.channel().is_closed()
1812 }
1813 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1814 self.inner.channel().on_closed()
1815 }
1816
1817 #[cfg(target_os = "fuchsia")]
1818 fn signal_peer(
1819 &self,
1820 clear_mask: zx::Signals,
1821 set_mask: zx::Signals,
1822 ) -> Result<(), zx_status::Status> {
1823 use fidl::Peered;
1824 self.inner.channel().signal_peer(clear_mask, set_mask)
1825 }
1826}
1827
1828impl RestarterControlHandle {}
1829
1830#[must_use = "FIDL methods require a response to be sent"]
1831#[derive(Debug)]
1832pub struct RestarterRestartResponder {
1833 control_handle: std::mem::ManuallyDrop<RestarterControlHandle>,
1834 tx_id: u32,
1835}
1836
1837impl std::ops::Drop for RestarterRestartResponder {
1841 fn drop(&mut self) {
1842 self.control_handle.shutdown();
1843 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1845 }
1846}
1847
1848impl fidl::endpoints::Responder for RestarterRestartResponder {
1849 type ControlHandle = RestarterControlHandle;
1850
1851 fn control_handle(&self) -> &RestarterControlHandle {
1852 &self.control_handle
1853 }
1854
1855 fn drop_without_shutdown(mut self) {
1856 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1858 std::mem::forget(self);
1860 }
1861}
1862
1863impl RestarterRestartResponder {
1864 pub fn send(self, mut result: Result<(), RestartError>) -> Result<(), fidl::Error> {
1868 let _result = self.send_raw(result);
1869 if _result.is_err() {
1870 self.control_handle.shutdown();
1871 }
1872 self.drop_without_shutdown();
1873 _result
1874 }
1875
1876 pub fn send_no_shutdown_on_err(
1878 self,
1879 mut result: Result<(), RestartError>,
1880 ) -> Result<(), fidl::Error> {
1881 let _result = self.send_raw(result);
1882 self.drop_without_shutdown();
1883 _result
1884 }
1885
1886 fn send_raw(&self, mut result: Result<(), RestartError>) -> Result<(), fidl::Error> {
1887 self.control_handle.inner.send::<fidl::encoding::ResultType<
1888 fidl::encoding::EmptyStruct,
1889 RestartError,
1890 >>(
1891 result,
1892 self.tx_id,
1893 0x50cd09e53189e5ae,
1894 fidl::encoding::DynamicFlags::empty(),
1895 )
1896 }
1897}
1898
1899mod internal {
1900 use super::*;
1901}