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