fidl_fuchsia_session/
fidl_fuchsia_session.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![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    /// Waits until an event arrives and returns it. It is safe for other
69    /// threads to make concurrent requests while waiting for an event.
70    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    /// Launches the session detailed in `configuration`.
78    ///
79    /// If a session is currently running, the component associated with the running
80    /// session will be destroyed.
81    ///
82    /// + `configuration` describes the session to launch.
83    /// * error `LaunchError.INVALID_ARGS` if `configuration.session_url` is not set.
84    /// * error `LaunchError.NOT_FOUND` if `configuration.session_url`
85    ///   could not be resolved.
86    /// * error `LaunchError.DESTROY_COMPONENT_FAILED` if an existing session component
87    ///   could not be destroyed. The existing session remains running at this point.
88    /// * error `LaunchError.CREATE_COMPONENT_FAILED` if the session component
89    ///   could not be started. No session will be running at this point.
90    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#[derive(Debug, Clone)]
109pub struct LauncherProxy {
110    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
111}
112
113impl fidl::endpoints::Proxy for LauncherProxy {
114    type Protocol = LauncherMarker;
115
116    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
117        Self::new(inner)
118    }
119
120    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
121        self.client.into_channel().map_err(|client| Self { client })
122    }
123
124    fn as_channel(&self) -> &::fidl::AsyncChannel {
125        self.client.as_channel()
126    }
127}
128
129impl LauncherProxy {
130    /// Create a new Proxy for fuchsia.session/Launcher.
131    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
132        let protocol_name = <LauncherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
133        Self { client: fidl::client::Client::new(channel, protocol_name) }
134    }
135
136    /// Get a Stream of events from the remote end of the protocol.
137    ///
138    /// # Panics
139    ///
140    /// Panics if the event stream was already taken.
141    pub fn take_event_stream(&self) -> LauncherEventStream {
142        LauncherEventStream { event_receiver: self.client.take_event_receiver() }
143    }
144
145    /// Launches the session detailed in `configuration`.
146    ///
147    /// If a session is currently running, the component associated with the running
148    /// session will be destroyed.
149    ///
150    /// + `configuration` describes the session to launch.
151    /// * error `LaunchError.INVALID_ARGS` if `configuration.session_url` is not set.
152    /// * error `LaunchError.NOT_FOUND` if `configuration.session_url`
153    ///   could not be resolved.
154    /// * error `LaunchError.DESTROY_COMPONENT_FAILED` if an existing session component
155    ///   could not be destroyed. The existing session remains running at this point.
156    /// * error `LaunchError.CREATE_COMPONENT_FAILED` if the session component
157    ///   could not be started. No session will be running at this point.
158    pub fn r#launch(
159        &self,
160        mut configuration: &LaunchConfiguration,
161    ) -> fidl::client::QueryResponseFut<
162        LauncherLaunchResult,
163        fidl::encoding::DefaultFuchsiaResourceDialect,
164    > {
165        LauncherProxyInterface::r#launch(self, configuration)
166    }
167}
168
169impl LauncherProxyInterface for LauncherProxy {
170    type LaunchResponseFut = fidl::client::QueryResponseFut<
171        LauncherLaunchResult,
172        fidl::encoding::DefaultFuchsiaResourceDialect,
173    >;
174    fn r#launch(&self, mut configuration: &LaunchConfiguration) -> Self::LaunchResponseFut {
175        fn _decode(
176            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
177        ) -> Result<LauncherLaunchResult, fidl::Error> {
178            let _response = fidl::client::decode_transaction_body::<
179                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, LaunchError>,
180                fidl::encoding::DefaultFuchsiaResourceDialect,
181                0x7674a4287f8a385a,
182            >(_buf?)?;
183            Ok(_response.map(|x| x))
184        }
185        self.client.send_query_and_decode::<LauncherLaunchRequest, LauncherLaunchResult>(
186            (configuration,),
187            0x7674a4287f8a385a,
188            fidl::encoding::DynamicFlags::empty(),
189            _decode,
190        )
191    }
192}
193
194pub struct LauncherEventStream {
195    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
196}
197
198impl std::marker::Unpin for LauncherEventStream {}
199
200impl futures::stream::FusedStream for LauncherEventStream {
201    fn is_terminated(&self) -> bool {
202        self.event_receiver.is_terminated()
203    }
204}
205
206impl futures::Stream for LauncherEventStream {
207    type Item = Result<LauncherEvent, fidl::Error>;
208
209    fn poll_next(
210        mut self: std::pin::Pin<&mut Self>,
211        cx: &mut std::task::Context<'_>,
212    ) -> std::task::Poll<Option<Self::Item>> {
213        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
214            &mut self.event_receiver,
215            cx
216        )?) {
217            Some(buf) => std::task::Poll::Ready(Some(LauncherEvent::decode(buf))),
218            None => std::task::Poll::Ready(None),
219        }
220    }
221}
222
223#[derive(Debug)]
224pub enum LauncherEvent {}
225
226impl LauncherEvent {
227    /// Decodes a message buffer as a [`LauncherEvent`].
228    fn decode(
229        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
230    ) -> Result<LauncherEvent, fidl::Error> {
231        let (bytes, _handles) = buf.split_mut();
232        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
233        debug_assert_eq!(tx_header.tx_id, 0);
234        match tx_header.ordinal {
235            _ => Err(fidl::Error::UnknownOrdinal {
236                ordinal: tx_header.ordinal,
237                protocol_name: <LauncherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
238            }),
239        }
240    }
241}
242
243/// A Stream of incoming requests for fuchsia.session/Launcher.
244pub struct LauncherRequestStream {
245    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
246    is_terminated: bool,
247}
248
249impl std::marker::Unpin for LauncherRequestStream {}
250
251impl futures::stream::FusedStream for LauncherRequestStream {
252    fn is_terminated(&self) -> bool {
253        self.is_terminated
254    }
255}
256
257impl fidl::endpoints::RequestStream for LauncherRequestStream {
258    type Protocol = LauncherMarker;
259    type ControlHandle = LauncherControlHandle;
260
261    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
262        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
263    }
264
265    fn control_handle(&self) -> Self::ControlHandle {
266        LauncherControlHandle { inner: self.inner.clone() }
267    }
268
269    fn into_inner(
270        self,
271    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
272    {
273        (self.inner, self.is_terminated)
274    }
275
276    fn from_inner(
277        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
278        is_terminated: bool,
279    ) -> Self {
280        Self { inner, is_terminated }
281    }
282}
283
284impl futures::Stream for LauncherRequestStream {
285    type Item = Result<LauncherRequest, fidl::Error>;
286
287    fn poll_next(
288        mut self: std::pin::Pin<&mut Self>,
289        cx: &mut std::task::Context<'_>,
290    ) -> std::task::Poll<Option<Self::Item>> {
291        let this = &mut *self;
292        if this.inner.check_shutdown(cx) {
293            this.is_terminated = true;
294            return std::task::Poll::Ready(None);
295        }
296        if this.is_terminated {
297            panic!("polled LauncherRequestStream after completion");
298        }
299        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
300            |bytes, handles| {
301                match this.inner.channel().read_etc(cx, bytes, handles) {
302                    std::task::Poll::Ready(Ok(())) => {}
303                    std::task::Poll::Pending => return std::task::Poll::Pending,
304                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
305                        this.is_terminated = true;
306                        return std::task::Poll::Ready(None);
307                    }
308                    std::task::Poll::Ready(Err(e)) => {
309                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
310                            e.into(),
311                        ))))
312                    }
313                }
314
315                // A message has been received from the channel
316                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
317
318                std::task::Poll::Ready(Some(match header.ordinal {
319                    0x7674a4287f8a385a => {
320                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
321                        let mut req = fidl::new_empty!(
322                            LauncherLaunchRequest,
323                            fidl::encoding::DefaultFuchsiaResourceDialect
324                        );
325                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LauncherLaunchRequest>(&header, _body_bytes, handles, &mut req)?;
326                        let control_handle = LauncherControlHandle { inner: this.inner.clone() };
327                        Ok(LauncherRequest::Launch {
328                            configuration: req.configuration,
329
330                            responder: LauncherLaunchResponder {
331                                control_handle: std::mem::ManuallyDrop::new(control_handle),
332                                tx_id: header.tx_id,
333                            },
334                        })
335                    }
336                    _ => Err(fidl::Error::UnknownOrdinal {
337                        ordinal: header.ordinal,
338                        protocol_name:
339                            <LauncherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
340                    }),
341                }))
342            },
343        )
344    }
345}
346
347/// A protocol used to launch sessions.
348#[derive(Debug)]
349pub enum LauncherRequest {
350    /// Launches the session detailed in `configuration`.
351    ///
352    /// If a session is currently running, the component associated with the running
353    /// session will be destroyed.
354    ///
355    /// + `configuration` describes the session to launch.
356    /// * error `LaunchError.INVALID_ARGS` if `configuration.session_url` is not set.
357    /// * error `LaunchError.NOT_FOUND` if `configuration.session_url`
358    ///   could not be resolved.
359    /// * error `LaunchError.DESTROY_COMPONENT_FAILED` if an existing session component
360    ///   could not be destroyed. The existing session remains running at this point.
361    /// * error `LaunchError.CREATE_COMPONENT_FAILED` if the session component
362    ///   could not be started. No session will be running at this point.
363    Launch { configuration: LaunchConfiguration, responder: LauncherLaunchResponder },
364}
365
366impl LauncherRequest {
367    #[allow(irrefutable_let_patterns)]
368    pub fn into_launch(self) -> Option<(LaunchConfiguration, LauncherLaunchResponder)> {
369        if let LauncherRequest::Launch { configuration, responder } = self {
370            Some((configuration, responder))
371        } else {
372            None
373        }
374    }
375
376    /// Name of the method defined in FIDL
377    pub fn method_name(&self) -> &'static str {
378        match *self {
379            LauncherRequest::Launch { .. } => "launch",
380        }
381    }
382}
383
384#[derive(Debug, Clone)]
385pub struct LauncherControlHandle {
386    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
387}
388
389impl fidl::endpoints::ControlHandle for LauncherControlHandle {
390    fn shutdown(&self) {
391        self.inner.shutdown()
392    }
393    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
394        self.inner.shutdown_with_epitaph(status)
395    }
396
397    fn is_closed(&self) -> bool {
398        self.inner.channel().is_closed()
399    }
400    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
401        self.inner.channel().on_closed()
402    }
403
404    #[cfg(target_os = "fuchsia")]
405    fn signal_peer(
406        &self,
407        clear_mask: zx::Signals,
408        set_mask: zx::Signals,
409    ) -> Result<(), zx_status::Status> {
410        use fidl::Peered;
411        self.inner.channel().signal_peer(clear_mask, set_mask)
412    }
413}
414
415impl LauncherControlHandle {}
416
417#[must_use = "FIDL methods require a response to be sent"]
418#[derive(Debug)]
419pub struct LauncherLaunchResponder {
420    control_handle: std::mem::ManuallyDrop<LauncherControlHandle>,
421    tx_id: u32,
422}
423
424/// Set the the channel to be shutdown (see [`LauncherControlHandle::shutdown`])
425/// if the responder is dropped without sending a response, so that the client
426/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
427impl std::ops::Drop for LauncherLaunchResponder {
428    fn drop(&mut self) {
429        self.control_handle.shutdown();
430        // Safety: drops once, never accessed again
431        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
432    }
433}
434
435impl fidl::endpoints::Responder for LauncherLaunchResponder {
436    type ControlHandle = LauncherControlHandle;
437
438    fn control_handle(&self) -> &LauncherControlHandle {
439        &self.control_handle
440    }
441
442    fn drop_without_shutdown(mut self) {
443        // Safety: drops once, never accessed again due to mem::forget
444        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
445        // Prevent Drop from running (which would shut down the channel)
446        std::mem::forget(self);
447    }
448}
449
450impl LauncherLaunchResponder {
451    /// Sends a response to the FIDL transaction.
452    ///
453    /// Sets the channel to shutdown if an error occurs.
454    pub fn send(self, mut result: Result<(), LaunchError>) -> Result<(), fidl::Error> {
455        let _result = self.send_raw(result);
456        if _result.is_err() {
457            self.control_handle.shutdown();
458        }
459        self.drop_without_shutdown();
460        _result
461    }
462
463    /// Similar to "send" but does not shutdown the channel if an error occurs.
464    pub fn send_no_shutdown_on_err(
465        self,
466        mut result: Result<(), LaunchError>,
467    ) -> Result<(), fidl::Error> {
468        let _result = self.send_raw(result);
469        self.drop_without_shutdown();
470        _result
471    }
472
473    fn send_raw(&self, mut result: Result<(), LaunchError>) -> Result<(), fidl::Error> {
474        self.control_handle.inner.send::<fidl::encoding::ResultType<
475            fidl::encoding::EmptyStruct,
476            LaunchError,
477        >>(
478            result,
479            self.tx_id,
480            0x7674a4287f8a385a,
481            fidl::encoding::DynamicFlags::empty(),
482        )
483    }
484}
485
486#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
487pub struct LifecycleMarker;
488
489impl fidl::endpoints::ProtocolMarker for LifecycleMarker {
490    type Proxy = LifecycleProxy;
491    type RequestStream = LifecycleRequestStream;
492    #[cfg(target_os = "fuchsia")]
493    type SynchronousProxy = LifecycleSynchronousProxy;
494
495    const DEBUG_NAME: &'static str = "fuchsia.session.Lifecycle";
496}
497impl fidl::endpoints::DiscoverableProtocolMarker for LifecycleMarker {}
498pub type LifecycleStartResult = Result<(), LifecycleError>;
499pub type LifecycleStopResult = Result<(), LifecycleError>;
500pub type LifecycleRestartResult = Result<(), LifecycleError>;
501
502pub trait LifecycleProxyInterface: Send + Sync {
503    type StartResponseFut: std::future::Future<Output = Result<LifecycleStartResult, fidl::Error>>
504        + Send;
505    fn r#start(&self, payload: &LifecycleStartRequest) -> Self::StartResponseFut;
506    type StopResponseFut: std::future::Future<Output = Result<LifecycleStopResult, fidl::Error>>
507        + Send;
508    fn r#stop(&self) -> Self::StopResponseFut;
509    type RestartResponseFut: std::future::Future<Output = Result<LifecycleRestartResult, fidl::Error>>
510        + Send;
511    fn r#restart(&self) -> Self::RestartResponseFut;
512}
513#[derive(Debug)]
514#[cfg(target_os = "fuchsia")]
515pub struct LifecycleSynchronousProxy {
516    client: fidl::client::sync::Client,
517}
518
519#[cfg(target_os = "fuchsia")]
520impl fidl::endpoints::SynchronousProxy for LifecycleSynchronousProxy {
521    type Proxy = LifecycleProxy;
522    type Protocol = LifecycleMarker;
523
524    fn from_channel(inner: fidl::Channel) -> Self {
525        Self::new(inner)
526    }
527
528    fn into_channel(self) -> fidl::Channel {
529        self.client.into_channel()
530    }
531
532    fn as_channel(&self) -> &fidl::Channel {
533        self.client.as_channel()
534    }
535}
536
537#[cfg(target_os = "fuchsia")]
538impl LifecycleSynchronousProxy {
539    pub fn new(channel: fidl::Channel) -> Self {
540        let protocol_name = <LifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
541        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
542    }
543
544    pub fn into_channel(self) -> fidl::Channel {
545        self.client.into_channel()
546    }
547
548    /// Waits until an event arrives and returns it. It is safe for other
549    /// threads to make concurrent requests while waiting for an event.
550    pub fn wait_for_event(
551        &self,
552        deadline: zx::MonotonicInstant,
553    ) -> Result<LifecycleEvent, fidl::Error> {
554        LifecycleEvent::decode(self.client.wait_for_event(deadline)?)
555    }
556
557    /// Starts the session.
558    ///
559    /// Returns after the session component has been created and started.
560    ///
561    /// * error `LifecycleError.NOT_FOUND` if `session_url` has not been provided
562    ///   and there is no configured default session URL.
563    /// * error `LifecycleError.ALREADY_STARTED` if a session has already been started.
564    /// * error `LifecycleError.RESOLVE_COMPONENT_FAILED` if `session_url` could not be
565    ///   resolved to a component.
566    /// * error `LifecycleError.DESTROY_COMPONENT_FAILED` if an existing session component
567    ///   could not be destroyed. The existing session remains running at this point.
568    /// * error `LifecycleError.CREATE_COMPONENT_FAILED` if the session component
569    ///   could not be started. No session will be running at this point.
570    pub fn r#start(
571        &self,
572        mut payload: &LifecycleStartRequest,
573        ___deadline: zx::MonotonicInstant,
574    ) -> Result<LifecycleStartResult, fidl::Error> {
575        let _response = self.client.send_query::<
576            LifecycleStartRequest,
577            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, LifecycleError>,
578        >(
579            payload,
580            0x2fda381d2cc41ce0,
581            fidl::encoding::DynamicFlags::FLEXIBLE,
582            ___deadline,
583        )?
584        .into_result::<LifecycleMarker>("start")?;
585        Ok(_response.map(|x| x))
586    }
587
588    /// Stops the session.
589    ///
590    /// Returns after the session component has been destroyed.
591    ///
592    /// * error `LifecycleError.NOT_FOUND` if the session has not been started.
593    /// * error `LifecycleError.DESTROY_COMPONENT_FAILED` if the session component
594    ///   could not be destroyed. The previous session will continue to exist at
595    ///   this point and the component may be running.
596    pub fn r#stop(
597        &self,
598        ___deadline: zx::MonotonicInstant,
599    ) -> Result<LifecycleStopResult, fidl::Error> {
600        let _response = self.client.send_query::<
601            fidl::encoding::EmptyPayload,
602            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, LifecycleError>,
603        >(
604            (),
605            0x453a9158431b4a2,
606            fidl::encoding::DynamicFlags::FLEXIBLE,
607            ___deadline,
608        )?
609        .into_result::<LifecycleMarker>("stop")?;
610        Ok(_response.map(|x| x))
611    }
612
613    /// Restarts the session.
614    ///
615    /// This stops the existing session and starts a new session with the same
616    /// session URL as the previous one.
617    ///
618    /// Returns once the new session component has been created and started.
619    ///
620    /// * error `LifecycleError.NOT_FOUND` if there is no existing session.
621    /// * error `LifecycleError.RESOLVE_COMPONENT_FAILED` if the session URL
622    ///   could not be resolved to a component.
623    /// * error `LifecycleError.DESTROY_COMPONENT_FAILED` if the session component
624    ///   could not be destroyed. The previous session will continue to exist at
625    ///   this point and the component may be running.
626    /// * error `LifecycleError.CREATE_COMPONENT_FAILED` if the session component
627    ///   could not be started. No session will be running at this point.
628    pub fn r#restart(
629        &self,
630        ___deadline: zx::MonotonicInstant,
631    ) -> Result<LifecycleRestartResult, fidl::Error> {
632        let _response = self.client.send_query::<
633            fidl::encoding::EmptyPayload,
634            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, LifecycleError>,
635        >(
636            (),
637            0x31faeac257bf1abb,
638            fidl::encoding::DynamicFlags::FLEXIBLE,
639            ___deadline,
640        )?
641        .into_result::<LifecycleMarker>("restart")?;
642        Ok(_response.map(|x| x))
643    }
644}
645
646#[derive(Debug, Clone)]
647pub struct LifecycleProxy {
648    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
649}
650
651impl fidl::endpoints::Proxy for LifecycleProxy {
652    type Protocol = LifecycleMarker;
653
654    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
655        Self::new(inner)
656    }
657
658    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
659        self.client.into_channel().map_err(|client| Self { client })
660    }
661
662    fn as_channel(&self) -> &::fidl::AsyncChannel {
663        self.client.as_channel()
664    }
665}
666
667impl LifecycleProxy {
668    /// Create a new Proxy for fuchsia.session/Lifecycle.
669    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
670        let protocol_name = <LifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
671        Self { client: fidl::client::Client::new(channel, protocol_name) }
672    }
673
674    /// Get a Stream of events from the remote end of the protocol.
675    ///
676    /// # Panics
677    ///
678    /// Panics if the event stream was already taken.
679    pub fn take_event_stream(&self) -> LifecycleEventStream {
680        LifecycleEventStream { event_receiver: self.client.take_event_receiver() }
681    }
682
683    /// Starts the session.
684    ///
685    /// Returns after the session component has been created and started.
686    ///
687    /// * error `LifecycleError.NOT_FOUND` if `session_url` has not been provided
688    ///   and there is no configured default session URL.
689    /// * error `LifecycleError.ALREADY_STARTED` if a session has already been started.
690    /// * error `LifecycleError.RESOLVE_COMPONENT_FAILED` if `session_url` could not be
691    ///   resolved to a component.
692    /// * error `LifecycleError.DESTROY_COMPONENT_FAILED` if an existing session component
693    ///   could not be destroyed. The existing session remains running at this point.
694    /// * error `LifecycleError.CREATE_COMPONENT_FAILED` if the session component
695    ///   could not be started. No session will be running at this point.
696    pub fn r#start(
697        &self,
698        mut payload: &LifecycleStartRequest,
699    ) -> fidl::client::QueryResponseFut<
700        LifecycleStartResult,
701        fidl::encoding::DefaultFuchsiaResourceDialect,
702    > {
703        LifecycleProxyInterface::r#start(self, payload)
704    }
705
706    /// Stops the session.
707    ///
708    /// Returns after the session component has been destroyed.
709    ///
710    /// * error `LifecycleError.NOT_FOUND` if the session has not been started.
711    /// * error `LifecycleError.DESTROY_COMPONENT_FAILED` if the session component
712    ///   could not be destroyed. The previous session will continue to exist at
713    ///   this point and the component may be running.
714    pub fn r#stop(
715        &self,
716    ) -> fidl::client::QueryResponseFut<
717        LifecycleStopResult,
718        fidl::encoding::DefaultFuchsiaResourceDialect,
719    > {
720        LifecycleProxyInterface::r#stop(self)
721    }
722
723    /// Restarts the session.
724    ///
725    /// This stops the existing session and starts a new session with the same
726    /// session URL as the previous one.
727    ///
728    /// Returns once the new session component has been created and started.
729    ///
730    /// * error `LifecycleError.NOT_FOUND` if there is no existing session.
731    /// * error `LifecycleError.RESOLVE_COMPONENT_FAILED` if the session URL
732    ///   could not be resolved to a component.
733    /// * error `LifecycleError.DESTROY_COMPONENT_FAILED` if the session component
734    ///   could not be destroyed. The previous session will continue to exist at
735    ///   this point and the component may be running.
736    /// * error `LifecycleError.CREATE_COMPONENT_FAILED` if the session component
737    ///   could not be started. No session will be running at this point.
738    pub fn r#restart(
739        &self,
740    ) -> fidl::client::QueryResponseFut<
741        LifecycleRestartResult,
742        fidl::encoding::DefaultFuchsiaResourceDialect,
743    > {
744        LifecycleProxyInterface::r#restart(self)
745    }
746}
747
748impl LifecycleProxyInterface for LifecycleProxy {
749    type StartResponseFut = fidl::client::QueryResponseFut<
750        LifecycleStartResult,
751        fidl::encoding::DefaultFuchsiaResourceDialect,
752    >;
753    fn r#start(&self, mut payload: &LifecycleStartRequest) -> Self::StartResponseFut {
754        fn _decode(
755            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
756        ) -> Result<LifecycleStartResult, fidl::Error> {
757            let _response = fidl::client::decode_transaction_body::<
758                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, LifecycleError>,
759                fidl::encoding::DefaultFuchsiaResourceDialect,
760                0x2fda381d2cc41ce0,
761            >(_buf?)?
762            .into_result::<LifecycleMarker>("start")?;
763            Ok(_response.map(|x| x))
764        }
765        self.client.send_query_and_decode::<LifecycleStartRequest, LifecycleStartResult>(
766            payload,
767            0x2fda381d2cc41ce0,
768            fidl::encoding::DynamicFlags::FLEXIBLE,
769            _decode,
770        )
771    }
772
773    type StopResponseFut = fidl::client::QueryResponseFut<
774        LifecycleStopResult,
775        fidl::encoding::DefaultFuchsiaResourceDialect,
776    >;
777    fn r#stop(&self) -> Self::StopResponseFut {
778        fn _decode(
779            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
780        ) -> Result<LifecycleStopResult, fidl::Error> {
781            let _response = fidl::client::decode_transaction_body::<
782                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, LifecycleError>,
783                fidl::encoding::DefaultFuchsiaResourceDialect,
784                0x453a9158431b4a2,
785            >(_buf?)?
786            .into_result::<LifecycleMarker>("stop")?;
787            Ok(_response.map(|x| x))
788        }
789        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, LifecycleStopResult>(
790            (),
791            0x453a9158431b4a2,
792            fidl::encoding::DynamicFlags::FLEXIBLE,
793            _decode,
794        )
795    }
796
797    type RestartResponseFut = fidl::client::QueryResponseFut<
798        LifecycleRestartResult,
799        fidl::encoding::DefaultFuchsiaResourceDialect,
800    >;
801    fn r#restart(&self) -> Self::RestartResponseFut {
802        fn _decode(
803            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
804        ) -> Result<LifecycleRestartResult, fidl::Error> {
805            let _response = fidl::client::decode_transaction_body::<
806                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, LifecycleError>,
807                fidl::encoding::DefaultFuchsiaResourceDialect,
808                0x31faeac257bf1abb,
809            >(_buf?)?
810            .into_result::<LifecycleMarker>("restart")?;
811            Ok(_response.map(|x| x))
812        }
813        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, LifecycleRestartResult>(
814            (),
815            0x31faeac257bf1abb,
816            fidl::encoding::DynamicFlags::FLEXIBLE,
817            _decode,
818        )
819    }
820}
821
822pub struct LifecycleEventStream {
823    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
824}
825
826impl std::marker::Unpin for LifecycleEventStream {}
827
828impl futures::stream::FusedStream for LifecycleEventStream {
829    fn is_terminated(&self) -> bool {
830        self.event_receiver.is_terminated()
831    }
832}
833
834impl futures::Stream for LifecycleEventStream {
835    type Item = Result<LifecycleEvent, fidl::Error>;
836
837    fn poll_next(
838        mut self: std::pin::Pin<&mut Self>,
839        cx: &mut std::task::Context<'_>,
840    ) -> std::task::Poll<Option<Self::Item>> {
841        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
842            &mut self.event_receiver,
843            cx
844        )?) {
845            Some(buf) => std::task::Poll::Ready(Some(LifecycleEvent::decode(buf))),
846            None => std::task::Poll::Ready(None),
847        }
848    }
849}
850
851#[derive(Debug)]
852pub enum LifecycleEvent {
853    #[non_exhaustive]
854    _UnknownEvent {
855        /// Ordinal of the event that was sent.
856        ordinal: u64,
857    },
858}
859
860impl LifecycleEvent {
861    /// Decodes a message buffer as a [`LifecycleEvent`].
862    fn decode(
863        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
864    ) -> Result<LifecycleEvent, fidl::Error> {
865        let (bytes, _handles) = buf.split_mut();
866        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
867        debug_assert_eq!(tx_header.tx_id, 0);
868        match tx_header.ordinal {
869            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
870                Ok(LifecycleEvent::_UnknownEvent { ordinal: tx_header.ordinal })
871            }
872            _ => Err(fidl::Error::UnknownOrdinal {
873                ordinal: tx_header.ordinal,
874                protocol_name: <LifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
875            }),
876        }
877    }
878}
879
880/// A Stream of incoming requests for fuchsia.session/Lifecycle.
881pub struct LifecycleRequestStream {
882    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
883    is_terminated: bool,
884}
885
886impl std::marker::Unpin for LifecycleRequestStream {}
887
888impl futures::stream::FusedStream for LifecycleRequestStream {
889    fn is_terminated(&self) -> bool {
890        self.is_terminated
891    }
892}
893
894impl fidl::endpoints::RequestStream for LifecycleRequestStream {
895    type Protocol = LifecycleMarker;
896    type ControlHandle = LifecycleControlHandle;
897
898    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
899        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
900    }
901
902    fn control_handle(&self) -> Self::ControlHandle {
903        LifecycleControlHandle { inner: self.inner.clone() }
904    }
905
906    fn into_inner(
907        self,
908    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
909    {
910        (self.inner, self.is_terminated)
911    }
912
913    fn from_inner(
914        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
915        is_terminated: bool,
916    ) -> Self {
917        Self { inner, is_terminated }
918    }
919}
920
921impl futures::Stream for LifecycleRequestStream {
922    type Item = Result<LifecycleRequest, fidl::Error>;
923
924    fn poll_next(
925        mut self: std::pin::Pin<&mut Self>,
926        cx: &mut std::task::Context<'_>,
927    ) -> std::task::Poll<Option<Self::Item>> {
928        let this = &mut *self;
929        if this.inner.check_shutdown(cx) {
930            this.is_terminated = true;
931            return std::task::Poll::Ready(None);
932        }
933        if this.is_terminated {
934            panic!("polled LifecycleRequestStream after completion");
935        }
936        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
937            |bytes, handles| {
938                match this.inner.channel().read_etc(cx, bytes, handles) {
939                    std::task::Poll::Ready(Ok(())) => {}
940                    std::task::Poll::Pending => return std::task::Poll::Pending,
941                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
942                        this.is_terminated = true;
943                        return std::task::Poll::Ready(None);
944                    }
945                    std::task::Poll::Ready(Err(e)) => {
946                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
947                            e.into(),
948                        ))))
949                    }
950                }
951
952                // A message has been received from the channel
953                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
954
955                std::task::Poll::Ready(Some(match header.ordinal {
956                    0x2fda381d2cc41ce0 => {
957                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
958                        let mut req = fidl::new_empty!(
959                            LifecycleStartRequest,
960                            fidl::encoding::DefaultFuchsiaResourceDialect
961                        );
962                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LifecycleStartRequest>(&header, _body_bytes, handles, &mut req)?;
963                        let control_handle = LifecycleControlHandle { inner: this.inner.clone() };
964                        Ok(LifecycleRequest::Start {
965                            payload: req,
966                            responder: LifecycleStartResponder {
967                                control_handle: std::mem::ManuallyDrop::new(control_handle),
968                                tx_id: header.tx_id,
969                            },
970                        })
971                    }
972                    0x453a9158431b4a2 => {
973                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
974                        let mut req = fidl::new_empty!(
975                            fidl::encoding::EmptyPayload,
976                            fidl::encoding::DefaultFuchsiaResourceDialect
977                        );
978                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
979                        let control_handle = LifecycleControlHandle { inner: this.inner.clone() };
980                        Ok(LifecycleRequest::Stop {
981                            responder: LifecycleStopResponder {
982                                control_handle: std::mem::ManuallyDrop::new(control_handle),
983                                tx_id: header.tx_id,
984                            },
985                        })
986                    }
987                    0x31faeac257bf1abb => {
988                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
989                        let mut req = fidl::new_empty!(
990                            fidl::encoding::EmptyPayload,
991                            fidl::encoding::DefaultFuchsiaResourceDialect
992                        );
993                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
994                        let control_handle = LifecycleControlHandle { inner: this.inner.clone() };
995                        Ok(LifecycleRequest::Restart {
996                            responder: LifecycleRestartResponder {
997                                control_handle: std::mem::ManuallyDrop::new(control_handle),
998                                tx_id: header.tx_id,
999                            },
1000                        })
1001                    }
1002                    _ if header.tx_id == 0
1003                        && header
1004                            .dynamic_flags()
1005                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1006                    {
1007                        Ok(LifecycleRequest::_UnknownMethod {
1008                            ordinal: header.ordinal,
1009                            control_handle: LifecycleControlHandle { inner: this.inner.clone() },
1010                            method_type: fidl::MethodType::OneWay,
1011                        })
1012                    }
1013                    _ if header
1014                        .dynamic_flags()
1015                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1016                    {
1017                        this.inner.send_framework_err(
1018                            fidl::encoding::FrameworkErr::UnknownMethod,
1019                            header.tx_id,
1020                            header.ordinal,
1021                            header.dynamic_flags(),
1022                            (bytes, handles),
1023                        )?;
1024                        Ok(LifecycleRequest::_UnknownMethod {
1025                            ordinal: header.ordinal,
1026                            control_handle: LifecycleControlHandle { inner: this.inner.clone() },
1027                            method_type: fidl::MethodType::TwoWay,
1028                        })
1029                    }
1030                    _ => Err(fidl::Error::UnknownOrdinal {
1031                        ordinal: header.ordinal,
1032                        protocol_name:
1033                            <LifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1034                    }),
1035                }))
1036            },
1037        )
1038    }
1039}
1040
1041/// A protocol used to control the session's lifecycle.
1042#[derive(Debug)]
1043pub enum LifecycleRequest {
1044    /// Starts the session.
1045    ///
1046    /// Returns after the session component has been created and started.
1047    ///
1048    /// * error `LifecycleError.NOT_FOUND` if `session_url` has not been provided
1049    ///   and there is no configured default session URL.
1050    /// * error `LifecycleError.ALREADY_STARTED` if a session has already been started.
1051    /// * error `LifecycleError.RESOLVE_COMPONENT_FAILED` if `session_url` could not be
1052    ///   resolved to a component.
1053    /// * error `LifecycleError.DESTROY_COMPONENT_FAILED` if an existing session component
1054    ///   could not be destroyed. The existing session remains running at this point.
1055    /// * error `LifecycleError.CREATE_COMPONENT_FAILED` if the session component
1056    ///   could not be started. No session will be running at this point.
1057    Start { payload: LifecycleStartRequest, responder: LifecycleStartResponder },
1058    /// Stops the session.
1059    ///
1060    /// Returns after the session component has been destroyed.
1061    ///
1062    /// * error `LifecycleError.NOT_FOUND` if the session has not been started.
1063    /// * error `LifecycleError.DESTROY_COMPONENT_FAILED` if the session component
1064    ///   could not be destroyed. The previous session will continue to exist at
1065    ///   this point and the component may be running.
1066    Stop { responder: LifecycleStopResponder },
1067    /// Restarts the session.
1068    ///
1069    /// This stops the existing session and starts a new session with the same
1070    /// session URL as the previous one.
1071    ///
1072    /// Returns once the new session component has been created and started.
1073    ///
1074    /// * error `LifecycleError.NOT_FOUND` if there is no existing session.
1075    /// * error `LifecycleError.RESOLVE_COMPONENT_FAILED` if the session URL
1076    ///   could not be resolved to a component.
1077    /// * error `LifecycleError.DESTROY_COMPONENT_FAILED` if the session component
1078    ///   could not be destroyed. The previous session will continue to exist at
1079    ///   this point and the component may be running.
1080    /// * error `LifecycleError.CREATE_COMPONENT_FAILED` if the session component
1081    ///   could not be started. No session will be running at this point.
1082    Restart { responder: LifecycleRestartResponder },
1083    /// An interaction was received which does not match any known method.
1084    #[non_exhaustive]
1085    _UnknownMethod {
1086        /// Ordinal of the method that was called.
1087        ordinal: u64,
1088        control_handle: LifecycleControlHandle,
1089        method_type: fidl::MethodType,
1090    },
1091}
1092
1093impl LifecycleRequest {
1094    #[allow(irrefutable_let_patterns)]
1095    pub fn into_start(self) -> Option<(LifecycleStartRequest, LifecycleStartResponder)> {
1096        if let LifecycleRequest::Start { payload, responder } = self {
1097            Some((payload, responder))
1098        } else {
1099            None
1100        }
1101    }
1102
1103    #[allow(irrefutable_let_patterns)]
1104    pub fn into_stop(self) -> Option<(LifecycleStopResponder)> {
1105        if let LifecycleRequest::Stop { responder } = self {
1106            Some((responder))
1107        } else {
1108            None
1109        }
1110    }
1111
1112    #[allow(irrefutable_let_patterns)]
1113    pub fn into_restart(self) -> Option<(LifecycleRestartResponder)> {
1114        if let LifecycleRequest::Restart { responder } = self {
1115            Some((responder))
1116        } else {
1117            None
1118        }
1119    }
1120
1121    /// Name of the method defined in FIDL
1122    pub fn method_name(&self) -> &'static str {
1123        match *self {
1124            LifecycleRequest::Start { .. } => "start",
1125            LifecycleRequest::Stop { .. } => "stop",
1126            LifecycleRequest::Restart { .. } => "restart",
1127            LifecycleRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1128                "unknown one-way method"
1129            }
1130            LifecycleRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1131                "unknown two-way method"
1132            }
1133        }
1134    }
1135}
1136
1137#[derive(Debug, Clone)]
1138pub struct LifecycleControlHandle {
1139    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1140}
1141
1142impl fidl::endpoints::ControlHandle for LifecycleControlHandle {
1143    fn shutdown(&self) {
1144        self.inner.shutdown()
1145    }
1146    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1147        self.inner.shutdown_with_epitaph(status)
1148    }
1149
1150    fn is_closed(&self) -> bool {
1151        self.inner.channel().is_closed()
1152    }
1153    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1154        self.inner.channel().on_closed()
1155    }
1156
1157    #[cfg(target_os = "fuchsia")]
1158    fn signal_peer(
1159        &self,
1160        clear_mask: zx::Signals,
1161        set_mask: zx::Signals,
1162    ) -> Result<(), zx_status::Status> {
1163        use fidl::Peered;
1164        self.inner.channel().signal_peer(clear_mask, set_mask)
1165    }
1166}
1167
1168impl LifecycleControlHandle {}
1169
1170#[must_use = "FIDL methods require a response to be sent"]
1171#[derive(Debug)]
1172pub struct LifecycleStartResponder {
1173    control_handle: std::mem::ManuallyDrop<LifecycleControlHandle>,
1174    tx_id: u32,
1175}
1176
1177/// Set the the channel to be shutdown (see [`LifecycleControlHandle::shutdown`])
1178/// if the responder is dropped without sending a response, so that the client
1179/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1180impl std::ops::Drop for LifecycleStartResponder {
1181    fn drop(&mut self) {
1182        self.control_handle.shutdown();
1183        // Safety: drops once, never accessed again
1184        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1185    }
1186}
1187
1188impl fidl::endpoints::Responder for LifecycleStartResponder {
1189    type ControlHandle = LifecycleControlHandle;
1190
1191    fn control_handle(&self) -> &LifecycleControlHandle {
1192        &self.control_handle
1193    }
1194
1195    fn drop_without_shutdown(mut self) {
1196        // Safety: drops once, never accessed again due to mem::forget
1197        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1198        // Prevent Drop from running (which would shut down the channel)
1199        std::mem::forget(self);
1200    }
1201}
1202
1203impl LifecycleStartResponder {
1204    /// Sends a response to the FIDL transaction.
1205    ///
1206    /// Sets the channel to shutdown if an error occurs.
1207    pub fn send(self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1208        let _result = self.send_raw(result);
1209        if _result.is_err() {
1210            self.control_handle.shutdown();
1211        }
1212        self.drop_without_shutdown();
1213        _result
1214    }
1215
1216    /// Similar to "send" but does not shutdown the channel if an error occurs.
1217    pub fn send_no_shutdown_on_err(
1218        self,
1219        mut result: Result<(), LifecycleError>,
1220    ) -> Result<(), fidl::Error> {
1221        let _result = self.send_raw(result);
1222        self.drop_without_shutdown();
1223        _result
1224    }
1225
1226    fn send_raw(&self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1227        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1228            fidl::encoding::EmptyStruct,
1229            LifecycleError,
1230        >>(
1231            fidl::encoding::FlexibleResult::new(result),
1232            self.tx_id,
1233            0x2fda381d2cc41ce0,
1234            fidl::encoding::DynamicFlags::FLEXIBLE,
1235        )
1236    }
1237}
1238
1239#[must_use = "FIDL methods require a response to be sent"]
1240#[derive(Debug)]
1241pub struct LifecycleStopResponder {
1242    control_handle: std::mem::ManuallyDrop<LifecycleControlHandle>,
1243    tx_id: u32,
1244}
1245
1246/// Set the the channel to be shutdown (see [`LifecycleControlHandle::shutdown`])
1247/// if the responder is dropped without sending a response, so that the client
1248/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1249impl std::ops::Drop for LifecycleStopResponder {
1250    fn drop(&mut self) {
1251        self.control_handle.shutdown();
1252        // Safety: drops once, never accessed again
1253        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1254    }
1255}
1256
1257impl fidl::endpoints::Responder for LifecycleStopResponder {
1258    type ControlHandle = LifecycleControlHandle;
1259
1260    fn control_handle(&self) -> &LifecycleControlHandle {
1261        &self.control_handle
1262    }
1263
1264    fn drop_without_shutdown(mut self) {
1265        // Safety: drops once, never accessed again due to mem::forget
1266        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1267        // Prevent Drop from running (which would shut down the channel)
1268        std::mem::forget(self);
1269    }
1270}
1271
1272impl LifecycleStopResponder {
1273    /// Sends a response to the FIDL transaction.
1274    ///
1275    /// Sets the channel to shutdown if an error occurs.
1276    pub fn send(self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1277        let _result = self.send_raw(result);
1278        if _result.is_err() {
1279            self.control_handle.shutdown();
1280        }
1281        self.drop_without_shutdown();
1282        _result
1283    }
1284
1285    /// Similar to "send" but does not shutdown the channel if an error occurs.
1286    pub fn send_no_shutdown_on_err(
1287        self,
1288        mut result: Result<(), LifecycleError>,
1289    ) -> Result<(), fidl::Error> {
1290        let _result = self.send_raw(result);
1291        self.drop_without_shutdown();
1292        _result
1293    }
1294
1295    fn send_raw(&self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1296        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1297            fidl::encoding::EmptyStruct,
1298            LifecycleError,
1299        >>(
1300            fidl::encoding::FlexibleResult::new(result),
1301            self.tx_id,
1302            0x453a9158431b4a2,
1303            fidl::encoding::DynamicFlags::FLEXIBLE,
1304        )
1305    }
1306}
1307
1308#[must_use = "FIDL methods require a response to be sent"]
1309#[derive(Debug)]
1310pub struct LifecycleRestartResponder {
1311    control_handle: std::mem::ManuallyDrop<LifecycleControlHandle>,
1312    tx_id: u32,
1313}
1314
1315/// Set the the channel to be shutdown (see [`LifecycleControlHandle::shutdown`])
1316/// if the responder is dropped without sending a response, so that the client
1317/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1318impl std::ops::Drop for LifecycleRestartResponder {
1319    fn drop(&mut self) {
1320        self.control_handle.shutdown();
1321        // Safety: drops once, never accessed again
1322        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1323    }
1324}
1325
1326impl fidl::endpoints::Responder for LifecycleRestartResponder {
1327    type ControlHandle = LifecycleControlHandle;
1328
1329    fn control_handle(&self) -> &LifecycleControlHandle {
1330        &self.control_handle
1331    }
1332
1333    fn drop_without_shutdown(mut self) {
1334        // Safety: drops once, never accessed again due to mem::forget
1335        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1336        // Prevent Drop from running (which would shut down the channel)
1337        std::mem::forget(self);
1338    }
1339}
1340
1341impl LifecycleRestartResponder {
1342    /// Sends a response to the FIDL transaction.
1343    ///
1344    /// Sets the channel to shutdown if an error occurs.
1345    pub fn send(self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1346        let _result = self.send_raw(result);
1347        if _result.is_err() {
1348            self.control_handle.shutdown();
1349        }
1350        self.drop_without_shutdown();
1351        _result
1352    }
1353
1354    /// Similar to "send" but does not shutdown the channel if an error occurs.
1355    pub fn send_no_shutdown_on_err(
1356        self,
1357        mut result: Result<(), LifecycleError>,
1358    ) -> Result<(), fidl::Error> {
1359        let _result = self.send_raw(result);
1360        self.drop_without_shutdown();
1361        _result
1362    }
1363
1364    fn send_raw(&self, mut result: Result<(), LifecycleError>) -> Result<(), fidl::Error> {
1365        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1366            fidl::encoding::EmptyStruct,
1367            LifecycleError,
1368        >>(
1369            fidl::encoding::FlexibleResult::new(result),
1370            self.tx_id,
1371            0x31faeac257bf1abb,
1372            fidl::encoding::DynamicFlags::FLEXIBLE,
1373        )
1374    }
1375}
1376
1377#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1378pub struct RestarterMarker;
1379
1380impl fidl::endpoints::ProtocolMarker for RestarterMarker {
1381    type Proxy = RestarterProxy;
1382    type RequestStream = RestarterRequestStream;
1383    #[cfg(target_os = "fuchsia")]
1384    type SynchronousProxy = RestarterSynchronousProxy;
1385
1386    const DEBUG_NAME: &'static str = "fuchsia.session.Restarter";
1387}
1388impl fidl::endpoints::DiscoverableProtocolMarker for RestarterMarker {}
1389pub type RestarterRestartResult = Result<(), RestartError>;
1390
1391pub trait RestarterProxyInterface: Send + Sync {
1392    type RestartResponseFut: std::future::Future<Output = Result<RestarterRestartResult, fidl::Error>>
1393        + Send;
1394    fn r#restart(&self) -> Self::RestartResponseFut;
1395}
1396#[derive(Debug)]
1397#[cfg(target_os = "fuchsia")]
1398pub struct RestarterSynchronousProxy {
1399    client: fidl::client::sync::Client,
1400}
1401
1402#[cfg(target_os = "fuchsia")]
1403impl fidl::endpoints::SynchronousProxy for RestarterSynchronousProxy {
1404    type Proxy = RestarterProxy;
1405    type Protocol = RestarterMarker;
1406
1407    fn from_channel(inner: fidl::Channel) -> Self {
1408        Self::new(inner)
1409    }
1410
1411    fn into_channel(self) -> fidl::Channel {
1412        self.client.into_channel()
1413    }
1414
1415    fn as_channel(&self) -> &fidl::Channel {
1416        self.client.as_channel()
1417    }
1418}
1419
1420#[cfg(target_os = "fuchsia")]
1421impl RestarterSynchronousProxy {
1422    pub fn new(channel: fidl::Channel) -> Self {
1423        let protocol_name = <RestarterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1424        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1425    }
1426
1427    pub fn into_channel(self) -> fidl::Channel {
1428        self.client.into_channel()
1429    }
1430
1431    /// Waits until an event arrives and returns it. It is safe for other
1432    /// threads to make concurrent requests while waiting for an event.
1433    pub fn wait_for_event(
1434        &self,
1435        deadline: zx::MonotonicInstant,
1436    ) -> Result<RestarterEvent, fidl::Error> {
1437        RestarterEvent::decode(self.client.wait_for_event(deadline)?)
1438    }
1439
1440    /// Restarts the session.
1441    ///
1442    /// * error `RestartError.NOT_RUNNING` if there is no
1443    ///   currently running session to restart.
1444    /// * error `RestartError.DESTROY_COMPONENT_FAILED` if an existing session component
1445    ///   could not be destroyed. The existing session remains running at this point.
1446    /// * error `RestartError.CREATE_COMPONENT_FAILED` if the session component
1447    ///   could not be started. No session will be running at this point.
1448    pub fn r#restart(
1449        &self,
1450        ___deadline: zx::MonotonicInstant,
1451    ) -> Result<RestarterRestartResult, fidl::Error> {
1452        let _response = self.client.send_query::<
1453            fidl::encoding::EmptyPayload,
1454            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RestartError>,
1455        >(
1456            (),
1457            0x50cd09e53189e5ae,
1458            fidl::encoding::DynamicFlags::empty(),
1459            ___deadline,
1460        )?;
1461        Ok(_response.map(|x| x))
1462    }
1463}
1464
1465#[derive(Debug, Clone)]
1466pub struct RestarterProxy {
1467    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1468}
1469
1470impl fidl::endpoints::Proxy for RestarterProxy {
1471    type Protocol = RestarterMarker;
1472
1473    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1474        Self::new(inner)
1475    }
1476
1477    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1478        self.client.into_channel().map_err(|client| Self { client })
1479    }
1480
1481    fn as_channel(&self) -> &::fidl::AsyncChannel {
1482        self.client.as_channel()
1483    }
1484}
1485
1486impl RestarterProxy {
1487    /// Create a new Proxy for fuchsia.session/Restarter.
1488    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1489        let protocol_name = <RestarterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1490        Self { client: fidl::client::Client::new(channel, protocol_name) }
1491    }
1492
1493    /// Get a Stream of events from the remote end of the protocol.
1494    ///
1495    /// # Panics
1496    ///
1497    /// Panics if the event stream was already taken.
1498    pub fn take_event_stream(&self) -> RestarterEventStream {
1499        RestarterEventStream { event_receiver: self.client.take_event_receiver() }
1500    }
1501
1502    /// Restarts the session.
1503    ///
1504    /// * error `RestartError.NOT_RUNNING` if there is no
1505    ///   currently running session to restart.
1506    /// * error `RestartError.DESTROY_COMPONENT_FAILED` if an existing session component
1507    ///   could not be destroyed. The existing session remains running at this point.
1508    /// * error `RestartError.CREATE_COMPONENT_FAILED` if the session component
1509    ///   could not be started. No session will be running at this point.
1510    pub fn r#restart(
1511        &self,
1512    ) -> fidl::client::QueryResponseFut<
1513        RestarterRestartResult,
1514        fidl::encoding::DefaultFuchsiaResourceDialect,
1515    > {
1516        RestarterProxyInterface::r#restart(self)
1517    }
1518}
1519
1520impl RestarterProxyInterface for RestarterProxy {
1521    type RestartResponseFut = fidl::client::QueryResponseFut<
1522        RestarterRestartResult,
1523        fidl::encoding::DefaultFuchsiaResourceDialect,
1524    >;
1525    fn r#restart(&self) -> Self::RestartResponseFut {
1526        fn _decode(
1527            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1528        ) -> Result<RestarterRestartResult, fidl::Error> {
1529            let _response = fidl::client::decode_transaction_body::<
1530                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RestartError>,
1531                fidl::encoding::DefaultFuchsiaResourceDialect,
1532                0x50cd09e53189e5ae,
1533            >(_buf?)?;
1534            Ok(_response.map(|x| x))
1535        }
1536        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, RestarterRestartResult>(
1537            (),
1538            0x50cd09e53189e5ae,
1539            fidl::encoding::DynamicFlags::empty(),
1540            _decode,
1541        )
1542    }
1543}
1544
1545pub struct RestarterEventStream {
1546    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1547}
1548
1549impl std::marker::Unpin for RestarterEventStream {}
1550
1551impl futures::stream::FusedStream for RestarterEventStream {
1552    fn is_terminated(&self) -> bool {
1553        self.event_receiver.is_terminated()
1554    }
1555}
1556
1557impl futures::Stream for RestarterEventStream {
1558    type Item = Result<RestarterEvent, fidl::Error>;
1559
1560    fn poll_next(
1561        mut self: std::pin::Pin<&mut Self>,
1562        cx: &mut std::task::Context<'_>,
1563    ) -> std::task::Poll<Option<Self::Item>> {
1564        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1565            &mut self.event_receiver,
1566            cx
1567        )?) {
1568            Some(buf) => std::task::Poll::Ready(Some(RestarterEvent::decode(buf))),
1569            None => std::task::Poll::Ready(None),
1570        }
1571    }
1572}
1573
1574#[derive(Debug)]
1575pub enum RestarterEvent {}
1576
1577impl RestarterEvent {
1578    /// Decodes a message buffer as a [`RestarterEvent`].
1579    fn decode(
1580        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1581    ) -> Result<RestarterEvent, fidl::Error> {
1582        let (bytes, _handles) = buf.split_mut();
1583        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1584        debug_assert_eq!(tx_header.tx_id, 0);
1585        match tx_header.ordinal {
1586            _ => Err(fidl::Error::UnknownOrdinal {
1587                ordinal: tx_header.ordinal,
1588                protocol_name: <RestarterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1589            }),
1590        }
1591    }
1592}
1593
1594/// A Stream of incoming requests for fuchsia.session/Restarter.
1595pub struct RestarterRequestStream {
1596    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1597    is_terminated: bool,
1598}
1599
1600impl std::marker::Unpin for RestarterRequestStream {}
1601
1602impl futures::stream::FusedStream for RestarterRequestStream {
1603    fn is_terminated(&self) -> bool {
1604        self.is_terminated
1605    }
1606}
1607
1608impl fidl::endpoints::RequestStream for RestarterRequestStream {
1609    type Protocol = RestarterMarker;
1610    type ControlHandle = RestarterControlHandle;
1611
1612    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1613        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1614    }
1615
1616    fn control_handle(&self) -> Self::ControlHandle {
1617        RestarterControlHandle { inner: self.inner.clone() }
1618    }
1619
1620    fn into_inner(
1621        self,
1622    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1623    {
1624        (self.inner, self.is_terminated)
1625    }
1626
1627    fn from_inner(
1628        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1629        is_terminated: bool,
1630    ) -> Self {
1631        Self { inner, is_terminated }
1632    }
1633}
1634
1635impl futures::Stream for RestarterRequestStream {
1636    type Item = Result<RestarterRequest, fidl::Error>;
1637
1638    fn poll_next(
1639        mut self: std::pin::Pin<&mut Self>,
1640        cx: &mut std::task::Context<'_>,
1641    ) -> std::task::Poll<Option<Self::Item>> {
1642        let this = &mut *self;
1643        if this.inner.check_shutdown(cx) {
1644            this.is_terminated = true;
1645            return std::task::Poll::Ready(None);
1646        }
1647        if this.is_terminated {
1648            panic!("polled RestarterRequestStream after completion");
1649        }
1650        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1651            |bytes, handles| {
1652                match this.inner.channel().read_etc(cx, bytes, handles) {
1653                    std::task::Poll::Ready(Ok(())) => {}
1654                    std::task::Poll::Pending => return std::task::Poll::Pending,
1655                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1656                        this.is_terminated = true;
1657                        return std::task::Poll::Ready(None);
1658                    }
1659                    std::task::Poll::Ready(Err(e)) => {
1660                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1661                            e.into(),
1662                        ))))
1663                    }
1664                }
1665
1666                // A message has been received from the channel
1667                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1668
1669                std::task::Poll::Ready(Some(match header.ordinal {
1670                    0x50cd09e53189e5ae => {
1671                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1672                        let mut req = fidl::new_empty!(
1673                            fidl::encoding::EmptyPayload,
1674                            fidl::encoding::DefaultFuchsiaResourceDialect
1675                        );
1676                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1677                        let control_handle = RestarterControlHandle { inner: this.inner.clone() };
1678                        Ok(RestarterRequest::Restart {
1679                            responder: RestarterRestartResponder {
1680                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1681                                tx_id: header.tx_id,
1682                            },
1683                        })
1684                    }
1685                    _ => Err(fidl::Error::UnknownOrdinal {
1686                        ordinal: header.ordinal,
1687                        protocol_name:
1688                            <RestarterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1689                    }),
1690                }))
1691            },
1692        )
1693    }
1694}
1695
1696/// A protocol used to restart the currently running session.
1697#[derive(Debug)]
1698pub enum RestarterRequest {
1699    /// Restarts the session.
1700    ///
1701    /// * error `RestartError.NOT_RUNNING` if there is no
1702    ///   currently running session to restart.
1703    /// * error `RestartError.DESTROY_COMPONENT_FAILED` if an existing session component
1704    ///   could not be destroyed. The existing session remains running at this point.
1705    /// * error `RestartError.CREATE_COMPONENT_FAILED` if the session component
1706    ///   could not be started. No session will be running at this point.
1707    Restart { responder: RestarterRestartResponder },
1708}
1709
1710impl RestarterRequest {
1711    #[allow(irrefutable_let_patterns)]
1712    pub fn into_restart(self) -> Option<(RestarterRestartResponder)> {
1713        if let RestarterRequest::Restart { responder } = self {
1714            Some((responder))
1715        } else {
1716            None
1717        }
1718    }
1719
1720    /// Name of the method defined in FIDL
1721    pub fn method_name(&self) -> &'static str {
1722        match *self {
1723            RestarterRequest::Restart { .. } => "restart",
1724        }
1725    }
1726}
1727
1728#[derive(Debug, Clone)]
1729pub struct RestarterControlHandle {
1730    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1731}
1732
1733impl fidl::endpoints::ControlHandle for RestarterControlHandle {
1734    fn shutdown(&self) {
1735        self.inner.shutdown()
1736    }
1737    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1738        self.inner.shutdown_with_epitaph(status)
1739    }
1740
1741    fn is_closed(&self) -> bool {
1742        self.inner.channel().is_closed()
1743    }
1744    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1745        self.inner.channel().on_closed()
1746    }
1747
1748    #[cfg(target_os = "fuchsia")]
1749    fn signal_peer(
1750        &self,
1751        clear_mask: zx::Signals,
1752        set_mask: zx::Signals,
1753    ) -> Result<(), zx_status::Status> {
1754        use fidl::Peered;
1755        self.inner.channel().signal_peer(clear_mask, set_mask)
1756    }
1757}
1758
1759impl RestarterControlHandle {}
1760
1761#[must_use = "FIDL methods require a response to be sent"]
1762#[derive(Debug)]
1763pub struct RestarterRestartResponder {
1764    control_handle: std::mem::ManuallyDrop<RestarterControlHandle>,
1765    tx_id: u32,
1766}
1767
1768/// Set the the channel to be shutdown (see [`RestarterControlHandle::shutdown`])
1769/// if the responder is dropped without sending a response, so that the client
1770/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1771impl std::ops::Drop for RestarterRestartResponder {
1772    fn drop(&mut self) {
1773        self.control_handle.shutdown();
1774        // Safety: drops once, never accessed again
1775        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1776    }
1777}
1778
1779impl fidl::endpoints::Responder for RestarterRestartResponder {
1780    type ControlHandle = RestarterControlHandle;
1781
1782    fn control_handle(&self) -> &RestarterControlHandle {
1783        &self.control_handle
1784    }
1785
1786    fn drop_without_shutdown(mut self) {
1787        // Safety: drops once, never accessed again due to mem::forget
1788        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1789        // Prevent Drop from running (which would shut down the channel)
1790        std::mem::forget(self);
1791    }
1792}
1793
1794impl RestarterRestartResponder {
1795    /// Sends a response to the FIDL transaction.
1796    ///
1797    /// Sets the channel to shutdown if an error occurs.
1798    pub fn send(self, mut result: Result<(), RestartError>) -> Result<(), fidl::Error> {
1799        let _result = self.send_raw(result);
1800        if _result.is_err() {
1801            self.control_handle.shutdown();
1802        }
1803        self.drop_without_shutdown();
1804        _result
1805    }
1806
1807    /// Similar to "send" but does not shutdown the channel if an error occurs.
1808    pub fn send_no_shutdown_on_err(
1809        self,
1810        mut result: Result<(), RestartError>,
1811    ) -> Result<(), fidl::Error> {
1812        let _result = self.send_raw(result);
1813        self.drop_without_shutdown();
1814        _result
1815    }
1816
1817    fn send_raw(&self, mut result: Result<(), RestartError>) -> Result<(), fidl::Error> {
1818        self.control_handle.inner.send::<fidl::encoding::ResultType<
1819            fidl::encoding::EmptyStruct,
1820            RestartError,
1821        >>(
1822            result,
1823            self.tx_id,
1824            0x50cd09e53189e5ae,
1825            fidl::encoding::DynamicFlags::empty(),
1826        )
1827    }
1828}
1829
1830mod internal {
1831    use super::*;
1832}