fidl_fuchsia_starnix_runner/
fidl_fuchsia_starnix_runner.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_starnix_runner_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Default, PartialEq)]
15pub struct ManagerProxyWakeChannelRequest {
16    /// The job of the container that holds the other end of `container_channel`.
17    pub container_job: Option<fidl::Job>,
18    /// The channel endpoint that is connected to the container.
19    pub container_channel: Option<fidl::Channel>,
20    /// The channel endpoint that is connected to a component outside the container.
21    pub remote_channel: Option<fidl::Channel>,
22    /// The event that will be signaled when a message appears on `container_channel` while the
23    /// container is suspended.
24    pub resume_event: Option<fidl::EventPair>,
25    /// The name of the proxy, used for debugging purposes.
26    pub name: Option<String>,
27    /// A counter that is used to count how many unhandled requests have been sent to the
28    /// container. If this counter is non-zero, the container will not be able to suspend.
29    ///
30    /// Each time the client handles a message on the proxied channel, it is expected to
31    /// decrement the counter by 1. This decrement should only happen once the client is
32    /// ready to allow suspension. Often this means that a new hanging get has been sent on
33    /// the proxied channel.
34    pub counter: Option<fidl::Counter>,
35    #[doc(hidden)]
36    pub __source_breaking: fidl::marker::SourceBreaking,
37}
38
39impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
40    for ManagerProxyWakeChannelRequest
41{
42}
43
44#[derive(Debug, Default, PartialEq)]
45pub struct ManagerRegisterWakeWatcherRequest {
46    /// The event that will be signaled when the container's wake status changes.
47    pub watcher: Option<fidl::EventPair>,
48    #[doc(hidden)]
49    pub __source_breaking: fidl::marker::SourceBreaking,
50}
51
52impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
53    for ManagerRegisterWakeWatcherRequest
54{
55}
56
57#[derive(Debug, Default, PartialEq)]
58pub struct ManagerSuspendContainerRequest {
59    /// The job of the container to suspend.
60    pub container_job: Option<fidl::Job>,
61    /// The event that is used to signal whether or not there are any active wake locks
62    /// in the container.
63    pub wake_locks: Option<fidl::EventPair>,
64    #[doc(hidden)]
65    pub __source_breaking: fidl::marker::SourceBreaking,
66}
67
68impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
69    for ManagerSuspendContainerRequest
70{
71}
72
73#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
74pub struct ManagerMarker;
75
76impl fidl::endpoints::ProtocolMarker for ManagerMarker {
77    type Proxy = ManagerProxy;
78    type RequestStream = ManagerRequestStream;
79    #[cfg(target_os = "fuchsia")]
80    type SynchronousProxy = ManagerSynchronousProxy;
81
82    const DEBUG_NAME: &'static str = "fuchsia.starnix.runner.Manager";
83}
84impl fidl::endpoints::DiscoverableProtocolMarker for ManagerMarker {}
85pub type ManagerSuspendContainerResult = Result<ManagerSuspendContainerResponse, SuspendError>;
86
87pub trait ManagerProxyInterface: Send + Sync {
88    type SuspendContainerResponseFut: std::future::Future<Output = Result<ManagerSuspendContainerResult, fidl::Error>>
89        + Send;
90    fn r#suspend_container(
91        &self,
92        payload: ManagerSuspendContainerRequest,
93    ) -> Self::SuspendContainerResponseFut;
94    fn r#proxy_wake_channel(
95        &self,
96        payload: ManagerProxyWakeChannelRequest,
97    ) -> Result<(), fidl::Error>;
98    type RegisterWakeWatcherResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
99        + Send;
100    fn r#register_wake_watcher(
101        &self,
102        payload: ManagerRegisterWakeWatcherRequest,
103    ) -> Self::RegisterWakeWatcherResponseFut;
104}
105#[derive(Debug)]
106#[cfg(target_os = "fuchsia")]
107pub struct ManagerSynchronousProxy {
108    client: fidl::client::sync::Client,
109}
110
111#[cfg(target_os = "fuchsia")]
112impl fidl::endpoints::SynchronousProxy for ManagerSynchronousProxy {
113    type Proxy = ManagerProxy;
114    type Protocol = ManagerMarker;
115
116    fn from_channel(inner: fidl::Channel) -> Self {
117        Self::new(inner)
118    }
119
120    fn into_channel(self) -> fidl::Channel {
121        self.client.into_channel()
122    }
123
124    fn as_channel(&self) -> &fidl::Channel {
125        self.client.as_channel()
126    }
127}
128
129#[cfg(target_os = "fuchsia")]
130impl ManagerSynchronousProxy {
131    pub fn new(channel: fidl::Channel) -> Self {
132        let protocol_name = <ManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
133        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
134    }
135
136    pub fn into_channel(self) -> fidl::Channel {
137        self.client.into_channel()
138    }
139
140    /// Waits until an event arrives and returns it. It is safe for other
141    /// threads to make concurrent requests while waiting for an event.
142    pub fn wait_for_event(
143        &self,
144        deadline: zx::MonotonicInstant,
145    ) -> Result<ManagerEvent, fidl::Error> {
146        ManagerEvent::decode(self.client.wait_for_event(deadline)?)
147    }
148
149    /// Suspends the container running in `job`.
150    ///
151    /// The call will return successfully when `wake_event` has been signaled. Returns
152    /// an error if `wake_locks` is signaled at the end of suspension, or an error is
153    /// encountered when suspending the container's processes.
154    pub fn r#suspend_container(
155        &self,
156        mut payload: ManagerSuspendContainerRequest,
157        ___deadline: zx::MonotonicInstant,
158    ) -> Result<ManagerSuspendContainerResult, fidl::Error> {
159        let _response = self.client.send_query::<
160            ManagerSuspendContainerRequest,
161            fidl::encoding::FlexibleResultType<ManagerSuspendContainerResponse, SuspendError>,
162        >(
163            &mut payload,
164            0x928527927c9f2a7,
165            fidl::encoding::DynamicFlags::FLEXIBLE,
166            ___deadline,
167        )?
168        .into_result::<ManagerMarker>("suspend_container")?;
169        Ok(_response.map(|x| x))
170    }
171
172    /// Creates a pass-through proxy that forwards messages between the `container_channel` and the
173    /// `remote_channel`.
174    ///
175    /// If any messages arrive on `remote_channel` while the container is suspended via
176    /// `SuspendContainer`, the container will be resumed and `resume_event` will be signaled with
177    /// `ZX_EVENT_SIGNALED`. Any suspend call that is made while that signal is present on
178    /// `resume_event` will wake immediately. The container is responsible for clearing
179    /// `ZX_EVENT_SIGNALED`.
180    pub fn r#proxy_wake_channel(
181        &self,
182        mut payload: ManagerProxyWakeChannelRequest,
183    ) -> Result<(), fidl::Error> {
184        self.client.send::<ManagerProxyWakeChannelRequest>(
185            &mut payload,
186            0x46a374ab73b23714,
187            fidl::encoding::DynamicFlags::FLEXIBLE,
188        )
189    }
190
191    /// Registers an eventpair that will be signaled when the container is suspended or resumed.
192    /// The signals are ASLEEP(USER_1) and AWAKE(USER_0).
193    ///
194    /// The kernel returns AWAKE upon initial registration of the eventpair.
195    pub fn r#register_wake_watcher(
196        &self,
197        mut payload: ManagerRegisterWakeWatcherRequest,
198        ___deadline: zx::MonotonicInstant,
199    ) -> Result<(), fidl::Error> {
200        let _response = self.client.send_query::<
201            ManagerRegisterWakeWatcherRequest,
202            fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
203        >(
204            &mut payload,
205            0x456d74519eb65b41,
206            fidl::encoding::DynamicFlags::FLEXIBLE,
207            ___deadline,
208        )?
209        .into_result::<ManagerMarker>("register_wake_watcher")?;
210        Ok(_response)
211    }
212}
213
214#[derive(Debug, Clone)]
215pub struct ManagerProxy {
216    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
217}
218
219impl fidl::endpoints::Proxy for ManagerProxy {
220    type Protocol = ManagerMarker;
221
222    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
223        Self::new(inner)
224    }
225
226    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
227        self.client.into_channel().map_err(|client| Self { client })
228    }
229
230    fn as_channel(&self) -> &::fidl::AsyncChannel {
231        self.client.as_channel()
232    }
233}
234
235impl ManagerProxy {
236    /// Create a new Proxy for fuchsia.starnix.runner/Manager.
237    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
238        let protocol_name = <ManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
239        Self { client: fidl::client::Client::new(channel, protocol_name) }
240    }
241
242    /// Get a Stream of events from the remote end of the protocol.
243    ///
244    /// # Panics
245    ///
246    /// Panics if the event stream was already taken.
247    pub fn take_event_stream(&self) -> ManagerEventStream {
248        ManagerEventStream { event_receiver: self.client.take_event_receiver() }
249    }
250
251    /// Suspends the container running in `job`.
252    ///
253    /// The call will return successfully when `wake_event` has been signaled. Returns
254    /// an error if `wake_locks` is signaled at the end of suspension, or an error is
255    /// encountered when suspending the container's processes.
256    pub fn r#suspend_container(
257        &self,
258        mut payload: ManagerSuspendContainerRequest,
259    ) -> fidl::client::QueryResponseFut<
260        ManagerSuspendContainerResult,
261        fidl::encoding::DefaultFuchsiaResourceDialect,
262    > {
263        ManagerProxyInterface::r#suspend_container(self, payload)
264    }
265
266    /// Creates a pass-through proxy that forwards messages between the `container_channel` and the
267    /// `remote_channel`.
268    ///
269    /// If any messages arrive on `remote_channel` while the container is suspended via
270    /// `SuspendContainer`, the container will be resumed and `resume_event` will be signaled with
271    /// `ZX_EVENT_SIGNALED`. Any suspend call that is made while that signal is present on
272    /// `resume_event` will wake immediately. The container is responsible for clearing
273    /// `ZX_EVENT_SIGNALED`.
274    pub fn r#proxy_wake_channel(
275        &self,
276        mut payload: ManagerProxyWakeChannelRequest,
277    ) -> Result<(), fidl::Error> {
278        ManagerProxyInterface::r#proxy_wake_channel(self, payload)
279    }
280
281    /// Registers an eventpair that will be signaled when the container is suspended or resumed.
282    /// The signals are ASLEEP(USER_1) and AWAKE(USER_0).
283    ///
284    /// The kernel returns AWAKE upon initial registration of the eventpair.
285    pub fn r#register_wake_watcher(
286        &self,
287        mut payload: ManagerRegisterWakeWatcherRequest,
288    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
289        ManagerProxyInterface::r#register_wake_watcher(self, payload)
290    }
291}
292
293impl ManagerProxyInterface for ManagerProxy {
294    type SuspendContainerResponseFut = fidl::client::QueryResponseFut<
295        ManagerSuspendContainerResult,
296        fidl::encoding::DefaultFuchsiaResourceDialect,
297    >;
298    fn r#suspend_container(
299        &self,
300        mut payload: ManagerSuspendContainerRequest,
301    ) -> Self::SuspendContainerResponseFut {
302        fn _decode(
303            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
304        ) -> Result<ManagerSuspendContainerResult, fidl::Error> {
305            let _response = fidl::client::decode_transaction_body::<
306                fidl::encoding::FlexibleResultType<ManagerSuspendContainerResponse, SuspendError>,
307                fidl::encoding::DefaultFuchsiaResourceDialect,
308                0x928527927c9f2a7,
309            >(_buf?)?
310            .into_result::<ManagerMarker>("suspend_container")?;
311            Ok(_response.map(|x| x))
312        }
313        self.client
314            .send_query_and_decode::<ManagerSuspendContainerRequest, ManagerSuspendContainerResult>(
315                &mut payload,
316                0x928527927c9f2a7,
317                fidl::encoding::DynamicFlags::FLEXIBLE,
318                _decode,
319            )
320    }
321
322    fn r#proxy_wake_channel(
323        &self,
324        mut payload: ManagerProxyWakeChannelRequest,
325    ) -> Result<(), fidl::Error> {
326        self.client.send::<ManagerProxyWakeChannelRequest>(
327            &mut payload,
328            0x46a374ab73b23714,
329            fidl::encoding::DynamicFlags::FLEXIBLE,
330        )
331    }
332
333    type RegisterWakeWatcherResponseFut =
334        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
335    fn r#register_wake_watcher(
336        &self,
337        mut payload: ManagerRegisterWakeWatcherRequest,
338    ) -> Self::RegisterWakeWatcherResponseFut {
339        fn _decode(
340            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
341        ) -> Result<(), fidl::Error> {
342            let _response = fidl::client::decode_transaction_body::<
343                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
344                fidl::encoding::DefaultFuchsiaResourceDialect,
345                0x456d74519eb65b41,
346            >(_buf?)?
347            .into_result::<ManagerMarker>("register_wake_watcher")?;
348            Ok(_response)
349        }
350        self.client.send_query_and_decode::<ManagerRegisterWakeWatcherRequest, ()>(
351            &mut payload,
352            0x456d74519eb65b41,
353            fidl::encoding::DynamicFlags::FLEXIBLE,
354            _decode,
355        )
356    }
357}
358
359pub struct ManagerEventStream {
360    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
361}
362
363impl std::marker::Unpin for ManagerEventStream {}
364
365impl futures::stream::FusedStream for ManagerEventStream {
366    fn is_terminated(&self) -> bool {
367        self.event_receiver.is_terminated()
368    }
369}
370
371impl futures::Stream for ManagerEventStream {
372    type Item = Result<ManagerEvent, fidl::Error>;
373
374    fn poll_next(
375        mut self: std::pin::Pin<&mut Self>,
376        cx: &mut std::task::Context<'_>,
377    ) -> std::task::Poll<Option<Self::Item>> {
378        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
379            &mut self.event_receiver,
380            cx
381        )?) {
382            Some(buf) => std::task::Poll::Ready(Some(ManagerEvent::decode(buf))),
383            None => std::task::Poll::Ready(None),
384        }
385    }
386}
387
388#[derive(Debug)]
389pub enum ManagerEvent {
390    #[non_exhaustive]
391    _UnknownEvent {
392        /// Ordinal of the event that was sent.
393        ordinal: u64,
394    },
395}
396
397impl ManagerEvent {
398    /// Decodes a message buffer as a [`ManagerEvent`].
399    fn decode(
400        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
401    ) -> Result<ManagerEvent, fidl::Error> {
402        let (bytes, _handles) = buf.split_mut();
403        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
404        debug_assert_eq!(tx_header.tx_id, 0);
405        match tx_header.ordinal {
406            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
407                Ok(ManagerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
408            }
409            _ => Err(fidl::Error::UnknownOrdinal {
410                ordinal: tx_header.ordinal,
411                protocol_name: <ManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
412            }),
413        }
414    }
415}
416
417/// A Stream of incoming requests for fuchsia.starnix.runner/Manager.
418pub struct ManagerRequestStream {
419    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
420    is_terminated: bool,
421}
422
423impl std::marker::Unpin for ManagerRequestStream {}
424
425impl futures::stream::FusedStream for ManagerRequestStream {
426    fn is_terminated(&self) -> bool {
427        self.is_terminated
428    }
429}
430
431impl fidl::endpoints::RequestStream for ManagerRequestStream {
432    type Protocol = ManagerMarker;
433    type ControlHandle = ManagerControlHandle;
434
435    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
436        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
437    }
438
439    fn control_handle(&self) -> Self::ControlHandle {
440        ManagerControlHandle { inner: self.inner.clone() }
441    }
442
443    fn into_inner(
444        self,
445    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
446    {
447        (self.inner, self.is_terminated)
448    }
449
450    fn from_inner(
451        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
452        is_terminated: bool,
453    ) -> Self {
454        Self { inner, is_terminated }
455    }
456}
457
458impl futures::Stream for ManagerRequestStream {
459    type Item = Result<ManagerRequest, fidl::Error>;
460
461    fn poll_next(
462        mut self: std::pin::Pin<&mut Self>,
463        cx: &mut std::task::Context<'_>,
464    ) -> std::task::Poll<Option<Self::Item>> {
465        let this = &mut *self;
466        if this.inner.check_shutdown(cx) {
467            this.is_terminated = true;
468            return std::task::Poll::Ready(None);
469        }
470        if this.is_terminated {
471            panic!("polled ManagerRequestStream after completion");
472        }
473        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
474            |bytes, handles| {
475                match this.inner.channel().read_etc(cx, bytes, handles) {
476                    std::task::Poll::Ready(Ok(())) => {}
477                    std::task::Poll::Pending => return std::task::Poll::Pending,
478                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
479                        this.is_terminated = true;
480                        return std::task::Poll::Ready(None);
481                    }
482                    std::task::Poll::Ready(Err(e)) => {
483                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
484                            e.into(),
485                        ))))
486                    }
487                }
488
489                // A message has been received from the channel
490                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
491
492                std::task::Poll::Ready(Some(match header.ordinal {
493                    0x928527927c9f2a7 => {
494                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
495                        let mut req = fidl::new_empty!(
496                            ManagerSuspendContainerRequest,
497                            fidl::encoding::DefaultFuchsiaResourceDialect
498                        );
499                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagerSuspendContainerRequest>(&header, _body_bytes, handles, &mut req)?;
500                        let control_handle = ManagerControlHandle { inner: this.inner.clone() };
501                        Ok(ManagerRequest::SuspendContainer {
502                            payload: req,
503                            responder: ManagerSuspendContainerResponder {
504                                control_handle: std::mem::ManuallyDrop::new(control_handle),
505                                tx_id: header.tx_id,
506                            },
507                        })
508                    }
509                    0x46a374ab73b23714 => {
510                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
511                        let mut req = fidl::new_empty!(
512                            ManagerProxyWakeChannelRequest,
513                            fidl::encoding::DefaultFuchsiaResourceDialect
514                        );
515                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagerProxyWakeChannelRequest>(&header, _body_bytes, handles, &mut req)?;
516                        let control_handle = ManagerControlHandle { inner: this.inner.clone() };
517                        Ok(ManagerRequest::ProxyWakeChannel { payload: req, control_handle })
518                    }
519                    0x456d74519eb65b41 => {
520                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
521                        let mut req = fidl::new_empty!(
522                            ManagerRegisterWakeWatcherRequest,
523                            fidl::encoding::DefaultFuchsiaResourceDialect
524                        );
525                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagerRegisterWakeWatcherRequest>(&header, _body_bytes, handles, &mut req)?;
526                        let control_handle = ManagerControlHandle { inner: this.inner.clone() };
527                        Ok(ManagerRequest::RegisterWakeWatcher {
528                            payload: req,
529                            responder: ManagerRegisterWakeWatcherResponder {
530                                control_handle: std::mem::ManuallyDrop::new(control_handle),
531                                tx_id: header.tx_id,
532                            },
533                        })
534                    }
535                    _ if header.tx_id == 0
536                        && header
537                            .dynamic_flags()
538                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
539                    {
540                        Ok(ManagerRequest::_UnknownMethod {
541                            ordinal: header.ordinal,
542                            control_handle: ManagerControlHandle { inner: this.inner.clone() },
543                            method_type: fidl::MethodType::OneWay,
544                        })
545                    }
546                    _ if header
547                        .dynamic_flags()
548                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
549                    {
550                        this.inner.send_framework_err(
551                            fidl::encoding::FrameworkErr::UnknownMethod,
552                            header.tx_id,
553                            header.ordinal,
554                            header.dynamic_flags(),
555                            (bytes, handles),
556                        )?;
557                        Ok(ManagerRequest::_UnknownMethod {
558                            ordinal: header.ordinal,
559                            control_handle: ManagerControlHandle { inner: this.inner.clone() },
560                            method_type: fidl::MethodType::TwoWay,
561                        })
562                    }
563                    _ => Err(fidl::Error::UnknownOrdinal {
564                        ordinal: header.ordinal,
565                        protocol_name:
566                            <ManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
567                    }),
568                }))
569            },
570        )
571    }
572}
573
574#[derive(Debug)]
575pub enum ManagerRequest {
576    /// Suspends the container running in `job`.
577    ///
578    /// The call will return successfully when `wake_event` has been signaled. Returns
579    /// an error if `wake_locks` is signaled at the end of suspension, or an error is
580    /// encountered when suspending the container's processes.
581    SuspendContainer {
582        payload: ManagerSuspendContainerRequest,
583        responder: ManagerSuspendContainerResponder,
584    },
585    /// Creates a pass-through proxy that forwards messages between the `container_channel` and the
586    /// `remote_channel`.
587    ///
588    /// If any messages arrive on `remote_channel` while the container is suspended via
589    /// `SuspendContainer`, the container will be resumed and `resume_event` will be signaled with
590    /// `ZX_EVENT_SIGNALED`. Any suspend call that is made while that signal is present on
591    /// `resume_event` will wake immediately. The container is responsible for clearing
592    /// `ZX_EVENT_SIGNALED`.
593    ProxyWakeChannel {
594        payload: ManagerProxyWakeChannelRequest,
595        control_handle: ManagerControlHandle,
596    },
597    /// Registers an eventpair that will be signaled when the container is suspended or resumed.
598    /// The signals are ASLEEP(USER_1) and AWAKE(USER_0).
599    ///
600    /// The kernel returns AWAKE upon initial registration of the eventpair.
601    RegisterWakeWatcher {
602        payload: ManagerRegisterWakeWatcherRequest,
603        responder: ManagerRegisterWakeWatcherResponder,
604    },
605    /// An interaction was received which does not match any known method.
606    #[non_exhaustive]
607    _UnknownMethod {
608        /// Ordinal of the method that was called.
609        ordinal: u64,
610        control_handle: ManagerControlHandle,
611        method_type: fidl::MethodType,
612    },
613}
614
615impl ManagerRequest {
616    #[allow(irrefutable_let_patterns)]
617    pub fn into_suspend_container(
618        self,
619    ) -> Option<(ManagerSuspendContainerRequest, ManagerSuspendContainerResponder)> {
620        if let ManagerRequest::SuspendContainer { payload, responder } = self {
621            Some((payload, responder))
622        } else {
623            None
624        }
625    }
626
627    #[allow(irrefutable_let_patterns)]
628    pub fn into_proxy_wake_channel(
629        self,
630    ) -> Option<(ManagerProxyWakeChannelRequest, ManagerControlHandle)> {
631        if let ManagerRequest::ProxyWakeChannel { payload, control_handle } = self {
632            Some((payload, control_handle))
633        } else {
634            None
635        }
636    }
637
638    #[allow(irrefutable_let_patterns)]
639    pub fn into_register_wake_watcher(
640        self,
641    ) -> Option<(ManagerRegisterWakeWatcherRequest, ManagerRegisterWakeWatcherResponder)> {
642        if let ManagerRequest::RegisterWakeWatcher { payload, responder } = self {
643            Some((payload, responder))
644        } else {
645            None
646        }
647    }
648
649    /// Name of the method defined in FIDL
650    pub fn method_name(&self) -> &'static str {
651        match *self {
652            ManagerRequest::SuspendContainer { .. } => "suspend_container",
653            ManagerRequest::ProxyWakeChannel { .. } => "proxy_wake_channel",
654            ManagerRequest::RegisterWakeWatcher { .. } => "register_wake_watcher",
655            ManagerRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
656                "unknown one-way method"
657            }
658            ManagerRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
659                "unknown two-way method"
660            }
661        }
662    }
663}
664
665#[derive(Debug, Clone)]
666pub struct ManagerControlHandle {
667    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
668}
669
670impl fidl::endpoints::ControlHandle for ManagerControlHandle {
671    fn shutdown(&self) {
672        self.inner.shutdown()
673    }
674    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
675        self.inner.shutdown_with_epitaph(status)
676    }
677
678    fn is_closed(&self) -> bool {
679        self.inner.channel().is_closed()
680    }
681    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
682        self.inner.channel().on_closed()
683    }
684
685    #[cfg(target_os = "fuchsia")]
686    fn signal_peer(
687        &self,
688        clear_mask: zx::Signals,
689        set_mask: zx::Signals,
690    ) -> Result<(), zx_status::Status> {
691        use fidl::Peered;
692        self.inner.channel().signal_peer(clear_mask, set_mask)
693    }
694}
695
696impl ManagerControlHandle {}
697
698#[must_use = "FIDL methods require a response to be sent"]
699#[derive(Debug)]
700pub struct ManagerSuspendContainerResponder {
701    control_handle: std::mem::ManuallyDrop<ManagerControlHandle>,
702    tx_id: u32,
703}
704
705/// Set the the channel to be shutdown (see [`ManagerControlHandle::shutdown`])
706/// if the responder is dropped without sending a response, so that the client
707/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
708impl std::ops::Drop for ManagerSuspendContainerResponder {
709    fn drop(&mut self) {
710        self.control_handle.shutdown();
711        // Safety: drops once, never accessed again
712        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
713    }
714}
715
716impl fidl::endpoints::Responder for ManagerSuspendContainerResponder {
717    type ControlHandle = ManagerControlHandle;
718
719    fn control_handle(&self) -> &ManagerControlHandle {
720        &self.control_handle
721    }
722
723    fn drop_without_shutdown(mut self) {
724        // Safety: drops once, never accessed again due to mem::forget
725        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
726        // Prevent Drop from running (which would shut down the channel)
727        std::mem::forget(self);
728    }
729}
730
731impl ManagerSuspendContainerResponder {
732    /// Sends a response to the FIDL transaction.
733    ///
734    /// Sets the channel to shutdown if an error occurs.
735    pub fn send(
736        self,
737        mut result: Result<&ManagerSuspendContainerResponse, SuspendError>,
738    ) -> Result<(), fidl::Error> {
739        let _result = self.send_raw(result);
740        if _result.is_err() {
741            self.control_handle.shutdown();
742        }
743        self.drop_without_shutdown();
744        _result
745    }
746
747    /// Similar to "send" but does not shutdown the channel if an error occurs.
748    pub fn send_no_shutdown_on_err(
749        self,
750        mut result: Result<&ManagerSuspendContainerResponse, SuspendError>,
751    ) -> Result<(), fidl::Error> {
752        let _result = self.send_raw(result);
753        self.drop_without_shutdown();
754        _result
755    }
756
757    fn send_raw(
758        &self,
759        mut result: Result<&ManagerSuspendContainerResponse, SuspendError>,
760    ) -> Result<(), fidl::Error> {
761        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
762            ManagerSuspendContainerResponse,
763            SuspendError,
764        >>(
765            fidl::encoding::FlexibleResult::new(result),
766            self.tx_id,
767            0x928527927c9f2a7,
768            fidl::encoding::DynamicFlags::FLEXIBLE,
769        )
770    }
771}
772
773#[must_use = "FIDL methods require a response to be sent"]
774#[derive(Debug)]
775pub struct ManagerRegisterWakeWatcherResponder {
776    control_handle: std::mem::ManuallyDrop<ManagerControlHandle>,
777    tx_id: u32,
778}
779
780/// Set the the channel to be shutdown (see [`ManagerControlHandle::shutdown`])
781/// if the responder is dropped without sending a response, so that the client
782/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
783impl std::ops::Drop for ManagerRegisterWakeWatcherResponder {
784    fn drop(&mut self) {
785        self.control_handle.shutdown();
786        // Safety: drops once, never accessed again
787        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
788    }
789}
790
791impl fidl::endpoints::Responder for ManagerRegisterWakeWatcherResponder {
792    type ControlHandle = ManagerControlHandle;
793
794    fn control_handle(&self) -> &ManagerControlHandle {
795        &self.control_handle
796    }
797
798    fn drop_without_shutdown(mut self) {
799        // Safety: drops once, never accessed again due to mem::forget
800        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
801        // Prevent Drop from running (which would shut down the channel)
802        std::mem::forget(self);
803    }
804}
805
806impl ManagerRegisterWakeWatcherResponder {
807    /// Sends a response to the FIDL transaction.
808    ///
809    /// Sets the channel to shutdown if an error occurs.
810    pub fn send(self) -> Result<(), fidl::Error> {
811        let _result = self.send_raw();
812        if _result.is_err() {
813            self.control_handle.shutdown();
814        }
815        self.drop_without_shutdown();
816        _result
817    }
818
819    /// Similar to "send" but does not shutdown the channel if an error occurs.
820    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
821        let _result = self.send_raw();
822        self.drop_without_shutdown();
823        _result
824    }
825
826    fn send_raw(&self) -> Result<(), fidl::Error> {
827        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
828            fidl::encoding::Flexible::new(()),
829            self.tx_id,
830            0x456d74519eb65b41,
831            fidl::encoding::DynamicFlags::FLEXIBLE,
832        )
833    }
834}
835
836mod internal {
837    use super::*;
838
839    impl ManagerProxyWakeChannelRequest {
840        #[inline(always)]
841        fn max_ordinal_present(&self) -> u64 {
842            if let Some(_) = self.counter {
843                return 6;
844            }
845            if let Some(_) = self.name {
846                return 5;
847            }
848            if let Some(_) = self.resume_event {
849                return 4;
850            }
851            if let Some(_) = self.remote_channel {
852                return 3;
853            }
854            if let Some(_) = self.container_channel {
855                return 2;
856            }
857            if let Some(_) = self.container_job {
858                return 1;
859            }
860            0
861        }
862    }
863
864    impl fidl::encoding::ResourceTypeMarker for ManagerProxyWakeChannelRequest {
865        type Borrowed<'a> = &'a mut Self;
866        fn take_or_borrow<'a>(
867            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
868        ) -> Self::Borrowed<'a> {
869            value
870        }
871    }
872
873    unsafe impl fidl::encoding::TypeMarker for ManagerProxyWakeChannelRequest {
874        type Owned = Self;
875
876        #[inline(always)]
877        fn inline_align(_context: fidl::encoding::Context) -> usize {
878            8
879        }
880
881        #[inline(always)]
882        fn inline_size(_context: fidl::encoding::Context) -> usize {
883            16
884        }
885    }
886
887    unsafe impl
888        fidl::encoding::Encode<
889            ManagerProxyWakeChannelRequest,
890            fidl::encoding::DefaultFuchsiaResourceDialect,
891        > for &mut ManagerProxyWakeChannelRequest
892    {
893        unsafe fn encode(
894            self,
895            encoder: &mut fidl::encoding::Encoder<
896                '_,
897                fidl::encoding::DefaultFuchsiaResourceDialect,
898            >,
899            offset: usize,
900            mut depth: fidl::encoding::Depth,
901        ) -> fidl::Result<()> {
902            encoder.debug_check_bounds::<ManagerProxyWakeChannelRequest>(offset);
903            // Vector header
904            let max_ordinal: u64 = self.max_ordinal_present();
905            encoder.write_num(max_ordinal, offset);
906            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
907            // Calling encoder.out_of_line_offset(0) is not allowed.
908            if max_ordinal == 0 {
909                return Ok(());
910            }
911            depth.increment()?;
912            let envelope_size = 8;
913            let bytes_len = max_ordinal as usize * envelope_size;
914            #[allow(unused_variables)]
915            let offset = encoder.out_of_line_offset(bytes_len);
916            let mut _prev_end_offset: usize = 0;
917            if 1 > max_ordinal {
918                return Ok(());
919            }
920
921            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
922            // are envelope_size bytes.
923            let cur_offset: usize = (1 - 1) * envelope_size;
924
925            // Zero reserved fields.
926            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
927
928            // Safety:
929            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
930            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
931            //   envelope_size bytes, there is always sufficient room.
932            fidl::encoding::encode_in_envelope_optional::<
933                fidl::encoding::HandleType<
934                    fidl::Job,
935                    { fidl::ObjectType::JOB.into_raw() },
936                    2147483648,
937                >,
938                fidl::encoding::DefaultFuchsiaResourceDialect,
939            >(
940                self.container_job.as_mut().map(
941                    <fidl::encoding::HandleType<
942                        fidl::Job,
943                        { fidl::ObjectType::JOB.into_raw() },
944                        2147483648,
945                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
946                ),
947                encoder,
948                offset + cur_offset,
949                depth,
950            )?;
951
952            _prev_end_offset = cur_offset + envelope_size;
953            if 2 > max_ordinal {
954                return Ok(());
955            }
956
957            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
958            // are envelope_size bytes.
959            let cur_offset: usize = (2 - 1) * envelope_size;
960
961            // Zero reserved fields.
962            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
963
964            // Safety:
965            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
966            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
967            //   envelope_size bytes, there is always sufficient room.
968            fidl::encoding::encode_in_envelope_optional::<
969                fidl::encoding::HandleType<
970                    fidl::Channel,
971                    { fidl::ObjectType::CHANNEL.into_raw() },
972                    2147483648,
973                >,
974                fidl::encoding::DefaultFuchsiaResourceDialect,
975            >(
976                self.container_channel.as_mut().map(
977                    <fidl::encoding::HandleType<
978                        fidl::Channel,
979                        { fidl::ObjectType::CHANNEL.into_raw() },
980                        2147483648,
981                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
982                ),
983                encoder,
984                offset + cur_offset,
985                depth,
986            )?;
987
988            _prev_end_offset = cur_offset + envelope_size;
989            if 3 > max_ordinal {
990                return Ok(());
991            }
992
993            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
994            // are envelope_size bytes.
995            let cur_offset: usize = (3 - 1) * envelope_size;
996
997            // Zero reserved fields.
998            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
999
1000            // Safety:
1001            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1002            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1003            //   envelope_size bytes, there is always sufficient room.
1004            fidl::encoding::encode_in_envelope_optional::<
1005                fidl::encoding::HandleType<
1006                    fidl::Channel,
1007                    { fidl::ObjectType::CHANNEL.into_raw() },
1008                    2147483648,
1009                >,
1010                fidl::encoding::DefaultFuchsiaResourceDialect,
1011            >(
1012                self.remote_channel.as_mut().map(
1013                    <fidl::encoding::HandleType<
1014                        fidl::Channel,
1015                        { fidl::ObjectType::CHANNEL.into_raw() },
1016                        2147483648,
1017                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1018                ),
1019                encoder,
1020                offset + cur_offset,
1021                depth,
1022            )?;
1023
1024            _prev_end_offset = cur_offset + envelope_size;
1025            if 4 > max_ordinal {
1026                return Ok(());
1027            }
1028
1029            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1030            // are envelope_size bytes.
1031            let cur_offset: usize = (4 - 1) * envelope_size;
1032
1033            // Zero reserved fields.
1034            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1035
1036            // Safety:
1037            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1038            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1039            //   envelope_size bytes, there is always sufficient room.
1040            fidl::encoding::encode_in_envelope_optional::<
1041                fidl::encoding::HandleType<
1042                    fidl::EventPair,
1043                    { fidl::ObjectType::EVENTPAIR.into_raw() },
1044                    2147483648,
1045                >,
1046                fidl::encoding::DefaultFuchsiaResourceDialect,
1047            >(
1048                self.resume_event.as_mut().map(
1049                    <fidl::encoding::HandleType<
1050                        fidl::EventPair,
1051                        { fidl::ObjectType::EVENTPAIR.into_raw() },
1052                        2147483648,
1053                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1054                ),
1055                encoder,
1056                offset + cur_offset,
1057                depth,
1058            )?;
1059
1060            _prev_end_offset = cur_offset + envelope_size;
1061            if 5 > max_ordinal {
1062                return Ok(());
1063            }
1064
1065            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1066            // are envelope_size bytes.
1067            let cur_offset: usize = (5 - 1) * envelope_size;
1068
1069            // Zero reserved fields.
1070            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1071
1072            // Safety:
1073            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1074            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1075            //   envelope_size bytes, there is always sufficient room.
1076            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<1024>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1077            self.name.as_ref().map(<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow),
1078            encoder, offset + cur_offset, depth
1079        )?;
1080
1081            _prev_end_offset = cur_offset + envelope_size;
1082            if 6 > max_ordinal {
1083                return Ok(());
1084            }
1085
1086            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1087            // are envelope_size bytes.
1088            let cur_offset: usize = (6 - 1) * envelope_size;
1089
1090            // Zero reserved fields.
1091            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1092
1093            // Safety:
1094            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1095            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1096            //   envelope_size bytes, there is always sufficient room.
1097            fidl::encoding::encode_in_envelope_optional::<
1098                fidl::encoding::HandleType<
1099                    fidl::Counter,
1100                    { fidl::ObjectType::COUNTER.into_raw() },
1101                    2147483648,
1102                >,
1103                fidl::encoding::DefaultFuchsiaResourceDialect,
1104            >(
1105                self.counter.as_mut().map(
1106                    <fidl::encoding::HandleType<
1107                        fidl::Counter,
1108                        { fidl::ObjectType::COUNTER.into_raw() },
1109                        2147483648,
1110                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1111                ),
1112                encoder,
1113                offset + cur_offset,
1114                depth,
1115            )?;
1116
1117            _prev_end_offset = cur_offset + envelope_size;
1118
1119            Ok(())
1120        }
1121    }
1122
1123    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1124        for ManagerProxyWakeChannelRequest
1125    {
1126        #[inline(always)]
1127        fn new_empty() -> Self {
1128            Self::default()
1129        }
1130
1131        unsafe fn decode(
1132            &mut self,
1133            decoder: &mut fidl::encoding::Decoder<
1134                '_,
1135                fidl::encoding::DefaultFuchsiaResourceDialect,
1136            >,
1137            offset: usize,
1138            mut depth: fidl::encoding::Depth,
1139        ) -> fidl::Result<()> {
1140            decoder.debug_check_bounds::<Self>(offset);
1141            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1142                None => return Err(fidl::Error::NotNullable),
1143                Some(len) => len,
1144            };
1145            // Calling decoder.out_of_line_offset(0) is not allowed.
1146            if len == 0 {
1147                return Ok(());
1148            };
1149            depth.increment()?;
1150            let envelope_size = 8;
1151            let bytes_len = len * envelope_size;
1152            let offset = decoder.out_of_line_offset(bytes_len)?;
1153            // Decode the envelope for each type.
1154            let mut _next_ordinal_to_read = 0;
1155            let mut next_offset = offset;
1156            let end_offset = offset + bytes_len;
1157            _next_ordinal_to_read += 1;
1158            if next_offset >= end_offset {
1159                return Ok(());
1160            }
1161
1162            // Decode unknown envelopes for gaps in ordinals.
1163            while _next_ordinal_to_read < 1 {
1164                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1165                _next_ordinal_to_read += 1;
1166                next_offset += envelope_size;
1167            }
1168
1169            let next_out_of_line = decoder.next_out_of_line();
1170            let handles_before = decoder.remaining_handles();
1171            if let Some((inlined, num_bytes, num_handles)) =
1172                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1173            {
1174                let member_inline_size = <fidl::encoding::HandleType<
1175                    fidl::Job,
1176                    { fidl::ObjectType::JOB.into_raw() },
1177                    2147483648,
1178                > as fidl::encoding::TypeMarker>::inline_size(
1179                    decoder.context
1180                );
1181                if inlined != (member_inline_size <= 4) {
1182                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1183                }
1184                let inner_offset;
1185                let mut inner_depth = depth.clone();
1186                if inlined {
1187                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1188                    inner_offset = next_offset;
1189                } else {
1190                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1191                    inner_depth.increment()?;
1192                }
1193                let val_ref =
1194                self.container_job.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1195                fidl::decode!(fidl::encoding::HandleType<fidl::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1196                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1197                {
1198                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1199                }
1200                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1201                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1202                }
1203            }
1204
1205            next_offset += envelope_size;
1206            _next_ordinal_to_read += 1;
1207            if next_offset >= end_offset {
1208                return Ok(());
1209            }
1210
1211            // Decode unknown envelopes for gaps in ordinals.
1212            while _next_ordinal_to_read < 2 {
1213                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1214                _next_ordinal_to_read += 1;
1215                next_offset += envelope_size;
1216            }
1217
1218            let next_out_of_line = decoder.next_out_of_line();
1219            let handles_before = decoder.remaining_handles();
1220            if let Some((inlined, num_bytes, num_handles)) =
1221                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1222            {
1223                let member_inline_size = <fidl::encoding::HandleType<
1224                    fidl::Channel,
1225                    { fidl::ObjectType::CHANNEL.into_raw() },
1226                    2147483648,
1227                > as fidl::encoding::TypeMarker>::inline_size(
1228                    decoder.context
1229                );
1230                if inlined != (member_inline_size <= 4) {
1231                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1232                }
1233                let inner_offset;
1234                let mut inner_depth = depth.clone();
1235                if inlined {
1236                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1237                    inner_offset = next_offset;
1238                } else {
1239                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1240                    inner_depth.increment()?;
1241                }
1242                let val_ref =
1243                self.container_channel.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1244                fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1245                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1246                {
1247                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1248                }
1249                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1250                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1251                }
1252            }
1253
1254            next_offset += envelope_size;
1255            _next_ordinal_to_read += 1;
1256            if next_offset >= end_offset {
1257                return Ok(());
1258            }
1259
1260            // Decode unknown envelopes for gaps in ordinals.
1261            while _next_ordinal_to_read < 3 {
1262                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1263                _next_ordinal_to_read += 1;
1264                next_offset += envelope_size;
1265            }
1266
1267            let next_out_of_line = decoder.next_out_of_line();
1268            let handles_before = decoder.remaining_handles();
1269            if let Some((inlined, num_bytes, num_handles)) =
1270                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1271            {
1272                let member_inline_size = <fidl::encoding::HandleType<
1273                    fidl::Channel,
1274                    { fidl::ObjectType::CHANNEL.into_raw() },
1275                    2147483648,
1276                > as fidl::encoding::TypeMarker>::inline_size(
1277                    decoder.context
1278                );
1279                if inlined != (member_inline_size <= 4) {
1280                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1281                }
1282                let inner_offset;
1283                let mut inner_depth = depth.clone();
1284                if inlined {
1285                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1286                    inner_offset = next_offset;
1287                } else {
1288                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1289                    inner_depth.increment()?;
1290                }
1291                let val_ref =
1292                self.remote_channel.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1293                fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1294                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1295                {
1296                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1297                }
1298                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1299                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1300                }
1301            }
1302
1303            next_offset += envelope_size;
1304            _next_ordinal_to_read += 1;
1305            if next_offset >= end_offset {
1306                return Ok(());
1307            }
1308
1309            // Decode unknown envelopes for gaps in ordinals.
1310            while _next_ordinal_to_read < 4 {
1311                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1312                _next_ordinal_to_read += 1;
1313                next_offset += envelope_size;
1314            }
1315
1316            let next_out_of_line = decoder.next_out_of_line();
1317            let handles_before = decoder.remaining_handles();
1318            if let Some((inlined, num_bytes, num_handles)) =
1319                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1320            {
1321                let member_inline_size = <fidl::encoding::HandleType<
1322                    fidl::EventPair,
1323                    { fidl::ObjectType::EVENTPAIR.into_raw() },
1324                    2147483648,
1325                > as fidl::encoding::TypeMarker>::inline_size(
1326                    decoder.context
1327                );
1328                if inlined != (member_inline_size <= 4) {
1329                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1330                }
1331                let inner_offset;
1332                let mut inner_depth = depth.clone();
1333                if inlined {
1334                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1335                    inner_offset = next_offset;
1336                } else {
1337                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1338                    inner_depth.increment()?;
1339                }
1340                let val_ref =
1341                self.resume_event.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1342                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1343                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1344                {
1345                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1346                }
1347                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1348                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1349                }
1350            }
1351
1352            next_offset += envelope_size;
1353            _next_ordinal_to_read += 1;
1354            if next_offset >= end_offset {
1355                return Ok(());
1356            }
1357
1358            // Decode unknown envelopes for gaps in ordinals.
1359            while _next_ordinal_to_read < 5 {
1360                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1361                _next_ordinal_to_read += 1;
1362                next_offset += envelope_size;
1363            }
1364
1365            let next_out_of_line = decoder.next_out_of_line();
1366            let handles_before = decoder.remaining_handles();
1367            if let Some((inlined, num_bytes, num_handles)) =
1368                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1369            {
1370                let member_inline_size = <fidl::encoding::BoundedString<1024> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1371                if inlined != (member_inline_size <= 4) {
1372                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1373                }
1374                let inner_offset;
1375                let mut inner_depth = depth.clone();
1376                if inlined {
1377                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1378                    inner_offset = next_offset;
1379                } else {
1380                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1381                    inner_depth.increment()?;
1382                }
1383                let val_ref = self.name.get_or_insert_with(|| {
1384                    fidl::new_empty!(
1385                        fidl::encoding::BoundedString<1024>,
1386                        fidl::encoding::DefaultFuchsiaResourceDialect
1387                    )
1388                });
1389                fidl::decode!(
1390                    fidl::encoding::BoundedString<1024>,
1391                    fidl::encoding::DefaultFuchsiaResourceDialect,
1392                    val_ref,
1393                    decoder,
1394                    inner_offset,
1395                    inner_depth
1396                )?;
1397                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1398                {
1399                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1400                }
1401                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1402                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1403                }
1404            }
1405
1406            next_offset += envelope_size;
1407            _next_ordinal_to_read += 1;
1408            if next_offset >= end_offset {
1409                return Ok(());
1410            }
1411
1412            // Decode unknown envelopes for gaps in ordinals.
1413            while _next_ordinal_to_read < 6 {
1414                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1415                _next_ordinal_to_read += 1;
1416                next_offset += envelope_size;
1417            }
1418
1419            let next_out_of_line = decoder.next_out_of_line();
1420            let handles_before = decoder.remaining_handles();
1421            if let Some((inlined, num_bytes, num_handles)) =
1422                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1423            {
1424                let member_inline_size = <fidl::encoding::HandleType<
1425                    fidl::Counter,
1426                    { fidl::ObjectType::COUNTER.into_raw() },
1427                    2147483648,
1428                > as fidl::encoding::TypeMarker>::inline_size(
1429                    decoder.context
1430                );
1431                if inlined != (member_inline_size <= 4) {
1432                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1433                }
1434                let inner_offset;
1435                let mut inner_depth = depth.clone();
1436                if inlined {
1437                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1438                    inner_offset = next_offset;
1439                } else {
1440                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1441                    inner_depth.increment()?;
1442                }
1443                let val_ref =
1444                self.counter.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Counter, { fidl::ObjectType::COUNTER.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1445                fidl::decode!(fidl::encoding::HandleType<fidl::Counter, { fidl::ObjectType::COUNTER.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1446                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1447                {
1448                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1449                }
1450                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1451                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1452                }
1453            }
1454
1455            next_offset += envelope_size;
1456
1457            // Decode the remaining unknown envelopes.
1458            while next_offset < end_offset {
1459                _next_ordinal_to_read += 1;
1460                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1461                next_offset += envelope_size;
1462            }
1463
1464            Ok(())
1465        }
1466    }
1467
1468    impl ManagerRegisterWakeWatcherRequest {
1469        #[inline(always)]
1470        fn max_ordinal_present(&self) -> u64 {
1471            if let Some(_) = self.watcher {
1472                return 1;
1473            }
1474            0
1475        }
1476    }
1477
1478    impl fidl::encoding::ResourceTypeMarker for ManagerRegisterWakeWatcherRequest {
1479        type Borrowed<'a> = &'a mut Self;
1480        fn take_or_borrow<'a>(
1481            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1482        ) -> Self::Borrowed<'a> {
1483            value
1484        }
1485    }
1486
1487    unsafe impl fidl::encoding::TypeMarker for ManagerRegisterWakeWatcherRequest {
1488        type Owned = Self;
1489
1490        #[inline(always)]
1491        fn inline_align(_context: fidl::encoding::Context) -> usize {
1492            8
1493        }
1494
1495        #[inline(always)]
1496        fn inline_size(_context: fidl::encoding::Context) -> usize {
1497            16
1498        }
1499    }
1500
1501    unsafe impl
1502        fidl::encoding::Encode<
1503            ManagerRegisterWakeWatcherRequest,
1504            fidl::encoding::DefaultFuchsiaResourceDialect,
1505        > for &mut ManagerRegisterWakeWatcherRequest
1506    {
1507        unsafe fn encode(
1508            self,
1509            encoder: &mut fidl::encoding::Encoder<
1510                '_,
1511                fidl::encoding::DefaultFuchsiaResourceDialect,
1512            >,
1513            offset: usize,
1514            mut depth: fidl::encoding::Depth,
1515        ) -> fidl::Result<()> {
1516            encoder.debug_check_bounds::<ManagerRegisterWakeWatcherRequest>(offset);
1517            // Vector header
1518            let max_ordinal: u64 = self.max_ordinal_present();
1519            encoder.write_num(max_ordinal, offset);
1520            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1521            // Calling encoder.out_of_line_offset(0) is not allowed.
1522            if max_ordinal == 0 {
1523                return Ok(());
1524            }
1525            depth.increment()?;
1526            let envelope_size = 8;
1527            let bytes_len = max_ordinal as usize * envelope_size;
1528            #[allow(unused_variables)]
1529            let offset = encoder.out_of_line_offset(bytes_len);
1530            let mut _prev_end_offset: usize = 0;
1531            if 1 > max_ordinal {
1532                return Ok(());
1533            }
1534
1535            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1536            // are envelope_size bytes.
1537            let cur_offset: usize = (1 - 1) * envelope_size;
1538
1539            // Zero reserved fields.
1540            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1541
1542            // Safety:
1543            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1544            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1545            //   envelope_size bytes, there is always sufficient room.
1546            fidl::encoding::encode_in_envelope_optional::<
1547                fidl::encoding::HandleType<
1548                    fidl::EventPair,
1549                    { fidl::ObjectType::EVENTPAIR.into_raw() },
1550                    2147483648,
1551                >,
1552                fidl::encoding::DefaultFuchsiaResourceDialect,
1553            >(
1554                self.watcher.as_mut().map(
1555                    <fidl::encoding::HandleType<
1556                        fidl::EventPair,
1557                        { fidl::ObjectType::EVENTPAIR.into_raw() },
1558                        2147483648,
1559                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1560                ),
1561                encoder,
1562                offset + cur_offset,
1563                depth,
1564            )?;
1565
1566            _prev_end_offset = cur_offset + envelope_size;
1567
1568            Ok(())
1569        }
1570    }
1571
1572    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1573        for ManagerRegisterWakeWatcherRequest
1574    {
1575        #[inline(always)]
1576        fn new_empty() -> Self {
1577            Self::default()
1578        }
1579
1580        unsafe fn decode(
1581            &mut self,
1582            decoder: &mut fidl::encoding::Decoder<
1583                '_,
1584                fidl::encoding::DefaultFuchsiaResourceDialect,
1585            >,
1586            offset: usize,
1587            mut depth: fidl::encoding::Depth,
1588        ) -> fidl::Result<()> {
1589            decoder.debug_check_bounds::<Self>(offset);
1590            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1591                None => return Err(fidl::Error::NotNullable),
1592                Some(len) => len,
1593            };
1594            // Calling decoder.out_of_line_offset(0) is not allowed.
1595            if len == 0 {
1596                return Ok(());
1597            };
1598            depth.increment()?;
1599            let envelope_size = 8;
1600            let bytes_len = len * envelope_size;
1601            let offset = decoder.out_of_line_offset(bytes_len)?;
1602            // Decode the envelope for each type.
1603            let mut _next_ordinal_to_read = 0;
1604            let mut next_offset = offset;
1605            let end_offset = offset + bytes_len;
1606            _next_ordinal_to_read += 1;
1607            if next_offset >= end_offset {
1608                return Ok(());
1609            }
1610
1611            // Decode unknown envelopes for gaps in ordinals.
1612            while _next_ordinal_to_read < 1 {
1613                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1614                _next_ordinal_to_read += 1;
1615                next_offset += envelope_size;
1616            }
1617
1618            let next_out_of_line = decoder.next_out_of_line();
1619            let handles_before = decoder.remaining_handles();
1620            if let Some((inlined, num_bytes, num_handles)) =
1621                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1622            {
1623                let member_inline_size = <fidl::encoding::HandleType<
1624                    fidl::EventPair,
1625                    { fidl::ObjectType::EVENTPAIR.into_raw() },
1626                    2147483648,
1627                > as fidl::encoding::TypeMarker>::inline_size(
1628                    decoder.context
1629                );
1630                if inlined != (member_inline_size <= 4) {
1631                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1632                }
1633                let inner_offset;
1634                let mut inner_depth = depth.clone();
1635                if inlined {
1636                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1637                    inner_offset = next_offset;
1638                } else {
1639                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1640                    inner_depth.increment()?;
1641                }
1642                let val_ref =
1643                self.watcher.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1644                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1645                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1646                {
1647                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1648                }
1649                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1650                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1651                }
1652            }
1653
1654            next_offset += envelope_size;
1655
1656            // Decode the remaining unknown envelopes.
1657            while next_offset < end_offset {
1658                _next_ordinal_to_read += 1;
1659                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1660                next_offset += envelope_size;
1661            }
1662
1663            Ok(())
1664        }
1665    }
1666
1667    impl ManagerSuspendContainerRequest {
1668        #[inline(always)]
1669        fn max_ordinal_present(&self) -> u64 {
1670            if let Some(_) = self.wake_locks {
1671                return 2;
1672            }
1673            if let Some(_) = self.container_job {
1674                return 1;
1675            }
1676            0
1677        }
1678    }
1679
1680    impl fidl::encoding::ResourceTypeMarker for ManagerSuspendContainerRequest {
1681        type Borrowed<'a> = &'a mut Self;
1682        fn take_or_borrow<'a>(
1683            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1684        ) -> Self::Borrowed<'a> {
1685            value
1686        }
1687    }
1688
1689    unsafe impl fidl::encoding::TypeMarker for ManagerSuspendContainerRequest {
1690        type Owned = Self;
1691
1692        #[inline(always)]
1693        fn inline_align(_context: fidl::encoding::Context) -> usize {
1694            8
1695        }
1696
1697        #[inline(always)]
1698        fn inline_size(_context: fidl::encoding::Context) -> usize {
1699            16
1700        }
1701    }
1702
1703    unsafe impl
1704        fidl::encoding::Encode<
1705            ManagerSuspendContainerRequest,
1706            fidl::encoding::DefaultFuchsiaResourceDialect,
1707        > for &mut ManagerSuspendContainerRequest
1708    {
1709        unsafe fn encode(
1710            self,
1711            encoder: &mut fidl::encoding::Encoder<
1712                '_,
1713                fidl::encoding::DefaultFuchsiaResourceDialect,
1714            >,
1715            offset: usize,
1716            mut depth: fidl::encoding::Depth,
1717        ) -> fidl::Result<()> {
1718            encoder.debug_check_bounds::<ManagerSuspendContainerRequest>(offset);
1719            // Vector header
1720            let max_ordinal: u64 = self.max_ordinal_present();
1721            encoder.write_num(max_ordinal, offset);
1722            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1723            // Calling encoder.out_of_line_offset(0) is not allowed.
1724            if max_ordinal == 0 {
1725                return Ok(());
1726            }
1727            depth.increment()?;
1728            let envelope_size = 8;
1729            let bytes_len = max_ordinal as usize * envelope_size;
1730            #[allow(unused_variables)]
1731            let offset = encoder.out_of_line_offset(bytes_len);
1732            let mut _prev_end_offset: usize = 0;
1733            if 1 > max_ordinal {
1734                return Ok(());
1735            }
1736
1737            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1738            // are envelope_size bytes.
1739            let cur_offset: usize = (1 - 1) * envelope_size;
1740
1741            // Zero reserved fields.
1742            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1743
1744            // Safety:
1745            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1746            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1747            //   envelope_size bytes, there is always sufficient room.
1748            fidl::encoding::encode_in_envelope_optional::<
1749                fidl::encoding::HandleType<
1750                    fidl::Job,
1751                    { fidl::ObjectType::JOB.into_raw() },
1752                    2147483648,
1753                >,
1754                fidl::encoding::DefaultFuchsiaResourceDialect,
1755            >(
1756                self.container_job.as_mut().map(
1757                    <fidl::encoding::HandleType<
1758                        fidl::Job,
1759                        { fidl::ObjectType::JOB.into_raw() },
1760                        2147483648,
1761                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1762                ),
1763                encoder,
1764                offset + cur_offset,
1765                depth,
1766            )?;
1767
1768            _prev_end_offset = cur_offset + envelope_size;
1769            if 2 > max_ordinal {
1770                return Ok(());
1771            }
1772
1773            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1774            // are envelope_size bytes.
1775            let cur_offset: usize = (2 - 1) * envelope_size;
1776
1777            // Zero reserved fields.
1778            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1779
1780            // Safety:
1781            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1782            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1783            //   envelope_size bytes, there is always sufficient room.
1784            fidl::encoding::encode_in_envelope_optional::<
1785                fidl::encoding::HandleType<
1786                    fidl::EventPair,
1787                    { fidl::ObjectType::EVENTPAIR.into_raw() },
1788                    2147483648,
1789                >,
1790                fidl::encoding::DefaultFuchsiaResourceDialect,
1791            >(
1792                self.wake_locks.as_mut().map(
1793                    <fidl::encoding::HandleType<
1794                        fidl::EventPair,
1795                        { fidl::ObjectType::EVENTPAIR.into_raw() },
1796                        2147483648,
1797                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1798                ),
1799                encoder,
1800                offset + cur_offset,
1801                depth,
1802            )?;
1803
1804            _prev_end_offset = cur_offset + envelope_size;
1805
1806            Ok(())
1807        }
1808    }
1809
1810    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1811        for ManagerSuspendContainerRequest
1812    {
1813        #[inline(always)]
1814        fn new_empty() -> Self {
1815            Self::default()
1816        }
1817
1818        unsafe fn decode(
1819            &mut self,
1820            decoder: &mut fidl::encoding::Decoder<
1821                '_,
1822                fidl::encoding::DefaultFuchsiaResourceDialect,
1823            >,
1824            offset: usize,
1825            mut depth: fidl::encoding::Depth,
1826        ) -> fidl::Result<()> {
1827            decoder.debug_check_bounds::<Self>(offset);
1828            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1829                None => return Err(fidl::Error::NotNullable),
1830                Some(len) => len,
1831            };
1832            // Calling decoder.out_of_line_offset(0) is not allowed.
1833            if len == 0 {
1834                return Ok(());
1835            };
1836            depth.increment()?;
1837            let envelope_size = 8;
1838            let bytes_len = len * envelope_size;
1839            let offset = decoder.out_of_line_offset(bytes_len)?;
1840            // Decode the envelope for each type.
1841            let mut _next_ordinal_to_read = 0;
1842            let mut next_offset = offset;
1843            let end_offset = offset + bytes_len;
1844            _next_ordinal_to_read += 1;
1845            if next_offset >= end_offset {
1846                return Ok(());
1847            }
1848
1849            // Decode unknown envelopes for gaps in ordinals.
1850            while _next_ordinal_to_read < 1 {
1851                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1852                _next_ordinal_to_read += 1;
1853                next_offset += envelope_size;
1854            }
1855
1856            let next_out_of_line = decoder.next_out_of_line();
1857            let handles_before = decoder.remaining_handles();
1858            if let Some((inlined, num_bytes, num_handles)) =
1859                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1860            {
1861                let member_inline_size = <fidl::encoding::HandleType<
1862                    fidl::Job,
1863                    { fidl::ObjectType::JOB.into_raw() },
1864                    2147483648,
1865                > as fidl::encoding::TypeMarker>::inline_size(
1866                    decoder.context
1867                );
1868                if inlined != (member_inline_size <= 4) {
1869                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1870                }
1871                let inner_offset;
1872                let mut inner_depth = depth.clone();
1873                if inlined {
1874                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1875                    inner_offset = next_offset;
1876                } else {
1877                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1878                    inner_depth.increment()?;
1879                }
1880                let val_ref =
1881                self.container_job.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1882                fidl::decode!(fidl::encoding::HandleType<fidl::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1883                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1884                {
1885                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1886                }
1887                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1888                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1889                }
1890            }
1891
1892            next_offset += envelope_size;
1893            _next_ordinal_to_read += 1;
1894            if next_offset >= end_offset {
1895                return Ok(());
1896            }
1897
1898            // Decode unknown envelopes for gaps in ordinals.
1899            while _next_ordinal_to_read < 2 {
1900                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1901                _next_ordinal_to_read += 1;
1902                next_offset += envelope_size;
1903            }
1904
1905            let next_out_of_line = decoder.next_out_of_line();
1906            let handles_before = decoder.remaining_handles();
1907            if let Some((inlined, num_bytes, num_handles)) =
1908                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1909            {
1910                let member_inline_size = <fidl::encoding::HandleType<
1911                    fidl::EventPair,
1912                    { fidl::ObjectType::EVENTPAIR.into_raw() },
1913                    2147483648,
1914                > as fidl::encoding::TypeMarker>::inline_size(
1915                    decoder.context
1916                );
1917                if inlined != (member_inline_size <= 4) {
1918                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1919                }
1920                let inner_offset;
1921                let mut inner_depth = depth.clone();
1922                if inlined {
1923                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1924                    inner_offset = next_offset;
1925                } else {
1926                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1927                    inner_depth.increment()?;
1928                }
1929                let val_ref =
1930                self.wake_locks.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1931                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1932                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1933                {
1934                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1935                }
1936                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1937                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1938                }
1939            }
1940
1941            next_offset += envelope_size;
1942
1943            // Decode the remaining unknown envelopes.
1944            while next_offset < end_offset {
1945                _next_ordinal_to_read += 1;
1946                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1947                next_offset += envelope_size;
1948            }
1949
1950            Ok(())
1951        }
1952    }
1953}