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 { Some((responder)) } else { None }
1152 }
1153
1154 #[allow(irrefutable_let_patterns)]
1155 pub fn into_restart(self) -> Option<(LifecycleRestartResponder)> {
1156 if let LifecycleRequest::Restart { responder } = self { Some((responder)) } else { None }
1157 }
1158
1159 pub fn method_name(&self) -> &'static str {
1161 match *self {
1162 LifecycleRequest::Start { .. } => "start",
1163 LifecycleRequest::Stop { .. } => "stop",
1164 LifecycleRequest::Restart { .. } => "restart",
1165 LifecycleRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1166 "unknown one-way method"
1167 }
1168 LifecycleRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1169 "unknown two-way method"
1170 }
1171 }
1172 }
1173}
1174
1175#[derive(Debug, Clone)]
1176pub struct LifecycleControlHandle {
1177 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1178}
1179
1180impl fidl::endpoints::ControlHandle for LifecycleControlHandle {
1181 fn shutdown(&self) {
1182 self.inner.shutdown()
1183 }
1184 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1185 self.inner.shutdown_with_epitaph(status)
1186 }
1187
1188 fn is_closed(&self) -> bool {
1189 self.inner.channel().is_closed()
1190 }
1191 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1192 self.inner.channel().on_closed()
1193 }
1194
1195 #[cfg(target_os = "fuchsia")]
1196 fn signal_peer(
1197 &self,
1198 clear_mask: zx::Signals,
1199 set_mask: zx::Signals,
1200 ) -> Result<(), zx_status::Status> {
1201 use fidl::Peered;
1202 self.inner.channel().signal_peer(clear_mask, set_mask)
1203 }
1204}
1205
1206impl LifecycleControlHandle {}
1207
1208#[must_use = "FIDL methods require a response to be sent"]
1209#[derive(Debug)]
1210pub struct LifecycleStartResponder {
1211 control_handle: std::mem::ManuallyDrop<LifecycleControlHandle>,
1212 tx_id: u32,
1213}
1214
1215impl std::ops::Drop for LifecycleStartResponder {
1219 fn drop(&mut self) {
1220 self.control_handle.shutdown();
1221 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1223 }
1224}
1225
1226impl fidl::endpoints::Responder for LifecycleStartResponder {
1227 type ControlHandle = LifecycleControlHandle;
1228
1229 fn control_handle(&self) -> &LifecycleControlHandle {
1230 &self.control_handle
1231 }
1232
1233 fn drop_without_shutdown(mut self) {
1234 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1236 std::mem::forget(self);
1238 }
1239}
1240
1241impl LifecycleStartResponder {
1242 pub fn send(self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1246 let _result = self.send_raw(result);
1247 if _result.is_err() {
1248 self.control_handle.shutdown();
1249 }
1250 self.drop_without_shutdown();
1251 _result
1252 }
1253
1254 pub fn send_no_shutdown_on_err(
1256 self,
1257 mut result: Result<(), LifecycleError>,
1258 ) -> Result<(), fidl::Error> {
1259 let _result = self.send_raw(result);
1260 self.drop_without_shutdown();
1261 _result
1262 }
1263
1264 fn send_raw(&self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1265 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1266 fidl::encoding::EmptyStruct,
1267 LifecycleError,
1268 >>(
1269 fidl::encoding::FlexibleResult::new(result),
1270 self.tx_id,
1271 0x2fda381d2cc41ce0,
1272 fidl::encoding::DynamicFlags::FLEXIBLE,
1273 )
1274 }
1275}
1276
1277#[must_use = "FIDL methods require a response to be sent"]
1278#[derive(Debug)]
1279pub struct LifecycleStopResponder {
1280 control_handle: std::mem::ManuallyDrop<LifecycleControlHandle>,
1281 tx_id: u32,
1282}
1283
1284impl std::ops::Drop for LifecycleStopResponder {
1288 fn drop(&mut self) {
1289 self.control_handle.shutdown();
1290 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1292 }
1293}
1294
1295impl fidl::endpoints::Responder for LifecycleStopResponder {
1296 type ControlHandle = LifecycleControlHandle;
1297
1298 fn control_handle(&self) -> &LifecycleControlHandle {
1299 &self.control_handle
1300 }
1301
1302 fn drop_without_shutdown(mut self) {
1303 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1305 std::mem::forget(self);
1307 }
1308}
1309
1310impl LifecycleStopResponder {
1311 pub fn send(self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1315 let _result = self.send_raw(result);
1316 if _result.is_err() {
1317 self.control_handle.shutdown();
1318 }
1319 self.drop_without_shutdown();
1320 _result
1321 }
1322
1323 pub fn send_no_shutdown_on_err(
1325 self,
1326 mut result: Result<(), LifecycleError>,
1327 ) -> Result<(), fidl::Error> {
1328 let _result = self.send_raw(result);
1329 self.drop_without_shutdown();
1330 _result
1331 }
1332
1333 fn send_raw(&self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1334 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1335 fidl::encoding::EmptyStruct,
1336 LifecycleError,
1337 >>(
1338 fidl::encoding::FlexibleResult::new(result),
1339 self.tx_id,
1340 0x453a9158431b4a2,
1341 fidl::encoding::DynamicFlags::FLEXIBLE,
1342 )
1343 }
1344}
1345
1346#[must_use = "FIDL methods require a response to be sent"]
1347#[derive(Debug)]
1348pub struct LifecycleRestartResponder {
1349 control_handle: std::mem::ManuallyDrop<LifecycleControlHandle>,
1350 tx_id: u32,
1351}
1352
1353impl std::ops::Drop for LifecycleRestartResponder {
1357 fn drop(&mut self) {
1358 self.control_handle.shutdown();
1359 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1361 }
1362}
1363
1364impl fidl::endpoints::Responder for LifecycleRestartResponder {
1365 type ControlHandle = LifecycleControlHandle;
1366
1367 fn control_handle(&self) -> &LifecycleControlHandle {
1368 &self.control_handle
1369 }
1370
1371 fn drop_without_shutdown(mut self) {
1372 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1374 std::mem::forget(self);
1376 }
1377}
1378
1379impl LifecycleRestartResponder {
1380 pub fn send(self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1384 let _result = self.send_raw(result);
1385 if _result.is_err() {
1386 self.control_handle.shutdown();
1387 }
1388 self.drop_without_shutdown();
1389 _result
1390 }
1391
1392 pub fn send_no_shutdown_on_err(
1394 self,
1395 mut result: Result<(), LifecycleError>,
1396 ) -> Result<(), fidl::Error> {
1397 let _result = self.send_raw(result);
1398 self.drop_without_shutdown();
1399 _result
1400 }
1401
1402 fn send_raw(&self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1403 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1404 fidl::encoding::EmptyStruct,
1405 LifecycleError,
1406 >>(
1407 fidl::encoding::FlexibleResult::new(result),
1408 self.tx_id,
1409 0x31faeac257bf1abb,
1410 fidl::encoding::DynamicFlags::FLEXIBLE,
1411 )
1412 }
1413}
1414
1415#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1416pub struct RestarterMarker;
1417
1418impl fidl::endpoints::ProtocolMarker for RestarterMarker {
1419 type Proxy = RestarterProxy;
1420 type RequestStream = RestarterRequestStream;
1421 #[cfg(target_os = "fuchsia")]
1422 type SynchronousProxy = RestarterSynchronousProxy;
1423
1424 const DEBUG_NAME: &'static str = "fuchsia.session.Restarter";
1425}
1426impl fidl::endpoints::DiscoverableProtocolMarker for RestarterMarker {}
1427pub type RestarterRestartResult = Result<(), RestartError>;
1428
1429pub trait RestarterProxyInterface: Send + Sync {
1430 type RestartResponseFut: std::future::Future<Output = Result<RestarterRestartResult, fidl::Error>>
1431 + Send;
1432 fn r#restart(&self) -> Self::RestartResponseFut;
1433}
1434#[derive(Debug)]
1435#[cfg(target_os = "fuchsia")]
1436pub struct RestarterSynchronousProxy {
1437 client: fidl::client::sync::Client,
1438}
1439
1440#[cfg(target_os = "fuchsia")]
1441impl fidl::endpoints::SynchronousProxy for RestarterSynchronousProxy {
1442 type Proxy = RestarterProxy;
1443 type Protocol = RestarterMarker;
1444
1445 fn from_channel(inner: fidl::Channel) -> Self {
1446 Self::new(inner)
1447 }
1448
1449 fn into_channel(self) -> fidl::Channel {
1450 self.client.into_channel()
1451 }
1452
1453 fn as_channel(&self) -> &fidl::Channel {
1454 self.client.as_channel()
1455 }
1456}
1457
1458#[cfg(target_os = "fuchsia")]
1459impl RestarterSynchronousProxy {
1460 pub fn new(channel: fidl::Channel) -> Self {
1461 let protocol_name = <RestarterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1462 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1463 }
1464
1465 pub fn into_channel(self) -> fidl::Channel {
1466 self.client.into_channel()
1467 }
1468
1469 pub fn wait_for_event(
1472 &self,
1473 deadline: zx::MonotonicInstant,
1474 ) -> Result<RestarterEvent, fidl::Error> {
1475 RestarterEvent::decode(self.client.wait_for_event(deadline)?)
1476 }
1477
1478 pub fn r#restart(
1487 &self,
1488 ___deadline: zx::MonotonicInstant,
1489 ) -> Result<RestarterRestartResult, fidl::Error> {
1490 let _response = self.client.send_query::<
1491 fidl::encoding::EmptyPayload,
1492 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RestartError>,
1493 >(
1494 (),
1495 0x50cd09e53189e5ae,
1496 fidl::encoding::DynamicFlags::empty(),
1497 ___deadline,
1498 )?;
1499 Ok(_response.map(|x| x))
1500 }
1501}
1502
1503#[cfg(target_os = "fuchsia")]
1504impl From<RestarterSynchronousProxy> for zx::Handle {
1505 fn from(value: RestarterSynchronousProxy) -> Self {
1506 value.into_channel().into()
1507 }
1508}
1509
1510#[cfg(target_os = "fuchsia")]
1511impl From<fidl::Channel> for RestarterSynchronousProxy {
1512 fn from(value: fidl::Channel) -> Self {
1513 Self::new(value)
1514 }
1515}
1516
1517#[cfg(target_os = "fuchsia")]
1518impl fidl::endpoints::FromClient for RestarterSynchronousProxy {
1519 type Protocol = RestarterMarker;
1520
1521 fn from_client(value: fidl::endpoints::ClientEnd<RestarterMarker>) -> Self {
1522 Self::new(value.into_channel())
1523 }
1524}
1525
1526#[derive(Debug, Clone)]
1527pub struct RestarterProxy {
1528 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1529}
1530
1531impl fidl::endpoints::Proxy for RestarterProxy {
1532 type Protocol = RestarterMarker;
1533
1534 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1535 Self::new(inner)
1536 }
1537
1538 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1539 self.client.into_channel().map_err(|client| Self { client })
1540 }
1541
1542 fn as_channel(&self) -> &::fidl::AsyncChannel {
1543 self.client.as_channel()
1544 }
1545}
1546
1547impl RestarterProxy {
1548 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1550 let protocol_name = <RestarterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1551 Self { client: fidl::client::Client::new(channel, protocol_name) }
1552 }
1553
1554 pub fn take_event_stream(&self) -> RestarterEventStream {
1560 RestarterEventStream { event_receiver: self.client.take_event_receiver() }
1561 }
1562
1563 pub fn r#restart(
1572 &self,
1573 ) -> fidl::client::QueryResponseFut<
1574 RestarterRestartResult,
1575 fidl::encoding::DefaultFuchsiaResourceDialect,
1576 > {
1577 RestarterProxyInterface::r#restart(self)
1578 }
1579}
1580
1581impl RestarterProxyInterface for RestarterProxy {
1582 type RestartResponseFut = fidl::client::QueryResponseFut<
1583 RestarterRestartResult,
1584 fidl::encoding::DefaultFuchsiaResourceDialect,
1585 >;
1586 fn r#restart(&self) -> Self::RestartResponseFut {
1587 fn _decode(
1588 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1589 ) -> Result<RestarterRestartResult, fidl::Error> {
1590 let _response = fidl::client::decode_transaction_body::<
1591 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RestartError>,
1592 fidl::encoding::DefaultFuchsiaResourceDialect,
1593 0x50cd09e53189e5ae,
1594 >(_buf?)?;
1595 Ok(_response.map(|x| x))
1596 }
1597 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, RestarterRestartResult>(
1598 (),
1599 0x50cd09e53189e5ae,
1600 fidl::encoding::DynamicFlags::empty(),
1601 _decode,
1602 )
1603 }
1604}
1605
1606pub struct RestarterEventStream {
1607 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1608}
1609
1610impl std::marker::Unpin for RestarterEventStream {}
1611
1612impl futures::stream::FusedStream for RestarterEventStream {
1613 fn is_terminated(&self) -> bool {
1614 self.event_receiver.is_terminated()
1615 }
1616}
1617
1618impl futures::Stream for RestarterEventStream {
1619 type Item = Result<RestarterEvent, fidl::Error>;
1620
1621 fn poll_next(
1622 mut self: std::pin::Pin<&mut Self>,
1623 cx: &mut std::task::Context<'_>,
1624 ) -> std::task::Poll<Option<Self::Item>> {
1625 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1626 &mut self.event_receiver,
1627 cx
1628 )?) {
1629 Some(buf) => std::task::Poll::Ready(Some(RestarterEvent::decode(buf))),
1630 None => std::task::Poll::Ready(None),
1631 }
1632 }
1633}
1634
1635#[derive(Debug)]
1636pub enum RestarterEvent {}
1637
1638impl RestarterEvent {
1639 fn decode(
1641 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1642 ) -> Result<RestarterEvent, fidl::Error> {
1643 let (bytes, _handles) = buf.split_mut();
1644 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1645 debug_assert_eq!(tx_header.tx_id, 0);
1646 match tx_header.ordinal {
1647 _ => Err(fidl::Error::UnknownOrdinal {
1648 ordinal: tx_header.ordinal,
1649 protocol_name: <RestarterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1650 }),
1651 }
1652 }
1653}
1654
1655pub struct RestarterRequestStream {
1657 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1658 is_terminated: bool,
1659}
1660
1661impl std::marker::Unpin for RestarterRequestStream {}
1662
1663impl futures::stream::FusedStream for RestarterRequestStream {
1664 fn is_terminated(&self) -> bool {
1665 self.is_terminated
1666 }
1667}
1668
1669impl fidl::endpoints::RequestStream for RestarterRequestStream {
1670 type Protocol = RestarterMarker;
1671 type ControlHandle = RestarterControlHandle;
1672
1673 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1674 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1675 }
1676
1677 fn control_handle(&self) -> Self::ControlHandle {
1678 RestarterControlHandle { inner: self.inner.clone() }
1679 }
1680
1681 fn into_inner(
1682 self,
1683 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1684 {
1685 (self.inner, self.is_terminated)
1686 }
1687
1688 fn from_inner(
1689 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1690 is_terminated: bool,
1691 ) -> Self {
1692 Self { inner, is_terminated }
1693 }
1694}
1695
1696impl futures::Stream for RestarterRequestStream {
1697 type Item = Result<RestarterRequest, fidl::Error>;
1698
1699 fn poll_next(
1700 mut self: std::pin::Pin<&mut Self>,
1701 cx: &mut std::task::Context<'_>,
1702 ) -> std::task::Poll<Option<Self::Item>> {
1703 let this = &mut *self;
1704 if this.inner.check_shutdown(cx) {
1705 this.is_terminated = true;
1706 return std::task::Poll::Ready(None);
1707 }
1708 if this.is_terminated {
1709 panic!("polled RestarterRequestStream after completion");
1710 }
1711 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1712 |bytes, handles| {
1713 match this.inner.channel().read_etc(cx, bytes, handles) {
1714 std::task::Poll::Ready(Ok(())) => {}
1715 std::task::Poll::Pending => return std::task::Poll::Pending,
1716 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1717 this.is_terminated = true;
1718 return std::task::Poll::Ready(None);
1719 }
1720 std::task::Poll::Ready(Err(e)) => {
1721 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1722 e.into(),
1723 ))));
1724 }
1725 }
1726
1727 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1729
1730 std::task::Poll::Ready(Some(match header.ordinal {
1731 0x50cd09e53189e5ae => {
1732 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1733 let mut req = fidl::new_empty!(
1734 fidl::encoding::EmptyPayload,
1735 fidl::encoding::DefaultFuchsiaResourceDialect
1736 );
1737 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1738 let control_handle = RestarterControlHandle { inner: this.inner.clone() };
1739 Ok(RestarterRequest::Restart {
1740 responder: RestarterRestartResponder {
1741 control_handle: std::mem::ManuallyDrop::new(control_handle),
1742 tx_id: header.tx_id,
1743 },
1744 })
1745 }
1746 _ => Err(fidl::Error::UnknownOrdinal {
1747 ordinal: header.ordinal,
1748 protocol_name:
1749 <RestarterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1750 }),
1751 }))
1752 },
1753 )
1754 }
1755}
1756
1757#[derive(Debug)]
1759pub enum RestarterRequest {
1760 Restart { responder: RestarterRestartResponder },
1769}
1770
1771impl RestarterRequest {
1772 #[allow(irrefutable_let_patterns)]
1773 pub fn into_restart(self) -> Option<(RestarterRestartResponder)> {
1774 if let RestarterRequest::Restart { responder } = self { Some((responder)) } else { None }
1775 }
1776
1777 pub fn method_name(&self) -> &'static str {
1779 match *self {
1780 RestarterRequest::Restart { .. } => "restart",
1781 }
1782 }
1783}
1784
1785#[derive(Debug, Clone)]
1786pub struct RestarterControlHandle {
1787 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1788}
1789
1790impl fidl::endpoints::ControlHandle for RestarterControlHandle {
1791 fn shutdown(&self) {
1792 self.inner.shutdown()
1793 }
1794 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1795 self.inner.shutdown_with_epitaph(status)
1796 }
1797
1798 fn is_closed(&self) -> bool {
1799 self.inner.channel().is_closed()
1800 }
1801 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1802 self.inner.channel().on_closed()
1803 }
1804
1805 #[cfg(target_os = "fuchsia")]
1806 fn signal_peer(
1807 &self,
1808 clear_mask: zx::Signals,
1809 set_mask: zx::Signals,
1810 ) -> Result<(), zx_status::Status> {
1811 use fidl::Peered;
1812 self.inner.channel().signal_peer(clear_mask, set_mask)
1813 }
1814}
1815
1816impl RestarterControlHandle {}
1817
1818#[must_use = "FIDL methods require a response to be sent"]
1819#[derive(Debug)]
1820pub struct RestarterRestartResponder {
1821 control_handle: std::mem::ManuallyDrop<RestarterControlHandle>,
1822 tx_id: u32,
1823}
1824
1825impl std::ops::Drop for RestarterRestartResponder {
1829 fn drop(&mut self) {
1830 self.control_handle.shutdown();
1831 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1833 }
1834}
1835
1836impl fidl::endpoints::Responder for RestarterRestartResponder {
1837 type ControlHandle = RestarterControlHandle;
1838
1839 fn control_handle(&self) -> &RestarterControlHandle {
1840 &self.control_handle
1841 }
1842
1843 fn drop_without_shutdown(mut self) {
1844 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1846 std::mem::forget(self);
1848 }
1849}
1850
1851impl RestarterRestartResponder {
1852 pub fn send(self, mut result: Result<(), RestartError>) -> Result<(), fidl::Error> {
1856 let _result = self.send_raw(result);
1857 if _result.is_err() {
1858 self.control_handle.shutdown();
1859 }
1860 self.drop_without_shutdown();
1861 _result
1862 }
1863
1864 pub fn send_no_shutdown_on_err(
1866 self,
1867 mut result: Result<(), RestartError>,
1868 ) -> Result<(), fidl::Error> {
1869 let _result = self.send_raw(result);
1870 self.drop_without_shutdown();
1871 _result
1872 }
1873
1874 fn send_raw(&self, mut result: Result<(), RestartError>) -> Result<(), fidl::Error> {
1875 self.control_handle.inner.send::<fidl::encoding::ResultType<
1876 fidl::encoding::EmptyStruct,
1877 RestartError,
1878 >>(
1879 result,
1880 self.tx_id,
1881 0x50cd09e53189e5ae,
1882 fidl::encoding::DynamicFlags::empty(),
1883 )
1884 }
1885}
1886
1887mod internal {
1888 use super::*;
1889}