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 {
988            Some(())
989        } else {
990            None
991        }
992    }
993    #[allow(irrefutable_let_patterns)]
994    pub fn into_on_bail(self) -> Option<()> {
995        if let TriageDetectEventsEvent::OnBail {} = self {
996            Some(())
997        } else {
998            None
999        }
1000    }
1001    #[allow(irrefutable_let_patterns)]
1002    pub fn into_on_diagnostic_fetch(self) -> Option<()> {
1003        if let TriageDetectEventsEvent::OnDiagnosticFetch {} = self {
1004            Some(())
1005        } else {
1006            None
1007        }
1008    }
1009    #[allow(irrefutable_let_patterns)]
1010    pub fn into_on_crash_report(self) -> Option<(String, String)> {
1011        if let TriageDetectEventsEvent::OnCrashReport { crash_signature, crash_program_name } = self
1012        {
1013            Some((crash_signature, crash_program_name))
1014        } else {
1015            None
1016        }
1017    }
1018    #[allow(irrefutable_let_patterns)]
1019    pub fn into_on_crash_reporting_product_registration(self) -> Option<(String, String)> {
1020        if let TriageDetectEventsEvent::OnCrashReportingProductRegistration {
1021            product_name,
1022            program_name,
1023        } = self
1024        {
1025            Some((product_name, program_name))
1026        } else {
1027            None
1028        }
1029    }
1030
1031    /// Decodes a message buffer as a [`TriageDetectEventsEvent`].
1032    fn decode(
1033        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1034    ) -> Result<TriageDetectEventsEvent, fidl::Error> {
1035        let (bytes, _handles) = buf.split_mut();
1036        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1037        debug_assert_eq!(tx_header.tx_id, 0);
1038        match tx_header.ordinal {
1039            0x66b129b2110cfda9 => {
1040                let mut out = fidl::new_empty!(
1041                    fidl::encoding::EmptyPayload,
1042                    fidl::encoding::DefaultFuchsiaResourceDialect
1043                );
1044                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
1045                Ok((TriageDetectEventsEvent::OnDone {}))
1046            }
1047            0x353ae45fe8b3ba1f => {
1048                let mut out = fidl::new_empty!(
1049                    fidl::encoding::EmptyPayload,
1050                    fidl::encoding::DefaultFuchsiaResourceDialect
1051                );
1052                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
1053                Ok((TriageDetectEventsEvent::OnBail {}))
1054            }
1055            0x4143229dae6d22cd => {
1056                let mut out = fidl::new_empty!(
1057                    fidl::encoding::EmptyPayload,
1058                    fidl::encoding::DefaultFuchsiaResourceDialect
1059                );
1060                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
1061                Ok((TriageDetectEventsEvent::OnDiagnosticFetch {}))
1062            }
1063            0x5906712c264a59a0 => {
1064                let mut out = fidl::new_empty!(
1065                    TriageDetectEventsOnCrashReportRequest,
1066                    fidl::encoding::DefaultFuchsiaResourceDialect
1067                );
1068                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TriageDetectEventsOnCrashReportRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1069                Ok((TriageDetectEventsEvent::OnCrashReport {
1070                    crash_signature: out.crash_signature,
1071                    crash_program_name: out.crash_program_name,
1072                }))
1073            }
1074            0x4646fa5654da3de9 => {
1075                let mut out = fidl::new_empty!(
1076                    TriageDetectEventsOnCrashReportingProductRegistrationRequest,
1077                    fidl::encoding::DefaultFuchsiaResourceDialect
1078                );
1079                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TriageDetectEventsOnCrashReportingProductRegistrationRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1080                Ok((TriageDetectEventsEvent::OnCrashReportingProductRegistration {
1081                    product_name: out.product_name,
1082                    program_name: out.program_name,
1083                }))
1084            }
1085            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1086                Ok(TriageDetectEventsEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1087            }
1088            _ => Err(fidl::Error::UnknownOrdinal {
1089                ordinal: tx_header.ordinal,
1090                protocol_name:
1091                    <TriageDetectEventsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1092            }),
1093        }
1094    }
1095}
1096
1097/// A Stream of incoming requests for test.detect.factory/TriageDetectEvents.
1098pub struct TriageDetectEventsRequestStream {
1099    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1100    is_terminated: bool,
1101}
1102
1103impl std::marker::Unpin for TriageDetectEventsRequestStream {}
1104
1105impl futures::stream::FusedStream for TriageDetectEventsRequestStream {
1106    fn is_terminated(&self) -> bool {
1107        self.is_terminated
1108    }
1109}
1110
1111impl fidl::endpoints::RequestStream for TriageDetectEventsRequestStream {
1112    type Protocol = TriageDetectEventsMarker;
1113    type ControlHandle = TriageDetectEventsControlHandle;
1114
1115    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1116        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1117    }
1118
1119    fn control_handle(&self) -> Self::ControlHandle {
1120        TriageDetectEventsControlHandle { inner: self.inner.clone() }
1121    }
1122
1123    fn into_inner(
1124        self,
1125    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1126    {
1127        (self.inner, self.is_terminated)
1128    }
1129
1130    fn from_inner(
1131        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1132        is_terminated: bool,
1133    ) -> Self {
1134        Self { inner, is_terminated }
1135    }
1136}
1137
1138impl futures::Stream for TriageDetectEventsRequestStream {
1139    type Item = Result<TriageDetectEventsRequest, fidl::Error>;
1140
1141    fn poll_next(
1142        mut self: std::pin::Pin<&mut Self>,
1143        cx: &mut std::task::Context<'_>,
1144    ) -> std::task::Poll<Option<Self::Item>> {
1145        let this = &mut *self;
1146        if this.inner.check_shutdown(cx) {
1147            this.is_terminated = true;
1148            return std::task::Poll::Ready(None);
1149        }
1150        if this.is_terminated {
1151            panic!("polled TriageDetectEventsRequestStream after completion");
1152        }
1153        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1154            |bytes, handles| {
1155                match this.inner.channel().read_etc(cx, bytes, handles) {
1156                    std::task::Poll::Ready(Ok(())) => {}
1157                    std::task::Poll::Pending => return std::task::Poll::Pending,
1158                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1159                        this.is_terminated = true;
1160                        return std::task::Poll::Ready(None);
1161                    }
1162                    std::task::Poll::Ready(Err(e)) => {
1163                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1164                            e.into(),
1165                        ))))
1166                    }
1167                }
1168
1169                // A message has been received from the channel
1170                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1171
1172                std::task::Poll::Ready(Some(match header.ordinal {
1173                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1174                    Ok(TriageDetectEventsRequest::_UnknownMethod {
1175                        ordinal: header.ordinal,
1176                        control_handle: TriageDetectEventsControlHandle { inner: this.inner.clone() },
1177                        method_type: fidl::MethodType::OneWay,
1178                    })
1179                }
1180                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1181                    this.inner.send_framework_err(
1182                        fidl::encoding::FrameworkErr::UnknownMethod,
1183                        header.tx_id,
1184                        header.ordinal,
1185                        header.dynamic_flags(),
1186                        (bytes, handles),
1187                    )?;
1188                    Ok(TriageDetectEventsRequest::_UnknownMethod {
1189                        ordinal: header.ordinal,
1190                        control_handle: TriageDetectEventsControlHandle { inner: this.inner.clone() },
1191                        method_type: fidl::MethodType::TwoWay,
1192                    })
1193                }
1194                _ => Err(fidl::Error::UnknownOrdinal {
1195                    ordinal: header.ordinal,
1196                    protocol_name: <TriageDetectEventsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1197                }),
1198            }))
1199            },
1200        )
1201    }
1202}
1203
1204/// Events sent from the test realm.
1205#[derive(Debug)]
1206pub enum TriageDetectEventsRequest {
1207    /// An interaction was received which does not match any known method.
1208    #[non_exhaustive]
1209    _UnknownMethod {
1210        /// Ordinal of the method that was called.
1211        ordinal: u64,
1212        control_handle: TriageDetectEventsControlHandle,
1213        method_type: fidl::MethodType,
1214    },
1215}
1216
1217impl TriageDetectEventsRequest {
1218    /// Name of the method defined in FIDL
1219    pub fn method_name(&self) -> &'static str {
1220        match *self {
1221            TriageDetectEventsRequest::_UnknownMethod {
1222                method_type: fidl::MethodType::OneWay,
1223                ..
1224            } => "unknown one-way method",
1225            TriageDetectEventsRequest::_UnknownMethod {
1226                method_type: fidl::MethodType::TwoWay,
1227                ..
1228            } => "unknown two-way method",
1229        }
1230    }
1231}
1232
1233#[derive(Debug, Clone)]
1234pub struct TriageDetectEventsControlHandle {
1235    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1236}
1237
1238impl fidl::endpoints::ControlHandle for TriageDetectEventsControlHandle {
1239    fn shutdown(&self) {
1240        self.inner.shutdown()
1241    }
1242    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1243        self.inner.shutdown_with_epitaph(status)
1244    }
1245
1246    fn is_closed(&self) -> bool {
1247        self.inner.channel().is_closed()
1248    }
1249    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1250        self.inner.channel().on_closed()
1251    }
1252
1253    #[cfg(target_os = "fuchsia")]
1254    fn signal_peer(
1255        &self,
1256        clear_mask: zx::Signals,
1257        set_mask: zx::Signals,
1258    ) -> Result<(), zx_status::Status> {
1259        use fidl::Peered;
1260        self.inner.channel().signal_peer(clear_mask, set_mask)
1261    }
1262}
1263
1264impl TriageDetectEventsControlHandle {
1265    pub fn send_on_done(&self) -> Result<(), fidl::Error> {
1266        self.inner.send::<fidl::encoding::EmptyPayload>(
1267            (),
1268            0,
1269            0x66b129b2110cfda9,
1270            fidl::encoding::DynamicFlags::FLEXIBLE,
1271        )
1272    }
1273
1274    pub fn send_on_bail(&self) -> Result<(), fidl::Error> {
1275        self.inner.send::<fidl::encoding::EmptyPayload>(
1276            (),
1277            0,
1278            0x353ae45fe8b3ba1f,
1279            fidl::encoding::DynamicFlags::FLEXIBLE,
1280        )
1281    }
1282
1283    pub fn send_on_diagnostic_fetch(&self) -> Result<(), fidl::Error> {
1284        self.inner.send::<fidl::encoding::EmptyPayload>(
1285            (),
1286            0,
1287            0x4143229dae6d22cd,
1288            fidl::encoding::DynamicFlags::FLEXIBLE,
1289        )
1290    }
1291
1292    pub fn send_on_crash_report(
1293        &self,
1294        mut crash_signature: &str,
1295        mut crash_program_name: &str,
1296    ) -> Result<(), fidl::Error> {
1297        self.inner.send::<TriageDetectEventsOnCrashReportRequest>(
1298            (crash_signature, crash_program_name),
1299            0,
1300            0x5906712c264a59a0,
1301            fidl::encoding::DynamicFlags::FLEXIBLE,
1302        )
1303    }
1304
1305    pub fn send_on_crash_reporting_product_registration(
1306        &self,
1307        mut product_name: &str,
1308        mut program_name: &str,
1309    ) -> Result<(), fidl::Error> {
1310        self.inner.send::<TriageDetectEventsOnCrashReportingProductRegistrationRequest>(
1311            (product_name, program_name),
1312            0,
1313            0x4646fa5654da3de9,
1314            fidl::encoding::DynamicFlags::FLEXIBLE,
1315        )
1316    }
1317}
1318
1319mod internal {
1320    use super::*;
1321
1322    impl fidl::encoding::ResourceTypeMarker for RealmFactoryCreateRealmRequest {
1323        type Borrowed<'a> = &'a mut Self;
1324        fn take_or_borrow<'a>(
1325            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1326        ) -> Self::Borrowed<'a> {
1327            value
1328        }
1329    }
1330
1331    unsafe impl fidl::encoding::TypeMarker for RealmFactoryCreateRealmRequest {
1332        type Owned = Self;
1333
1334        #[inline(always)]
1335        fn inline_align(_context: fidl::encoding::Context) -> usize {
1336            8
1337        }
1338
1339        #[inline(always)]
1340        fn inline_size(_context: fidl::encoding::Context) -> usize {
1341            24
1342        }
1343    }
1344
1345    unsafe impl
1346        fidl::encoding::Encode<
1347            RealmFactoryCreateRealmRequest,
1348            fidl::encoding::DefaultFuchsiaResourceDialect,
1349        > for &mut RealmFactoryCreateRealmRequest
1350    {
1351        #[inline]
1352        unsafe fn encode(
1353            self,
1354            encoder: &mut fidl::encoding::Encoder<
1355                '_,
1356                fidl::encoding::DefaultFuchsiaResourceDialect,
1357            >,
1358            offset: usize,
1359            _depth: fidl::encoding::Depth,
1360        ) -> fidl::Result<()> {
1361            encoder.debug_check_bounds::<RealmFactoryCreateRealmRequest>(offset);
1362            // Delegate to tuple encoding.
1363            fidl::encoding::Encode::<
1364                RealmFactoryCreateRealmRequest,
1365                fidl::encoding::DefaultFuchsiaResourceDialect,
1366            >::encode(
1367                (
1368                    <RealmOptions as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1369                        &mut self.options,
1370                    ),
1371                    <fidl::encoding::Endpoint<
1372                        fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1373                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1374                        &mut self.realm_server,
1375                    ),
1376                ),
1377                encoder,
1378                offset,
1379                _depth,
1380            )
1381        }
1382    }
1383    unsafe impl<
1384            T0: fidl::encoding::Encode<RealmOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
1385            T1: fidl::encoding::Encode<
1386                fidl::encoding::Endpoint<
1387                    fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1388                >,
1389                fidl::encoding::DefaultFuchsiaResourceDialect,
1390            >,
1391        >
1392        fidl::encoding::Encode<
1393            RealmFactoryCreateRealmRequest,
1394            fidl::encoding::DefaultFuchsiaResourceDialect,
1395        > for (T0, T1)
1396    {
1397        #[inline]
1398        unsafe fn encode(
1399            self,
1400            encoder: &mut fidl::encoding::Encoder<
1401                '_,
1402                fidl::encoding::DefaultFuchsiaResourceDialect,
1403            >,
1404            offset: usize,
1405            depth: fidl::encoding::Depth,
1406        ) -> fidl::Result<()> {
1407            encoder.debug_check_bounds::<RealmFactoryCreateRealmRequest>(offset);
1408            // Zero out padding regions. There's no need to apply masks
1409            // because the unmasked parts will be overwritten by fields.
1410            unsafe {
1411                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1412                (ptr as *mut u64).write_unaligned(0);
1413            }
1414            // Write the fields.
1415            self.0.encode(encoder, offset + 0, depth)?;
1416            self.1.encode(encoder, offset + 16, depth)?;
1417            Ok(())
1418        }
1419    }
1420
1421    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1422        for RealmFactoryCreateRealmRequest
1423    {
1424        #[inline(always)]
1425        fn new_empty() -> Self {
1426            Self {
1427                options: fidl::new_empty!(
1428                    RealmOptions,
1429                    fidl::encoding::DefaultFuchsiaResourceDialect
1430                ),
1431                realm_server: fidl::new_empty!(
1432                    fidl::encoding::Endpoint<
1433                        fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1434                    >,
1435                    fidl::encoding::DefaultFuchsiaResourceDialect
1436                ),
1437            }
1438        }
1439
1440        #[inline]
1441        unsafe fn decode(
1442            &mut self,
1443            decoder: &mut fidl::encoding::Decoder<
1444                '_,
1445                fidl::encoding::DefaultFuchsiaResourceDialect,
1446            >,
1447            offset: usize,
1448            _depth: fidl::encoding::Depth,
1449        ) -> fidl::Result<()> {
1450            decoder.debug_check_bounds::<Self>(offset);
1451            // Verify that padding bytes are zero.
1452            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1453            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1454            let mask = 0xffffffff00000000u64;
1455            let maskedval = padval & mask;
1456            if maskedval != 0 {
1457                return Err(fidl::Error::NonZeroPadding {
1458                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1459                });
1460            }
1461            fidl::decode!(
1462                RealmOptions,
1463                fidl::encoding::DefaultFuchsiaResourceDialect,
1464                &mut self.options,
1465                decoder,
1466                offset + 0,
1467                _depth
1468            )?;
1469            fidl::decode!(
1470                fidl::encoding::Endpoint<
1471                    fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1472                >,
1473                fidl::encoding::DefaultFuchsiaResourceDialect,
1474                &mut self.realm_server,
1475                decoder,
1476                offset + 16,
1477                _depth
1478            )?;
1479            Ok(())
1480        }
1481    }
1482
1483    impl fidl::encoding::ResourceTypeMarker for RealmFactoryGetTriageDetectEventsResponse {
1484        type Borrowed<'a> = &'a mut Self;
1485        fn take_or_borrow<'a>(
1486            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1487        ) -> Self::Borrowed<'a> {
1488            value
1489        }
1490    }
1491
1492    unsafe impl fidl::encoding::TypeMarker for RealmFactoryGetTriageDetectEventsResponse {
1493        type Owned = Self;
1494
1495        #[inline(always)]
1496        fn inline_align(_context: fidl::encoding::Context) -> usize {
1497            4
1498        }
1499
1500        #[inline(always)]
1501        fn inline_size(_context: fidl::encoding::Context) -> usize {
1502            4
1503        }
1504    }
1505
1506    unsafe impl
1507        fidl::encoding::Encode<
1508            RealmFactoryGetTriageDetectEventsResponse,
1509            fidl::encoding::DefaultFuchsiaResourceDialect,
1510        > for &mut RealmFactoryGetTriageDetectEventsResponse
1511    {
1512        #[inline]
1513        unsafe fn encode(
1514            self,
1515            encoder: &mut fidl::encoding::Encoder<
1516                '_,
1517                fidl::encoding::DefaultFuchsiaResourceDialect,
1518            >,
1519            offset: usize,
1520            _depth: fidl::encoding::Depth,
1521        ) -> fidl::Result<()> {
1522            encoder.debug_check_bounds::<RealmFactoryGetTriageDetectEventsResponse>(offset);
1523            // Delegate to tuple encoding.
1524            fidl::encoding::Encode::<RealmFactoryGetTriageDetectEventsResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1525                (
1526                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TriageDetectEventsMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.client_end),
1527                ),
1528                encoder, offset, _depth
1529            )
1530        }
1531    }
1532    unsafe impl<
1533            T0: fidl::encoding::Encode<
1534                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TriageDetectEventsMarker>>,
1535                fidl::encoding::DefaultFuchsiaResourceDialect,
1536            >,
1537        >
1538        fidl::encoding::Encode<
1539            RealmFactoryGetTriageDetectEventsResponse,
1540            fidl::encoding::DefaultFuchsiaResourceDialect,
1541        > for (T0,)
1542    {
1543        #[inline]
1544        unsafe fn encode(
1545            self,
1546            encoder: &mut fidl::encoding::Encoder<
1547                '_,
1548                fidl::encoding::DefaultFuchsiaResourceDialect,
1549            >,
1550            offset: usize,
1551            depth: fidl::encoding::Depth,
1552        ) -> fidl::Result<()> {
1553            encoder.debug_check_bounds::<RealmFactoryGetTriageDetectEventsResponse>(offset);
1554            // Zero out padding regions. There's no need to apply masks
1555            // because the unmasked parts will be overwritten by fields.
1556            // Write the fields.
1557            self.0.encode(encoder, offset + 0, depth)?;
1558            Ok(())
1559        }
1560    }
1561
1562    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1563        for RealmFactoryGetTriageDetectEventsResponse
1564    {
1565        #[inline(always)]
1566        fn new_empty() -> Self {
1567            Self {
1568                client_end: fidl::new_empty!(
1569                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TriageDetectEventsMarker>>,
1570                    fidl::encoding::DefaultFuchsiaResourceDialect
1571                ),
1572            }
1573        }
1574
1575        #[inline]
1576        unsafe fn decode(
1577            &mut self,
1578            decoder: &mut fidl::encoding::Decoder<
1579                '_,
1580                fidl::encoding::DefaultFuchsiaResourceDialect,
1581            >,
1582            offset: usize,
1583            _depth: fidl::encoding::Depth,
1584        ) -> fidl::Result<()> {
1585            decoder.debug_check_bounds::<Self>(offset);
1586            // Verify that padding bytes are zero.
1587            fidl::decode!(
1588                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TriageDetectEventsMarker>>,
1589                fidl::encoding::DefaultFuchsiaResourceDialect,
1590                &mut self.client_end,
1591                decoder,
1592                offset + 0,
1593                _depth
1594            )?;
1595            Ok(())
1596        }
1597    }
1598
1599    impl RealmOptions {
1600        #[inline(always)]
1601        fn max_ordinal_present(&self) -> u64 {
1602            if let Some(_) = self.inspect_data {
1603                return 3;
1604            }
1605            if let Some(_) = self.triage_configs {
1606                return 2;
1607            }
1608            if let Some(_) = self.program_config {
1609                return 1;
1610            }
1611            0
1612        }
1613    }
1614
1615    impl fidl::encoding::ResourceTypeMarker for RealmOptions {
1616        type Borrowed<'a> = &'a mut Self;
1617        fn take_or_borrow<'a>(
1618            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1619        ) -> Self::Borrowed<'a> {
1620            value
1621        }
1622    }
1623
1624    unsafe impl fidl::encoding::TypeMarker for RealmOptions {
1625        type Owned = Self;
1626
1627        #[inline(always)]
1628        fn inline_align(_context: fidl::encoding::Context) -> usize {
1629            8
1630        }
1631
1632        #[inline(always)]
1633        fn inline_size(_context: fidl::encoding::Context) -> usize {
1634            16
1635        }
1636    }
1637
1638    unsafe impl fidl::encoding::Encode<RealmOptions, fidl::encoding::DefaultFuchsiaResourceDialect>
1639        for &mut RealmOptions
1640    {
1641        unsafe fn encode(
1642            self,
1643            encoder: &mut fidl::encoding::Encoder<
1644                '_,
1645                fidl::encoding::DefaultFuchsiaResourceDialect,
1646            >,
1647            offset: usize,
1648            mut depth: fidl::encoding::Depth,
1649        ) -> fidl::Result<()> {
1650            encoder.debug_check_bounds::<RealmOptions>(offset);
1651            // Vector header
1652            let max_ordinal: u64 = self.max_ordinal_present();
1653            encoder.write_num(max_ordinal, offset);
1654            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1655            // Calling encoder.out_of_line_offset(0) is not allowed.
1656            if max_ordinal == 0 {
1657                return Ok(());
1658            }
1659            depth.increment()?;
1660            let envelope_size = 8;
1661            let bytes_len = max_ordinal as usize * envelope_size;
1662            #[allow(unused_variables)]
1663            let offset = encoder.out_of_line_offset(bytes_len);
1664            let mut _prev_end_offset: usize = 0;
1665            if 1 > max_ordinal {
1666                return Ok(());
1667            }
1668
1669            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1670            // are envelope_size bytes.
1671            let cur_offset: usize = (1 - 1) * envelope_size;
1672
1673            // Zero reserved fields.
1674            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1675
1676            // Safety:
1677            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1678            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1679            //   envelope_size bytes, there is always sufficient room.
1680            fidl::encoding::encode_in_envelope_optional::<
1681                fidl::encoding::HandleType<
1682                    fidl::Vmo,
1683                    { fidl::ObjectType::VMO.into_raw() },
1684                    2147483648,
1685                >,
1686                fidl::encoding::DefaultFuchsiaResourceDialect,
1687            >(
1688                self.program_config.as_mut().map(
1689                    <fidl::encoding::HandleType<
1690                        fidl::Vmo,
1691                        { fidl::ObjectType::VMO.into_raw() },
1692                        2147483648,
1693                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1694                ),
1695                encoder,
1696                offset + cur_offset,
1697                depth,
1698            )?;
1699
1700            _prev_end_offset = cur_offset + envelope_size;
1701            if 2 > max_ordinal {
1702                return Ok(());
1703            }
1704
1705            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1706            // are envelope_size bytes.
1707            let cur_offset: usize = (2 - 1) * envelope_size;
1708
1709            // Zero reserved fields.
1710            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1711
1712            // Safety:
1713            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1714            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1715            //   envelope_size bytes, there is always sufficient room.
1716            fidl::encoding::encode_in_envelope_optional::<
1717                fidl::encoding::Vector<
1718                    fidl::encoding::HandleType<
1719                        fidl::Vmo,
1720                        { fidl::ObjectType::VMO.into_raw() },
1721                        2147483648,
1722                    >,
1723                    64,
1724                >,
1725                fidl::encoding::DefaultFuchsiaResourceDialect,
1726            >(
1727                self.triage_configs.as_mut().map(
1728                    <fidl::encoding::Vector<
1729                        fidl::encoding::HandleType<
1730                            fidl::Vmo,
1731                            { fidl::ObjectType::VMO.into_raw() },
1732                            2147483648,
1733                        >,
1734                        64,
1735                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1736                ),
1737                encoder,
1738                offset + cur_offset,
1739                depth,
1740            )?;
1741
1742            _prev_end_offset = cur_offset + envelope_size;
1743            if 3 > max_ordinal {
1744                return Ok(());
1745            }
1746
1747            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1748            // are envelope_size bytes.
1749            let cur_offset: usize = (3 - 1) * envelope_size;
1750
1751            // Zero reserved fields.
1752            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1753
1754            // Safety:
1755            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1756            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1757            //   envelope_size bytes, there is always sufficient room.
1758            fidl::encoding::encode_in_envelope_optional::<
1759                fidl::encoding::Vector<
1760                    fidl::encoding::HandleType<
1761                        fidl::Vmo,
1762                        { fidl::ObjectType::VMO.into_raw() },
1763                        2147483648,
1764                    >,
1765                    64,
1766                >,
1767                fidl::encoding::DefaultFuchsiaResourceDialect,
1768            >(
1769                self.inspect_data.as_mut().map(
1770                    <fidl::encoding::Vector<
1771                        fidl::encoding::HandleType<
1772                            fidl::Vmo,
1773                            { fidl::ObjectType::VMO.into_raw() },
1774                            2147483648,
1775                        >,
1776                        64,
1777                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1778                ),
1779                encoder,
1780                offset + cur_offset,
1781                depth,
1782            )?;
1783
1784            _prev_end_offset = cur_offset + envelope_size;
1785
1786            Ok(())
1787        }
1788    }
1789
1790    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for RealmOptions {
1791        #[inline(always)]
1792        fn new_empty() -> Self {
1793            Self::default()
1794        }
1795
1796        unsafe fn decode(
1797            &mut self,
1798            decoder: &mut fidl::encoding::Decoder<
1799                '_,
1800                fidl::encoding::DefaultFuchsiaResourceDialect,
1801            >,
1802            offset: usize,
1803            mut depth: fidl::encoding::Depth,
1804        ) -> fidl::Result<()> {
1805            decoder.debug_check_bounds::<Self>(offset);
1806            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1807                None => return Err(fidl::Error::NotNullable),
1808                Some(len) => len,
1809            };
1810            // Calling decoder.out_of_line_offset(0) is not allowed.
1811            if len == 0 {
1812                return Ok(());
1813            };
1814            depth.increment()?;
1815            let envelope_size = 8;
1816            let bytes_len = len * envelope_size;
1817            let offset = decoder.out_of_line_offset(bytes_len)?;
1818            // Decode the envelope for each type.
1819            let mut _next_ordinal_to_read = 0;
1820            let mut next_offset = offset;
1821            let end_offset = offset + bytes_len;
1822            _next_ordinal_to_read += 1;
1823            if next_offset >= end_offset {
1824                return Ok(());
1825            }
1826
1827            // Decode unknown envelopes for gaps in ordinals.
1828            while _next_ordinal_to_read < 1 {
1829                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1830                _next_ordinal_to_read += 1;
1831                next_offset += envelope_size;
1832            }
1833
1834            let next_out_of_line = decoder.next_out_of_line();
1835            let handles_before = decoder.remaining_handles();
1836            if let Some((inlined, num_bytes, num_handles)) =
1837                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1838            {
1839                let member_inline_size = <fidl::encoding::HandleType<
1840                    fidl::Vmo,
1841                    { fidl::ObjectType::VMO.into_raw() },
1842                    2147483648,
1843                > as fidl::encoding::TypeMarker>::inline_size(
1844                    decoder.context
1845                );
1846                if inlined != (member_inline_size <= 4) {
1847                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1848                }
1849                let inner_offset;
1850                let mut inner_depth = depth.clone();
1851                if inlined {
1852                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1853                    inner_offset = next_offset;
1854                } else {
1855                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1856                    inner_depth.increment()?;
1857                }
1858                let val_ref =
1859                self.program_config.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1860                fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1861                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1862                {
1863                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1864                }
1865                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1866                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1867                }
1868            }
1869
1870            next_offset += envelope_size;
1871            _next_ordinal_to_read += 1;
1872            if next_offset >= end_offset {
1873                return Ok(());
1874            }
1875
1876            // Decode unknown envelopes for gaps in ordinals.
1877            while _next_ordinal_to_read < 2 {
1878                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1879                _next_ordinal_to_read += 1;
1880                next_offset += envelope_size;
1881            }
1882
1883            let next_out_of_line = decoder.next_out_of_line();
1884            let handles_before = decoder.remaining_handles();
1885            if let Some((inlined, num_bytes, num_handles)) =
1886                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1887            {
1888                let member_inline_size = <fidl::encoding::Vector<
1889                    fidl::encoding::HandleType<
1890                        fidl::Vmo,
1891                        { fidl::ObjectType::VMO.into_raw() },
1892                        2147483648,
1893                    >,
1894                    64,
1895                > as fidl::encoding::TypeMarker>::inline_size(
1896                    decoder.context
1897                );
1898                if inlined != (member_inline_size <= 4) {
1899                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1900                }
1901                let inner_offset;
1902                let mut inner_depth = depth.clone();
1903                if inlined {
1904                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1905                    inner_offset = next_offset;
1906                } else {
1907                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1908                    inner_depth.increment()?;
1909                }
1910                let val_ref = self.triage_configs.get_or_insert_with(|| {
1911                    fidl::new_empty!(
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                    )
1922                });
1923                fidl::decode!(
1924                    fidl::encoding::Vector<
1925                        fidl::encoding::HandleType<
1926                            fidl::Vmo,
1927                            { fidl::ObjectType::VMO.into_raw() },
1928                            2147483648,
1929                        >,
1930                        64,
1931                    >,
1932                    fidl::encoding::DefaultFuchsiaResourceDialect,
1933                    val_ref,
1934                    decoder,
1935                    inner_offset,
1936                    inner_depth
1937                )?;
1938                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1939                {
1940                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1941                }
1942                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1943                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1944                }
1945            }
1946
1947            next_offset += envelope_size;
1948            _next_ordinal_to_read += 1;
1949            if next_offset >= end_offset {
1950                return Ok(());
1951            }
1952
1953            // Decode unknown envelopes for gaps in ordinals.
1954            while _next_ordinal_to_read < 3 {
1955                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1956                _next_ordinal_to_read += 1;
1957                next_offset += envelope_size;
1958            }
1959
1960            let next_out_of_line = decoder.next_out_of_line();
1961            let handles_before = decoder.remaining_handles();
1962            if let Some((inlined, num_bytes, num_handles)) =
1963                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1964            {
1965                let member_inline_size = <fidl::encoding::Vector<
1966                    fidl::encoding::HandleType<
1967                        fidl::Vmo,
1968                        { fidl::ObjectType::VMO.into_raw() },
1969                        2147483648,
1970                    >,
1971                    64,
1972                > as fidl::encoding::TypeMarker>::inline_size(
1973                    decoder.context
1974                );
1975                if inlined != (member_inline_size <= 4) {
1976                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1977                }
1978                let inner_offset;
1979                let mut inner_depth = depth.clone();
1980                if inlined {
1981                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1982                    inner_offset = next_offset;
1983                } else {
1984                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1985                    inner_depth.increment()?;
1986                }
1987                let val_ref = self.inspect_data.get_or_insert_with(|| {
1988                    fidl::new_empty!(
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                    )
1999                });
2000                fidl::decode!(
2001                    fidl::encoding::Vector<
2002                        fidl::encoding::HandleType<
2003                            fidl::Vmo,
2004                            { fidl::ObjectType::VMO.into_raw() },
2005                            2147483648,
2006                        >,
2007                        64,
2008                    >,
2009                    fidl::encoding::DefaultFuchsiaResourceDialect,
2010                    val_ref,
2011                    decoder,
2012                    inner_offset,
2013                    inner_depth
2014                )?;
2015                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2016                {
2017                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2018                }
2019                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2020                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2021                }
2022            }
2023
2024            next_offset += envelope_size;
2025
2026            // Decode the remaining unknown envelopes.
2027            while next_offset < end_offset {
2028                _next_ordinal_to_read += 1;
2029                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2030                next_offset += envelope_size;
2031            }
2032
2033            Ok(())
2034        }
2035    }
2036}