Skip to main content

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