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