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 fidl::endpoints::ControlHandle for InspectPuppetControlHandle {
660    fn shutdown(&self) {
661        self.inner.shutdown()
662    }
663
664    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
665        self.inner.shutdown_with_epitaph(status)
666    }
667
668    fn is_closed(&self) -> bool {
669        self.inner.channel().is_closed()
670    }
671    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
672        self.inner.channel().on_closed()
673    }
674
675    #[cfg(target_os = "fuchsia")]
676    fn signal_peer(
677        &self,
678        clear_mask: zx::Signals,
679        set_mask: zx::Signals,
680    ) -> Result<(), zx_status::Status> {
681        use fidl::Peered;
682        self.inner.channel().signal_peer(clear_mask, set_mask)
683    }
684}
685
686impl InspectPuppetControlHandle {}
687
688#[must_use = "FIDL methods require a response to be sent"]
689#[derive(Debug)]
690pub struct InspectPuppetInitializeResponder {
691    control_handle: std::mem::ManuallyDrop<InspectPuppetControlHandle>,
692    tx_id: u32,
693}
694
695/// Set the the channel to be shutdown (see [`InspectPuppetControlHandle::shutdown`])
696/// if the responder is dropped without sending a response, so that the client
697/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
698impl std::ops::Drop for InspectPuppetInitializeResponder {
699    fn drop(&mut self) {
700        self.control_handle.shutdown();
701        // Safety: drops once, never accessed again
702        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
703    }
704}
705
706impl fidl::endpoints::Responder for InspectPuppetInitializeResponder {
707    type ControlHandle = InspectPuppetControlHandle;
708
709    fn control_handle(&self) -> &InspectPuppetControlHandle {
710        &self.control_handle
711    }
712
713    fn drop_without_shutdown(mut self) {
714        // Safety: drops once, never accessed again due to mem::forget
715        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
716        // Prevent Drop from running (which would shut down the channel)
717        std::mem::forget(self);
718    }
719}
720
721impl InspectPuppetInitializeResponder {
722    /// Sends a response to the FIDL transaction.
723    ///
724    /// Sets the channel to shutdown if an error occurs.
725    pub fn send(
726        self,
727        mut vmo: Option<fidl::NullableHandle>,
728        mut result: TestResult,
729    ) -> Result<(), fidl::Error> {
730        let _result = self.send_raw(vmo, result);
731        if _result.is_err() {
732            self.control_handle.shutdown();
733        }
734        self.drop_without_shutdown();
735        _result
736    }
737
738    /// Similar to "send" but does not shutdown the channel if an error occurs.
739    pub fn send_no_shutdown_on_err(
740        self,
741        mut vmo: Option<fidl::NullableHandle>,
742        mut result: TestResult,
743    ) -> Result<(), fidl::Error> {
744        let _result = self.send_raw(vmo, result);
745        self.drop_without_shutdown();
746        _result
747    }
748
749    fn send_raw(
750        &self,
751        mut vmo: Option<fidl::NullableHandle>,
752        mut result: TestResult,
753    ) -> Result<(), fidl::Error> {
754        self.control_handle.inner.send::<InspectPuppetInitializeResponse>(
755            (vmo, result),
756            self.tx_id,
757            0x48fbff796c4186cb,
758            fidl::encoding::DynamicFlags::empty(),
759        )
760    }
761}
762
763#[must_use = "FIDL methods require a response to be sent"]
764#[derive(Debug)]
765pub struct InspectPuppetGetConfigResponder {
766    control_handle: std::mem::ManuallyDrop<InspectPuppetControlHandle>,
767    tx_id: u32,
768}
769
770/// Set the the channel to be shutdown (see [`InspectPuppetControlHandle::shutdown`])
771/// if the responder is dropped without sending a response, so that the client
772/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
773impl std::ops::Drop for InspectPuppetGetConfigResponder {
774    fn drop(&mut self) {
775        self.control_handle.shutdown();
776        // Safety: drops once, never accessed again
777        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
778    }
779}
780
781impl fidl::endpoints::Responder for InspectPuppetGetConfigResponder {
782    type ControlHandle = InspectPuppetControlHandle;
783
784    fn control_handle(&self) -> &InspectPuppetControlHandle {
785        &self.control_handle
786    }
787
788    fn drop_without_shutdown(mut self) {
789        // Safety: drops once, never accessed again due to mem::forget
790        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
791        // Prevent Drop from running (which would shut down the channel)
792        std::mem::forget(self);
793    }
794}
795
796impl InspectPuppetGetConfigResponder {
797    /// Sends a response to the FIDL transaction.
798    ///
799    /// Sets the channel to shutdown if an error occurs.
800    pub fn send(self, mut printable_name: &str, mut options: Options) -> Result<(), fidl::Error> {
801        let _result = self.send_raw(printable_name, options);
802        if _result.is_err() {
803            self.control_handle.shutdown();
804        }
805        self.drop_without_shutdown();
806        _result
807    }
808
809    /// Similar to "send" but does not shutdown the channel if an error occurs.
810    pub fn send_no_shutdown_on_err(
811        self,
812        mut printable_name: &str,
813        mut options: Options,
814    ) -> Result<(), fidl::Error> {
815        let _result = self.send_raw(printable_name, options);
816        self.drop_without_shutdown();
817        _result
818    }
819
820    fn send_raw(&self, mut printable_name: &str, mut options: Options) -> Result<(), fidl::Error> {
821        self.control_handle.inner.send::<InspectPuppetGetConfigResponse>(
822            (printable_name, &mut options),
823            self.tx_id,
824            0x4cf4dcbd7aa20a0d,
825            fidl::encoding::DynamicFlags::empty(),
826        )
827    }
828}
829
830#[must_use = "FIDL methods require a response to be sent"]
831#[derive(Debug)]
832pub struct InspectPuppetPublishResponder {
833    control_handle: std::mem::ManuallyDrop<InspectPuppetControlHandle>,
834    tx_id: u32,
835}
836
837/// Set the the channel to be shutdown (see [`InspectPuppetControlHandle::shutdown`])
838/// if the responder is dropped without sending a response, so that the client
839/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
840impl std::ops::Drop for InspectPuppetPublishResponder {
841    fn drop(&mut self) {
842        self.control_handle.shutdown();
843        // Safety: drops once, never accessed again
844        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
845    }
846}
847
848impl fidl::endpoints::Responder for InspectPuppetPublishResponder {
849    type ControlHandle = InspectPuppetControlHandle;
850
851    fn control_handle(&self) -> &InspectPuppetControlHandle {
852        &self.control_handle
853    }
854
855    fn drop_without_shutdown(mut self) {
856        // Safety: drops once, never accessed again due to mem::forget
857        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
858        // Prevent Drop from running (which would shut down the channel)
859        std::mem::forget(self);
860    }
861}
862
863impl InspectPuppetPublishResponder {
864    /// Sends a response to the FIDL transaction.
865    ///
866    /// Sets the channel to shutdown if an error occurs.
867    pub fn send(self, mut result: TestResult) -> Result<(), fidl::Error> {
868        let _result = self.send_raw(result);
869        if _result.is_err() {
870            self.control_handle.shutdown();
871        }
872        self.drop_without_shutdown();
873        _result
874    }
875
876    /// Similar to "send" but does not shutdown the channel if an error occurs.
877    pub fn send_no_shutdown_on_err(self, mut result: TestResult) -> Result<(), fidl::Error> {
878        let _result = self.send_raw(result);
879        self.drop_without_shutdown();
880        _result
881    }
882
883    fn send_raw(&self, mut result: TestResult) -> Result<(), fidl::Error> {
884        self.control_handle.inner.send::<InspectPuppetPublishResponse>(
885            (result,),
886            self.tx_id,
887            0x31e9bddcb93a4985,
888            fidl::encoding::DynamicFlags::empty(),
889        )
890    }
891}
892
893#[must_use = "FIDL methods require a response to be sent"]
894#[derive(Debug)]
895pub struct InspectPuppetActResponder {
896    control_handle: std::mem::ManuallyDrop<InspectPuppetControlHandle>,
897    tx_id: u32,
898}
899
900/// Set the the channel to be shutdown (see [`InspectPuppetControlHandle::shutdown`])
901/// if the responder is dropped without sending a response, so that the client
902/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
903impl std::ops::Drop for InspectPuppetActResponder {
904    fn drop(&mut self) {
905        self.control_handle.shutdown();
906        // Safety: drops once, never accessed again
907        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
908    }
909}
910
911impl fidl::endpoints::Responder for InspectPuppetActResponder {
912    type ControlHandle = InspectPuppetControlHandle;
913
914    fn control_handle(&self) -> &InspectPuppetControlHandle {
915        &self.control_handle
916    }
917
918    fn drop_without_shutdown(mut self) {
919        // Safety: drops once, never accessed again due to mem::forget
920        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
921        // Prevent Drop from running (which would shut down the channel)
922        std::mem::forget(self);
923    }
924}
925
926impl InspectPuppetActResponder {
927    /// Sends a response to the FIDL transaction.
928    ///
929    /// Sets the channel to shutdown if an error occurs.
930    pub fn send(self, mut result: TestResult) -> Result<(), fidl::Error> {
931        let _result = self.send_raw(result);
932        if _result.is_err() {
933            self.control_handle.shutdown();
934        }
935        self.drop_without_shutdown();
936        _result
937    }
938
939    /// Similar to "send" but does not shutdown the channel if an error occurs.
940    pub fn send_no_shutdown_on_err(self, mut result: TestResult) -> Result<(), fidl::Error> {
941        let _result = self.send_raw(result);
942        self.drop_without_shutdown();
943        _result
944    }
945
946    fn send_raw(&self, mut result: TestResult) -> Result<(), fidl::Error> {
947        self.control_handle.inner.send::<InspectPuppetActResponse>(
948            (result,),
949            self.tx_id,
950            0x6ce177c6016605e,
951            fidl::encoding::DynamicFlags::empty(),
952        )
953    }
954}
955
956mod internal {
957    use super::*;
958
959    impl fidl::encoding::ResourceTypeMarker for InspectPuppetGetConfigResponse {
960        type Borrowed<'a> = &'a mut Self;
961        fn take_or_borrow<'a>(
962            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
963        ) -> Self::Borrowed<'a> {
964            value
965        }
966    }
967
968    unsafe impl fidl::encoding::TypeMarker for InspectPuppetGetConfigResponse {
969        type Owned = Self;
970
971        #[inline(always)]
972        fn inline_align(_context: fidl::encoding::Context) -> usize {
973            8
974        }
975
976        #[inline(always)]
977        fn inline_size(_context: fidl::encoding::Context) -> usize {
978            32
979        }
980    }
981
982    unsafe impl
983        fidl::encoding::Encode<
984            InspectPuppetGetConfigResponse,
985            fidl::encoding::DefaultFuchsiaResourceDialect,
986        > for &mut InspectPuppetGetConfigResponse
987    {
988        #[inline]
989        unsafe fn encode(
990            self,
991            encoder: &mut fidl::encoding::Encoder<
992                '_,
993                fidl::encoding::DefaultFuchsiaResourceDialect,
994            >,
995            offset: usize,
996            _depth: fidl::encoding::Depth,
997        ) -> fidl::Result<()> {
998            encoder.debug_check_bounds::<InspectPuppetGetConfigResponse>(offset);
999            // Delegate to tuple encoding.
1000            fidl::encoding::Encode::<
1001                InspectPuppetGetConfigResponse,
1002                fidl::encoding::DefaultFuchsiaResourceDialect,
1003            >::encode(
1004                (
1005                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
1006                        &self.printable_name,
1007                    ),
1008                    <Options as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1009                        &mut self.options,
1010                    ),
1011                ),
1012                encoder,
1013                offset,
1014                _depth,
1015            )
1016        }
1017    }
1018    unsafe impl<
1019        T0: fidl::encoding::Encode<
1020                fidl::encoding::UnboundedString,
1021                fidl::encoding::DefaultFuchsiaResourceDialect,
1022            >,
1023        T1: fidl::encoding::Encode<Options, fidl::encoding::DefaultFuchsiaResourceDialect>,
1024    >
1025        fidl::encoding::Encode<
1026            InspectPuppetGetConfigResponse,
1027            fidl::encoding::DefaultFuchsiaResourceDialect,
1028        > for (T0, T1)
1029    {
1030        #[inline]
1031        unsafe fn encode(
1032            self,
1033            encoder: &mut fidl::encoding::Encoder<
1034                '_,
1035                fidl::encoding::DefaultFuchsiaResourceDialect,
1036            >,
1037            offset: usize,
1038            depth: fidl::encoding::Depth,
1039        ) -> fidl::Result<()> {
1040            encoder.debug_check_bounds::<InspectPuppetGetConfigResponse>(offset);
1041            // Zero out padding regions. There's no need to apply masks
1042            // because the unmasked parts will be overwritten by fields.
1043            // Write the fields.
1044            self.0.encode(encoder, offset + 0, depth)?;
1045            self.1.encode(encoder, offset + 16, depth)?;
1046            Ok(())
1047        }
1048    }
1049
1050    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1051        for InspectPuppetGetConfigResponse
1052    {
1053        #[inline(always)]
1054        fn new_empty() -> Self {
1055            Self {
1056                printable_name: fidl::new_empty!(
1057                    fidl::encoding::UnboundedString,
1058                    fidl::encoding::DefaultFuchsiaResourceDialect
1059                ),
1060                options: fidl::new_empty!(Options, fidl::encoding::DefaultFuchsiaResourceDialect),
1061            }
1062        }
1063
1064        #[inline]
1065        unsafe fn decode(
1066            &mut self,
1067            decoder: &mut fidl::encoding::Decoder<
1068                '_,
1069                fidl::encoding::DefaultFuchsiaResourceDialect,
1070            >,
1071            offset: usize,
1072            _depth: fidl::encoding::Depth,
1073        ) -> fidl::Result<()> {
1074            decoder.debug_check_bounds::<Self>(offset);
1075            // Verify that padding bytes are zero.
1076            fidl::decode!(
1077                fidl::encoding::UnboundedString,
1078                fidl::encoding::DefaultFuchsiaResourceDialect,
1079                &mut self.printable_name,
1080                decoder,
1081                offset + 0,
1082                _depth
1083            )?;
1084            fidl::decode!(
1085                Options,
1086                fidl::encoding::DefaultFuchsiaResourceDialect,
1087                &mut self.options,
1088                decoder,
1089                offset + 16,
1090                _depth
1091            )?;
1092            Ok(())
1093        }
1094    }
1095
1096    impl fidl::encoding::ResourceTypeMarker for InspectPuppetInitializeResponse {
1097        type Borrowed<'a> = &'a mut Self;
1098        fn take_or_borrow<'a>(
1099            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1100        ) -> Self::Borrowed<'a> {
1101            value
1102        }
1103    }
1104
1105    unsafe impl fidl::encoding::TypeMarker for InspectPuppetInitializeResponse {
1106        type Owned = Self;
1107
1108        #[inline(always)]
1109        fn inline_align(_context: fidl::encoding::Context) -> usize {
1110            4
1111        }
1112
1113        #[inline(always)]
1114        fn inline_size(_context: fidl::encoding::Context) -> usize {
1115            8
1116        }
1117    }
1118
1119    unsafe impl
1120        fidl::encoding::Encode<
1121            InspectPuppetInitializeResponse,
1122            fidl::encoding::DefaultFuchsiaResourceDialect,
1123        > for &mut InspectPuppetInitializeResponse
1124    {
1125        #[inline]
1126        unsafe fn encode(
1127            self,
1128            encoder: &mut fidl::encoding::Encoder<
1129                '_,
1130                fidl::encoding::DefaultFuchsiaResourceDialect,
1131            >,
1132            offset: usize,
1133            _depth: fidl::encoding::Depth,
1134        ) -> fidl::Result<()> {
1135            encoder.debug_check_bounds::<InspectPuppetInitializeResponse>(offset);
1136            // Delegate to tuple encoding.
1137            fidl::encoding::Encode::<
1138                InspectPuppetInitializeResponse,
1139                fidl::encoding::DefaultFuchsiaResourceDialect,
1140            >::encode(
1141                (
1142                    <fidl::encoding::Optional<
1143                        fidl::encoding::HandleType<
1144                            fidl::NullableHandle,
1145                            { fidl::ObjectType::NONE.into_raw() },
1146                            2147483648,
1147                        >,
1148                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1149                        &mut self.vmo
1150                    ),
1151                    <TestResult as fidl::encoding::ValueTypeMarker>::borrow(&self.result),
1152                ),
1153                encoder,
1154                offset,
1155                _depth,
1156            )
1157        }
1158    }
1159    unsafe impl<
1160        T0: fidl::encoding::Encode<
1161                fidl::encoding::Optional<
1162                    fidl::encoding::HandleType<
1163                        fidl::NullableHandle,
1164                        { fidl::ObjectType::NONE.into_raw() },
1165                        2147483648,
1166                    >,
1167                >,
1168                fidl::encoding::DefaultFuchsiaResourceDialect,
1169            >,
1170        T1: fidl::encoding::Encode<TestResult, fidl::encoding::DefaultFuchsiaResourceDialect>,
1171    >
1172        fidl::encoding::Encode<
1173            InspectPuppetInitializeResponse,
1174            fidl::encoding::DefaultFuchsiaResourceDialect,
1175        > for (T0, T1)
1176    {
1177        #[inline]
1178        unsafe fn encode(
1179            self,
1180            encoder: &mut fidl::encoding::Encoder<
1181                '_,
1182                fidl::encoding::DefaultFuchsiaResourceDialect,
1183            >,
1184            offset: usize,
1185            depth: fidl::encoding::Depth,
1186        ) -> fidl::Result<()> {
1187            encoder.debug_check_bounds::<InspectPuppetInitializeResponse>(offset);
1188            // Zero out padding regions. There's no need to apply masks
1189            // because the unmasked parts will be overwritten by fields.
1190            // Write the fields.
1191            self.0.encode(encoder, offset + 0, depth)?;
1192            self.1.encode(encoder, offset + 4, depth)?;
1193            Ok(())
1194        }
1195    }
1196
1197    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1198        for InspectPuppetInitializeResponse
1199    {
1200        #[inline(always)]
1201        fn new_empty() -> Self {
1202            Self {
1203                vmo: fidl::new_empty!(
1204                    fidl::encoding::Optional<
1205                        fidl::encoding::HandleType<
1206                            fidl::NullableHandle,
1207                            { fidl::ObjectType::NONE.into_raw() },
1208                            2147483648,
1209                        >,
1210                    >,
1211                    fidl::encoding::DefaultFuchsiaResourceDialect
1212                ),
1213                result: fidl::new_empty!(TestResult, fidl::encoding::DefaultFuchsiaResourceDialect),
1214            }
1215        }
1216
1217        #[inline]
1218        unsafe fn decode(
1219            &mut self,
1220            decoder: &mut fidl::encoding::Decoder<
1221                '_,
1222                fidl::encoding::DefaultFuchsiaResourceDialect,
1223            >,
1224            offset: usize,
1225            _depth: fidl::encoding::Depth,
1226        ) -> fidl::Result<()> {
1227            decoder.debug_check_bounds::<Self>(offset);
1228            // Verify that padding bytes are zero.
1229            fidl::decode!(
1230                fidl::encoding::Optional<
1231                    fidl::encoding::HandleType<
1232                        fidl::NullableHandle,
1233                        { fidl::ObjectType::NONE.into_raw() },
1234                        2147483648,
1235                    >,
1236                >,
1237                fidl::encoding::DefaultFuchsiaResourceDialect,
1238                &mut self.vmo,
1239                decoder,
1240                offset + 0,
1241                _depth
1242            )?;
1243            fidl::decode!(
1244                TestResult,
1245                fidl::encoding::DefaultFuchsiaResourceDialect,
1246                &mut self.result,
1247                decoder,
1248                offset + 4,
1249                _depth
1250            )?;
1251            Ok(())
1252        }
1253    }
1254
1255    impl Options {
1256        #[inline(always)]
1257        fn max_ordinal_present(&self) -> u64 {
1258            if let Some(_) = self.diff_type {
1259                return 2;
1260            }
1261            if let Some(_) = self.has_runner_node {
1262                return 1;
1263            }
1264            0
1265        }
1266    }
1267
1268    impl fidl::encoding::ResourceTypeMarker for Options {
1269        type Borrowed<'a> = &'a mut Self;
1270        fn take_or_borrow<'a>(
1271            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1272        ) -> Self::Borrowed<'a> {
1273            value
1274        }
1275    }
1276
1277    unsafe impl fidl::encoding::TypeMarker for Options {
1278        type Owned = Self;
1279
1280        #[inline(always)]
1281        fn inline_align(_context: fidl::encoding::Context) -> usize {
1282            8
1283        }
1284
1285        #[inline(always)]
1286        fn inline_size(_context: fidl::encoding::Context) -> usize {
1287            16
1288        }
1289    }
1290
1291    unsafe impl fidl::encoding::Encode<Options, fidl::encoding::DefaultFuchsiaResourceDialect>
1292        for &mut Options
1293    {
1294        unsafe fn encode(
1295            self,
1296            encoder: &mut fidl::encoding::Encoder<
1297                '_,
1298                fidl::encoding::DefaultFuchsiaResourceDialect,
1299            >,
1300            offset: usize,
1301            mut depth: fidl::encoding::Depth,
1302        ) -> fidl::Result<()> {
1303            encoder.debug_check_bounds::<Options>(offset);
1304            // Vector header
1305            let max_ordinal: u64 = self.max_ordinal_present();
1306            encoder.write_num(max_ordinal, offset);
1307            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1308            // Calling encoder.out_of_line_offset(0) is not allowed.
1309            if max_ordinal == 0 {
1310                return Ok(());
1311            }
1312            depth.increment()?;
1313            let envelope_size = 8;
1314            let bytes_len = max_ordinal as usize * envelope_size;
1315            #[allow(unused_variables)]
1316            let offset = encoder.out_of_line_offset(bytes_len);
1317            let mut _prev_end_offset: usize = 0;
1318            if 1 > max_ordinal {
1319                return Ok(());
1320            }
1321
1322            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1323            // are envelope_size bytes.
1324            let cur_offset: usize = (1 - 1) * envelope_size;
1325
1326            // Zero reserved fields.
1327            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1328
1329            // Safety:
1330            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1331            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1332            //   envelope_size bytes, there is always sufficient room.
1333            fidl::encoding::encode_in_envelope_optional::<
1334                bool,
1335                fidl::encoding::DefaultFuchsiaResourceDialect,
1336            >(
1337                self.has_runner_node
1338                    .as_ref()
1339                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1340                encoder,
1341                offset + cur_offset,
1342                depth,
1343            )?;
1344
1345            _prev_end_offset = cur_offset + envelope_size;
1346            if 2 > max_ordinal {
1347                return Ok(());
1348            }
1349
1350            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1351            // are envelope_size bytes.
1352            let cur_offset: usize = (2 - 1) * envelope_size;
1353
1354            // Zero reserved fields.
1355            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1356
1357            // Safety:
1358            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1359            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1360            //   envelope_size bytes, there is always sufficient room.
1361            fidl::encoding::encode_in_envelope_optional::<
1362                DiffType,
1363                fidl::encoding::DefaultFuchsiaResourceDialect,
1364            >(
1365                self.diff_type.as_ref().map(<DiffType as fidl::encoding::ValueTypeMarker>::borrow),
1366                encoder,
1367                offset + cur_offset,
1368                depth,
1369            )?;
1370
1371            _prev_end_offset = cur_offset + envelope_size;
1372
1373            Ok(())
1374        }
1375    }
1376
1377    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Options {
1378        #[inline(always)]
1379        fn new_empty() -> Self {
1380            Self::default()
1381        }
1382
1383        unsafe fn decode(
1384            &mut self,
1385            decoder: &mut fidl::encoding::Decoder<
1386                '_,
1387                fidl::encoding::DefaultFuchsiaResourceDialect,
1388            >,
1389            offset: usize,
1390            mut depth: fidl::encoding::Depth,
1391        ) -> fidl::Result<()> {
1392            decoder.debug_check_bounds::<Self>(offset);
1393            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1394                None => return Err(fidl::Error::NotNullable),
1395                Some(len) => len,
1396            };
1397            // Calling decoder.out_of_line_offset(0) is not allowed.
1398            if len == 0 {
1399                return Ok(());
1400            };
1401            depth.increment()?;
1402            let envelope_size = 8;
1403            let bytes_len = len * envelope_size;
1404            let offset = decoder.out_of_line_offset(bytes_len)?;
1405            // Decode the envelope for each type.
1406            let mut _next_ordinal_to_read = 0;
1407            let mut next_offset = offset;
1408            let end_offset = offset + bytes_len;
1409            _next_ordinal_to_read += 1;
1410            if next_offset >= end_offset {
1411                return Ok(());
1412            }
1413
1414            // Decode unknown envelopes for gaps in ordinals.
1415            while _next_ordinal_to_read < 1 {
1416                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1417                _next_ordinal_to_read += 1;
1418                next_offset += envelope_size;
1419            }
1420
1421            let next_out_of_line = decoder.next_out_of_line();
1422            let handles_before = decoder.remaining_handles();
1423            if let Some((inlined, num_bytes, num_handles)) =
1424                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1425            {
1426                let member_inline_size =
1427                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1428                if inlined != (member_inline_size <= 4) {
1429                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1430                }
1431                let inner_offset;
1432                let mut inner_depth = depth.clone();
1433                if inlined {
1434                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1435                    inner_offset = next_offset;
1436                } else {
1437                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1438                    inner_depth.increment()?;
1439                }
1440                let val_ref = self.has_runner_node.get_or_insert_with(|| {
1441                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
1442                });
1443                fidl::decode!(
1444                    bool,
1445                    fidl::encoding::DefaultFuchsiaResourceDialect,
1446                    val_ref,
1447                    decoder,
1448                    inner_offset,
1449                    inner_depth
1450                )?;
1451                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1452                {
1453                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1454                }
1455                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1456                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1457                }
1458            }
1459
1460            next_offset += envelope_size;
1461            _next_ordinal_to_read += 1;
1462            if next_offset >= end_offset {
1463                return Ok(());
1464            }
1465
1466            // Decode unknown envelopes for gaps in ordinals.
1467            while _next_ordinal_to_read < 2 {
1468                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1469                _next_ordinal_to_read += 1;
1470                next_offset += envelope_size;
1471            }
1472
1473            let next_out_of_line = decoder.next_out_of_line();
1474            let handles_before = decoder.remaining_handles();
1475            if let Some((inlined, num_bytes, num_handles)) =
1476                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1477            {
1478                let member_inline_size =
1479                    <DiffType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1480                if inlined != (member_inline_size <= 4) {
1481                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1482                }
1483                let inner_offset;
1484                let mut inner_depth = depth.clone();
1485                if inlined {
1486                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1487                    inner_offset = next_offset;
1488                } else {
1489                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1490                    inner_depth.increment()?;
1491                }
1492                let val_ref = self.diff_type.get_or_insert_with(|| {
1493                    fidl::new_empty!(DiffType, fidl::encoding::DefaultFuchsiaResourceDialect)
1494                });
1495                fidl::decode!(
1496                    DiffType,
1497                    fidl::encoding::DefaultFuchsiaResourceDialect,
1498                    val_ref,
1499                    decoder,
1500                    inner_offset,
1501                    inner_depth
1502                )?;
1503                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1504                {
1505                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1506                }
1507                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1508                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1509                }
1510            }
1511
1512            next_offset += envelope_size;
1513
1514            // Decode the remaining unknown envelopes.
1515            while next_offset < end_offset {
1516                _next_ordinal_to_read += 1;
1517                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1518                next_offset += envelope_size;
1519            }
1520
1521            Ok(())
1522        }
1523    }
1524}