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