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