fidl_test_detect_factory/
fidl_test_detect_factory.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_test_detect_factory__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct RealmFactoryCreateRealmRequest {
16    pub options: RealmOptions,
17    pub realm_server: fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21    for RealmFactoryCreateRealmRequest
22{
23}
24
25#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26pub struct RealmFactoryGetTriageDetectEventsResponse {
27    pub client_end: fidl::endpoints::ClientEnd<TriageDetectEventsMarker>,
28}
29
30impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
31    for RealmFactoryGetTriageDetectEventsResponse
32{
33}
34
35/// RealmOptions tells the RealmFactory protocol how to create the test realm.
36///
37/// Note that there is a limit of 64 handles in a single channel write.
38/// Keep in mind that when initializing these RealmOptions, 64 is the combined
39/// limit for all handles in the message.
40#[derive(Debug, Default, PartialEq)]
41pub struct RealmOptions {
42    /// The JSON configuration for the triage-detect component.
43    ///
44    /// Values in this config may override `enable_crash_reporting`.
45    /// This is exposed to allow the tests to see how the compnent behaves if e.g.
46    /// the config file is corrupted.
47    pub program_config: Option<fidl::Vmo>,
48    /// Triage config contents.
49    ///
50    /// Triage configs are JSON objects that tell the component which diagnostic data
51    /// to fetch and what to do in response to that data. The schema of this JSON
52    /// can be found at //src/diagnostics/lib/triage/src/config.rs.
53    pub triage_configs: Option<Vec<fidl::Vmo>>,
54    /// A list of a canned JSON responses to send when triage-detect fetches inspect data.
55    ///
56    /// The data are sent in the order they appear in this vector.
57    pub inspect_data: Option<Vec<fidl::Vmo>>,
58    #[doc(hidden)]
59    pub __source_breaking: fidl::marker::SourceBreaking,
60}
61
62impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RealmOptions {}
63
64#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
65pub struct RealmFactoryMarker;
66
67impl fidl::endpoints::ProtocolMarker for RealmFactoryMarker {
68    type Proxy = RealmFactoryProxy;
69    type RequestStream = RealmFactoryRequestStream;
70    #[cfg(target_os = "fuchsia")]
71    type SynchronousProxy = RealmFactorySynchronousProxy;
72
73    const DEBUG_NAME: &'static str = "test.detect.factory.RealmFactory";
74}
75impl fidl::endpoints::DiscoverableProtocolMarker for RealmFactoryMarker {}
76pub type RealmFactoryCreateRealmResult = Result<(), fidl_fuchsia_testing_harness::OperationError>;
77
78pub trait RealmFactoryProxyInterface: Send + Sync {
79    type CreateRealmResponseFut: std::future::Future<Output = Result<RealmFactoryCreateRealmResult, fidl::Error>>
80        + Send;
81    fn r#create_realm(
82        &self,
83        options: RealmOptions,
84        realm_server: fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
85    ) -> Self::CreateRealmResponseFut;
86    type GetTriageDetectEventsResponseFut: std::future::Future<
87            Output = Result<fidl::endpoints::ClientEnd<TriageDetectEventsMarker>, fidl::Error>,
88        > + Send;
89    fn r#get_triage_detect_events(&self) -> Self::GetTriageDetectEventsResponseFut;
90}
91#[derive(Debug)]
92#[cfg(target_os = "fuchsia")]
93pub struct RealmFactorySynchronousProxy {
94    client: fidl::client::sync::Client,
95}
96
97#[cfg(target_os = "fuchsia")]
98impl fidl::endpoints::SynchronousProxy for RealmFactorySynchronousProxy {
99    type Proxy = RealmFactoryProxy;
100    type Protocol = RealmFactoryMarker;
101
102    fn from_channel(inner: fidl::Channel) -> Self {
103        Self::new(inner)
104    }
105
106    fn into_channel(self) -> fidl::Channel {
107        self.client.into_channel()
108    }
109
110    fn as_channel(&self) -> &fidl::Channel {
111        self.client.as_channel()
112    }
113}
114
115#[cfg(target_os = "fuchsia")]
116impl RealmFactorySynchronousProxy {
117    pub fn new(channel: fidl::Channel) -> Self {
118        let protocol_name = <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
119        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
120    }
121
122    pub fn into_channel(self) -> fidl::Channel {
123        self.client.into_channel()
124    }
125
126    /// Waits until an event arrives and returns it. It is safe for other
127    /// threads to make concurrent requests while waiting for an event.
128    pub fn wait_for_event(
129        &self,
130        deadline: zx::MonotonicInstant,
131    ) -> Result<RealmFactoryEvent, fidl::Error> {
132        RealmFactoryEvent::decode(self.client.wait_for_event(deadline)?)
133    }
134
135    /// Specifies the options to use when creating the realm.
136    ///
137    /// Returns OperationError.INVALID if called more than once.
138    pub fn r#create_realm(
139        &self,
140        mut options: RealmOptions,
141        mut realm_server: fidl::endpoints::ServerEnd<
142            fidl_fuchsia_testing_harness::RealmProxy_Marker,
143        >,
144        ___deadline: zx::MonotonicInstant,
145    ) -> Result<RealmFactoryCreateRealmResult, fidl::Error> {
146        let _response = self
147            .client
148            .send_query::<RealmFactoryCreateRealmRequest, fidl::encoding::FlexibleResultType<
149                fidl::encoding::EmptyStruct,
150                fidl_fuchsia_testing_harness::OperationError,
151            >>(
152                (&mut options, realm_server),
153                0x12d4b5c7c9d9801a,
154                fidl::encoding::DynamicFlags::FLEXIBLE,
155                ___deadline,
156            )?
157            .into_result::<RealmFactoryMarker>("create_realm")?;
158        Ok(_response.map(|x| x))
159    }
160
161    /// Returns a client end to the `Realm` protocol.
162    ///
163    /// The test can use this client end to listen for events.
164    /// It is a fatal error to call this more than once or before the test realm
165    /// is started.
166    pub fn r#get_triage_detect_events(
167        &self,
168        ___deadline: zx::MonotonicInstant,
169    ) -> Result<fidl::endpoints::ClientEnd<TriageDetectEventsMarker>, fidl::Error> {
170        let _response = self
171            .client
172            .send_query::<fidl::encoding::EmptyPayload, RealmFactoryGetTriageDetectEventsResponse>(
173                (),
174                0x7be53256487c35fd,
175                fidl::encoding::DynamicFlags::empty(),
176                ___deadline,
177            )?;
178        Ok(_response.client_end)
179    }
180}
181
182#[cfg(target_os = "fuchsia")]
183impl From<RealmFactorySynchronousProxy> for zx::NullableHandle {
184    fn from(value: RealmFactorySynchronousProxy) -> Self {
185        value.into_channel().into()
186    }
187}
188
189#[cfg(target_os = "fuchsia")]
190impl From<fidl::Channel> for RealmFactorySynchronousProxy {
191    fn from(value: fidl::Channel) -> Self {
192        Self::new(value)
193    }
194}
195
196#[cfg(target_os = "fuchsia")]
197impl fidl::endpoints::FromClient for RealmFactorySynchronousProxy {
198    type Protocol = RealmFactoryMarker;
199
200    fn from_client(value: fidl::endpoints::ClientEnd<RealmFactoryMarker>) -> Self {
201        Self::new(value.into_channel())
202    }
203}
204
205#[derive(Debug, Clone)]
206pub struct RealmFactoryProxy {
207    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
208}
209
210impl fidl::endpoints::Proxy for RealmFactoryProxy {
211    type Protocol = RealmFactoryMarker;
212
213    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
214        Self::new(inner)
215    }
216
217    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
218        self.client.into_channel().map_err(|client| Self { client })
219    }
220
221    fn as_channel(&self) -> &::fidl::AsyncChannel {
222        self.client.as_channel()
223    }
224}
225
226impl RealmFactoryProxy {
227    /// Create a new Proxy for test.detect.factory/RealmFactory.
228    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
229        let protocol_name = <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
230        Self { client: fidl::client::Client::new(channel, protocol_name) }
231    }
232
233    /// Get a Stream of events from the remote end of the protocol.
234    ///
235    /// # Panics
236    ///
237    /// Panics if the event stream was already taken.
238    pub fn take_event_stream(&self) -> RealmFactoryEventStream {
239        RealmFactoryEventStream { event_receiver: self.client.take_event_receiver() }
240    }
241
242    /// Specifies the options to use when creating the realm.
243    ///
244    /// Returns OperationError.INVALID if called more than once.
245    pub fn r#create_realm(
246        &self,
247        mut options: RealmOptions,
248        mut realm_server: fidl::endpoints::ServerEnd<
249            fidl_fuchsia_testing_harness::RealmProxy_Marker,
250        >,
251    ) -> fidl::client::QueryResponseFut<
252        RealmFactoryCreateRealmResult,
253        fidl::encoding::DefaultFuchsiaResourceDialect,
254    > {
255        RealmFactoryProxyInterface::r#create_realm(self, options, realm_server)
256    }
257
258    /// Returns a client end to the `Realm` protocol.
259    ///
260    /// The test can use this client end to listen for events.
261    /// It is a fatal error to call this more than once or before the test realm
262    /// is started.
263    pub fn r#get_triage_detect_events(
264        &self,
265    ) -> fidl::client::QueryResponseFut<
266        fidl::endpoints::ClientEnd<TriageDetectEventsMarker>,
267        fidl::encoding::DefaultFuchsiaResourceDialect,
268    > {
269        RealmFactoryProxyInterface::r#get_triage_detect_events(self)
270    }
271}
272
273impl RealmFactoryProxyInterface for RealmFactoryProxy {
274    type CreateRealmResponseFut = fidl::client::QueryResponseFut<
275        RealmFactoryCreateRealmResult,
276        fidl::encoding::DefaultFuchsiaResourceDialect,
277    >;
278    fn r#create_realm(
279        &self,
280        mut options: RealmOptions,
281        mut realm_server: fidl::endpoints::ServerEnd<
282            fidl_fuchsia_testing_harness::RealmProxy_Marker,
283        >,
284    ) -> Self::CreateRealmResponseFut {
285        fn _decode(
286            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
287        ) -> Result<RealmFactoryCreateRealmResult, fidl::Error> {
288            let _response = fidl::client::decode_transaction_body::<
289                fidl::encoding::FlexibleResultType<
290                    fidl::encoding::EmptyStruct,
291                    fidl_fuchsia_testing_harness::OperationError,
292                >,
293                fidl::encoding::DefaultFuchsiaResourceDialect,
294                0x12d4b5c7c9d9801a,
295            >(_buf?)?
296            .into_result::<RealmFactoryMarker>("create_realm")?;
297            Ok(_response.map(|x| x))
298        }
299        self.client
300            .send_query_and_decode::<RealmFactoryCreateRealmRequest, RealmFactoryCreateRealmResult>(
301                (&mut options, realm_server),
302                0x12d4b5c7c9d9801a,
303                fidl::encoding::DynamicFlags::FLEXIBLE,
304                _decode,
305            )
306    }
307
308    type GetTriageDetectEventsResponseFut = fidl::client::QueryResponseFut<
309        fidl::endpoints::ClientEnd<TriageDetectEventsMarker>,
310        fidl::encoding::DefaultFuchsiaResourceDialect,
311    >;
312    fn r#get_triage_detect_events(&self) -> Self::GetTriageDetectEventsResponseFut {
313        fn _decode(
314            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
315        ) -> Result<fidl::endpoints::ClientEnd<TriageDetectEventsMarker>, fidl::Error> {
316            let _response = fidl::client::decode_transaction_body::<
317                RealmFactoryGetTriageDetectEventsResponse,
318                fidl::encoding::DefaultFuchsiaResourceDialect,
319                0x7be53256487c35fd,
320            >(_buf?)?;
321            Ok(_response.client_end)
322        }
323        self.client.send_query_and_decode::<
324            fidl::encoding::EmptyPayload,
325            fidl::endpoints::ClientEnd<TriageDetectEventsMarker>,
326        >(
327            (),
328            0x7be53256487c35fd,
329            fidl::encoding::DynamicFlags::empty(),
330            _decode,
331        )
332    }
333}
334
335pub struct RealmFactoryEventStream {
336    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
337}
338
339impl std::marker::Unpin for RealmFactoryEventStream {}
340
341impl futures::stream::FusedStream for RealmFactoryEventStream {
342    fn is_terminated(&self) -> bool {
343        self.event_receiver.is_terminated()
344    }
345}
346
347impl futures::Stream for RealmFactoryEventStream {
348    type Item = Result<RealmFactoryEvent, fidl::Error>;
349
350    fn poll_next(
351        mut self: std::pin::Pin<&mut Self>,
352        cx: &mut std::task::Context<'_>,
353    ) -> std::task::Poll<Option<Self::Item>> {
354        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
355            &mut self.event_receiver,
356            cx
357        )?) {
358            Some(buf) => std::task::Poll::Ready(Some(RealmFactoryEvent::decode(buf))),
359            None => std::task::Poll::Ready(None),
360        }
361    }
362}
363
364#[derive(Debug)]
365pub enum RealmFactoryEvent {
366    #[non_exhaustive]
367    _UnknownEvent {
368        /// Ordinal of the event that was sent.
369        ordinal: u64,
370    },
371}
372
373impl RealmFactoryEvent {
374    /// Decodes a message buffer as a [`RealmFactoryEvent`].
375    fn decode(
376        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
377    ) -> Result<RealmFactoryEvent, fidl::Error> {
378        let (bytes, _handles) = buf.split_mut();
379        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
380        debug_assert_eq!(tx_header.tx_id, 0);
381        match tx_header.ordinal {
382            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
383                Ok(RealmFactoryEvent::_UnknownEvent { ordinal: tx_header.ordinal })
384            }
385            _ => Err(fidl::Error::UnknownOrdinal {
386                ordinal: tx_header.ordinal,
387                protocol_name: <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
388            }),
389        }
390    }
391}
392
393/// A Stream of incoming requests for test.detect.factory/RealmFactory.
394pub struct RealmFactoryRequestStream {
395    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
396    is_terminated: bool,
397}
398
399impl std::marker::Unpin for RealmFactoryRequestStream {}
400
401impl futures::stream::FusedStream for RealmFactoryRequestStream {
402    fn is_terminated(&self) -> bool {
403        self.is_terminated
404    }
405}
406
407impl fidl::endpoints::RequestStream for RealmFactoryRequestStream {
408    type Protocol = RealmFactoryMarker;
409    type ControlHandle = RealmFactoryControlHandle;
410
411    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
412        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
413    }
414
415    fn control_handle(&self) -> Self::ControlHandle {
416        RealmFactoryControlHandle { inner: self.inner.clone() }
417    }
418
419    fn into_inner(
420        self,
421    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
422    {
423        (self.inner, self.is_terminated)
424    }
425
426    fn from_inner(
427        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
428        is_terminated: bool,
429    ) -> Self {
430        Self { inner, is_terminated }
431    }
432}
433
434impl futures::Stream for RealmFactoryRequestStream {
435    type Item = Result<RealmFactoryRequest, fidl::Error>;
436
437    fn poll_next(
438        mut self: std::pin::Pin<&mut Self>,
439        cx: &mut std::task::Context<'_>,
440    ) -> std::task::Poll<Option<Self::Item>> {
441        let this = &mut *self;
442        if this.inner.check_shutdown(cx) {
443            this.is_terminated = true;
444            return std::task::Poll::Ready(None);
445        }
446        if this.is_terminated {
447            panic!("polled RealmFactoryRequestStream after completion");
448        }
449        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
450            |bytes, handles| {
451                match this.inner.channel().read_etc(cx, bytes, handles) {
452                    std::task::Poll::Ready(Ok(())) => {}
453                    std::task::Poll::Pending => return std::task::Poll::Pending,
454                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
455                        this.is_terminated = true;
456                        return std::task::Poll::Ready(None);
457                    }
458                    std::task::Poll::Ready(Err(e)) => {
459                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
460                            e.into(),
461                        ))));
462                    }
463                }
464
465                // A message has been received from the channel
466                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
467
468                std::task::Poll::Ready(Some(match header.ordinal {
469                    0x12d4b5c7c9d9801a => {
470                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
471                        let mut req = fidl::new_empty!(
472                            RealmFactoryCreateRealmRequest,
473                            fidl::encoding::DefaultFuchsiaResourceDialect
474                        );
475                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmFactoryCreateRealmRequest>(&header, _body_bytes, handles, &mut req)?;
476                        let control_handle =
477                            RealmFactoryControlHandle { inner: this.inner.clone() };
478                        Ok(RealmFactoryRequest::CreateRealm {
479                            options: req.options,
480                            realm_server: req.realm_server,
481
482                            responder: RealmFactoryCreateRealmResponder {
483                                control_handle: std::mem::ManuallyDrop::new(control_handle),
484                                tx_id: header.tx_id,
485                            },
486                        })
487                    }
488                    0x7be53256487c35fd => {
489                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
490                        let mut req = fidl::new_empty!(
491                            fidl::encoding::EmptyPayload,
492                            fidl::encoding::DefaultFuchsiaResourceDialect
493                        );
494                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
495                        let control_handle =
496                            RealmFactoryControlHandle { inner: this.inner.clone() };
497                        Ok(RealmFactoryRequest::GetTriageDetectEvents {
498                            responder: RealmFactoryGetTriageDetectEventsResponder {
499                                control_handle: std::mem::ManuallyDrop::new(control_handle),
500                                tx_id: header.tx_id,
501                            },
502                        })
503                    }
504                    _ if header.tx_id == 0
505                        && header
506                            .dynamic_flags()
507                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
508                    {
509                        Ok(RealmFactoryRequest::_UnknownMethod {
510                            ordinal: header.ordinal,
511                            control_handle: RealmFactoryControlHandle { inner: this.inner.clone() },
512                            method_type: fidl::MethodType::OneWay,
513                        })
514                    }
515                    _ if header
516                        .dynamic_flags()
517                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
518                    {
519                        this.inner.send_framework_err(
520                            fidl::encoding::FrameworkErr::UnknownMethod,
521                            header.tx_id,
522                            header.ordinal,
523                            header.dynamic_flags(),
524                            (bytes, handles),
525                        )?;
526                        Ok(RealmFactoryRequest::_UnknownMethod {
527                            ordinal: header.ordinal,
528                            control_handle: RealmFactoryControlHandle { inner: this.inner.clone() },
529                            method_type: fidl::MethodType::TwoWay,
530                        })
531                    }
532                    _ => Err(fidl::Error::UnknownOrdinal {
533                        ordinal: header.ordinal,
534                        protocol_name:
535                            <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
536                    }),
537                }))
538            },
539        )
540    }
541}
542
543/// This protocol is used to write integration tests for the triage-detect component.
544///
545/// Each test case should create a new connection to this protocol, and call
546/// CreateRealm only after all other methods have been called to setup the test realm.
547///
548/// # The triage-detect component
549///
550/// The triage-detect component's job is to file crash reports whenever inspect data
551/// reveals that some component in the system has produced an error.
552///
553/// # FIDL Interactions
554///
555/// At startup, the triage-detect component tells the CrashReportingProductRegister
556/// to file all crash reports sent by triage-detect under the "FuchsiaDetect" crash
557/// product.
558///
559/// Periodically, the triage-detect component will fetch inspect data and file
560/// crash reports for all of the data it receives. Tests can control how reports
561/// are filed by providing any number of *.triage configuration files using
562/// `AddConfigFile`.
563#[derive(Debug)]
564pub enum RealmFactoryRequest {
565    /// Specifies the options to use when creating the realm.
566    ///
567    /// Returns OperationError.INVALID if called more than once.
568    CreateRealm {
569        options: RealmOptions,
570        realm_server: fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
571        responder: RealmFactoryCreateRealmResponder,
572    },
573    /// Returns a client end to the `Realm` protocol.
574    ///
575    /// The test can use this client end to listen for events.
576    /// It is a fatal error to call this more than once or before the test realm
577    /// is started.
578    GetTriageDetectEvents { responder: RealmFactoryGetTriageDetectEventsResponder },
579    /// An interaction was received which does not match any known method.
580    #[non_exhaustive]
581    _UnknownMethod {
582        /// Ordinal of the method that was called.
583        ordinal: u64,
584        control_handle: RealmFactoryControlHandle,
585        method_type: fidl::MethodType,
586    },
587}
588
589impl RealmFactoryRequest {
590    #[allow(irrefutable_let_patterns)]
591    pub fn into_create_realm(
592        self,
593    ) -> Option<(
594        RealmOptions,
595        fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
596        RealmFactoryCreateRealmResponder,
597    )> {
598        if let RealmFactoryRequest::CreateRealm { options, realm_server, responder } = self {
599            Some((options, realm_server, responder))
600        } else {
601            None
602        }
603    }
604
605    #[allow(irrefutable_let_patterns)]
606    pub fn into_get_triage_detect_events(
607        self,
608    ) -> Option<(RealmFactoryGetTriageDetectEventsResponder)> {
609        if let RealmFactoryRequest::GetTriageDetectEvents { responder } = self {
610            Some((responder))
611        } else {
612            None
613        }
614    }
615
616    /// Name of the method defined in FIDL
617    pub fn method_name(&self) -> &'static str {
618        match *self {
619            RealmFactoryRequest::CreateRealm { .. } => "create_realm",
620            RealmFactoryRequest::GetTriageDetectEvents { .. } => "get_triage_detect_events",
621            RealmFactoryRequest::_UnknownMethod {
622                method_type: fidl::MethodType::OneWay, ..
623            } => "unknown one-way method",
624            RealmFactoryRequest::_UnknownMethod {
625                method_type: fidl::MethodType::TwoWay, ..
626            } => "unknown two-way method",
627        }
628    }
629}
630
631#[derive(Debug, Clone)]
632pub struct RealmFactoryControlHandle {
633    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
634}
635
636impl fidl::endpoints::ControlHandle for RealmFactoryControlHandle {
637    fn shutdown(&self) {
638        self.inner.shutdown()
639    }
640
641    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
642        self.inner.shutdown_with_epitaph(status)
643    }
644
645    fn is_closed(&self) -> bool {
646        self.inner.channel().is_closed()
647    }
648    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
649        self.inner.channel().on_closed()
650    }
651
652    #[cfg(target_os = "fuchsia")]
653    fn signal_peer(
654        &self,
655        clear_mask: zx::Signals,
656        set_mask: zx::Signals,
657    ) -> Result<(), zx_status::Status> {
658        use fidl::Peered;
659        self.inner.channel().signal_peer(clear_mask, set_mask)
660    }
661}
662
663impl RealmFactoryControlHandle {}
664
665#[must_use = "FIDL methods require a response to be sent"]
666#[derive(Debug)]
667pub struct RealmFactoryCreateRealmResponder {
668    control_handle: std::mem::ManuallyDrop<RealmFactoryControlHandle>,
669    tx_id: u32,
670}
671
672/// Set the the channel to be shutdown (see [`RealmFactoryControlHandle::shutdown`])
673/// if the responder is dropped without sending a response, so that the client
674/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
675impl std::ops::Drop for RealmFactoryCreateRealmResponder {
676    fn drop(&mut self) {
677        self.control_handle.shutdown();
678        // Safety: drops once, never accessed again
679        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
680    }
681}
682
683impl fidl::endpoints::Responder for RealmFactoryCreateRealmResponder {
684    type ControlHandle = RealmFactoryControlHandle;
685
686    fn control_handle(&self) -> &RealmFactoryControlHandle {
687        &self.control_handle
688    }
689
690    fn drop_without_shutdown(mut self) {
691        // Safety: drops once, never accessed again due to mem::forget
692        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
693        // Prevent Drop from running (which would shut down the channel)
694        std::mem::forget(self);
695    }
696}
697
698impl RealmFactoryCreateRealmResponder {
699    /// Sends a response to the FIDL transaction.
700    ///
701    /// Sets the channel to shutdown if an error occurs.
702    pub fn send(
703        self,
704        mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
705    ) -> Result<(), fidl::Error> {
706        let _result = self.send_raw(result);
707        if _result.is_err() {
708            self.control_handle.shutdown();
709        }
710        self.drop_without_shutdown();
711        _result
712    }
713
714    /// Similar to "send" but does not shutdown the channel if an error occurs.
715    pub fn send_no_shutdown_on_err(
716        self,
717        mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
718    ) -> Result<(), fidl::Error> {
719        let _result = self.send_raw(result);
720        self.drop_without_shutdown();
721        _result
722    }
723
724    fn send_raw(
725        &self,
726        mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
727    ) -> Result<(), fidl::Error> {
728        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
729            fidl::encoding::EmptyStruct,
730            fidl_fuchsia_testing_harness::OperationError,
731        >>(
732            fidl::encoding::FlexibleResult::new(result),
733            self.tx_id,
734            0x12d4b5c7c9d9801a,
735            fidl::encoding::DynamicFlags::FLEXIBLE,
736        )
737    }
738}
739
740#[must_use = "FIDL methods require a response to be sent"]
741#[derive(Debug)]
742pub struct RealmFactoryGetTriageDetectEventsResponder {
743    control_handle: std::mem::ManuallyDrop<RealmFactoryControlHandle>,
744    tx_id: u32,
745}
746
747/// Set the the channel to be shutdown (see [`RealmFactoryControlHandle::shutdown`])
748/// if the responder is dropped without sending a response, so that the client
749/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
750impl std::ops::Drop for RealmFactoryGetTriageDetectEventsResponder {
751    fn drop(&mut self) {
752        self.control_handle.shutdown();
753        // Safety: drops once, never accessed again
754        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
755    }
756}
757
758impl fidl::endpoints::Responder for RealmFactoryGetTriageDetectEventsResponder {
759    type ControlHandle = RealmFactoryControlHandle;
760
761    fn control_handle(&self) -> &RealmFactoryControlHandle {
762        &self.control_handle
763    }
764
765    fn drop_without_shutdown(mut self) {
766        // Safety: drops once, never accessed again due to mem::forget
767        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
768        // Prevent Drop from running (which would shut down the channel)
769        std::mem::forget(self);
770    }
771}
772
773impl RealmFactoryGetTriageDetectEventsResponder {
774    /// Sends a response to the FIDL transaction.
775    ///
776    /// Sets the channel to shutdown if an error occurs.
777    pub fn send(
778        self,
779        mut client_end: fidl::endpoints::ClientEnd<TriageDetectEventsMarker>,
780    ) -> Result<(), fidl::Error> {
781        let _result = self.send_raw(client_end);
782        if _result.is_err() {
783            self.control_handle.shutdown();
784        }
785        self.drop_without_shutdown();
786        _result
787    }
788
789    /// Similar to "send" but does not shutdown the channel if an error occurs.
790    pub fn send_no_shutdown_on_err(
791        self,
792        mut client_end: fidl::endpoints::ClientEnd<TriageDetectEventsMarker>,
793    ) -> Result<(), fidl::Error> {
794        let _result = self.send_raw(client_end);
795        self.drop_without_shutdown();
796        _result
797    }
798
799    fn send_raw(
800        &self,
801        mut client_end: fidl::endpoints::ClientEnd<TriageDetectEventsMarker>,
802    ) -> Result<(), fidl::Error> {
803        self.control_handle.inner.send::<RealmFactoryGetTriageDetectEventsResponse>(
804            (client_end,),
805            self.tx_id,
806            0x7be53256487c35fd,
807            fidl::encoding::DynamicFlags::empty(),
808        )
809    }
810}
811
812#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
813pub struct TriageDetectEventsMarker;
814
815impl fidl::endpoints::ProtocolMarker for TriageDetectEventsMarker {
816    type Proxy = TriageDetectEventsProxy;
817    type RequestStream = TriageDetectEventsRequestStream;
818    #[cfg(target_os = "fuchsia")]
819    type SynchronousProxy = TriageDetectEventsSynchronousProxy;
820
821    const DEBUG_NAME: &'static str = "test.detect.factory.TriageDetectEvents";
822}
823impl fidl::endpoints::DiscoverableProtocolMarker for TriageDetectEventsMarker {}
824
825pub trait TriageDetectEventsProxyInterface: Send + Sync {}
826#[derive(Debug)]
827#[cfg(target_os = "fuchsia")]
828pub struct TriageDetectEventsSynchronousProxy {
829    client: fidl::client::sync::Client,
830}
831
832#[cfg(target_os = "fuchsia")]
833impl fidl::endpoints::SynchronousProxy for TriageDetectEventsSynchronousProxy {
834    type Proxy = TriageDetectEventsProxy;
835    type Protocol = TriageDetectEventsMarker;
836
837    fn from_channel(inner: fidl::Channel) -> Self {
838        Self::new(inner)
839    }
840
841    fn into_channel(self) -> fidl::Channel {
842        self.client.into_channel()
843    }
844
845    fn as_channel(&self) -> &fidl::Channel {
846        self.client.as_channel()
847    }
848}
849
850#[cfg(target_os = "fuchsia")]
851impl TriageDetectEventsSynchronousProxy {
852    pub fn new(channel: fidl::Channel) -> Self {
853        let protocol_name =
854            <TriageDetectEventsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
855        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
856    }
857
858    pub fn into_channel(self) -> fidl::Channel {
859        self.client.into_channel()
860    }
861
862    /// Waits until an event arrives and returns it. It is safe for other
863    /// threads to make concurrent requests while waiting for an event.
864    pub fn wait_for_event(
865        &self,
866        deadline: zx::MonotonicInstant,
867    ) -> Result<TriageDetectEventsEvent, fidl::Error> {
868        TriageDetectEventsEvent::decode(self.client.wait_for_event(deadline)?)
869    }
870}
871
872#[cfg(target_os = "fuchsia")]
873impl From<TriageDetectEventsSynchronousProxy> for zx::NullableHandle {
874    fn from(value: TriageDetectEventsSynchronousProxy) -> Self {
875        value.into_channel().into()
876    }
877}
878
879#[cfg(target_os = "fuchsia")]
880impl From<fidl::Channel> for TriageDetectEventsSynchronousProxy {
881    fn from(value: fidl::Channel) -> Self {
882        Self::new(value)
883    }
884}
885
886#[cfg(target_os = "fuchsia")]
887impl fidl::endpoints::FromClient for TriageDetectEventsSynchronousProxy {
888    type Protocol = TriageDetectEventsMarker;
889
890    fn from_client(value: fidl::endpoints::ClientEnd<TriageDetectEventsMarker>) -> Self {
891        Self::new(value.into_channel())
892    }
893}
894
895#[derive(Debug, Clone)]
896pub struct TriageDetectEventsProxy {
897    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
898}
899
900impl fidl::endpoints::Proxy for TriageDetectEventsProxy {
901    type Protocol = TriageDetectEventsMarker;
902
903    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
904        Self::new(inner)
905    }
906
907    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
908        self.client.into_channel().map_err(|client| Self { client })
909    }
910
911    fn as_channel(&self) -> &::fidl::AsyncChannel {
912        self.client.as_channel()
913    }
914}
915
916impl TriageDetectEventsProxy {
917    /// Create a new Proxy for test.detect.factory/TriageDetectEvents.
918    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
919        let protocol_name =
920            <TriageDetectEventsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
921        Self { client: fidl::client::Client::new(channel, protocol_name) }
922    }
923
924    /// Get a Stream of events from the remote end of the protocol.
925    ///
926    /// # Panics
927    ///
928    /// Panics if the event stream was already taken.
929    pub fn take_event_stream(&self) -> TriageDetectEventsEventStream {
930        TriageDetectEventsEventStream { event_receiver: self.client.take_event_receiver() }
931    }
932}
933
934impl TriageDetectEventsProxyInterface for TriageDetectEventsProxy {}
935
936pub struct TriageDetectEventsEventStream {
937    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
938}
939
940impl std::marker::Unpin for TriageDetectEventsEventStream {}
941
942impl futures::stream::FusedStream for TriageDetectEventsEventStream {
943    fn is_terminated(&self) -> bool {
944        self.event_receiver.is_terminated()
945    }
946}
947
948impl futures::Stream for TriageDetectEventsEventStream {
949    type Item = Result<TriageDetectEventsEvent, fidl::Error>;
950
951    fn poll_next(
952        mut self: std::pin::Pin<&mut Self>,
953        cx: &mut std::task::Context<'_>,
954    ) -> std::task::Poll<Option<Self::Item>> {
955        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
956            &mut self.event_receiver,
957            cx
958        )?) {
959            Some(buf) => std::task::Poll::Ready(Some(TriageDetectEventsEvent::decode(buf))),
960            None => std::task::Poll::Ready(None),
961        }
962    }
963}
964
965#[derive(Debug)]
966pub enum TriageDetectEventsEvent {
967    OnDone {},
968    OnBail {},
969    OnDiagnosticFetch {},
970    OnCrashReport {
971        crash_signature: String,
972        crash_program_name: String,
973    },
974    OnCrashReportingProductRegistration {
975        product_name: String,
976        program_name: String,
977    },
978    #[non_exhaustive]
979    _UnknownEvent {
980        /// Ordinal of the event that was sent.
981        ordinal: u64,
982    },
983}
984
985impl TriageDetectEventsEvent {
986    #[allow(irrefutable_let_patterns)]
987    pub fn into_on_done(self) -> Option<()> {
988        if let TriageDetectEventsEvent::OnDone {} = self { Some(()) } else { None }
989    }
990    #[allow(irrefutable_let_patterns)]
991    pub fn into_on_bail(self) -> Option<()> {
992        if let TriageDetectEventsEvent::OnBail {} = self { Some(()) } else { None }
993    }
994    #[allow(irrefutable_let_patterns)]
995    pub fn into_on_diagnostic_fetch(self) -> Option<()> {
996        if let TriageDetectEventsEvent::OnDiagnosticFetch {} = self { Some(()) } else { None }
997    }
998    #[allow(irrefutable_let_patterns)]
999    pub fn into_on_crash_report(self) -> Option<(String, String)> {
1000        if let TriageDetectEventsEvent::OnCrashReport { crash_signature, crash_program_name } = self
1001        {
1002            Some((crash_signature, crash_program_name))
1003        } else {
1004            None
1005        }
1006    }
1007    #[allow(irrefutable_let_patterns)]
1008    pub fn into_on_crash_reporting_product_registration(self) -> Option<(String, String)> {
1009        if let TriageDetectEventsEvent::OnCrashReportingProductRegistration {
1010            product_name,
1011            program_name,
1012        } = self
1013        {
1014            Some((product_name, program_name))
1015        } else {
1016            None
1017        }
1018    }
1019
1020    /// Decodes a message buffer as a [`TriageDetectEventsEvent`].
1021    fn decode(
1022        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1023    ) -> Result<TriageDetectEventsEvent, fidl::Error> {
1024        let (bytes, _handles) = buf.split_mut();
1025        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1026        debug_assert_eq!(tx_header.tx_id, 0);
1027        match tx_header.ordinal {
1028            0x66b129b2110cfda9 => {
1029                let mut out = fidl::new_empty!(
1030                    fidl::encoding::EmptyPayload,
1031                    fidl::encoding::DefaultFuchsiaResourceDialect
1032                );
1033                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
1034                Ok((TriageDetectEventsEvent::OnDone {}))
1035            }
1036            0x353ae45fe8b3ba1f => {
1037                let mut out = fidl::new_empty!(
1038                    fidl::encoding::EmptyPayload,
1039                    fidl::encoding::DefaultFuchsiaResourceDialect
1040                );
1041                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
1042                Ok((TriageDetectEventsEvent::OnBail {}))
1043            }
1044            0x4143229dae6d22cd => {
1045                let mut out = fidl::new_empty!(
1046                    fidl::encoding::EmptyPayload,
1047                    fidl::encoding::DefaultFuchsiaResourceDialect
1048                );
1049                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
1050                Ok((TriageDetectEventsEvent::OnDiagnosticFetch {}))
1051            }
1052            0x5906712c264a59a0 => {
1053                let mut out = fidl::new_empty!(
1054                    TriageDetectEventsOnCrashReportRequest,
1055                    fidl::encoding::DefaultFuchsiaResourceDialect
1056                );
1057                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TriageDetectEventsOnCrashReportRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1058                Ok((TriageDetectEventsEvent::OnCrashReport {
1059                    crash_signature: out.crash_signature,
1060                    crash_program_name: out.crash_program_name,
1061                }))
1062            }
1063            0x4646fa5654da3de9 => {
1064                let mut out = fidl::new_empty!(
1065                    TriageDetectEventsOnCrashReportingProductRegistrationRequest,
1066                    fidl::encoding::DefaultFuchsiaResourceDialect
1067                );
1068                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TriageDetectEventsOnCrashReportingProductRegistrationRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1069                Ok((TriageDetectEventsEvent::OnCrashReportingProductRegistration {
1070                    product_name: out.product_name,
1071                    program_name: out.program_name,
1072                }))
1073            }
1074            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1075                Ok(TriageDetectEventsEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1076            }
1077            _ => Err(fidl::Error::UnknownOrdinal {
1078                ordinal: tx_header.ordinal,
1079                protocol_name:
1080                    <TriageDetectEventsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1081            }),
1082        }
1083    }
1084}
1085
1086/// A Stream of incoming requests for test.detect.factory/TriageDetectEvents.
1087pub struct TriageDetectEventsRequestStream {
1088    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1089    is_terminated: bool,
1090}
1091
1092impl std::marker::Unpin for TriageDetectEventsRequestStream {}
1093
1094impl futures::stream::FusedStream for TriageDetectEventsRequestStream {
1095    fn is_terminated(&self) -> bool {
1096        self.is_terminated
1097    }
1098}
1099
1100impl fidl::endpoints::RequestStream for TriageDetectEventsRequestStream {
1101    type Protocol = TriageDetectEventsMarker;
1102    type ControlHandle = TriageDetectEventsControlHandle;
1103
1104    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1105        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1106    }
1107
1108    fn control_handle(&self) -> Self::ControlHandle {
1109        TriageDetectEventsControlHandle { inner: self.inner.clone() }
1110    }
1111
1112    fn into_inner(
1113        self,
1114    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1115    {
1116        (self.inner, self.is_terminated)
1117    }
1118
1119    fn from_inner(
1120        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1121        is_terminated: bool,
1122    ) -> Self {
1123        Self { inner, is_terminated }
1124    }
1125}
1126
1127impl futures::Stream for TriageDetectEventsRequestStream {
1128    type Item = Result<TriageDetectEventsRequest, fidl::Error>;
1129
1130    fn poll_next(
1131        mut self: std::pin::Pin<&mut Self>,
1132        cx: &mut std::task::Context<'_>,
1133    ) -> std::task::Poll<Option<Self::Item>> {
1134        let this = &mut *self;
1135        if this.inner.check_shutdown(cx) {
1136            this.is_terminated = true;
1137            return std::task::Poll::Ready(None);
1138        }
1139        if this.is_terminated {
1140            panic!("polled TriageDetectEventsRequestStream after completion");
1141        }
1142        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1143            |bytes, handles| {
1144                match this.inner.channel().read_etc(cx, bytes, handles) {
1145                    std::task::Poll::Ready(Ok(())) => {}
1146                    std::task::Poll::Pending => return std::task::Poll::Pending,
1147                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1148                        this.is_terminated = true;
1149                        return std::task::Poll::Ready(None);
1150                    }
1151                    std::task::Poll::Ready(Err(e)) => {
1152                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1153                            e.into(),
1154                        ))));
1155                    }
1156                }
1157
1158                // A message has been received from the channel
1159                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1160
1161                std::task::Poll::Ready(Some(match header.ordinal {
1162                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1163                    Ok(TriageDetectEventsRequest::_UnknownMethod {
1164                        ordinal: header.ordinal,
1165                        control_handle: TriageDetectEventsControlHandle { inner: this.inner.clone() },
1166                        method_type: fidl::MethodType::OneWay,
1167                    })
1168                }
1169                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1170                    this.inner.send_framework_err(
1171                        fidl::encoding::FrameworkErr::UnknownMethod,
1172                        header.tx_id,
1173                        header.ordinal,
1174                        header.dynamic_flags(),
1175                        (bytes, handles),
1176                    )?;
1177                    Ok(TriageDetectEventsRequest::_UnknownMethod {
1178                        ordinal: header.ordinal,
1179                        control_handle: TriageDetectEventsControlHandle { inner: this.inner.clone() },
1180                        method_type: fidl::MethodType::TwoWay,
1181                    })
1182                }
1183                _ => Err(fidl::Error::UnknownOrdinal {
1184                    ordinal: header.ordinal,
1185                    protocol_name: <TriageDetectEventsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1186                }),
1187            }))
1188            },
1189        )
1190    }
1191}
1192
1193/// Events sent from the test realm.
1194#[derive(Debug)]
1195pub enum TriageDetectEventsRequest {
1196    /// An interaction was received which does not match any known method.
1197    #[non_exhaustive]
1198    _UnknownMethod {
1199        /// Ordinal of the method that was called.
1200        ordinal: u64,
1201        control_handle: TriageDetectEventsControlHandle,
1202        method_type: fidl::MethodType,
1203    },
1204}
1205
1206impl TriageDetectEventsRequest {
1207    /// Name of the method defined in FIDL
1208    pub fn method_name(&self) -> &'static str {
1209        match *self {
1210            TriageDetectEventsRequest::_UnknownMethod {
1211                method_type: fidl::MethodType::OneWay,
1212                ..
1213            } => "unknown one-way method",
1214            TriageDetectEventsRequest::_UnknownMethod {
1215                method_type: fidl::MethodType::TwoWay,
1216                ..
1217            } => "unknown two-way method",
1218        }
1219    }
1220}
1221
1222#[derive(Debug, Clone)]
1223pub struct TriageDetectEventsControlHandle {
1224    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1225}
1226
1227impl fidl::endpoints::ControlHandle for TriageDetectEventsControlHandle {
1228    fn shutdown(&self) {
1229        self.inner.shutdown()
1230    }
1231
1232    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1233        self.inner.shutdown_with_epitaph(status)
1234    }
1235
1236    fn is_closed(&self) -> bool {
1237        self.inner.channel().is_closed()
1238    }
1239    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1240        self.inner.channel().on_closed()
1241    }
1242
1243    #[cfg(target_os = "fuchsia")]
1244    fn signal_peer(
1245        &self,
1246        clear_mask: zx::Signals,
1247        set_mask: zx::Signals,
1248    ) -> Result<(), zx_status::Status> {
1249        use fidl::Peered;
1250        self.inner.channel().signal_peer(clear_mask, set_mask)
1251    }
1252}
1253
1254impl TriageDetectEventsControlHandle {
1255    pub fn send_on_done(&self) -> Result<(), fidl::Error> {
1256        self.inner.send::<fidl::encoding::EmptyPayload>(
1257            (),
1258            0,
1259            0x66b129b2110cfda9,
1260            fidl::encoding::DynamicFlags::FLEXIBLE,
1261        )
1262    }
1263
1264    pub fn send_on_bail(&self) -> Result<(), fidl::Error> {
1265        self.inner.send::<fidl::encoding::EmptyPayload>(
1266            (),
1267            0,
1268            0x353ae45fe8b3ba1f,
1269            fidl::encoding::DynamicFlags::FLEXIBLE,
1270        )
1271    }
1272
1273    pub fn send_on_diagnostic_fetch(&self) -> Result<(), fidl::Error> {
1274        self.inner.send::<fidl::encoding::EmptyPayload>(
1275            (),
1276            0,
1277            0x4143229dae6d22cd,
1278            fidl::encoding::DynamicFlags::FLEXIBLE,
1279        )
1280    }
1281
1282    pub fn send_on_crash_report(
1283        &self,
1284        mut crash_signature: &str,
1285        mut crash_program_name: &str,
1286    ) -> Result<(), fidl::Error> {
1287        self.inner.send::<TriageDetectEventsOnCrashReportRequest>(
1288            (crash_signature, crash_program_name),
1289            0,
1290            0x5906712c264a59a0,
1291            fidl::encoding::DynamicFlags::FLEXIBLE,
1292        )
1293    }
1294
1295    pub fn send_on_crash_reporting_product_registration(
1296        &self,
1297        mut product_name: &str,
1298        mut program_name: &str,
1299    ) -> Result<(), fidl::Error> {
1300        self.inner.send::<TriageDetectEventsOnCrashReportingProductRegistrationRequest>(
1301            (product_name, program_name),
1302            0,
1303            0x4646fa5654da3de9,
1304            fidl::encoding::DynamicFlags::FLEXIBLE,
1305        )
1306    }
1307}
1308
1309mod internal {
1310    use super::*;
1311
1312    impl fidl::encoding::ResourceTypeMarker for RealmFactoryCreateRealmRequest {
1313        type Borrowed<'a> = &'a mut Self;
1314        fn take_or_borrow<'a>(
1315            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1316        ) -> Self::Borrowed<'a> {
1317            value
1318        }
1319    }
1320
1321    unsafe impl fidl::encoding::TypeMarker for RealmFactoryCreateRealmRequest {
1322        type Owned = Self;
1323
1324        #[inline(always)]
1325        fn inline_align(_context: fidl::encoding::Context) -> usize {
1326            8
1327        }
1328
1329        #[inline(always)]
1330        fn inline_size(_context: fidl::encoding::Context) -> usize {
1331            24
1332        }
1333    }
1334
1335    unsafe impl
1336        fidl::encoding::Encode<
1337            RealmFactoryCreateRealmRequest,
1338            fidl::encoding::DefaultFuchsiaResourceDialect,
1339        > for &mut RealmFactoryCreateRealmRequest
1340    {
1341        #[inline]
1342        unsafe fn encode(
1343            self,
1344            encoder: &mut fidl::encoding::Encoder<
1345                '_,
1346                fidl::encoding::DefaultFuchsiaResourceDialect,
1347            >,
1348            offset: usize,
1349            _depth: fidl::encoding::Depth,
1350        ) -> fidl::Result<()> {
1351            encoder.debug_check_bounds::<RealmFactoryCreateRealmRequest>(offset);
1352            // Delegate to tuple encoding.
1353            fidl::encoding::Encode::<
1354                RealmFactoryCreateRealmRequest,
1355                fidl::encoding::DefaultFuchsiaResourceDialect,
1356            >::encode(
1357                (
1358                    <RealmOptions as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1359                        &mut self.options,
1360                    ),
1361                    <fidl::encoding::Endpoint<
1362                        fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1363                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1364                        &mut self.realm_server,
1365                    ),
1366                ),
1367                encoder,
1368                offset,
1369                _depth,
1370            )
1371        }
1372    }
1373    unsafe impl<
1374        T0: fidl::encoding::Encode<RealmOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
1375        T1: fidl::encoding::Encode<
1376                fidl::encoding::Endpoint<
1377                    fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1378                >,
1379                fidl::encoding::DefaultFuchsiaResourceDialect,
1380            >,
1381    >
1382        fidl::encoding::Encode<
1383            RealmFactoryCreateRealmRequest,
1384            fidl::encoding::DefaultFuchsiaResourceDialect,
1385        > for (T0, T1)
1386    {
1387        #[inline]
1388        unsafe fn encode(
1389            self,
1390            encoder: &mut fidl::encoding::Encoder<
1391                '_,
1392                fidl::encoding::DefaultFuchsiaResourceDialect,
1393            >,
1394            offset: usize,
1395            depth: fidl::encoding::Depth,
1396        ) -> fidl::Result<()> {
1397            encoder.debug_check_bounds::<RealmFactoryCreateRealmRequest>(offset);
1398            // Zero out padding regions. There's no need to apply masks
1399            // because the unmasked parts will be overwritten by fields.
1400            unsafe {
1401                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1402                (ptr as *mut u64).write_unaligned(0);
1403            }
1404            // Write the fields.
1405            self.0.encode(encoder, offset + 0, depth)?;
1406            self.1.encode(encoder, offset + 16, depth)?;
1407            Ok(())
1408        }
1409    }
1410
1411    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1412        for RealmFactoryCreateRealmRequest
1413    {
1414        #[inline(always)]
1415        fn new_empty() -> Self {
1416            Self {
1417                options: fidl::new_empty!(
1418                    RealmOptions,
1419                    fidl::encoding::DefaultFuchsiaResourceDialect
1420                ),
1421                realm_server: fidl::new_empty!(
1422                    fidl::encoding::Endpoint<
1423                        fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1424                    >,
1425                    fidl::encoding::DefaultFuchsiaResourceDialect
1426                ),
1427            }
1428        }
1429
1430        #[inline]
1431        unsafe fn decode(
1432            &mut self,
1433            decoder: &mut fidl::encoding::Decoder<
1434                '_,
1435                fidl::encoding::DefaultFuchsiaResourceDialect,
1436            >,
1437            offset: usize,
1438            _depth: fidl::encoding::Depth,
1439        ) -> fidl::Result<()> {
1440            decoder.debug_check_bounds::<Self>(offset);
1441            // Verify that padding bytes are zero.
1442            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1443            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1444            let mask = 0xffffffff00000000u64;
1445            let maskedval = padval & mask;
1446            if maskedval != 0 {
1447                return Err(fidl::Error::NonZeroPadding {
1448                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1449                });
1450            }
1451            fidl::decode!(
1452                RealmOptions,
1453                fidl::encoding::DefaultFuchsiaResourceDialect,
1454                &mut self.options,
1455                decoder,
1456                offset + 0,
1457                _depth
1458            )?;
1459            fidl::decode!(
1460                fidl::encoding::Endpoint<
1461                    fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1462                >,
1463                fidl::encoding::DefaultFuchsiaResourceDialect,
1464                &mut self.realm_server,
1465                decoder,
1466                offset + 16,
1467                _depth
1468            )?;
1469            Ok(())
1470        }
1471    }
1472
1473    impl fidl::encoding::ResourceTypeMarker for RealmFactoryGetTriageDetectEventsResponse {
1474        type Borrowed<'a> = &'a mut Self;
1475        fn take_or_borrow<'a>(
1476            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1477        ) -> Self::Borrowed<'a> {
1478            value
1479        }
1480    }
1481
1482    unsafe impl fidl::encoding::TypeMarker for RealmFactoryGetTriageDetectEventsResponse {
1483        type Owned = Self;
1484
1485        #[inline(always)]
1486        fn inline_align(_context: fidl::encoding::Context) -> usize {
1487            4
1488        }
1489
1490        #[inline(always)]
1491        fn inline_size(_context: fidl::encoding::Context) -> usize {
1492            4
1493        }
1494    }
1495
1496    unsafe impl
1497        fidl::encoding::Encode<
1498            RealmFactoryGetTriageDetectEventsResponse,
1499            fidl::encoding::DefaultFuchsiaResourceDialect,
1500        > for &mut RealmFactoryGetTriageDetectEventsResponse
1501    {
1502        #[inline]
1503        unsafe fn encode(
1504            self,
1505            encoder: &mut fidl::encoding::Encoder<
1506                '_,
1507                fidl::encoding::DefaultFuchsiaResourceDialect,
1508            >,
1509            offset: usize,
1510            _depth: fidl::encoding::Depth,
1511        ) -> fidl::Result<()> {
1512            encoder.debug_check_bounds::<RealmFactoryGetTriageDetectEventsResponse>(offset);
1513            // Delegate to tuple encoding.
1514            fidl::encoding::Encode::<RealmFactoryGetTriageDetectEventsResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1515                (
1516                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TriageDetectEventsMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.client_end),
1517                ),
1518                encoder, offset, _depth
1519            )
1520        }
1521    }
1522    unsafe impl<
1523        T0: fidl::encoding::Encode<
1524                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TriageDetectEventsMarker>>,
1525                fidl::encoding::DefaultFuchsiaResourceDialect,
1526            >,
1527    >
1528        fidl::encoding::Encode<
1529            RealmFactoryGetTriageDetectEventsResponse,
1530            fidl::encoding::DefaultFuchsiaResourceDialect,
1531        > for (T0,)
1532    {
1533        #[inline]
1534        unsafe fn encode(
1535            self,
1536            encoder: &mut fidl::encoding::Encoder<
1537                '_,
1538                fidl::encoding::DefaultFuchsiaResourceDialect,
1539            >,
1540            offset: usize,
1541            depth: fidl::encoding::Depth,
1542        ) -> fidl::Result<()> {
1543            encoder.debug_check_bounds::<RealmFactoryGetTriageDetectEventsResponse>(offset);
1544            // Zero out padding regions. There's no need to apply masks
1545            // because the unmasked parts will be overwritten by fields.
1546            // Write the fields.
1547            self.0.encode(encoder, offset + 0, depth)?;
1548            Ok(())
1549        }
1550    }
1551
1552    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1553        for RealmFactoryGetTriageDetectEventsResponse
1554    {
1555        #[inline(always)]
1556        fn new_empty() -> Self {
1557            Self {
1558                client_end: fidl::new_empty!(
1559                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TriageDetectEventsMarker>>,
1560                    fidl::encoding::DefaultFuchsiaResourceDialect
1561                ),
1562            }
1563        }
1564
1565        #[inline]
1566        unsafe fn decode(
1567            &mut self,
1568            decoder: &mut fidl::encoding::Decoder<
1569                '_,
1570                fidl::encoding::DefaultFuchsiaResourceDialect,
1571            >,
1572            offset: usize,
1573            _depth: fidl::encoding::Depth,
1574        ) -> fidl::Result<()> {
1575            decoder.debug_check_bounds::<Self>(offset);
1576            // Verify that padding bytes are zero.
1577            fidl::decode!(
1578                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TriageDetectEventsMarker>>,
1579                fidl::encoding::DefaultFuchsiaResourceDialect,
1580                &mut self.client_end,
1581                decoder,
1582                offset + 0,
1583                _depth
1584            )?;
1585            Ok(())
1586        }
1587    }
1588
1589    impl RealmOptions {
1590        #[inline(always)]
1591        fn max_ordinal_present(&self) -> u64 {
1592            if let Some(_) = self.inspect_data {
1593                return 3;
1594            }
1595            if let Some(_) = self.triage_configs {
1596                return 2;
1597            }
1598            if let Some(_) = self.program_config {
1599                return 1;
1600            }
1601            0
1602        }
1603    }
1604
1605    impl fidl::encoding::ResourceTypeMarker for RealmOptions {
1606        type Borrowed<'a> = &'a mut Self;
1607        fn take_or_borrow<'a>(
1608            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1609        ) -> Self::Borrowed<'a> {
1610            value
1611        }
1612    }
1613
1614    unsafe impl fidl::encoding::TypeMarker for RealmOptions {
1615        type Owned = Self;
1616
1617        #[inline(always)]
1618        fn inline_align(_context: fidl::encoding::Context) -> usize {
1619            8
1620        }
1621
1622        #[inline(always)]
1623        fn inline_size(_context: fidl::encoding::Context) -> usize {
1624            16
1625        }
1626    }
1627
1628    unsafe impl fidl::encoding::Encode<RealmOptions, fidl::encoding::DefaultFuchsiaResourceDialect>
1629        for &mut RealmOptions
1630    {
1631        unsafe fn encode(
1632            self,
1633            encoder: &mut fidl::encoding::Encoder<
1634                '_,
1635                fidl::encoding::DefaultFuchsiaResourceDialect,
1636            >,
1637            offset: usize,
1638            mut depth: fidl::encoding::Depth,
1639        ) -> fidl::Result<()> {
1640            encoder.debug_check_bounds::<RealmOptions>(offset);
1641            // Vector header
1642            let max_ordinal: u64 = self.max_ordinal_present();
1643            encoder.write_num(max_ordinal, offset);
1644            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1645            // Calling encoder.out_of_line_offset(0) is not allowed.
1646            if max_ordinal == 0 {
1647                return Ok(());
1648            }
1649            depth.increment()?;
1650            let envelope_size = 8;
1651            let bytes_len = max_ordinal as usize * envelope_size;
1652            #[allow(unused_variables)]
1653            let offset = encoder.out_of_line_offset(bytes_len);
1654            let mut _prev_end_offset: usize = 0;
1655            if 1 > max_ordinal {
1656                return Ok(());
1657            }
1658
1659            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1660            // are envelope_size bytes.
1661            let cur_offset: usize = (1 - 1) * envelope_size;
1662
1663            // Zero reserved fields.
1664            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1665
1666            // Safety:
1667            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1668            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1669            //   envelope_size bytes, there is always sufficient room.
1670            fidl::encoding::encode_in_envelope_optional::<
1671                fidl::encoding::HandleType<
1672                    fidl::Vmo,
1673                    { fidl::ObjectType::VMO.into_raw() },
1674                    2147483648,
1675                >,
1676                fidl::encoding::DefaultFuchsiaResourceDialect,
1677            >(
1678                self.program_config.as_mut().map(
1679                    <fidl::encoding::HandleType<
1680                        fidl::Vmo,
1681                        { fidl::ObjectType::VMO.into_raw() },
1682                        2147483648,
1683                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1684                ),
1685                encoder,
1686                offset + cur_offset,
1687                depth,
1688            )?;
1689
1690            _prev_end_offset = cur_offset + envelope_size;
1691            if 2 > max_ordinal {
1692                return Ok(());
1693            }
1694
1695            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1696            // are envelope_size bytes.
1697            let cur_offset: usize = (2 - 1) * envelope_size;
1698
1699            // Zero reserved fields.
1700            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1701
1702            // Safety:
1703            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1704            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1705            //   envelope_size bytes, there is always sufficient room.
1706            fidl::encoding::encode_in_envelope_optional::<
1707                fidl::encoding::Vector<
1708                    fidl::encoding::HandleType<
1709                        fidl::Vmo,
1710                        { fidl::ObjectType::VMO.into_raw() },
1711                        2147483648,
1712                    >,
1713                    64,
1714                >,
1715                fidl::encoding::DefaultFuchsiaResourceDialect,
1716            >(
1717                self.triage_configs.as_mut().map(
1718                    <fidl::encoding::Vector<
1719                        fidl::encoding::HandleType<
1720                            fidl::Vmo,
1721                            { fidl::ObjectType::VMO.into_raw() },
1722                            2147483648,
1723                        >,
1724                        64,
1725                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1726                ),
1727                encoder,
1728                offset + cur_offset,
1729                depth,
1730            )?;
1731
1732            _prev_end_offset = cur_offset + envelope_size;
1733            if 3 > max_ordinal {
1734                return Ok(());
1735            }
1736
1737            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1738            // are envelope_size bytes.
1739            let cur_offset: usize = (3 - 1) * envelope_size;
1740
1741            // Zero reserved fields.
1742            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1743
1744            // Safety:
1745            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1746            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1747            //   envelope_size bytes, there is always sufficient room.
1748            fidl::encoding::encode_in_envelope_optional::<
1749                fidl::encoding::Vector<
1750                    fidl::encoding::HandleType<
1751                        fidl::Vmo,
1752                        { fidl::ObjectType::VMO.into_raw() },
1753                        2147483648,
1754                    >,
1755                    64,
1756                >,
1757                fidl::encoding::DefaultFuchsiaResourceDialect,
1758            >(
1759                self.inspect_data.as_mut().map(
1760                    <fidl::encoding::Vector<
1761                        fidl::encoding::HandleType<
1762                            fidl::Vmo,
1763                            { fidl::ObjectType::VMO.into_raw() },
1764                            2147483648,
1765                        >,
1766                        64,
1767                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1768                ),
1769                encoder,
1770                offset + cur_offset,
1771                depth,
1772            )?;
1773
1774            _prev_end_offset = cur_offset + envelope_size;
1775
1776            Ok(())
1777        }
1778    }
1779
1780    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for RealmOptions {
1781        #[inline(always)]
1782        fn new_empty() -> Self {
1783            Self::default()
1784        }
1785
1786        unsafe fn decode(
1787            &mut self,
1788            decoder: &mut fidl::encoding::Decoder<
1789                '_,
1790                fidl::encoding::DefaultFuchsiaResourceDialect,
1791            >,
1792            offset: usize,
1793            mut depth: fidl::encoding::Depth,
1794        ) -> fidl::Result<()> {
1795            decoder.debug_check_bounds::<Self>(offset);
1796            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1797                None => return Err(fidl::Error::NotNullable),
1798                Some(len) => len,
1799            };
1800            // Calling decoder.out_of_line_offset(0) is not allowed.
1801            if len == 0 {
1802                return Ok(());
1803            };
1804            depth.increment()?;
1805            let envelope_size = 8;
1806            let bytes_len = len * envelope_size;
1807            let offset = decoder.out_of_line_offset(bytes_len)?;
1808            // Decode the envelope for each type.
1809            let mut _next_ordinal_to_read = 0;
1810            let mut next_offset = offset;
1811            let end_offset = offset + bytes_len;
1812            _next_ordinal_to_read += 1;
1813            if next_offset >= end_offset {
1814                return Ok(());
1815            }
1816
1817            // Decode unknown envelopes for gaps in ordinals.
1818            while _next_ordinal_to_read < 1 {
1819                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1820                _next_ordinal_to_read += 1;
1821                next_offset += envelope_size;
1822            }
1823
1824            let next_out_of_line = decoder.next_out_of_line();
1825            let handles_before = decoder.remaining_handles();
1826            if let Some((inlined, num_bytes, num_handles)) =
1827                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1828            {
1829                let member_inline_size = <fidl::encoding::HandleType<
1830                    fidl::Vmo,
1831                    { fidl::ObjectType::VMO.into_raw() },
1832                    2147483648,
1833                > as fidl::encoding::TypeMarker>::inline_size(
1834                    decoder.context
1835                );
1836                if inlined != (member_inline_size <= 4) {
1837                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1838                }
1839                let inner_offset;
1840                let mut inner_depth = depth.clone();
1841                if inlined {
1842                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1843                    inner_offset = next_offset;
1844                } else {
1845                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1846                    inner_depth.increment()?;
1847                }
1848                let val_ref =
1849                self.program_config.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1850                fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1851                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1852                {
1853                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1854                }
1855                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1856                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1857                }
1858            }
1859
1860            next_offset += envelope_size;
1861            _next_ordinal_to_read += 1;
1862            if next_offset >= end_offset {
1863                return Ok(());
1864            }
1865
1866            // Decode unknown envelopes for gaps in ordinals.
1867            while _next_ordinal_to_read < 2 {
1868                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1869                _next_ordinal_to_read += 1;
1870                next_offset += envelope_size;
1871            }
1872
1873            let next_out_of_line = decoder.next_out_of_line();
1874            let handles_before = decoder.remaining_handles();
1875            if let Some((inlined, num_bytes, num_handles)) =
1876                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1877            {
1878                let member_inline_size = <fidl::encoding::Vector<
1879                    fidl::encoding::HandleType<
1880                        fidl::Vmo,
1881                        { fidl::ObjectType::VMO.into_raw() },
1882                        2147483648,
1883                    >,
1884                    64,
1885                > as fidl::encoding::TypeMarker>::inline_size(
1886                    decoder.context
1887                );
1888                if inlined != (member_inline_size <= 4) {
1889                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1890                }
1891                let inner_offset;
1892                let mut inner_depth = depth.clone();
1893                if inlined {
1894                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1895                    inner_offset = next_offset;
1896                } else {
1897                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1898                    inner_depth.increment()?;
1899                }
1900                let val_ref = self.triage_configs.get_or_insert_with(|| {
1901                    fidl::new_empty!(
1902                        fidl::encoding::Vector<
1903                            fidl::encoding::HandleType<
1904                                fidl::Vmo,
1905                                { fidl::ObjectType::VMO.into_raw() },
1906                                2147483648,
1907                            >,
1908                            64,
1909                        >,
1910                        fidl::encoding::DefaultFuchsiaResourceDialect
1911                    )
1912                });
1913                fidl::decode!(
1914                    fidl::encoding::Vector<
1915                        fidl::encoding::HandleType<
1916                            fidl::Vmo,
1917                            { fidl::ObjectType::VMO.into_raw() },
1918                            2147483648,
1919                        >,
1920                        64,
1921                    >,
1922                    fidl::encoding::DefaultFuchsiaResourceDialect,
1923                    val_ref,
1924                    decoder,
1925                    inner_offset,
1926                    inner_depth
1927                )?;
1928                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1929                {
1930                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1931                }
1932                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1933                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1934                }
1935            }
1936
1937            next_offset += envelope_size;
1938            _next_ordinal_to_read += 1;
1939            if next_offset >= end_offset {
1940                return Ok(());
1941            }
1942
1943            // Decode unknown envelopes for gaps in ordinals.
1944            while _next_ordinal_to_read < 3 {
1945                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1946                _next_ordinal_to_read += 1;
1947                next_offset += envelope_size;
1948            }
1949
1950            let next_out_of_line = decoder.next_out_of_line();
1951            let handles_before = decoder.remaining_handles();
1952            if let Some((inlined, num_bytes, num_handles)) =
1953                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1954            {
1955                let member_inline_size = <fidl::encoding::Vector<
1956                    fidl::encoding::HandleType<
1957                        fidl::Vmo,
1958                        { fidl::ObjectType::VMO.into_raw() },
1959                        2147483648,
1960                    >,
1961                    64,
1962                > as fidl::encoding::TypeMarker>::inline_size(
1963                    decoder.context
1964                );
1965                if inlined != (member_inline_size <= 4) {
1966                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1967                }
1968                let inner_offset;
1969                let mut inner_depth = depth.clone();
1970                if inlined {
1971                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1972                    inner_offset = next_offset;
1973                } else {
1974                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1975                    inner_depth.increment()?;
1976                }
1977                let val_ref = self.inspect_data.get_or_insert_with(|| {
1978                    fidl::new_empty!(
1979                        fidl::encoding::Vector<
1980                            fidl::encoding::HandleType<
1981                                fidl::Vmo,
1982                                { fidl::ObjectType::VMO.into_raw() },
1983                                2147483648,
1984                            >,
1985                            64,
1986                        >,
1987                        fidl::encoding::DefaultFuchsiaResourceDialect
1988                    )
1989                });
1990                fidl::decode!(
1991                    fidl::encoding::Vector<
1992                        fidl::encoding::HandleType<
1993                            fidl::Vmo,
1994                            { fidl::ObjectType::VMO.into_raw() },
1995                            2147483648,
1996                        >,
1997                        64,
1998                    >,
1999                    fidl::encoding::DefaultFuchsiaResourceDialect,
2000                    val_ref,
2001                    decoder,
2002                    inner_offset,
2003                    inner_depth
2004                )?;
2005                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2006                {
2007                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2008                }
2009                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2010                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2011                }
2012            }
2013
2014            next_offset += envelope_size;
2015
2016            // Decode the remaining unknown envelopes.
2017            while next_offset < end_offset {
2018                _next_ordinal_to_read += 1;
2019                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2020                next_offset += envelope_size;
2021            }
2022
2023            Ok(())
2024        }
2025    }
2026}