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::Handle {
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    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
641        self.inner.shutdown_with_epitaph(status)
642    }
643
644    fn is_closed(&self) -> bool {
645        self.inner.channel().is_closed()
646    }
647    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
648        self.inner.channel().on_closed()
649    }
650
651    #[cfg(target_os = "fuchsia")]
652    fn signal_peer(
653        &self,
654        clear_mask: zx::Signals,
655        set_mask: zx::Signals,
656    ) -> Result<(), zx_status::Status> {
657        use fidl::Peered;
658        self.inner.channel().signal_peer(clear_mask, set_mask)
659    }
660}
661
662impl RealmFactoryControlHandle {}
663
664#[must_use = "FIDL methods require a response to be sent"]
665#[derive(Debug)]
666pub struct RealmFactoryCreateRealmResponder {
667    control_handle: std::mem::ManuallyDrop<RealmFactoryControlHandle>,
668    tx_id: u32,
669}
670
671/// Set the the channel to be shutdown (see [`RealmFactoryControlHandle::shutdown`])
672/// if the responder is dropped without sending a response, so that the client
673/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
674impl std::ops::Drop for RealmFactoryCreateRealmResponder {
675    fn drop(&mut self) {
676        self.control_handle.shutdown();
677        // Safety: drops once, never accessed again
678        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
679    }
680}
681
682impl fidl::endpoints::Responder for RealmFactoryCreateRealmResponder {
683    type ControlHandle = RealmFactoryControlHandle;
684
685    fn control_handle(&self) -> &RealmFactoryControlHandle {
686        &self.control_handle
687    }
688
689    fn drop_without_shutdown(mut self) {
690        // Safety: drops once, never accessed again due to mem::forget
691        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
692        // Prevent Drop from running (which would shut down the channel)
693        std::mem::forget(self);
694    }
695}
696
697impl RealmFactoryCreateRealmResponder {
698    /// Sends a response to the FIDL transaction.
699    ///
700    /// Sets the channel to shutdown if an error occurs.
701    pub fn send(
702        self,
703        mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
704    ) -> Result<(), fidl::Error> {
705        let _result = self.send_raw(result);
706        if _result.is_err() {
707            self.control_handle.shutdown();
708        }
709        self.drop_without_shutdown();
710        _result
711    }
712
713    /// Similar to "send" but does not shutdown the channel if an error occurs.
714    pub fn send_no_shutdown_on_err(
715        self,
716        mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
717    ) -> Result<(), fidl::Error> {
718        let _result = self.send_raw(result);
719        self.drop_without_shutdown();
720        _result
721    }
722
723    fn send_raw(
724        &self,
725        mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
726    ) -> Result<(), fidl::Error> {
727        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
728            fidl::encoding::EmptyStruct,
729            fidl_fuchsia_testing_harness::OperationError,
730        >>(
731            fidl::encoding::FlexibleResult::new(result),
732            self.tx_id,
733            0x12d4b5c7c9d9801a,
734            fidl::encoding::DynamicFlags::FLEXIBLE,
735        )
736    }
737}
738
739#[must_use = "FIDL methods require a response to be sent"]
740#[derive(Debug)]
741pub struct RealmFactoryGetTriageDetectEventsResponder {
742    control_handle: std::mem::ManuallyDrop<RealmFactoryControlHandle>,
743    tx_id: u32,
744}
745
746/// Set the the channel to be shutdown (see [`RealmFactoryControlHandle::shutdown`])
747/// if the responder is dropped without sending a response, so that the client
748/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
749impl std::ops::Drop for RealmFactoryGetTriageDetectEventsResponder {
750    fn drop(&mut self) {
751        self.control_handle.shutdown();
752        // Safety: drops once, never accessed again
753        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
754    }
755}
756
757impl fidl::endpoints::Responder for RealmFactoryGetTriageDetectEventsResponder {
758    type ControlHandle = RealmFactoryControlHandle;
759
760    fn control_handle(&self) -> &RealmFactoryControlHandle {
761        &self.control_handle
762    }
763
764    fn drop_without_shutdown(mut self) {
765        // Safety: drops once, never accessed again due to mem::forget
766        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
767        // Prevent Drop from running (which would shut down the channel)
768        std::mem::forget(self);
769    }
770}
771
772impl RealmFactoryGetTriageDetectEventsResponder {
773    /// Sends a response to the FIDL transaction.
774    ///
775    /// Sets the channel to shutdown if an error occurs.
776    pub fn send(
777        self,
778        mut client_end: fidl::endpoints::ClientEnd<TriageDetectEventsMarker>,
779    ) -> Result<(), fidl::Error> {
780        let _result = self.send_raw(client_end);
781        if _result.is_err() {
782            self.control_handle.shutdown();
783        }
784        self.drop_without_shutdown();
785        _result
786    }
787
788    /// Similar to "send" but does not shutdown the channel if an error occurs.
789    pub fn send_no_shutdown_on_err(
790        self,
791        mut client_end: fidl::endpoints::ClientEnd<TriageDetectEventsMarker>,
792    ) -> Result<(), fidl::Error> {
793        let _result = self.send_raw(client_end);
794        self.drop_without_shutdown();
795        _result
796    }
797
798    fn send_raw(
799        &self,
800        mut client_end: fidl::endpoints::ClientEnd<TriageDetectEventsMarker>,
801    ) -> Result<(), fidl::Error> {
802        self.control_handle.inner.send::<RealmFactoryGetTriageDetectEventsResponse>(
803            (client_end,),
804            self.tx_id,
805            0x7be53256487c35fd,
806            fidl::encoding::DynamicFlags::empty(),
807        )
808    }
809}
810
811#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
812pub struct TriageDetectEventsMarker;
813
814impl fidl::endpoints::ProtocolMarker for TriageDetectEventsMarker {
815    type Proxy = TriageDetectEventsProxy;
816    type RequestStream = TriageDetectEventsRequestStream;
817    #[cfg(target_os = "fuchsia")]
818    type SynchronousProxy = TriageDetectEventsSynchronousProxy;
819
820    const DEBUG_NAME: &'static str = "test.detect.factory.TriageDetectEvents";
821}
822impl fidl::endpoints::DiscoverableProtocolMarker for TriageDetectEventsMarker {}
823
824pub trait TriageDetectEventsProxyInterface: Send + Sync {}
825#[derive(Debug)]
826#[cfg(target_os = "fuchsia")]
827pub struct TriageDetectEventsSynchronousProxy {
828    client: fidl::client::sync::Client,
829}
830
831#[cfg(target_os = "fuchsia")]
832impl fidl::endpoints::SynchronousProxy for TriageDetectEventsSynchronousProxy {
833    type Proxy = TriageDetectEventsProxy;
834    type Protocol = TriageDetectEventsMarker;
835
836    fn from_channel(inner: fidl::Channel) -> Self {
837        Self::new(inner)
838    }
839
840    fn into_channel(self) -> fidl::Channel {
841        self.client.into_channel()
842    }
843
844    fn as_channel(&self) -> &fidl::Channel {
845        self.client.as_channel()
846    }
847}
848
849#[cfg(target_os = "fuchsia")]
850impl TriageDetectEventsSynchronousProxy {
851    pub fn new(channel: fidl::Channel) -> Self {
852        let protocol_name =
853            <TriageDetectEventsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
854        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
855    }
856
857    pub fn into_channel(self) -> fidl::Channel {
858        self.client.into_channel()
859    }
860
861    /// Waits until an event arrives and returns it. It is safe for other
862    /// threads to make concurrent requests while waiting for an event.
863    pub fn wait_for_event(
864        &self,
865        deadline: zx::MonotonicInstant,
866    ) -> Result<TriageDetectEventsEvent, fidl::Error> {
867        TriageDetectEventsEvent::decode(self.client.wait_for_event(deadline)?)
868    }
869}
870
871#[cfg(target_os = "fuchsia")]
872impl From<TriageDetectEventsSynchronousProxy> for zx::Handle {
873    fn from(value: TriageDetectEventsSynchronousProxy) -> Self {
874        value.into_channel().into()
875    }
876}
877
878#[cfg(target_os = "fuchsia")]
879impl From<fidl::Channel> for TriageDetectEventsSynchronousProxy {
880    fn from(value: fidl::Channel) -> Self {
881        Self::new(value)
882    }
883}
884
885#[cfg(target_os = "fuchsia")]
886impl fidl::endpoints::FromClient for TriageDetectEventsSynchronousProxy {
887    type Protocol = TriageDetectEventsMarker;
888
889    fn from_client(value: fidl::endpoints::ClientEnd<TriageDetectEventsMarker>) -> Self {
890        Self::new(value.into_channel())
891    }
892}
893
894#[derive(Debug, Clone)]
895pub struct TriageDetectEventsProxy {
896    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
897}
898
899impl fidl::endpoints::Proxy for TriageDetectEventsProxy {
900    type Protocol = TriageDetectEventsMarker;
901
902    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
903        Self::new(inner)
904    }
905
906    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
907        self.client.into_channel().map_err(|client| Self { client })
908    }
909
910    fn as_channel(&self) -> &::fidl::AsyncChannel {
911        self.client.as_channel()
912    }
913}
914
915impl TriageDetectEventsProxy {
916    /// Create a new Proxy for test.detect.factory/TriageDetectEvents.
917    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
918        let protocol_name =
919            <TriageDetectEventsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
920        Self { client: fidl::client::Client::new(channel, protocol_name) }
921    }
922
923    /// Get a Stream of events from the remote end of the protocol.
924    ///
925    /// # Panics
926    ///
927    /// Panics if the event stream was already taken.
928    pub fn take_event_stream(&self) -> TriageDetectEventsEventStream {
929        TriageDetectEventsEventStream { event_receiver: self.client.take_event_receiver() }
930    }
931}
932
933impl TriageDetectEventsProxyInterface for TriageDetectEventsProxy {}
934
935pub struct TriageDetectEventsEventStream {
936    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
937}
938
939impl std::marker::Unpin for TriageDetectEventsEventStream {}
940
941impl futures::stream::FusedStream for TriageDetectEventsEventStream {
942    fn is_terminated(&self) -> bool {
943        self.event_receiver.is_terminated()
944    }
945}
946
947impl futures::Stream for TriageDetectEventsEventStream {
948    type Item = Result<TriageDetectEventsEvent, fidl::Error>;
949
950    fn poll_next(
951        mut self: std::pin::Pin<&mut Self>,
952        cx: &mut std::task::Context<'_>,
953    ) -> std::task::Poll<Option<Self::Item>> {
954        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
955            &mut self.event_receiver,
956            cx
957        )?) {
958            Some(buf) => std::task::Poll::Ready(Some(TriageDetectEventsEvent::decode(buf))),
959            None => std::task::Poll::Ready(None),
960        }
961    }
962}
963
964#[derive(Debug)]
965pub enum TriageDetectEventsEvent {
966    OnDone {},
967    OnBail {},
968    OnDiagnosticFetch {},
969    OnCrashReport {
970        crash_signature: String,
971        crash_program_name: String,
972    },
973    OnCrashReportingProductRegistration {
974        product_name: String,
975        program_name: String,
976    },
977    #[non_exhaustive]
978    _UnknownEvent {
979        /// Ordinal of the event that was sent.
980        ordinal: u64,
981    },
982}
983
984impl TriageDetectEventsEvent {
985    #[allow(irrefutable_let_patterns)]
986    pub fn into_on_done(self) -> Option<()> {
987        if let TriageDetectEventsEvent::OnDone {} = self { Some(()) } else { None }
988    }
989    #[allow(irrefutable_let_patterns)]
990    pub fn into_on_bail(self) -> Option<()> {
991        if let TriageDetectEventsEvent::OnBail {} = self { Some(()) } else { None }
992    }
993    #[allow(irrefutable_let_patterns)]
994    pub fn into_on_diagnostic_fetch(self) -> Option<()> {
995        if let TriageDetectEventsEvent::OnDiagnosticFetch {} = self { Some(()) } else { None }
996    }
997    #[allow(irrefutable_let_patterns)]
998    pub fn into_on_crash_report(self) -> Option<(String, String)> {
999        if let TriageDetectEventsEvent::OnCrashReport { crash_signature, crash_program_name } = self
1000        {
1001            Some((crash_signature, crash_program_name))
1002        } else {
1003            None
1004        }
1005    }
1006    #[allow(irrefutable_let_patterns)]
1007    pub fn into_on_crash_reporting_product_registration(self) -> Option<(String, String)> {
1008        if let TriageDetectEventsEvent::OnCrashReportingProductRegistration {
1009            product_name,
1010            program_name,
1011        } = self
1012        {
1013            Some((product_name, program_name))
1014        } else {
1015            None
1016        }
1017    }
1018
1019    /// Decodes a message buffer as a [`TriageDetectEventsEvent`].
1020    fn decode(
1021        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1022    ) -> Result<TriageDetectEventsEvent, fidl::Error> {
1023        let (bytes, _handles) = buf.split_mut();
1024        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1025        debug_assert_eq!(tx_header.tx_id, 0);
1026        match tx_header.ordinal {
1027            0x66b129b2110cfda9 => {
1028                let mut out = fidl::new_empty!(
1029                    fidl::encoding::EmptyPayload,
1030                    fidl::encoding::DefaultFuchsiaResourceDialect
1031                );
1032                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
1033                Ok((TriageDetectEventsEvent::OnDone {}))
1034            }
1035            0x353ae45fe8b3ba1f => {
1036                let mut out = fidl::new_empty!(
1037                    fidl::encoding::EmptyPayload,
1038                    fidl::encoding::DefaultFuchsiaResourceDialect
1039                );
1040                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
1041                Ok((TriageDetectEventsEvent::OnBail {}))
1042            }
1043            0x4143229dae6d22cd => {
1044                let mut out = fidl::new_empty!(
1045                    fidl::encoding::EmptyPayload,
1046                    fidl::encoding::DefaultFuchsiaResourceDialect
1047                );
1048                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
1049                Ok((TriageDetectEventsEvent::OnDiagnosticFetch {}))
1050            }
1051            0x5906712c264a59a0 => {
1052                let mut out = fidl::new_empty!(
1053                    TriageDetectEventsOnCrashReportRequest,
1054                    fidl::encoding::DefaultFuchsiaResourceDialect
1055                );
1056                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TriageDetectEventsOnCrashReportRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1057                Ok((TriageDetectEventsEvent::OnCrashReport {
1058                    crash_signature: out.crash_signature,
1059                    crash_program_name: out.crash_program_name,
1060                }))
1061            }
1062            0x4646fa5654da3de9 => {
1063                let mut out = fidl::new_empty!(
1064                    TriageDetectEventsOnCrashReportingProductRegistrationRequest,
1065                    fidl::encoding::DefaultFuchsiaResourceDialect
1066                );
1067                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TriageDetectEventsOnCrashReportingProductRegistrationRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1068                Ok((TriageDetectEventsEvent::OnCrashReportingProductRegistration {
1069                    product_name: out.product_name,
1070                    program_name: out.program_name,
1071                }))
1072            }
1073            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1074                Ok(TriageDetectEventsEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1075            }
1076            _ => Err(fidl::Error::UnknownOrdinal {
1077                ordinal: tx_header.ordinal,
1078                protocol_name:
1079                    <TriageDetectEventsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1080            }),
1081        }
1082    }
1083}
1084
1085/// A Stream of incoming requests for test.detect.factory/TriageDetectEvents.
1086pub struct TriageDetectEventsRequestStream {
1087    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1088    is_terminated: bool,
1089}
1090
1091impl std::marker::Unpin for TriageDetectEventsRequestStream {}
1092
1093impl futures::stream::FusedStream for TriageDetectEventsRequestStream {
1094    fn is_terminated(&self) -> bool {
1095        self.is_terminated
1096    }
1097}
1098
1099impl fidl::endpoints::RequestStream for TriageDetectEventsRequestStream {
1100    type Protocol = TriageDetectEventsMarker;
1101    type ControlHandle = TriageDetectEventsControlHandle;
1102
1103    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1104        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1105    }
1106
1107    fn control_handle(&self) -> Self::ControlHandle {
1108        TriageDetectEventsControlHandle { inner: self.inner.clone() }
1109    }
1110
1111    fn into_inner(
1112        self,
1113    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1114    {
1115        (self.inner, self.is_terminated)
1116    }
1117
1118    fn from_inner(
1119        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1120        is_terminated: bool,
1121    ) -> Self {
1122        Self { inner, is_terminated }
1123    }
1124}
1125
1126impl futures::Stream for TriageDetectEventsRequestStream {
1127    type Item = Result<TriageDetectEventsRequest, fidl::Error>;
1128
1129    fn poll_next(
1130        mut self: std::pin::Pin<&mut Self>,
1131        cx: &mut std::task::Context<'_>,
1132    ) -> std::task::Poll<Option<Self::Item>> {
1133        let this = &mut *self;
1134        if this.inner.check_shutdown(cx) {
1135            this.is_terminated = true;
1136            return std::task::Poll::Ready(None);
1137        }
1138        if this.is_terminated {
1139            panic!("polled TriageDetectEventsRequestStream after completion");
1140        }
1141        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1142            |bytes, handles| {
1143                match this.inner.channel().read_etc(cx, bytes, handles) {
1144                    std::task::Poll::Ready(Ok(())) => {}
1145                    std::task::Poll::Pending => return std::task::Poll::Pending,
1146                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1147                        this.is_terminated = true;
1148                        return std::task::Poll::Ready(None);
1149                    }
1150                    std::task::Poll::Ready(Err(e)) => {
1151                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1152                            e.into(),
1153                        ))));
1154                    }
1155                }
1156
1157                // A message has been received from the channel
1158                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1159
1160                std::task::Poll::Ready(Some(match header.ordinal {
1161                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1162                    Ok(TriageDetectEventsRequest::_UnknownMethod {
1163                        ordinal: header.ordinal,
1164                        control_handle: TriageDetectEventsControlHandle { inner: this.inner.clone() },
1165                        method_type: fidl::MethodType::OneWay,
1166                    })
1167                }
1168                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1169                    this.inner.send_framework_err(
1170                        fidl::encoding::FrameworkErr::UnknownMethod,
1171                        header.tx_id,
1172                        header.ordinal,
1173                        header.dynamic_flags(),
1174                        (bytes, handles),
1175                    )?;
1176                    Ok(TriageDetectEventsRequest::_UnknownMethod {
1177                        ordinal: header.ordinal,
1178                        control_handle: TriageDetectEventsControlHandle { inner: this.inner.clone() },
1179                        method_type: fidl::MethodType::TwoWay,
1180                    })
1181                }
1182                _ => Err(fidl::Error::UnknownOrdinal {
1183                    ordinal: header.ordinal,
1184                    protocol_name: <TriageDetectEventsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1185                }),
1186            }))
1187            },
1188        )
1189    }
1190}
1191
1192/// Events sent from the test realm.
1193#[derive(Debug)]
1194pub enum TriageDetectEventsRequest {
1195    /// An interaction was received which does not match any known method.
1196    #[non_exhaustive]
1197    _UnknownMethod {
1198        /// Ordinal of the method that was called.
1199        ordinal: u64,
1200        control_handle: TriageDetectEventsControlHandle,
1201        method_type: fidl::MethodType,
1202    },
1203}
1204
1205impl TriageDetectEventsRequest {
1206    /// Name of the method defined in FIDL
1207    pub fn method_name(&self) -> &'static str {
1208        match *self {
1209            TriageDetectEventsRequest::_UnknownMethod {
1210                method_type: fidl::MethodType::OneWay,
1211                ..
1212            } => "unknown one-way method",
1213            TriageDetectEventsRequest::_UnknownMethod {
1214                method_type: fidl::MethodType::TwoWay,
1215                ..
1216            } => "unknown two-way method",
1217        }
1218    }
1219}
1220
1221#[derive(Debug, Clone)]
1222pub struct TriageDetectEventsControlHandle {
1223    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1224}
1225
1226impl fidl::endpoints::ControlHandle for TriageDetectEventsControlHandle {
1227    fn shutdown(&self) {
1228        self.inner.shutdown()
1229    }
1230    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1231        self.inner.shutdown_with_epitaph(status)
1232    }
1233
1234    fn is_closed(&self) -> bool {
1235        self.inner.channel().is_closed()
1236    }
1237    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1238        self.inner.channel().on_closed()
1239    }
1240
1241    #[cfg(target_os = "fuchsia")]
1242    fn signal_peer(
1243        &self,
1244        clear_mask: zx::Signals,
1245        set_mask: zx::Signals,
1246    ) -> Result<(), zx_status::Status> {
1247        use fidl::Peered;
1248        self.inner.channel().signal_peer(clear_mask, set_mask)
1249    }
1250}
1251
1252impl TriageDetectEventsControlHandle {
1253    pub fn send_on_done(&self) -> Result<(), fidl::Error> {
1254        self.inner.send::<fidl::encoding::EmptyPayload>(
1255            (),
1256            0,
1257            0x66b129b2110cfda9,
1258            fidl::encoding::DynamicFlags::FLEXIBLE,
1259        )
1260    }
1261
1262    pub fn send_on_bail(&self) -> Result<(), fidl::Error> {
1263        self.inner.send::<fidl::encoding::EmptyPayload>(
1264            (),
1265            0,
1266            0x353ae45fe8b3ba1f,
1267            fidl::encoding::DynamicFlags::FLEXIBLE,
1268        )
1269    }
1270
1271    pub fn send_on_diagnostic_fetch(&self) -> Result<(), fidl::Error> {
1272        self.inner.send::<fidl::encoding::EmptyPayload>(
1273            (),
1274            0,
1275            0x4143229dae6d22cd,
1276            fidl::encoding::DynamicFlags::FLEXIBLE,
1277        )
1278    }
1279
1280    pub fn send_on_crash_report(
1281        &self,
1282        mut crash_signature: &str,
1283        mut crash_program_name: &str,
1284    ) -> Result<(), fidl::Error> {
1285        self.inner.send::<TriageDetectEventsOnCrashReportRequest>(
1286            (crash_signature, crash_program_name),
1287            0,
1288            0x5906712c264a59a0,
1289            fidl::encoding::DynamicFlags::FLEXIBLE,
1290        )
1291    }
1292
1293    pub fn send_on_crash_reporting_product_registration(
1294        &self,
1295        mut product_name: &str,
1296        mut program_name: &str,
1297    ) -> Result<(), fidl::Error> {
1298        self.inner.send::<TriageDetectEventsOnCrashReportingProductRegistrationRequest>(
1299            (product_name, program_name),
1300            0,
1301            0x4646fa5654da3de9,
1302            fidl::encoding::DynamicFlags::FLEXIBLE,
1303        )
1304    }
1305}
1306
1307mod internal {
1308    use super::*;
1309
1310    impl fidl::encoding::ResourceTypeMarker for RealmFactoryCreateRealmRequest {
1311        type Borrowed<'a> = &'a mut Self;
1312        fn take_or_borrow<'a>(
1313            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1314        ) -> Self::Borrowed<'a> {
1315            value
1316        }
1317    }
1318
1319    unsafe impl fidl::encoding::TypeMarker for RealmFactoryCreateRealmRequest {
1320        type Owned = Self;
1321
1322        #[inline(always)]
1323        fn inline_align(_context: fidl::encoding::Context) -> usize {
1324            8
1325        }
1326
1327        #[inline(always)]
1328        fn inline_size(_context: fidl::encoding::Context) -> usize {
1329            24
1330        }
1331    }
1332
1333    unsafe impl
1334        fidl::encoding::Encode<
1335            RealmFactoryCreateRealmRequest,
1336            fidl::encoding::DefaultFuchsiaResourceDialect,
1337        > for &mut RealmFactoryCreateRealmRequest
1338    {
1339        #[inline]
1340        unsafe fn encode(
1341            self,
1342            encoder: &mut fidl::encoding::Encoder<
1343                '_,
1344                fidl::encoding::DefaultFuchsiaResourceDialect,
1345            >,
1346            offset: usize,
1347            _depth: fidl::encoding::Depth,
1348        ) -> fidl::Result<()> {
1349            encoder.debug_check_bounds::<RealmFactoryCreateRealmRequest>(offset);
1350            // Delegate to tuple encoding.
1351            fidl::encoding::Encode::<
1352                RealmFactoryCreateRealmRequest,
1353                fidl::encoding::DefaultFuchsiaResourceDialect,
1354            >::encode(
1355                (
1356                    <RealmOptions as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1357                        &mut self.options,
1358                    ),
1359                    <fidl::encoding::Endpoint<
1360                        fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1361                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1362                        &mut self.realm_server,
1363                    ),
1364                ),
1365                encoder,
1366                offset,
1367                _depth,
1368            )
1369        }
1370    }
1371    unsafe impl<
1372        T0: fidl::encoding::Encode<RealmOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
1373        T1: fidl::encoding::Encode<
1374                fidl::encoding::Endpoint<
1375                    fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1376                >,
1377                fidl::encoding::DefaultFuchsiaResourceDialect,
1378            >,
1379    >
1380        fidl::encoding::Encode<
1381            RealmFactoryCreateRealmRequest,
1382            fidl::encoding::DefaultFuchsiaResourceDialect,
1383        > for (T0, T1)
1384    {
1385        #[inline]
1386        unsafe fn encode(
1387            self,
1388            encoder: &mut fidl::encoding::Encoder<
1389                '_,
1390                fidl::encoding::DefaultFuchsiaResourceDialect,
1391            >,
1392            offset: usize,
1393            depth: fidl::encoding::Depth,
1394        ) -> fidl::Result<()> {
1395            encoder.debug_check_bounds::<RealmFactoryCreateRealmRequest>(offset);
1396            // Zero out padding regions. There's no need to apply masks
1397            // because the unmasked parts will be overwritten by fields.
1398            unsafe {
1399                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1400                (ptr as *mut u64).write_unaligned(0);
1401            }
1402            // Write the fields.
1403            self.0.encode(encoder, offset + 0, depth)?;
1404            self.1.encode(encoder, offset + 16, depth)?;
1405            Ok(())
1406        }
1407    }
1408
1409    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1410        for RealmFactoryCreateRealmRequest
1411    {
1412        #[inline(always)]
1413        fn new_empty() -> Self {
1414            Self {
1415                options: fidl::new_empty!(
1416                    RealmOptions,
1417                    fidl::encoding::DefaultFuchsiaResourceDialect
1418                ),
1419                realm_server: fidl::new_empty!(
1420                    fidl::encoding::Endpoint<
1421                        fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1422                    >,
1423                    fidl::encoding::DefaultFuchsiaResourceDialect
1424                ),
1425            }
1426        }
1427
1428        #[inline]
1429        unsafe fn decode(
1430            &mut self,
1431            decoder: &mut fidl::encoding::Decoder<
1432                '_,
1433                fidl::encoding::DefaultFuchsiaResourceDialect,
1434            >,
1435            offset: usize,
1436            _depth: fidl::encoding::Depth,
1437        ) -> fidl::Result<()> {
1438            decoder.debug_check_bounds::<Self>(offset);
1439            // Verify that padding bytes are zero.
1440            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1441            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1442            let mask = 0xffffffff00000000u64;
1443            let maskedval = padval & mask;
1444            if maskedval != 0 {
1445                return Err(fidl::Error::NonZeroPadding {
1446                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1447                });
1448            }
1449            fidl::decode!(
1450                RealmOptions,
1451                fidl::encoding::DefaultFuchsiaResourceDialect,
1452                &mut self.options,
1453                decoder,
1454                offset + 0,
1455                _depth
1456            )?;
1457            fidl::decode!(
1458                fidl::encoding::Endpoint<
1459                    fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1460                >,
1461                fidl::encoding::DefaultFuchsiaResourceDialect,
1462                &mut self.realm_server,
1463                decoder,
1464                offset + 16,
1465                _depth
1466            )?;
1467            Ok(())
1468        }
1469    }
1470
1471    impl fidl::encoding::ResourceTypeMarker for RealmFactoryGetTriageDetectEventsResponse {
1472        type Borrowed<'a> = &'a mut Self;
1473        fn take_or_borrow<'a>(
1474            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1475        ) -> Self::Borrowed<'a> {
1476            value
1477        }
1478    }
1479
1480    unsafe impl fidl::encoding::TypeMarker for RealmFactoryGetTriageDetectEventsResponse {
1481        type Owned = Self;
1482
1483        #[inline(always)]
1484        fn inline_align(_context: fidl::encoding::Context) -> usize {
1485            4
1486        }
1487
1488        #[inline(always)]
1489        fn inline_size(_context: fidl::encoding::Context) -> usize {
1490            4
1491        }
1492    }
1493
1494    unsafe impl
1495        fidl::encoding::Encode<
1496            RealmFactoryGetTriageDetectEventsResponse,
1497            fidl::encoding::DefaultFuchsiaResourceDialect,
1498        > for &mut RealmFactoryGetTriageDetectEventsResponse
1499    {
1500        #[inline]
1501        unsafe fn encode(
1502            self,
1503            encoder: &mut fidl::encoding::Encoder<
1504                '_,
1505                fidl::encoding::DefaultFuchsiaResourceDialect,
1506            >,
1507            offset: usize,
1508            _depth: fidl::encoding::Depth,
1509        ) -> fidl::Result<()> {
1510            encoder.debug_check_bounds::<RealmFactoryGetTriageDetectEventsResponse>(offset);
1511            // Delegate to tuple encoding.
1512            fidl::encoding::Encode::<RealmFactoryGetTriageDetectEventsResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1513                (
1514                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TriageDetectEventsMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.client_end),
1515                ),
1516                encoder, offset, _depth
1517            )
1518        }
1519    }
1520    unsafe impl<
1521        T0: fidl::encoding::Encode<
1522                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TriageDetectEventsMarker>>,
1523                fidl::encoding::DefaultFuchsiaResourceDialect,
1524            >,
1525    >
1526        fidl::encoding::Encode<
1527            RealmFactoryGetTriageDetectEventsResponse,
1528            fidl::encoding::DefaultFuchsiaResourceDialect,
1529        > for (T0,)
1530    {
1531        #[inline]
1532        unsafe fn encode(
1533            self,
1534            encoder: &mut fidl::encoding::Encoder<
1535                '_,
1536                fidl::encoding::DefaultFuchsiaResourceDialect,
1537            >,
1538            offset: usize,
1539            depth: fidl::encoding::Depth,
1540        ) -> fidl::Result<()> {
1541            encoder.debug_check_bounds::<RealmFactoryGetTriageDetectEventsResponse>(offset);
1542            // Zero out padding regions. There's no need to apply masks
1543            // because the unmasked parts will be overwritten by fields.
1544            // Write the fields.
1545            self.0.encode(encoder, offset + 0, depth)?;
1546            Ok(())
1547        }
1548    }
1549
1550    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1551        for RealmFactoryGetTriageDetectEventsResponse
1552    {
1553        #[inline(always)]
1554        fn new_empty() -> Self {
1555            Self {
1556                client_end: fidl::new_empty!(
1557                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TriageDetectEventsMarker>>,
1558                    fidl::encoding::DefaultFuchsiaResourceDialect
1559                ),
1560            }
1561        }
1562
1563        #[inline]
1564        unsafe fn decode(
1565            &mut self,
1566            decoder: &mut fidl::encoding::Decoder<
1567                '_,
1568                fidl::encoding::DefaultFuchsiaResourceDialect,
1569            >,
1570            offset: usize,
1571            _depth: fidl::encoding::Depth,
1572        ) -> fidl::Result<()> {
1573            decoder.debug_check_bounds::<Self>(offset);
1574            // Verify that padding bytes are zero.
1575            fidl::decode!(
1576                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TriageDetectEventsMarker>>,
1577                fidl::encoding::DefaultFuchsiaResourceDialect,
1578                &mut self.client_end,
1579                decoder,
1580                offset + 0,
1581                _depth
1582            )?;
1583            Ok(())
1584        }
1585    }
1586
1587    impl RealmOptions {
1588        #[inline(always)]
1589        fn max_ordinal_present(&self) -> u64 {
1590            if let Some(_) = self.inspect_data {
1591                return 3;
1592            }
1593            if let Some(_) = self.triage_configs {
1594                return 2;
1595            }
1596            if let Some(_) = self.program_config {
1597                return 1;
1598            }
1599            0
1600        }
1601    }
1602
1603    impl fidl::encoding::ResourceTypeMarker for RealmOptions {
1604        type Borrowed<'a> = &'a mut Self;
1605        fn take_or_borrow<'a>(
1606            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1607        ) -> Self::Borrowed<'a> {
1608            value
1609        }
1610    }
1611
1612    unsafe impl fidl::encoding::TypeMarker for RealmOptions {
1613        type Owned = Self;
1614
1615        #[inline(always)]
1616        fn inline_align(_context: fidl::encoding::Context) -> usize {
1617            8
1618        }
1619
1620        #[inline(always)]
1621        fn inline_size(_context: fidl::encoding::Context) -> usize {
1622            16
1623        }
1624    }
1625
1626    unsafe impl fidl::encoding::Encode<RealmOptions, fidl::encoding::DefaultFuchsiaResourceDialect>
1627        for &mut RealmOptions
1628    {
1629        unsafe fn encode(
1630            self,
1631            encoder: &mut fidl::encoding::Encoder<
1632                '_,
1633                fidl::encoding::DefaultFuchsiaResourceDialect,
1634            >,
1635            offset: usize,
1636            mut depth: fidl::encoding::Depth,
1637        ) -> fidl::Result<()> {
1638            encoder.debug_check_bounds::<RealmOptions>(offset);
1639            // Vector header
1640            let max_ordinal: u64 = self.max_ordinal_present();
1641            encoder.write_num(max_ordinal, offset);
1642            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1643            // Calling encoder.out_of_line_offset(0) is not allowed.
1644            if max_ordinal == 0 {
1645                return Ok(());
1646            }
1647            depth.increment()?;
1648            let envelope_size = 8;
1649            let bytes_len = max_ordinal as usize * envelope_size;
1650            #[allow(unused_variables)]
1651            let offset = encoder.out_of_line_offset(bytes_len);
1652            let mut _prev_end_offset: usize = 0;
1653            if 1 > max_ordinal {
1654                return Ok(());
1655            }
1656
1657            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1658            // are envelope_size bytes.
1659            let cur_offset: usize = (1 - 1) * envelope_size;
1660
1661            // Zero reserved fields.
1662            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1663
1664            // Safety:
1665            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1666            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1667            //   envelope_size bytes, there is always sufficient room.
1668            fidl::encoding::encode_in_envelope_optional::<
1669                fidl::encoding::HandleType<
1670                    fidl::Vmo,
1671                    { fidl::ObjectType::VMO.into_raw() },
1672                    2147483648,
1673                >,
1674                fidl::encoding::DefaultFuchsiaResourceDialect,
1675            >(
1676                self.program_config.as_mut().map(
1677                    <fidl::encoding::HandleType<
1678                        fidl::Vmo,
1679                        { fidl::ObjectType::VMO.into_raw() },
1680                        2147483648,
1681                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1682                ),
1683                encoder,
1684                offset + cur_offset,
1685                depth,
1686            )?;
1687
1688            _prev_end_offset = cur_offset + envelope_size;
1689            if 2 > max_ordinal {
1690                return Ok(());
1691            }
1692
1693            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1694            // are envelope_size bytes.
1695            let cur_offset: usize = (2 - 1) * envelope_size;
1696
1697            // Zero reserved fields.
1698            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1699
1700            // Safety:
1701            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1702            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1703            //   envelope_size bytes, there is always sufficient room.
1704            fidl::encoding::encode_in_envelope_optional::<
1705                fidl::encoding::Vector<
1706                    fidl::encoding::HandleType<
1707                        fidl::Vmo,
1708                        { fidl::ObjectType::VMO.into_raw() },
1709                        2147483648,
1710                    >,
1711                    64,
1712                >,
1713                fidl::encoding::DefaultFuchsiaResourceDialect,
1714            >(
1715                self.triage_configs.as_mut().map(
1716                    <fidl::encoding::Vector<
1717                        fidl::encoding::HandleType<
1718                            fidl::Vmo,
1719                            { fidl::ObjectType::VMO.into_raw() },
1720                            2147483648,
1721                        >,
1722                        64,
1723                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1724                ),
1725                encoder,
1726                offset + cur_offset,
1727                depth,
1728            )?;
1729
1730            _prev_end_offset = cur_offset + envelope_size;
1731            if 3 > max_ordinal {
1732                return Ok(());
1733            }
1734
1735            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1736            // are envelope_size bytes.
1737            let cur_offset: usize = (3 - 1) * envelope_size;
1738
1739            // Zero reserved fields.
1740            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1741
1742            // Safety:
1743            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1744            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1745            //   envelope_size bytes, there is always sufficient room.
1746            fidl::encoding::encode_in_envelope_optional::<
1747                fidl::encoding::Vector<
1748                    fidl::encoding::HandleType<
1749                        fidl::Vmo,
1750                        { fidl::ObjectType::VMO.into_raw() },
1751                        2147483648,
1752                    >,
1753                    64,
1754                >,
1755                fidl::encoding::DefaultFuchsiaResourceDialect,
1756            >(
1757                self.inspect_data.as_mut().map(
1758                    <fidl::encoding::Vector<
1759                        fidl::encoding::HandleType<
1760                            fidl::Vmo,
1761                            { fidl::ObjectType::VMO.into_raw() },
1762                            2147483648,
1763                        >,
1764                        64,
1765                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1766                ),
1767                encoder,
1768                offset + cur_offset,
1769                depth,
1770            )?;
1771
1772            _prev_end_offset = cur_offset + envelope_size;
1773
1774            Ok(())
1775        }
1776    }
1777
1778    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for RealmOptions {
1779        #[inline(always)]
1780        fn new_empty() -> Self {
1781            Self::default()
1782        }
1783
1784        unsafe fn decode(
1785            &mut self,
1786            decoder: &mut fidl::encoding::Decoder<
1787                '_,
1788                fidl::encoding::DefaultFuchsiaResourceDialect,
1789            >,
1790            offset: usize,
1791            mut depth: fidl::encoding::Depth,
1792        ) -> fidl::Result<()> {
1793            decoder.debug_check_bounds::<Self>(offset);
1794            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1795                None => return Err(fidl::Error::NotNullable),
1796                Some(len) => len,
1797            };
1798            // Calling decoder.out_of_line_offset(0) is not allowed.
1799            if len == 0 {
1800                return Ok(());
1801            };
1802            depth.increment()?;
1803            let envelope_size = 8;
1804            let bytes_len = len * envelope_size;
1805            let offset = decoder.out_of_line_offset(bytes_len)?;
1806            // Decode the envelope for each type.
1807            let mut _next_ordinal_to_read = 0;
1808            let mut next_offset = offset;
1809            let end_offset = offset + bytes_len;
1810            _next_ordinal_to_read += 1;
1811            if next_offset >= end_offset {
1812                return Ok(());
1813            }
1814
1815            // Decode unknown envelopes for gaps in ordinals.
1816            while _next_ordinal_to_read < 1 {
1817                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1818                _next_ordinal_to_read += 1;
1819                next_offset += envelope_size;
1820            }
1821
1822            let next_out_of_line = decoder.next_out_of_line();
1823            let handles_before = decoder.remaining_handles();
1824            if let Some((inlined, num_bytes, num_handles)) =
1825                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1826            {
1827                let member_inline_size = <fidl::encoding::HandleType<
1828                    fidl::Vmo,
1829                    { fidl::ObjectType::VMO.into_raw() },
1830                    2147483648,
1831                > as fidl::encoding::TypeMarker>::inline_size(
1832                    decoder.context
1833                );
1834                if inlined != (member_inline_size <= 4) {
1835                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1836                }
1837                let inner_offset;
1838                let mut inner_depth = depth.clone();
1839                if inlined {
1840                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1841                    inner_offset = next_offset;
1842                } else {
1843                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1844                    inner_depth.increment()?;
1845                }
1846                let val_ref =
1847                self.program_config.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1848                fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1849                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1850                {
1851                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1852                }
1853                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1854                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1855                }
1856            }
1857
1858            next_offset += envelope_size;
1859            _next_ordinal_to_read += 1;
1860            if next_offset >= end_offset {
1861                return Ok(());
1862            }
1863
1864            // Decode unknown envelopes for gaps in ordinals.
1865            while _next_ordinal_to_read < 2 {
1866                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1867                _next_ordinal_to_read += 1;
1868                next_offset += envelope_size;
1869            }
1870
1871            let next_out_of_line = decoder.next_out_of_line();
1872            let handles_before = decoder.remaining_handles();
1873            if let Some((inlined, num_bytes, num_handles)) =
1874                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1875            {
1876                let member_inline_size = <fidl::encoding::Vector<
1877                    fidl::encoding::HandleType<
1878                        fidl::Vmo,
1879                        { fidl::ObjectType::VMO.into_raw() },
1880                        2147483648,
1881                    >,
1882                    64,
1883                > as fidl::encoding::TypeMarker>::inline_size(
1884                    decoder.context
1885                );
1886                if inlined != (member_inline_size <= 4) {
1887                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1888                }
1889                let inner_offset;
1890                let mut inner_depth = depth.clone();
1891                if inlined {
1892                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1893                    inner_offset = next_offset;
1894                } else {
1895                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1896                    inner_depth.increment()?;
1897                }
1898                let val_ref = self.triage_configs.get_or_insert_with(|| {
1899                    fidl::new_empty!(
1900                        fidl::encoding::Vector<
1901                            fidl::encoding::HandleType<
1902                                fidl::Vmo,
1903                                { fidl::ObjectType::VMO.into_raw() },
1904                                2147483648,
1905                            >,
1906                            64,
1907                        >,
1908                        fidl::encoding::DefaultFuchsiaResourceDialect
1909                    )
1910                });
1911                fidl::decode!(
1912                    fidl::encoding::Vector<
1913                        fidl::encoding::HandleType<
1914                            fidl::Vmo,
1915                            { fidl::ObjectType::VMO.into_raw() },
1916                            2147483648,
1917                        >,
1918                        64,
1919                    >,
1920                    fidl::encoding::DefaultFuchsiaResourceDialect,
1921                    val_ref,
1922                    decoder,
1923                    inner_offset,
1924                    inner_depth
1925                )?;
1926                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1927                {
1928                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1929                }
1930                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1931                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1932                }
1933            }
1934
1935            next_offset += envelope_size;
1936            _next_ordinal_to_read += 1;
1937            if next_offset >= end_offset {
1938                return Ok(());
1939            }
1940
1941            // Decode unknown envelopes for gaps in ordinals.
1942            while _next_ordinal_to_read < 3 {
1943                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1944                _next_ordinal_to_read += 1;
1945                next_offset += envelope_size;
1946            }
1947
1948            let next_out_of_line = decoder.next_out_of_line();
1949            let handles_before = decoder.remaining_handles();
1950            if let Some((inlined, num_bytes, num_handles)) =
1951                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1952            {
1953                let member_inline_size = <fidl::encoding::Vector<
1954                    fidl::encoding::HandleType<
1955                        fidl::Vmo,
1956                        { fidl::ObjectType::VMO.into_raw() },
1957                        2147483648,
1958                    >,
1959                    64,
1960                > as fidl::encoding::TypeMarker>::inline_size(
1961                    decoder.context
1962                );
1963                if inlined != (member_inline_size <= 4) {
1964                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1965                }
1966                let inner_offset;
1967                let mut inner_depth = depth.clone();
1968                if inlined {
1969                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1970                    inner_offset = next_offset;
1971                } else {
1972                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1973                    inner_depth.increment()?;
1974                }
1975                let val_ref = self.inspect_data.get_or_insert_with(|| {
1976                    fidl::new_empty!(
1977                        fidl::encoding::Vector<
1978                            fidl::encoding::HandleType<
1979                                fidl::Vmo,
1980                                { fidl::ObjectType::VMO.into_raw() },
1981                                2147483648,
1982                            >,
1983                            64,
1984                        >,
1985                        fidl::encoding::DefaultFuchsiaResourceDialect
1986                    )
1987                });
1988                fidl::decode!(
1989                    fidl::encoding::Vector<
1990                        fidl::encoding::HandleType<
1991                            fidl::Vmo,
1992                            { fidl::ObjectType::VMO.into_raw() },
1993                            2147483648,
1994                        >,
1995                        64,
1996                    >,
1997                    fidl::encoding::DefaultFuchsiaResourceDialect,
1998                    val_ref,
1999                    decoder,
2000                    inner_offset,
2001                    inner_depth
2002                )?;
2003                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2004                {
2005                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2006                }
2007                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2008                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2009                }
2010            }
2011
2012            next_offset += envelope_size;
2013
2014            // Decode the remaining unknown envelopes.
2015            while next_offset < end_offset {
2016                _next_ordinal_to_read += 1;
2017                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2018                next_offset += envelope_size;
2019            }
2020
2021            Ok(())
2022        }
2023    }
2024}