fidl_test_systemactivitygovernor/
fidl_test_systemactivitygovernor.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_test_systemactivitygovernor_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct RealmFactoryCreateRealmExtRequest {
16    pub options: RealmOptions,
17    pub realm_server: fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21    for RealmFactoryCreateRealmExtRequest
22{
23}
24
25#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26pub struct RealmFactoryCreateRealmRequest {
27    pub realm_server: fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
28}
29
30impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
31    for RealmFactoryCreateRealmRequest
32{
33}
34
35/// RealmOptions tells the RealmFactory protocol how to create the test realm.
36#[derive(Debug, Default, PartialEq)]
37pub struct RealmOptions {
38    /// Specifies whether to use a fake SAG that exposes additional protocols
39    /// to set/watch real SAG power element power levels. Defaults to false.
40    pub use_fake_sag: Option<bool>,
41    /// Specifies whether to set the fuchsia.power.WaitForSuspendingToken config
42    /// capability to true. If true, SAG will wait to receive a token through
43    /// [`fuchsia.power.system/CpuElementManager.AddExectuionStateDependency`].
44    /// If false, SAG will skip adding external Execution State dependencies.
45    /// Defaults to false.
46    pub wait_for_suspending_token: Option<bool>,
47    /// Specifies whether SAG will use a suspender or not. Defaults to true.
48    pub use_suspender: Option<bool>,
49    #[doc(hidden)]
50    pub __source_breaking: fidl::marker::SourceBreaking,
51}
52
53impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RealmOptions {}
54
55#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
56pub struct RealmFactoryMarker;
57
58impl fidl::endpoints::ProtocolMarker for RealmFactoryMarker {
59    type Proxy = RealmFactoryProxy;
60    type RequestStream = RealmFactoryRequestStream;
61    #[cfg(target_os = "fuchsia")]
62    type SynchronousProxy = RealmFactorySynchronousProxy;
63
64    const DEBUG_NAME: &'static str = "test.systemactivitygovernor.RealmFactory";
65}
66impl fidl::endpoints::DiscoverableProtocolMarker for RealmFactoryMarker {}
67pub type RealmFactoryCreateRealmResult =
68    Result<String, fidl_fuchsia_testing_harness::OperationError>;
69pub type RealmFactoryCreateRealmExtResult =
70    Result<String, fidl_fuchsia_testing_harness::OperationError>;
71
72pub trait RealmFactoryProxyInterface: Send + Sync {
73    type CreateRealmResponseFut: std::future::Future<Output = Result<RealmFactoryCreateRealmResult, fidl::Error>>
74        + Send;
75    fn r#create_realm(
76        &self,
77        realm_server: fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
78    ) -> Self::CreateRealmResponseFut;
79    type CreateRealmExtResponseFut: std::future::Future<Output = Result<RealmFactoryCreateRealmExtResult, fidl::Error>>
80        + Send;
81    fn r#create_realm_ext(
82        &self,
83        options: RealmOptions,
84        realm_server: fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
85    ) -> Self::CreateRealmExtResponseFut;
86}
87#[derive(Debug)]
88#[cfg(target_os = "fuchsia")]
89pub struct RealmFactorySynchronousProxy {
90    client: fidl::client::sync::Client,
91}
92
93#[cfg(target_os = "fuchsia")]
94impl fidl::endpoints::SynchronousProxy for RealmFactorySynchronousProxy {
95    type Proxy = RealmFactoryProxy;
96    type Protocol = RealmFactoryMarker;
97
98    fn from_channel(inner: fidl::Channel) -> Self {
99        Self::new(inner)
100    }
101
102    fn into_channel(self) -> fidl::Channel {
103        self.client.into_channel()
104    }
105
106    fn as_channel(&self) -> &fidl::Channel {
107        self.client.as_channel()
108    }
109}
110
111#[cfg(target_os = "fuchsia")]
112impl RealmFactorySynchronousProxy {
113    pub fn new(channel: fidl::Channel) -> Self {
114        let protocol_name = <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
115        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
116    }
117
118    pub fn into_channel(self) -> fidl::Channel {
119        self.client.into_channel()
120    }
121
122    /// Waits until an event arrives and returns it. It is safe for other
123    /// threads to make concurrent requests while waiting for an event.
124    pub fn wait_for_event(
125        &self,
126        deadline: zx::MonotonicInstant,
127    ) -> Result<RealmFactoryEvent, fidl::Error> {
128        RealmFactoryEvent::decode(self.client.wait_for_event(deadline)?)
129    }
130
131    /// Creates a new realm and binds the given RealmProxy server end to it.
132    pub fn r#create_realm(
133        &self,
134        mut realm_server: fidl::endpoints::ServerEnd<
135            fidl_fuchsia_testing_harness::RealmProxy_Marker,
136        >,
137        ___deadline: zx::MonotonicInstant,
138    ) -> Result<RealmFactoryCreateRealmResult, fidl::Error> {
139        let _response = self
140            .client
141            .send_query::<RealmFactoryCreateRealmRequest, fidl::encoding::FlexibleResultType<
142                RealmFactoryCreateRealmResponse,
143                fidl_fuchsia_testing_harness::OperationError,
144            >>(
145                (realm_server,),
146                0x3fcb27aa634a2df3,
147                fidl::encoding::DynamicFlags::FLEXIBLE,
148                ___deadline,
149            )?
150            .into_result::<RealmFactoryMarker>("create_realm")?;
151        Ok(_response.map(|x| x.activity_governor_moniker))
152    }
153
154    /// Creates a new realm and accepts options.
155    pub fn r#create_realm_ext(
156        &self,
157        mut options: RealmOptions,
158        mut realm_server: fidl::endpoints::ServerEnd<
159            fidl_fuchsia_testing_harness::RealmProxy_Marker,
160        >,
161        ___deadline: zx::MonotonicInstant,
162    ) -> Result<RealmFactoryCreateRealmExtResult, fidl::Error> {
163        let _response = self
164            .client
165            .send_query::<RealmFactoryCreateRealmExtRequest, fidl::encoding::FlexibleResultType<
166                RealmFactoryCreateRealmExtResponse,
167                fidl_fuchsia_testing_harness::OperationError,
168            >>(
169                (&mut options, realm_server),
170                0x63a655ff630a0db0,
171                fidl::encoding::DynamicFlags::FLEXIBLE,
172                ___deadline,
173            )?
174            .into_result::<RealmFactoryMarker>("create_realm_ext")?;
175        Ok(_response.map(|x| x.activity_governor_moniker))
176    }
177}
178
179#[derive(Debug, Clone)]
180pub struct RealmFactoryProxy {
181    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
182}
183
184impl fidl::endpoints::Proxy for RealmFactoryProxy {
185    type Protocol = RealmFactoryMarker;
186
187    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
188        Self::new(inner)
189    }
190
191    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
192        self.client.into_channel().map_err(|client| Self { client })
193    }
194
195    fn as_channel(&self) -> &::fidl::AsyncChannel {
196        self.client.as_channel()
197    }
198}
199
200impl RealmFactoryProxy {
201    /// Create a new Proxy for test.systemactivitygovernor/RealmFactory.
202    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
203        let protocol_name = <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
204        Self { client: fidl::client::Client::new(channel, protocol_name) }
205    }
206
207    /// Get a Stream of events from the remote end of the protocol.
208    ///
209    /// # Panics
210    ///
211    /// Panics if the event stream was already taken.
212    pub fn take_event_stream(&self) -> RealmFactoryEventStream {
213        RealmFactoryEventStream { event_receiver: self.client.take_event_receiver() }
214    }
215
216    /// Creates a new realm and binds the given RealmProxy server end to it.
217    pub fn r#create_realm(
218        &self,
219        mut realm_server: fidl::endpoints::ServerEnd<
220            fidl_fuchsia_testing_harness::RealmProxy_Marker,
221        >,
222    ) -> fidl::client::QueryResponseFut<
223        RealmFactoryCreateRealmResult,
224        fidl::encoding::DefaultFuchsiaResourceDialect,
225    > {
226        RealmFactoryProxyInterface::r#create_realm(self, realm_server)
227    }
228
229    /// Creates a new realm and accepts options.
230    pub fn r#create_realm_ext(
231        &self,
232        mut options: RealmOptions,
233        mut realm_server: fidl::endpoints::ServerEnd<
234            fidl_fuchsia_testing_harness::RealmProxy_Marker,
235        >,
236    ) -> fidl::client::QueryResponseFut<
237        RealmFactoryCreateRealmExtResult,
238        fidl::encoding::DefaultFuchsiaResourceDialect,
239    > {
240        RealmFactoryProxyInterface::r#create_realm_ext(self, options, realm_server)
241    }
242}
243
244impl RealmFactoryProxyInterface for RealmFactoryProxy {
245    type CreateRealmResponseFut = fidl::client::QueryResponseFut<
246        RealmFactoryCreateRealmResult,
247        fidl::encoding::DefaultFuchsiaResourceDialect,
248    >;
249    fn r#create_realm(
250        &self,
251        mut realm_server: fidl::endpoints::ServerEnd<
252            fidl_fuchsia_testing_harness::RealmProxy_Marker,
253        >,
254    ) -> Self::CreateRealmResponseFut {
255        fn _decode(
256            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
257        ) -> Result<RealmFactoryCreateRealmResult, fidl::Error> {
258            let _response = fidl::client::decode_transaction_body::<
259                fidl::encoding::FlexibleResultType<
260                    RealmFactoryCreateRealmResponse,
261                    fidl_fuchsia_testing_harness::OperationError,
262                >,
263                fidl::encoding::DefaultFuchsiaResourceDialect,
264                0x3fcb27aa634a2df3,
265            >(_buf?)?
266            .into_result::<RealmFactoryMarker>("create_realm")?;
267            Ok(_response.map(|x| x.activity_governor_moniker))
268        }
269        self.client
270            .send_query_and_decode::<RealmFactoryCreateRealmRequest, RealmFactoryCreateRealmResult>(
271                (realm_server,),
272                0x3fcb27aa634a2df3,
273                fidl::encoding::DynamicFlags::FLEXIBLE,
274                _decode,
275            )
276    }
277
278    type CreateRealmExtResponseFut = fidl::client::QueryResponseFut<
279        RealmFactoryCreateRealmExtResult,
280        fidl::encoding::DefaultFuchsiaResourceDialect,
281    >;
282    fn r#create_realm_ext(
283        &self,
284        mut options: RealmOptions,
285        mut realm_server: fidl::endpoints::ServerEnd<
286            fidl_fuchsia_testing_harness::RealmProxy_Marker,
287        >,
288    ) -> Self::CreateRealmExtResponseFut {
289        fn _decode(
290            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
291        ) -> Result<RealmFactoryCreateRealmExtResult, fidl::Error> {
292            let _response = fidl::client::decode_transaction_body::<
293                fidl::encoding::FlexibleResultType<
294                    RealmFactoryCreateRealmExtResponse,
295                    fidl_fuchsia_testing_harness::OperationError,
296                >,
297                fidl::encoding::DefaultFuchsiaResourceDialect,
298                0x63a655ff630a0db0,
299            >(_buf?)?
300            .into_result::<RealmFactoryMarker>("create_realm_ext")?;
301            Ok(_response.map(|x| x.activity_governor_moniker))
302        }
303        self.client.send_query_and_decode::<
304            RealmFactoryCreateRealmExtRequest,
305            RealmFactoryCreateRealmExtResult,
306        >(
307            (&mut options, realm_server,),
308            0x63a655ff630a0db0,
309            fidl::encoding::DynamicFlags::FLEXIBLE,
310            _decode,
311        )
312    }
313}
314
315pub struct RealmFactoryEventStream {
316    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
317}
318
319impl std::marker::Unpin for RealmFactoryEventStream {}
320
321impl futures::stream::FusedStream for RealmFactoryEventStream {
322    fn is_terminated(&self) -> bool {
323        self.event_receiver.is_terminated()
324    }
325}
326
327impl futures::Stream for RealmFactoryEventStream {
328    type Item = Result<RealmFactoryEvent, fidl::Error>;
329
330    fn poll_next(
331        mut self: std::pin::Pin<&mut Self>,
332        cx: &mut std::task::Context<'_>,
333    ) -> std::task::Poll<Option<Self::Item>> {
334        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
335            &mut self.event_receiver,
336            cx
337        )?) {
338            Some(buf) => std::task::Poll::Ready(Some(RealmFactoryEvent::decode(buf))),
339            None => std::task::Poll::Ready(None),
340        }
341    }
342}
343
344#[derive(Debug)]
345pub enum RealmFactoryEvent {
346    #[non_exhaustive]
347    _UnknownEvent {
348        /// Ordinal of the event that was sent.
349        ordinal: u64,
350    },
351}
352
353impl RealmFactoryEvent {
354    /// Decodes a message buffer as a [`RealmFactoryEvent`].
355    fn decode(
356        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
357    ) -> Result<RealmFactoryEvent, fidl::Error> {
358        let (bytes, _handles) = buf.split_mut();
359        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
360        debug_assert_eq!(tx_header.tx_id, 0);
361        match tx_header.ordinal {
362            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
363                Ok(RealmFactoryEvent::_UnknownEvent { ordinal: tx_header.ordinal })
364            }
365            _ => Err(fidl::Error::UnknownOrdinal {
366                ordinal: tx_header.ordinal,
367                protocol_name: <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
368            }),
369        }
370    }
371}
372
373/// A Stream of incoming requests for test.systemactivitygovernor/RealmFactory.
374pub struct RealmFactoryRequestStream {
375    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
376    is_terminated: bool,
377}
378
379impl std::marker::Unpin for RealmFactoryRequestStream {}
380
381impl futures::stream::FusedStream for RealmFactoryRequestStream {
382    fn is_terminated(&self) -> bool {
383        self.is_terminated
384    }
385}
386
387impl fidl::endpoints::RequestStream for RealmFactoryRequestStream {
388    type Protocol = RealmFactoryMarker;
389    type ControlHandle = RealmFactoryControlHandle;
390
391    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
392        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
393    }
394
395    fn control_handle(&self) -> Self::ControlHandle {
396        RealmFactoryControlHandle { inner: self.inner.clone() }
397    }
398
399    fn into_inner(
400        self,
401    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
402    {
403        (self.inner, self.is_terminated)
404    }
405
406    fn from_inner(
407        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
408        is_terminated: bool,
409    ) -> Self {
410        Self { inner, is_terminated }
411    }
412}
413
414impl futures::Stream for RealmFactoryRequestStream {
415    type Item = Result<RealmFactoryRequest, fidl::Error>;
416
417    fn poll_next(
418        mut self: std::pin::Pin<&mut Self>,
419        cx: &mut std::task::Context<'_>,
420    ) -> std::task::Poll<Option<Self::Item>> {
421        let this = &mut *self;
422        if this.inner.check_shutdown(cx) {
423            this.is_terminated = true;
424            return std::task::Poll::Ready(None);
425        }
426        if this.is_terminated {
427            panic!("polled RealmFactoryRequestStream after completion");
428        }
429        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
430            |bytes, handles| {
431                match this.inner.channel().read_etc(cx, bytes, handles) {
432                    std::task::Poll::Ready(Ok(())) => {}
433                    std::task::Poll::Pending => return std::task::Poll::Pending,
434                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
435                        this.is_terminated = true;
436                        return std::task::Poll::Ready(None);
437                    }
438                    std::task::Poll::Ready(Err(e)) => {
439                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
440                            e.into(),
441                        ))))
442                    }
443                }
444
445                // A message has been received from the channel
446                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
447
448                std::task::Poll::Ready(Some(match header.ordinal {
449                    0x3fcb27aa634a2df3 => {
450                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
451                        let mut req = fidl::new_empty!(
452                            RealmFactoryCreateRealmRequest,
453                            fidl::encoding::DefaultFuchsiaResourceDialect
454                        );
455                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmFactoryCreateRealmRequest>(&header, _body_bytes, handles, &mut req)?;
456                        let control_handle =
457                            RealmFactoryControlHandle { inner: this.inner.clone() };
458                        Ok(RealmFactoryRequest::CreateRealm {
459                            realm_server: req.realm_server,
460
461                            responder: RealmFactoryCreateRealmResponder {
462                                control_handle: std::mem::ManuallyDrop::new(control_handle),
463                                tx_id: header.tx_id,
464                            },
465                        })
466                    }
467                    0x63a655ff630a0db0 => {
468                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
469                        let mut req = fidl::new_empty!(
470                            RealmFactoryCreateRealmExtRequest,
471                            fidl::encoding::DefaultFuchsiaResourceDialect
472                        );
473                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmFactoryCreateRealmExtRequest>(&header, _body_bytes, handles, &mut req)?;
474                        let control_handle =
475                            RealmFactoryControlHandle { inner: this.inner.clone() };
476                        Ok(RealmFactoryRequest::CreateRealmExt {
477                            options: req.options,
478                            realm_server: req.realm_server,
479
480                            responder: RealmFactoryCreateRealmExtResponder {
481                                control_handle: std::mem::ManuallyDrop::new(control_handle),
482                                tx_id: header.tx_id,
483                            },
484                        })
485                    }
486                    _ if header.tx_id == 0
487                        && header
488                            .dynamic_flags()
489                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
490                    {
491                        Ok(RealmFactoryRequest::_UnknownMethod {
492                            ordinal: header.ordinal,
493                            control_handle: RealmFactoryControlHandle { inner: this.inner.clone() },
494                            method_type: fidl::MethodType::OneWay,
495                        })
496                    }
497                    _ if header
498                        .dynamic_flags()
499                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
500                    {
501                        this.inner.send_framework_err(
502                            fidl::encoding::FrameworkErr::UnknownMethod,
503                            header.tx_id,
504                            header.ordinal,
505                            header.dynamic_flags(),
506                            (bytes, handles),
507                        )?;
508                        Ok(RealmFactoryRequest::_UnknownMethod {
509                            ordinal: header.ordinal,
510                            control_handle: RealmFactoryControlHandle { inner: this.inner.clone() },
511                            method_type: fidl::MethodType::TwoWay,
512                        })
513                    }
514                    _ => Err(fidl::Error::UnknownOrdinal {
515                        ordinal: header.ordinal,
516                        protocol_name:
517                            <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
518                    }),
519                }))
520            },
521        )
522    }
523}
524
525#[derive(Debug)]
526pub enum RealmFactoryRequest {
527    /// Creates a new realm and binds the given RealmProxy server end to it.
528    CreateRealm {
529        realm_server: fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
530        responder: RealmFactoryCreateRealmResponder,
531    },
532    /// Creates a new realm and accepts options.
533    CreateRealmExt {
534        options: RealmOptions,
535        realm_server: fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
536        responder: RealmFactoryCreateRealmExtResponder,
537    },
538    /// An interaction was received which does not match any known method.
539    #[non_exhaustive]
540    _UnknownMethod {
541        /// Ordinal of the method that was called.
542        ordinal: u64,
543        control_handle: RealmFactoryControlHandle,
544        method_type: fidl::MethodType,
545    },
546}
547
548impl RealmFactoryRequest {
549    #[allow(irrefutable_let_patterns)]
550    pub fn into_create_realm(
551        self,
552    ) -> Option<(
553        fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
554        RealmFactoryCreateRealmResponder,
555    )> {
556        if let RealmFactoryRequest::CreateRealm { realm_server, responder } = self {
557            Some((realm_server, responder))
558        } else {
559            None
560        }
561    }
562
563    #[allow(irrefutable_let_patterns)]
564    pub fn into_create_realm_ext(
565        self,
566    ) -> Option<(
567        RealmOptions,
568        fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
569        RealmFactoryCreateRealmExtResponder,
570    )> {
571        if let RealmFactoryRequest::CreateRealmExt { options, realm_server, responder } = self {
572            Some((options, realm_server, responder))
573        } else {
574            None
575        }
576    }
577
578    /// Name of the method defined in FIDL
579    pub fn method_name(&self) -> &'static str {
580        match *self {
581            RealmFactoryRequest::CreateRealm { .. } => "create_realm",
582            RealmFactoryRequest::CreateRealmExt { .. } => "create_realm_ext",
583            RealmFactoryRequest::_UnknownMethod {
584                method_type: fidl::MethodType::OneWay, ..
585            } => "unknown one-way method",
586            RealmFactoryRequest::_UnknownMethod {
587                method_type: fidl::MethodType::TwoWay, ..
588            } => "unknown two-way method",
589        }
590    }
591}
592
593#[derive(Debug, Clone)]
594pub struct RealmFactoryControlHandle {
595    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
596}
597
598impl fidl::endpoints::ControlHandle for RealmFactoryControlHandle {
599    fn shutdown(&self) {
600        self.inner.shutdown()
601    }
602    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
603        self.inner.shutdown_with_epitaph(status)
604    }
605
606    fn is_closed(&self) -> bool {
607        self.inner.channel().is_closed()
608    }
609    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
610        self.inner.channel().on_closed()
611    }
612
613    #[cfg(target_os = "fuchsia")]
614    fn signal_peer(
615        &self,
616        clear_mask: zx::Signals,
617        set_mask: zx::Signals,
618    ) -> Result<(), zx_status::Status> {
619        use fidl::Peered;
620        self.inner.channel().signal_peer(clear_mask, set_mask)
621    }
622}
623
624impl RealmFactoryControlHandle {}
625
626#[must_use = "FIDL methods require a response to be sent"]
627#[derive(Debug)]
628pub struct RealmFactoryCreateRealmResponder {
629    control_handle: std::mem::ManuallyDrop<RealmFactoryControlHandle>,
630    tx_id: u32,
631}
632
633/// Set the the channel to be shutdown (see [`RealmFactoryControlHandle::shutdown`])
634/// if the responder is dropped without sending a response, so that the client
635/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
636impl std::ops::Drop for RealmFactoryCreateRealmResponder {
637    fn drop(&mut self) {
638        self.control_handle.shutdown();
639        // Safety: drops once, never accessed again
640        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
641    }
642}
643
644impl fidl::endpoints::Responder for RealmFactoryCreateRealmResponder {
645    type ControlHandle = RealmFactoryControlHandle;
646
647    fn control_handle(&self) -> &RealmFactoryControlHandle {
648        &self.control_handle
649    }
650
651    fn drop_without_shutdown(mut self) {
652        // Safety: drops once, never accessed again due to mem::forget
653        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
654        // Prevent Drop from running (which would shut down the channel)
655        std::mem::forget(self);
656    }
657}
658
659impl RealmFactoryCreateRealmResponder {
660    /// Sends a response to the FIDL transaction.
661    ///
662    /// Sets the channel to shutdown if an error occurs.
663    pub fn send(
664        self,
665        mut result: Result<&str, fidl_fuchsia_testing_harness::OperationError>,
666    ) -> Result<(), fidl::Error> {
667        let _result = self.send_raw(result);
668        if _result.is_err() {
669            self.control_handle.shutdown();
670        }
671        self.drop_without_shutdown();
672        _result
673    }
674
675    /// Similar to "send" but does not shutdown the channel if an error occurs.
676    pub fn send_no_shutdown_on_err(
677        self,
678        mut result: Result<&str, fidl_fuchsia_testing_harness::OperationError>,
679    ) -> Result<(), fidl::Error> {
680        let _result = self.send_raw(result);
681        self.drop_without_shutdown();
682        _result
683    }
684
685    fn send_raw(
686        &self,
687        mut result: Result<&str, fidl_fuchsia_testing_harness::OperationError>,
688    ) -> Result<(), fidl::Error> {
689        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
690            RealmFactoryCreateRealmResponse,
691            fidl_fuchsia_testing_harness::OperationError,
692        >>(
693            fidl::encoding::FlexibleResult::new(
694                result.map(|activity_governor_moniker| (activity_governor_moniker,)),
695            ),
696            self.tx_id,
697            0x3fcb27aa634a2df3,
698            fidl::encoding::DynamicFlags::FLEXIBLE,
699        )
700    }
701}
702
703#[must_use = "FIDL methods require a response to be sent"]
704#[derive(Debug)]
705pub struct RealmFactoryCreateRealmExtResponder {
706    control_handle: std::mem::ManuallyDrop<RealmFactoryControlHandle>,
707    tx_id: u32,
708}
709
710/// Set the the channel to be shutdown (see [`RealmFactoryControlHandle::shutdown`])
711/// if the responder is dropped without sending a response, so that the client
712/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
713impl std::ops::Drop for RealmFactoryCreateRealmExtResponder {
714    fn drop(&mut self) {
715        self.control_handle.shutdown();
716        // Safety: drops once, never accessed again
717        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
718    }
719}
720
721impl fidl::endpoints::Responder for RealmFactoryCreateRealmExtResponder {
722    type ControlHandle = RealmFactoryControlHandle;
723
724    fn control_handle(&self) -> &RealmFactoryControlHandle {
725        &self.control_handle
726    }
727
728    fn drop_without_shutdown(mut self) {
729        // Safety: drops once, never accessed again due to mem::forget
730        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
731        // Prevent Drop from running (which would shut down the channel)
732        std::mem::forget(self);
733    }
734}
735
736impl RealmFactoryCreateRealmExtResponder {
737    /// Sends a response to the FIDL transaction.
738    ///
739    /// Sets the channel to shutdown if an error occurs.
740    pub fn send(
741        self,
742        mut result: Result<&str, fidl_fuchsia_testing_harness::OperationError>,
743    ) -> Result<(), fidl::Error> {
744        let _result = self.send_raw(result);
745        if _result.is_err() {
746            self.control_handle.shutdown();
747        }
748        self.drop_without_shutdown();
749        _result
750    }
751
752    /// Similar to "send" but does not shutdown the channel if an error occurs.
753    pub fn send_no_shutdown_on_err(
754        self,
755        mut result: Result<&str, fidl_fuchsia_testing_harness::OperationError>,
756    ) -> Result<(), fidl::Error> {
757        let _result = self.send_raw(result);
758        self.drop_without_shutdown();
759        _result
760    }
761
762    fn send_raw(
763        &self,
764        mut result: Result<&str, fidl_fuchsia_testing_harness::OperationError>,
765    ) -> Result<(), fidl::Error> {
766        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
767            RealmFactoryCreateRealmExtResponse,
768            fidl_fuchsia_testing_harness::OperationError,
769        >>(
770            fidl::encoding::FlexibleResult::new(
771                result.map(|activity_governor_moniker| (activity_governor_moniker,)),
772            ),
773            self.tx_id,
774            0x63a655ff630a0db0,
775            fidl::encoding::DynamicFlags::FLEXIBLE,
776        )
777    }
778}
779
780mod internal {
781    use super::*;
782
783    impl fidl::encoding::ResourceTypeMarker for RealmFactoryCreateRealmExtRequest {
784        type Borrowed<'a> = &'a mut Self;
785        fn take_or_borrow<'a>(
786            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
787        ) -> Self::Borrowed<'a> {
788            value
789        }
790    }
791
792    unsafe impl fidl::encoding::TypeMarker for RealmFactoryCreateRealmExtRequest {
793        type Owned = Self;
794
795        #[inline(always)]
796        fn inline_align(_context: fidl::encoding::Context) -> usize {
797            8
798        }
799
800        #[inline(always)]
801        fn inline_size(_context: fidl::encoding::Context) -> usize {
802            24
803        }
804    }
805
806    unsafe impl
807        fidl::encoding::Encode<
808            RealmFactoryCreateRealmExtRequest,
809            fidl::encoding::DefaultFuchsiaResourceDialect,
810        > for &mut RealmFactoryCreateRealmExtRequest
811    {
812        #[inline]
813        unsafe fn encode(
814            self,
815            encoder: &mut fidl::encoding::Encoder<
816                '_,
817                fidl::encoding::DefaultFuchsiaResourceDialect,
818            >,
819            offset: usize,
820            _depth: fidl::encoding::Depth,
821        ) -> fidl::Result<()> {
822            encoder.debug_check_bounds::<RealmFactoryCreateRealmExtRequest>(offset);
823            // Delegate to tuple encoding.
824            fidl::encoding::Encode::<
825                RealmFactoryCreateRealmExtRequest,
826                fidl::encoding::DefaultFuchsiaResourceDialect,
827            >::encode(
828                (
829                    <RealmOptions as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
830                        &mut self.options,
831                    ),
832                    <fidl::encoding::Endpoint<
833                        fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
834                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
835                        &mut self.realm_server,
836                    ),
837                ),
838                encoder,
839                offset,
840                _depth,
841            )
842        }
843    }
844    unsafe impl<
845            T0: fidl::encoding::Encode<RealmOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
846            T1: fidl::encoding::Encode<
847                fidl::encoding::Endpoint<
848                    fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
849                >,
850                fidl::encoding::DefaultFuchsiaResourceDialect,
851            >,
852        >
853        fidl::encoding::Encode<
854            RealmFactoryCreateRealmExtRequest,
855            fidl::encoding::DefaultFuchsiaResourceDialect,
856        > for (T0, T1)
857    {
858        #[inline]
859        unsafe fn encode(
860            self,
861            encoder: &mut fidl::encoding::Encoder<
862                '_,
863                fidl::encoding::DefaultFuchsiaResourceDialect,
864            >,
865            offset: usize,
866            depth: fidl::encoding::Depth,
867        ) -> fidl::Result<()> {
868            encoder.debug_check_bounds::<RealmFactoryCreateRealmExtRequest>(offset);
869            // Zero out padding regions. There's no need to apply masks
870            // because the unmasked parts will be overwritten by fields.
871            unsafe {
872                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
873                (ptr as *mut u64).write_unaligned(0);
874            }
875            // Write the fields.
876            self.0.encode(encoder, offset + 0, depth)?;
877            self.1.encode(encoder, offset + 16, depth)?;
878            Ok(())
879        }
880    }
881
882    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
883        for RealmFactoryCreateRealmExtRequest
884    {
885        #[inline(always)]
886        fn new_empty() -> Self {
887            Self {
888                options: fidl::new_empty!(
889                    RealmOptions,
890                    fidl::encoding::DefaultFuchsiaResourceDialect
891                ),
892                realm_server: fidl::new_empty!(
893                    fidl::encoding::Endpoint<
894                        fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
895                    >,
896                    fidl::encoding::DefaultFuchsiaResourceDialect
897                ),
898            }
899        }
900
901        #[inline]
902        unsafe fn decode(
903            &mut self,
904            decoder: &mut fidl::encoding::Decoder<
905                '_,
906                fidl::encoding::DefaultFuchsiaResourceDialect,
907            >,
908            offset: usize,
909            _depth: fidl::encoding::Depth,
910        ) -> fidl::Result<()> {
911            decoder.debug_check_bounds::<Self>(offset);
912            // Verify that padding bytes are zero.
913            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
914            let padval = unsafe { (ptr as *const u64).read_unaligned() };
915            let mask = 0xffffffff00000000u64;
916            let maskedval = padval & mask;
917            if maskedval != 0 {
918                return Err(fidl::Error::NonZeroPadding {
919                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
920                });
921            }
922            fidl::decode!(
923                RealmOptions,
924                fidl::encoding::DefaultFuchsiaResourceDialect,
925                &mut self.options,
926                decoder,
927                offset + 0,
928                _depth
929            )?;
930            fidl::decode!(
931                fidl::encoding::Endpoint<
932                    fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
933                >,
934                fidl::encoding::DefaultFuchsiaResourceDialect,
935                &mut self.realm_server,
936                decoder,
937                offset + 16,
938                _depth
939            )?;
940            Ok(())
941        }
942    }
943
944    impl fidl::encoding::ResourceTypeMarker for RealmFactoryCreateRealmRequest {
945        type Borrowed<'a> = &'a mut Self;
946        fn take_or_borrow<'a>(
947            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
948        ) -> Self::Borrowed<'a> {
949            value
950        }
951    }
952
953    unsafe impl fidl::encoding::TypeMarker for RealmFactoryCreateRealmRequest {
954        type Owned = Self;
955
956        #[inline(always)]
957        fn inline_align(_context: fidl::encoding::Context) -> usize {
958            4
959        }
960
961        #[inline(always)]
962        fn inline_size(_context: fidl::encoding::Context) -> usize {
963            4
964        }
965    }
966
967    unsafe impl
968        fidl::encoding::Encode<
969            RealmFactoryCreateRealmRequest,
970            fidl::encoding::DefaultFuchsiaResourceDialect,
971        > for &mut RealmFactoryCreateRealmRequest
972    {
973        #[inline]
974        unsafe fn encode(
975            self,
976            encoder: &mut fidl::encoding::Encoder<
977                '_,
978                fidl::encoding::DefaultFuchsiaResourceDialect,
979            >,
980            offset: usize,
981            _depth: fidl::encoding::Depth,
982        ) -> fidl::Result<()> {
983            encoder.debug_check_bounds::<RealmFactoryCreateRealmRequest>(offset);
984            // Delegate to tuple encoding.
985            fidl::encoding::Encode::<
986                RealmFactoryCreateRealmRequest,
987                fidl::encoding::DefaultFuchsiaResourceDialect,
988            >::encode(
989                (<fidl::encoding::Endpoint<
990                    fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
991                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
992                    &mut self.realm_server
993                ),),
994                encoder,
995                offset,
996                _depth,
997            )
998        }
999    }
1000    unsafe impl<
1001            T0: fidl::encoding::Encode<
1002                fidl::encoding::Endpoint<
1003                    fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1004                >,
1005                fidl::encoding::DefaultFuchsiaResourceDialect,
1006            >,
1007        >
1008        fidl::encoding::Encode<
1009            RealmFactoryCreateRealmRequest,
1010            fidl::encoding::DefaultFuchsiaResourceDialect,
1011        > for (T0,)
1012    {
1013        #[inline]
1014        unsafe fn encode(
1015            self,
1016            encoder: &mut fidl::encoding::Encoder<
1017                '_,
1018                fidl::encoding::DefaultFuchsiaResourceDialect,
1019            >,
1020            offset: usize,
1021            depth: fidl::encoding::Depth,
1022        ) -> fidl::Result<()> {
1023            encoder.debug_check_bounds::<RealmFactoryCreateRealmRequest>(offset);
1024            // Zero out padding regions. There's no need to apply masks
1025            // because the unmasked parts will be overwritten by fields.
1026            // Write the fields.
1027            self.0.encode(encoder, offset + 0, depth)?;
1028            Ok(())
1029        }
1030    }
1031
1032    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1033        for RealmFactoryCreateRealmRequest
1034    {
1035        #[inline(always)]
1036        fn new_empty() -> Self {
1037            Self {
1038                realm_server: fidl::new_empty!(
1039                    fidl::encoding::Endpoint<
1040                        fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1041                    >,
1042                    fidl::encoding::DefaultFuchsiaResourceDialect
1043                ),
1044            }
1045        }
1046
1047        #[inline]
1048        unsafe fn decode(
1049            &mut self,
1050            decoder: &mut fidl::encoding::Decoder<
1051                '_,
1052                fidl::encoding::DefaultFuchsiaResourceDialect,
1053            >,
1054            offset: usize,
1055            _depth: fidl::encoding::Depth,
1056        ) -> fidl::Result<()> {
1057            decoder.debug_check_bounds::<Self>(offset);
1058            // Verify that padding bytes are zero.
1059            fidl::decode!(
1060                fidl::encoding::Endpoint<
1061                    fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1062                >,
1063                fidl::encoding::DefaultFuchsiaResourceDialect,
1064                &mut self.realm_server,
1065                decoder,
1066                offset + 0,
1067                _depth
1068            )?;
1069            Ok(())
1070        }
1071    }
1072
1073    impl RealmOptions {
1074        #[inline(always)]
1075        fn max_ordinal_present(&self) -> u64 {
1076            if let Some(_) = self.use_suspender {
1077                return 3;
1078            }
1079            if let Some(_) = self.wait_for_suspending_token {
1080                return 2;
1081            }
1082            if let Some(_) = self.use_fake_sag {
1083                return 1;
1084            }
1085            0
1086        }
1087    }
1088
1089    impl fidl::encoding::ResourceTypeMarker for RealmOptions {
1090        type Borrowed<'a> = &'a mut Self;
1091        fn take_or_borrow<'a>(
1092            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1093        ) -> Self::Borrowed<'a> {
1094            value
1095        }
1096    }
1097
1098    unsafe impl fidl::encoding::TypeMarker for RealmOptions {
1099        type Owned = Self;
1100
1101        #[inline(always)]
1102        fn inline_align(_context: fidl::encoding::Context) -> usize {
1103            8
1104        }
1105
1106        #[inline(always)]
1107        fn inline_size(_context: fidl::encoding::Context) -> usize {
1108            16
1109        }
1110    }
1111
1112    unsafe impl fidl::encoding::Encode<RealmOptions, fidl::encoding::DefaultFuchsiaResourceDialect>
1113        for &mut RealmOptions
1114    {
1115        unsafe fn encode(
1116            self,
1117            encoder: &mut fidl::encoding::Encoder<
1118                '_,
1119                fidl::encoding::DefaultFuchsiaResourceDialect,
1120            >,
1121            offset: usize,
1122            mut depth: fidl::encoding::Depth,
1123        ) -> fidl::Result<()> {
1124            encoder.debug_check_bounds::<RealmOptions>(offset);
1125            // Vector header
1126            let max_ordinal: u64 = self.max_ordinal_present();
1127            encoder.write_num(max_ordinal, offset);
1128            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1129            // Calling encoder.out_of_line_offset(0) is not allowed.
1130            if max_ordinal == 0 {
1131                return Ok(());
1132            }
1133            depth.increment()?;
1134            let envelope_size = 8;
1135            let bytes_len = max_ordinal as usize * envelope_size;
1136            #[allow(unused_variables)]
1137            let offset = encoder.out_of_line_offset(bytes_len);
1138            let mut _prev_end_offset: usize = 0;
1139            if 1 > max_ordinal {
1140                return Ok(());
1141            }
1142
1143            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1144            // are envelope_size bytes.
1145            let cur_offset: usize = (1 - 1) * envelope_size;
1146
1147            // Zero reserved fields.
1148            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1149
1150            // Safety:
1151            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1152            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1153            //   envelope_size bytes, there is always sufficient room.
1154            fidl::encoding::encode_in_envelope_optional::<
1155                bool,
1156                fidl::encoding::DefaultFuchsiaResourceDialect,
1157            >(
1158                self.use_fake_sag.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1159                encoder,
1160                offset + cur_offset,
1161                depth,
1162            )?;
1163
1164            _prev_end_offset = cur_offset + envelope_size;
1165            if 2 > max_ordinal {
1166                return Ok(());
1167            }
1168
1169            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1170            // are envelope_size bytes.
1171            let cur_offset: usize = (2 - 1) * envelope_size;
1172
1173            // Zero reserved fields.
1174            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1175
1176            // Safety:
1177            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1178            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1179            //   envelope_size bytes, there is always sufficient room.
1180            fidl::encoding::encode_in_envelope_optional::<
1181                bool,
1182                fidl::encoding::DefaultFuchsiaResourceDialect,
1183            >(
1184                self.wait_for_suspending_token
1185                    .as_ref()
1186                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1187                encoder,
1188                offset + cur_offset,
1189                depth,
1190            )?;
1191
1192            _prev_end_offset = cur_offset + envelope_size;
1193            if 3 > max_ordinal {
1194                return Ok(());
1195            }
1196
1197            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1198            // are envelope_size bytes.
1199            let cur_offset: usize = (3 - 1) * envelope_size;
1200
1201            // Zero reserved fields.
1202            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1203
1204            // Safety:
1205            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1206            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1207            //   envelope_size bytes, there is always sufficient room.
1208            fidl::encoding::encode_in_envelope_optional::<
1209                bool,
1210                fidl::encoding::DefaultFuchsiaResourceDialect,
1211            >(
1212                self.use_suspender.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1213                encoder,
1214                offset + cur_offset,
1215                depth,
1216            )?;
1217
1218            _prev_end_offset = cur_offset + envelope_size;
1219
1220            Ok(())
1221        }
1222    }
1223
1224    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for RealmOptions {
1225        #[inline(always)]
1226        fn new_empty() -> Self {
1227            Self::default()
1228        }
1229
1230        unsafe fn decode(
1231            &mut self,
1232            decoder: &mut fidl::encoding::Decoder<
1233                '_,
1234                fidl::encoding::DefaultFuchsiaResourceDialect,
1235            >,
1236            offset: usize,
1237            mut depth: fidl::encoding::Depth,
1238        ) -> fidl::Result<()> {
1239            decoder.debug_check_bounds::<Self>(offset);
1240            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1241                None => return Err(fidl::Error::NotNullable),
1242                Some(len) => len,
1243            };
1244            // Calling decoder.out_of_line_offset(0) is not allowed.
1245            if len == 0 {
1246                return Ok(());
1247            };
1248            depth.increment()?;
1249            let envelope_size = 8;
1250            let bytes_len = len * envelope_size;
1251            let offset = decoder.out_of_line_offset(bytes_len)?;
1252            // Decode the envelope for each type.
1253            let mut _next_ordinal_to_read = 0;
1254            let mut next_offset = offset;
1255            let end_offset = offset + bytes_len;
1256            _next_ordinal_to_read += 1;
1257            if next_offset >= end_offset {
1258                return Ok(());
1259            }
1260
1261            // Decode unknown envelopes for gaps in ordinals.
1262            while _next_ordinal_to_read < 1 {
1263                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1264                _next_ordinal_to_read += 1;
1265                next_offset += envelope_size;
1266            }
1267
1268            let next_out_of_line = decoder.next_out_of_line();
1269            let handles_before = decoder.remaining_handles();
1270            if let Some((inlined, num_bytes, num_handles)) =
1271                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1272            {
1273                let member_inline_size =
1274                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1275                if inlined != (member_inline_size <= 4) {
1276                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1277                }
1278                let inner_offset;
1279                let mut inner_depth = depth.clone();
1280                if inlined {
1281                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1282                    inner_offset = next_offset;
1283                } else {
1284                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1285                    inner_depth.increment()?;
1286                }
1287                let val_ref = self.use_fake_sag.get_or_insert_with(|| {
1288                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
1289                });
1290                fidl::decode!(
1291                    bool,
1292                    fidl::encoding::DefaultFuchsiaResourceDialect,
1293                    val_ref,
1294                    decoder,
1295                    inner_offset,
1296                    inner_depth
1297                )?;
1298                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1299                {
1300                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1301                }
1302                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1303                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1304                }
1305            }
1306
1307            next_offset += envelope_size;
1308            _next_ordinal_to_read += 1;
1309            if next_offset >= end_offset {
1310                return Ok(());
1311            }
1312
1313            // Decode unknown envelopes for gaps in ordinals.
1314            while _next_ordinal_to_read < 2 {
1315                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1316                _next_ordinal_to_read += 1;
1317                next_offset += envelope_size;
1318            }
1319
1320            let next_out_of_line = decoder.next_out_of_line();
1321            let handles_before = decoder.remaining_handles();
1322            if let Some((inlined, num_bytes, num_handles)) =
1323                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1324            {
1325                let member_inline_size =
1326                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1327                if inlined != (member_inline_size <= 4) {
1328                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1329                }
1330                let inner_offset;
1331                let mut inner_depth = depth.clone();
1332                if inlined {
1333                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1334                    inner_offset = next_offset;
1335                } else {
1336                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1337                    inner_depth.increment()?;
1338                }
1339                let val_ref = self.wait_for_suspending_token.get_or_insert_with(|| {
1340                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
1341                });
1342                fidl::decode!(
1343                    bool,
1344                    fidl::encoding::DefaultFuchsiaResourceDialect,
1345                    val_ref,
1346                    decoder,
1347                    inner_offset,
1348                    inner_depth
1349                )?;
1350                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1351                {
1352                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1353                }
1354                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1355                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1356                }
1357            }
1358
1359            next_offset += envelope_size;
1360            _next_ordinal_to_read += 1;
1361            if next_offset >= end_offset {
1362                return Ok(());
1363            }
1364
1365            // Decode unknown envelopes for gaps in ordinals.
1366            while _next_ordinal_to_read < 3 {
1367                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1368                _next_ordinal_to_read += 1;
1369                next_offset += envelope_size;
1370            }
1371
1372            let next_out_of_line = decoder.next_out_of_line();
1373            let handles_before = decoder.remaining_handles();
1374            if let Some((inlined, num_bytes, num_handles)) =
1375                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1376            {
1377                let member_inline_size =
1378                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1379                if inlined != (member_inline_size <= 4) {
1380                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1381                }
1382                let inner_offset;
1383                let mut inner_depth = depth.clone();
1384                if inlined {
1385                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1386                    inner_offset = next_offset;
1387                } else {
1388                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1389                    inner_depth.increment()?;
1390                }
1391                let val_ref = self.use_suspender.get_or_insert_with(|| {
1392                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
1393                });
1394                fidl::decode!(
1395                    bool,
1396                    fidl::encoding::DefaultFuchsiaResourceDialect,
1397                    val_ref,
1398                    decoder,
1399                    inner_offset,
1400                    inner_depth
1401                )?;
1402                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1403                {
1404                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1405                }
1406                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1407                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1408                }
1409            }
1410
1411            next_offset += envelope_size;
1412
1413            // Decode the remaining unknown envelopes.
1414            while next_offset < end_offset {
1415                _next_ordinal_to_read += 1;
1416                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1417                next_offset += envelope_size;
1418            }
1419
1420            Ok(())
1421        }
1422    }
1423}