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