fidl_diagnostics_validate_deprecated/
fidl_diagnostics_validate_deprecated.rs

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