Skip to main content

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