fidl_diagnostics_validate_deprecated/
fidl_diagnostics_validate_deprecated.rs

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