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