Skip to main content

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