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