Skip to main content

fdomain_fuchsia_diagnostics/
fdomain_fuchsia_diagnostics.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 fdomain_client::fidl::{ControlHandle as _, FDomainFlexibleIntoResult as _, Responder as _};
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9pub use fidl_fuchsia_diagnostics_common::*;
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13#[derive(Debug, PartialEq)]
14pub struct ArchiveAccessorStreamDiagnosticsRequest {
15    pub stream_parameters: StreamParameters,
16    pub result_stream: fdomain_client::fidl::ServerEnd<BatchIteratorMarker>,
17}
18
19impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
20    for ArchiveAccessorStreamDiagnosticsRequest
21{
22}
23
24#[derive(Debug, PartialEq)]
25pub struct ArchiveAccessorStreamDiagnosticsToSocketRequest {
26    pub stream_parameters: StreamParameters,
27    pub stream: fdomain_client::Socket,
28}
29
30impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
31    for ArchiveAccessorStreamDiagnosticsToSocketRequest
32{
33}
34
35#[derive(Debug, PartialEq)]
36pub struct BatchIteratorGetNextResponse {
37    pub batch: Vec<FormattedContent>,
38}
39
40impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
41    for BatchIteratorGetNextResponse
42{
43}
44
45#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
46pub struct SampleCommitRequest {
47    /// Where results are sent.
48    pub sink: fdomain_client::fidl::ClientEnd<SampleSinkMarker>,
49}
50
51impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for SampleCommitRequest {}
52
53#[derive(Debug, PartialEq)]
54pub struct SampleSetRequest {
55    /// The data configuration for this sample server.
56    pub sample_parameters: SampleParameters,
57}
58
59impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for SampleSetRequest {}
60
61#[derive(Debug, PartialEq)]
62pub struct SampleSinkOnSampleReadiedRequest {
63    pub event: SampleSinkResult,
64}
65
66impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
67    for SampleSinkOnSampleReadiedRequest
68{
69}
70
71/// `SampleReady` carries the data for a ready-to-consume sample.
72#[derive(Debug, Default, PartialEq)]
73pub struct SampleReady {
74    /// `batch_iter` is the `BatchIterator` over the set of data.
75    pub batch_iter: Option<fdomain_client::fidl::ClientEnd<BatchIteratorMarker>>,
76    /// `seconds_since_start` is `ticks * interval_secs` for the current
77    /// polling period.
78    ///
79    /// This can be used to check whether a value in the batch corresponds
80    /// to a `SampleDatum`, assuming you have not registered the same selector
81    /// with different `SampleStrategy` types. The procedure is:
82    ///
83    /// 1) Resolve `batch_iter` into a set of Inspect hierarchies.
84    /// 2) Filter the set of `SampleDatum`s committed to this server with
85    ///    the predicate `seconds_since_start % datum.interval_secs == 0`.
86    /// 3) Any selector from the filtered `SampleDatum`s that matches data
87    ///    in the resolved Inspect hierarchies is valid.
88    ///
89    /// If you DO have one selector registered twice with different strategies,
90    /// you must maintain a local cache and check the value yourself.
91    pub seconds_since_start: Option<i64>,
92    #[doc(hidden)]
93    pub __source_breaking: fidl::marker::SourceBreaking,
94}
95
96impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for SampleReady {}
97
98/// A fidl union containing a complete hierarchy of structured diagnostics
99/// data, such that the content can be parsed into a file by itself.
100#[derive(Debug)]
101pub enum FormattedContent {
102    /// A diagnostics schema encoded as json.
103    /// The VMO will contain up to 1mb of diagnostics data.
104    Json(fdomain_fuchsia_mem::Buffer),
105    /// A diagnostics schema encoded as cbor.
106    /// The VMO will contain up to 1mb of diagnostics data.
107    /// The size will be in ZX_PROP_VMO_CONTENT_SIZE.
108    Cbor(fdomain_client::Vmo),
109    /// A diagnostics schema encoded as FXT.
110    /// This is only valid for logs data.
111    /// The VMO will contain up to PerformanceConfiguration/max_aggregate_content_size_bytes
112    /// of diagnostics data, or 1mb if not specified.
113    /// The size will be in ZX_PROP_VMO_CONTENT_SIZE.
114    Fxt(fdomain_client::Vmo),
115    #[doc(hidden)]
116    __SourceBreaking { unknown_ordinal: u64 },
117}
118
119/// Pattern that matches an unknown `FormattedContent` member.
120#[macro_export]
121macro_rules! FormattedContentUnknown {
122    () => {
123        _
124    };
125}
126
127// Custom PartialEq so that unknown variants are not equal to themselves.
128impl PartialEq for FormattedContent {
129    fn eq(&self, other: &Self) -> bool {
130        match (self, other) {
131            (Self::Json(x), Self::Json(y)) => *x == *y,
132            (Self::Cbor(x), Self::Cbor(y)) => *x == *y,
133            (Self::Fxt(x), Self::Fxt(y)) => *x == *y,
134            _ => false,
135        }
136    }
137}
138
139impl FormattedContent {
140    #[inline]
141    pub fn ordinal(&self) -> u64 {
142        match *self {
143            Self::Json(_) => 1,
144            Self::Cbor(_) => 3,
145            Self::Fxt(_) => 4,
146            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
147        }
148    }
149
150    #[inline]
151    pub fn unknown_variant_for_testing() -> Self {
152        Self::__SourceBreaking { unknown_ordinal: 0 }
153    }
154
155    #[inline]
156    pub fn is_unknown(&self) -> bool {
157        match self {
158            Self::__SourceBreaking { .. } => true,
159            _ => false,
160        }
161    }
162}
163
164impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for FormattedContent {}
165
166#[derive(Debug)]
167pub enum SampleSinkResult {
168    /// `SampleReady` provides a `BatchIterator` for the client containing all
169    /// ready samples.
170    ///
171    /// This will include all `SampleStrategy::ALWAYS` samples and all
172    /// `SampleStrategy::ON_DIFF` for which there was a changed value.
173    Ready(SampleReady),
174    /// `error` provides an interface for receiving runtime errors from the
175    /// sample server.
176    Error(RuntimeError),
177    #[doc(hidden)]
178    __SourceBreaking { unknown_ordinal: u64 },
179}
180
181/// Pattern that matches an unknown `SampleSinkResult` member.
182#[macro_export]
183macro_rules! SampleSinkResultUnknown {
184    () => {
185        _
186    };
187}
188
189// Custom PartialEq so that unknown variants are not equal to themselves.
190impl PartialEq for SampleSinkResult {
191    fn eq(&self, other: &Self) -> bool {
192        match (self, other) {
193            (Self::Ready(x), Self::Ready(y)) => *x == *y,
194            (Self::Error(x), Self::Error(y)) => *x == *y,
195            _ => false,
196        }
197    }
198}
199
200impl SampleSinkResult {
201    #[inline]
202    pub fn ordinal(&self) -> u64 {
203        match *self {
204            Self::Ready(_) => 1,
205            Self::Error(_) => 2,
206            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
207        }
208    }
209
210    #[inline]
211    pub fn unknown_variant_for_testing() -> Self {
212        Self::__SourceBreaking { unknown_ordinal: 0 }
213    }
214
215    #[inline]
216    pub fn is_unknown(&self) -> bool {
217        match self {
218            Self::__SourceBreaking { .. } => true,
219            _ => false,
220        }
221    }
222}
223
224impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for SampleSinkResult {}
225
226#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
227pub struct ArchiveAccessorMarker;
228
229impl fdomain_client::fidl::ProtocolMarker for ArchiveAccessorMarker {
230    type Proxy = ArchiveAccessorProxy;
231    type RequestStream = ArchiveAccessorRequestStream;
232
233    const DEBUG_NAME: &'static str = "fuchsia.diagnostics.ArchiveAccessor";
234}
235impl fdomain_client::fidl::DiscoverableProtocolMarker for ArchiveAccessorMarker {}
236
237pub trait ArchiveAccessorProxyInterface: Send + Sync {
238    fn r#stream_diagnostics(
239        &self,
240        stream_parameters: &StreamParameters,
241        result_stream: fdomain_client::fidl::ServerEnd<BatchIteratorMarker>,
242    ) -> Result<(), fidl::Error>;
243    type StreamDiagnosticsToSocketResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
244        + Send;
245    fn r#stream_diagnostics_to_socket(
246        &self,
247        stream_parameters: &StreamParameters,
248        stream: fdomain_client::Socket,
249    ) -> Self::StreamDiagnosticsToSocketResponseFut;
250    type WaitForReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
251    fn r#wait_for_ready(&self) -> Self::WaitForReadyResponseFut;
252}
253
254#[derive(Debug, Clone)]
255pub struct ArchiveAccessorProxy {
256    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
257}
258
259impl fdomain_client::fidl::Proxy for ArchiveAccessorProxy {
260    type Protocol = ArchiveAccessorMarker;
261
262    fn from_channel(inner: fdomain_client::Channel) -> Self {
263        Self::new(inner)
264    }
265
266    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
267        self.client.into_channel().map_err(|client| Self { client })
268    }
269
270    fn as_channel(&self) -> &fdomain_client::Channel {
271        self.client.as_channel()
272    }
273}
274
275impl ArchiveAccessorProxy {
276    /// Create a new Proxy for fuchsia.diagnostics/ArchiveAccessor.
277    pub fn new(channel: fdomain_client::Channel) -> Self {
278        let protocol_name =
279            <ArchiveAccessorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
280        Self { client: fidl::client::Client::new(channel, protocol_name) }
281    }
282
283    /// Get a Stream of events from the remote end of the protocol.
284    ///
285    /// # Panics
286    ///
287    /// Panics if the event stream was already taken.
288    pub fn take_event_stream(&self) -> ArchiveAccessorEventStream {
289        ArchiveAccessorEventStream { event_receiver: self.client.take_event_receiver() }
290    }
291
292    /// Creates an iterator over diagnostics data on the system.
293    ///   * The iterator may be finite by streaming in SNAPSHOT mode, serving only the
294    ///     current state of diagnostics data on the system.
295    ///   * The iterator may be infinite by streaming in either SNAPSHOT_THEN_SUBSCRIBE
296    ///     or SUBSCRIBE mode; the prior first provides iteration over the current state of
297    ///     the sytem, and then both provide ongoing iteration over newly arriving diagnostics
298    ///     data.
299    ///
300    /// + request `result stream` a [fuchsia.diagnostics/BatchIterator] that diagnostic
301    ///   records are exposed to the client over.
302    ///   * epitaphs:
303    ///      - INVALID_ARGS: A required argument in the StreamParameters struct was missing.
304    ///      - WRONG_TYPE: A selector provided by the StreamParameters struct was incorrectly
305    ///                    formatted.
306    ///
307    /// + request `stream_parameters` is a [fuchsia.diagnostics/StreamParameter] which
308    ///   specifies how to configure the stream.
309    pub fn r#stream_diagnostics(
310        &self,
311        mut stream_parameters: &StreamParameters,
312        mut result_stream: fdomain_client::fidl::ServerEnd<BatchIteratorMarker>,
313    ) -> Result<(), fidl::Error> {
314        ArchiveAccessorProxyInterface::r#stream_diagnostics(self, stream_parameters, result_stream)
315    }
316
317    /// Stream diagnostics data directly to a socket.
318    /// This is intended for host tools or components that prefer socket-based streaming.
319    pub fn r#stream_diagnostics_to_socket(
320        &self,
321        mut stream_parameters: &StreamParameters,
322        mut stream: fdomain_client::Socket,
323    ) -> fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect> {
324        ArchiveAccessorProxyInterface::r#stream_diagnostics_to_socket(
325            self,
326            stream_parameters,
327            stream,
328        )
329    }
330
331    /// Ensures that the connection with the server was established to prevent
332    /// races when using other pipelined methods of this protocol.
333    pub fn r#wait_for_ready(
334        &self,
335    ) -> fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect> {
336        ArchiveAccessorProxyInterface::r#wait_for_ready(self)
337    }
338}
339
340impl ArchiveAccessorProxyInterface for ArchiveAccessorProxy {
341    fn r#stream_diagnostics(
342        &self,
343        mut stream_parameters: &StreamParameters,
344        mut result_stream: fdomain_client::fidl::ServerEnd<BatchIteratorMarker>,
345    ) -> Result<(), fidl::Error> {
346        self.client.send::<ArchiveAccessorStreamDiagnosticsRequest>(
347            (stream_parameters, result_stream),
348            0x20c73e2ecd653c3e,
349            fidl::encoding::DynamicFlags::FLEXIBLE,
350        )
351    }
352
353    type StreamDiagnosticsToSocketResponseFut =
354        fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect>;
355    fn r#stream_diagnostics_to_socket(
356        &self,
357        mut stream_parameters: &StreamParameters,
358        mut stream: fdomain_client::Socket,
359    ) -> Self::StreamDiagnosticsToSocketResponseFut {
360        fn _decode(
361            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
362        ) -> Result<(), fidl::Error> {
363            let _response = fidl::client::decode_transaction_body::<
364                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
365                fdomain_client::fidl::FDomainResourceDialect,
366                0x2498dd7cea299478,
367            >(_buf?)?
368            .into_result_fdomain::<ArchiveAccessorMarker>("stream_diagnostics_to_socket")?;
369            Ok(_response)
370        }
371        self.client.send_query_and_decode::<ArchiveAccessorStreamDiagnosticsToSocketRequest, ()>(
372            (stream_parameters, stream),
373            0x2498dd7cea299478,
374            fidl::encoding::DynamicFlags::FLEXIBLE,
375            _decode,
376        )
377    }
378
379    type WaitForReadyResponseFut =
380        fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect>;
381    fn r#wait_for_ready(&self) -> Self::WaitForReadyResponseFut {
382        fn _decode(
383            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
384        ) -> Result<(), fidl::Error> {
385            let _response = fidl::client::decode_transaction_body::<
386                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
387                fdomain_client::fidl::FDomainResourceDialect,
388                0x122963198011bd24,
389            >(_buf?)?
390            .into_result_fdomain::<ArchiveAccessorMarker>("wait_for_ready")?;
391            Ok(_response)
392        }
393        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
394            (),
395            0x122963198011bd24,
396            fidl::encoding::DynamicFlags::FLEXIBLE,
397            _decode,
398        )
399    }
400}
401
402pub struct ArchiveAccessorEventStream {
403    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
404}
405
406impl std::marker::Unpin for ArchiveAccessorEventStream {}
407
408impl futures::stream::FusedStream for ArchiveAccessorEventStream {
409    fn is_terminated(&self) -> bool {
410        self.event_receiver.is_terminated()
411    }
412}
413
414impl futures::Stream for ArchiveAccessorEventStream {
415    type Item = Result<ArchiveAccessorEvent, fidl::Error>;
416
417    fn poll_next(
418        mut self: std::pin::Pin<&mut Self>,
419        cx: &mut std::task::Context<'_>,
420    ) -> std::task::Poll<Option<Self::Item>> {
421        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
422            &mut self.event_receiver,
423            cx
424        )?) {
425            Some(buf) => std::task::Poll::Ready(Some(ArchiveAccessorEvent::decode(buf))),
426            None => std::task::Poll::Ready(None),
427        }
428    }
429}
430
431#[derive(Debug)]
432pub enum ArchiveAccessorEvent {
433    #[non_exhaustive]
434    _UnknownEvent {
435        /// Ordinal of the event that was sent.
436        ordinal: u64,
437    },
438}
439
440impl ArchiveAccessorEvent {
441    /// Decodes a message buffer as a [`ArchiveAccessorEvent`].
442    fn decode(
443        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
444    ) -> Result<ArchiveAccessorEvent, fidl::Error> {
445        let (bytes, _handles) = buf.split_mut();
446        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
447        debug_assert_eq!(tx_header.tx_id, 0);
448        match tx_header.ordinal {
449            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
450                Ok(ArchiveAccessorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
451            }
452            _ => Err(fidl::Error::UnknownOrdinal {
453                ordinal: tx_header.ordinal,
454                protocol_name:
455                    <ArchiveAccessorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
456            }),
457        }
458    }
459}
460
461/// A Stream of incoming requests for fuchsia.diagnostics/ArchiveAccessor.
462pub struct ArchiveAccessorRequestStream {
463    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
464    is_terminated: bool,
465}
466
467impl std::marker::Unpin for ArchiveAccessorRequestStream {}
468
469impl futures::stream::FusedStream for ArchiveAccessorRequestStream {
470    fn is_terminated(&self) -> bool {
471        self.is_terminated
472    }
473}
474
475impl fdomain_client::fidl::RequestStream for ArchiveAccessorRequestStream {
476    type Protocol = ArchiveAccessorMarker;
477    type ControlHandle = ArchiveAccessorControlHandle;
478
479    fn from_channel(channel: fdomain_client::Channel) -> Self {
480        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
481    }
482
483    fn control_handle(&self) -> Self::ControlHandle {
484        ArchiveAccessorControlHandle { inner: self.inner.clone() }
485    }
486
487    fn into_inner(
488        self,
489    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
490    {
491        (self.inner, self.is_terminated)
492    }
493
494    fn from_inner(
495        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
496        is_terminated: bool,
497    ) -> Self {
498        Self { inner, is_terminated }
499    }
500}
501
502impl futures::Stream for ArchiveAccessorRequestStream {
503    type Item = Result<ArchiveAccessorRequest, fidl::Error>;
504
505    fn poll_next(
506        mut self: std::pin::Pin<&mut Self>,
507        cx: &mut std::task::Context<'_>,
508    ) -> std::task::Poll<Option<Self::Item>> {
509        let this = &mut *self;
510        if this.inner.check_shutdown(cx) {
511            this.is_terminated = true;
512            return std::task::Poll::Ready(None);
513        }
514        if this.is_terminated {
515            panic!("polled ArchiveAccessorRequestStream after completion");
516        }
517        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
518            |bytes, handles| {
519                match this.inner.channel().read_etc(cx, bytes, handles) {
520                    std::task::Poll::Ready(Ok(())) => {}
521                    std::task::Poll::Pending => return std::task::Poll::Pending,
522                    std::task::Poll::Ready(Err(None)) => {
523                        this.is_terminated = true;
524                        return std::task::Poll::Ready(None);
525                    }
526                    std::task::Poll::Ready(Err(Some(e))) => {
527                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
528                            e.into(),
529                        ))));
530                    }
531                }
532
533                // A message has been received from the channel
534                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
535
536                std::task::Poll::Ready(Some(match header.ordinal {
537                0x20c73e2ecd653c3e => {
538                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
539                    let mut req = fidl::new_empty!(ArchiveAccessorStreamDiagnosticsRequest, fdomain_client::fidl::FDomainResourceDialect);
540                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<ArchiveAccessorStreamDiagnosticsRequest>(&header, _body_bytes, handles, &mut req)?;
541                    let control_handle = ArchiveAccessorControlHandle {
542                        inner: this.inner.clone(),
543                    };
544                    Ok(ArchiveAccessorRequest::StreamDiagnostics {stream_parameters: req.stream_parameters,
545result_stream: req.result_stream,
546
547                        control_handle,
548                    })
549                }
550                0x2498dd7cea299478 => {
551                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
552                    let mut req = fidl::new_empty!(ArchiveAccessorStreamDiagnosticsToSocketRequest, fdomain_client::fidl::FDomainResourceDialect);
553                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<ArchiveAccessorStreamDiagnosticsToSocketRequest>(&header, _body_bytes, handles, &mut req)?;
554                    let control_handle = ArchiveAccessorControlHandle {
555                        inner: this.inner.clone(),
556                    };
557                    Ok(ArchiveAccessorRequest::StreamDiagnosticsToSocket {stream_parameters: req.stream_parameters,
558stream: req.stream,
559
560                        responder: ArchiveAccessorStreamDiagnosticsToSocketResponder {
561                            control_handle: std::mem::ManuallyDrop::new(control_handle),
562                            tx_id: header.tx_id,
563                        },
564                    })
565                }
566                0x122963198011bd24 => {
567                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
568                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
569                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
570                    let control_handle = ArchiveAccessorControlHandle {
571                        inner: this.inner.clone(),
572                    };
573                    Ok(ArchiveAccessorRequest::WaitForReady {
574                        responder: ArchiveAccessorWaitForReadyResponder {
575                            control_handle: std::mem::ManuallyDrop::new(control_handle),
576                            tx_id: header.tx_id,
577                        },
578                    })
579                }
580                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
581                    Ok(ArchiveAccessorRequest::_UnknownMethod {
582                        ordinal: header.ordinal,
583                        control_handle: ArchiveAccessorControlHandle { inner: this.inner.clone() },
584                        method_type: fidl::MethodType::OneWay,
585                    })
586                }
587                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
588                    this.inner.send_framework_err(
589                        fidl::encoding::FrameworkErr::UnknownMethod,
590                        header.tx_id,
591                        header.ordinal,
592                        header.dynamic_flags(),
593                        (bytes, handles),
594                    )?;
595                    Ok(ArchiveAccessorRequest::_UnknownMethod {
596                        ordinal: header.ordinal,
597                        control_handle: ArchiveAccessorControlHandle { inner: this.inner.clone() },
598                        method_type: fidl::MethodType::TwoWay,
599                    })
600                }
601                _ => Err(fidl::Error::UnknownOrdinal {
602                    ordinal: header.ordinal,
603                    protocol_name: <ArchiveAccessorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
604                }),
605            }))
606            },
607        )
608    }
609}
610
611/// Outer protocol for interacting with the different diagnostics data sources.
612#[derive(Debug)]
613pub enum ArchiveAccessorRequest {
614    /// Creates an iterator over diagnostics data on the system.
615    ///   * The iterator may be finite by streaming in SNAPSHOT mode, serving only the
616    ///     current state of diagnostics data on the system.
617    ///   * The iterator may be infinite by streaming in either SNAPSHOT_THEN_SUBSCRIBE
618    ///     or SUBSCRIBE mode; the prior first provides iteration over the current state of
619    ///     the sytem, and then both provide ongoing iteration over newly arriving diagnostics
620    ///     data.
621    ///
622    /// + request `result stream` a [fuchsia.diagnostics/BatchIterator] that diagnostic
623    ///   records are exposed to the client over.
624    ///   * epitaphs:
625    ///      - INVALID_ARGS: A required argument in the StreamParameters struct was missing.
626    ///      - WRONG_TYPE: A selector provided by the StreamParameters struct was incorrectly
627    ///                    formatted.
628    ///
629    /// + request `stream_parameters` is a [fuchsia.diagnostics/StreamParameter] which
630    ///   specifies how to configure the stream.
631    StreamDiagnostics {
632        stream_parameters: StreamParameters,
633        result_stream: fdomain_client::fidl::ServerEnd<BatchIteratorMarker>,
634        control_handle: ArchiveAccessorControlHandle,
635    },
636    /// Stream diagnostics data directly to a socket.
637    /// This is intended for host tools or components that prefer socket-based streaming.
638    StreamDiagnosticsToSocket {
639        stream_parameters: StreamParameters,
640        stream: fdomain_client::Socket,
641        responder: ArchiveAccessorStreamDiagnosticsToSocketResponder,
642    },
643    /// Ensures that the connection with the server was established to prevent
644    /// races when using other pipelined methods of this protocol.
645    WaitForReady { responder: ArchiveAccessorWaitForReadyResponder },
646    /// An interaction was received which does not match any known method.
647    #[non_exhaustive]
648    _UnknownMethod {
649        /// Ordinal of the method that was called.
650        ordinal: u64,
651        control_handle: ArchiveAccessorControlHandle,
652        method_type: fidl::MethodType,
653    },
654}
655
656impl ArchiveAccessorRequest {
657    #[allow(irrefutable_let_patterns)]
658    pub fn into_stream_diagnostics(
659        self,
660    ) -> Option<(
661        StreamParameters,
662        fdomain_client::fidl::ServerEnd<BatchIteratorMarker>,
663        ArchiveAccessorControlHandle,
664    )> {
665        if let ArchiveAccessorRequest::StreamDiagnostics {
666            stream_parameters,
667            result_stream,
668            control_handle,
669        } = self
670        {
671            Some((stream_parameters, result_stream, control_handle))
672        } else {
673            None
674        }
675    }
676
677    #[allow(irrefutable_let_patterns)]
678    pub fn into_stream_diagnostics_to_socket(
679        self,
680    ) -> Option<(
681        StreamParameters,
682        fdomain_client::Socket,
683        ArchiveAccessorStreamDiagnosticsToSocketResponder,
684    )> {
685        if let ArchiveAccessorRequest::StreamDiagnosticsToSocket {
686            stream_parameters,
687            stream,
688            responder,
689        } = self
690        {
691            Some((stream_parameters, stream, responder))
692        } else {
693            None
694        }
695    }
696
697    #[allow(irrefutable_let_patterns)]
698    pub fn into_wait_for_ready(self) -> Option<(ArchiveAccessorWaitForReadyResponder)> {
699        if let ArchiveAccessorRequest::WaitForReady { responder } = self {
700            Some((responder))
701        } else {
702            None
703        }
704    }
705
706    /// Name of the method defined in FIDL
707    pub fn method_name(&self) -> &'static str {
708        match *self {
709            ArchiveAccessorRequest::StreamDiagnostics { .. } => "stream_diagnostics",
710            ArchiveAccessorRequest::StreamDiagnosticsToSocket { .. } => {
711                "stream_diagnostics_to_socket"
712            }
713            ArchiveAccessorRequest::WaitForReady { .. } => "wait_for_ready",
714            ArchiveAccessorRequest::_UnknownMethod {
715                method_type: fidl::MethodType::OneWay,
716                ..
717            } => "unknown one-way method",
718            ArchiveAccessorRequest::_UnknownMethod {
719                method_type: fidl::MethodType::TwoWay,
720                ..
721            } => "unknown two-way method",
722        }
723    }
724}
725
726#[derive(Debug, Clone)]
727pub struct ArchiveAccessorControlHandle {
728    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
729}
730
731impl ArchiveAccessorControlHandle {
732    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
733        self.inner.shutdown_with_epitaph(status.into())
734    }
735}
736
737impl fdomain_client::fidl::ControlHandle for ArchiveAccessorControlHandle {
738    fn shutdown(&self) {
739        self.inner.shutdown()
740    }
741
742    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
743        self.inner.shutdown_with_epitaph(status)
744    }
745
746    fn is_closed(&self) -> bool {
747        self.inner.channel().is_closed()
748    }
749    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
750        self.inner.channel().on_closed()
751    }
752}
753
754impl ArchiveAccessorControlHandle {}
755
756#[must_use = "FIDL methods require a response to be sent"]
757#[derive(Debug)]
758pub struct ArchiveAccessorStreamDiagnosticsToSocketResponder {
759    control_handle: std::mem::ManuallyDrop<ArchiveAccessorControlHandle>,
760    tx_id: u32,
761}
762
763/// Set the the channel to be shutdown (see [`ArchiveAccessorControlHandle::shutdown`])
764/// if the responder is dropped without sending a response, so that the client
765/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
766impl std::ops::Drop for ArchiveAccessorStreamDiagnosticsToSocketResponder {
767    fn drop(&mut self) {
768        self.control_handle.shutdown();
769        // Safety: drops once, never accessed again
770        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
771    }
772}
773
774impl fdomain_client::fidl::Responder for ArchiveAccessorStreamDiagnosticsToSocketResponder {
775    type ControlHandle = ArchiveAccessorControlHandle;
776
777    fn control_handle(&self) -> &ArchiveAccessorControlHandle {
778        &self.control_handle
779    }
780
781    fn drop_without_shutdown(mut self) {
782        // Safety: drops once, never accessed again due to mem::forget
783        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
784        // Prevent Drop from running (which would shut down the channel)
785        std::mem::forget(self);
786    }
787}
788
789impl ArchiveAccessorStreamDiagnosticsToSocketResponder {
790    /// Sends a response to the FIDL transaction.
791    ///
792    /// Sets the channel to shutdown if an error occurs.
793    pub fn send(self) -> Result<(), fidl::Error> {
794        let _result = self.send_raw();
795        if _result.is_err() {
796            self.control_handle.shutdown();
797        }
798        self.drop_without_shutdown();
799        _result
800    }
801
802    /// Similar to "send" but does not shutdown the channel if an error occurs.
803    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
804        let _result = self.send_raw();
805        self.drop_without_shutdown();
806        _result
807    }
808
809    fn send_raw(&self) -> Result<(), fidl::Error> {
810        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
811            fidl::encoding::Flexible::new(()),
812            self.tx_id,
813            0x2498dd7cea299478,
814            fidl::encoding::DynamicFlags::FLEXIBLE,
815        )
816    }
817}
818
819#[must_use = "FIDL methods require a response to be sent"]
820#[derive(Debug)]
821pub struct ArchiveAccessorWaitForReadyResponder {
822    control_handle: std::mem::ManuallyDrop<ArchiveAccessorControlHandle>,
823    tx_id: u32,
824}
825
826/// Set the the channel to be shutdown (see [`ArchiveAccessorControlHandle::shutdown`])
827/// if the responder is dropped without sending a response, so that the client
828/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
829impl std::ops::Drop for ArchiveAccessorWaitForReadyResponder {
830    fn drop(&mut self) {
831        self.control_handle.shutdown();
832        // Safety: drops once, never accessed again
833        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
834    }
835}
836
837impl fdomain_client::fidl::Responder for ArchiveAccessorWaitForReadyResponder {
838    type ControlHandle = ArchiveAccessorControlHandle;
839
840    fn control_handle(&self) -> &ArchiveAccessorControlHandle {
841        &self.control_handle
842    }
843
844    fn drop_without_shutdown(mut self) {
845        // Safety: drops once, never accessed again due to mem::forget
846        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
847        // Prevent Drop from running (which would shut down the channel)
848        std::mem::forget(self);
849    }
850}
851
852impl ArchiveAccessorWaitForReadyResponder {
853    /// Sends a response to the FIDL transaction.
854    ///
855    /// Sets the channel to shutdown if an error occurs.
856    pub fn send(self) -> Result<(), fidl::Error> {
857        let _result = self.send_raw();
858        if _result.is_err() {
859            self.control_handle.shutdown();
860        }
861        self.drop_without_shutdown();
862        _result
863    }
864
865    /// Similar to "send" but does not shutdown the channel if an error occurs.
866    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
867        let _result = self.send_raw();
868        self.drop_without_shutdown();
869        _result
870    }
871
872    fn send_raw(&self) -> Result<(), fidl::Error> {
873        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
874            fidl::encoding::Flexible::new(()),
875            self.tx_id,
876            0x122963198011bd24,
877            fidl::encoding::DynamicFlags::FLEXIBLE,
878        )
879    }
880}
881
882#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
883pub struct BatchIteratorMarker;
884
885impl fdomain_client::fidl::ProtocolMarker for BatchIteratorMarker {
886    type Proxy = BatchIteratorProxy;
887    type RequestStream = BatchIteratorRequestStream;
888
889    const DEBUG_NAME: &'static str = "(anonymous) BatchIterator";
890}
891pub type BatchIteratorGetNextResult = Result<Vec<FormattedContent>, ReaderError>;
892
893pub trait BatchIteratorProxyInterface: Send + Sync {
894    type GetNextResponseFut: std::future::Future<Output = Result<BatchIteratorGetNextResult, fidl::Error>>
895        + Send;
896    fn r#get_next(&self) -> Self::GetNextResponseFut;
897    type WaitForReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
898    fn r#wait_for_ready(&self) -> Self::WaitForReadyResponseFut;
899}
900
901#[derive(Debug, Clone)]
902pub struct BatchIteratorProxy {
903    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
904}
905
906impl fdomain_client::fidl::Proxy for BatchIteratorProxy {
907    type Protocol = BatchIteratorMarker;
908
909    fn from_channel(inner: fdomain_client::Channel) -> Self {
910        Self::new(inner)
911    }
912
913    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
914        self.client.into_channel().map_err(|client| Self { client })
915    }
916
917    fn as_channel(&self) -> &fdomain_client::Channel {
918        self.client.as_channel()
919    }
920}
921
922impl BatchIteratorProxy {
923    /// Create a new Proxy for fuchsia.diagnostics/BatchIterator.
924    pub fn new(channel: fdomain_client::Channel) -> Self {
925        let protocol_name =
926            <BatchIteratorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
927        Self { client: fidl::client::Client::new(channel, protocol_name) }
928    }
929
930    /// Get a Stream of events from the remote end of the protocol.
931    ///
932    /// # Panics
933    ///
934    /// Panics if the event stream was already taken.
935    pub fn take_event_stream(&self) -> BatchIteratorEventStream {
936        BatchIteratorEventStream { event_receiver: self.client.take_event_receiver() }
937    }
938
939    /// Returns a vector of [fuchsia.diagnostics/FormattedContent] structs
940    /// with a format dictated by the format_settings argument provided to the Reader protocol
941    /// which spawned this BatchIterator.
942    ///
943    /// An empty vector implies that the data hierarchy has been fully iterated, and subsequent
944    /// GetNext calls will always return the empty vector.
945    ///
946    /// When the BatchIterator is serving results via subscription model, calls to GetNext will
947    /// hang until there is new data available, it will not return an empty vector.
948    ///
949    /// - returns a vector of FormattedContent structs. Clients connected to a
950    ///   Batch are expected to call GetNext() until an empty vector
951    ///   is returned, denoting that the entire data hierarchy has been read.
952    ///
953    /// * error a [fuchsia.diagnostics/ReaderError]
954    ///   value indicating that there was an issue reading the underlying data hierarchies
955    ///   or formatting those hierarchies to populate the `batch`. Note, these
956    ///   issues do not include a single component's data hierarchy failing to be read.
957    ///   The iterator is tolerant of individual component data sources failing to be read,
958    ///   whether that failure is a timeout or a malformed binary file.
959    ///   In the event that a GetNext call fails, that subset of the data hierarchy results is
960    ///   dropped, but future calls to GetNext will provide new subsets of
961    ///   FormattedDataHierarchies.
962    pub fn r#get_next(
963        &self,
964    ) -> fidl::client::QueryResponseFut<
965        BatchIteratorGetNextResult,
966        fdomain_client::fidl::FDomainResourceDialect,
967    > {
968        BatchIteratorProxyInterface::r#get_next(self)
969    }
970
971    /// Indicates that the BatchIterator has been connected. If the
972    /// BatchIterator hasn't been connected, this method will hang until it is.
973    pub fn r#wait_for_ready(
974        &self,
975    ) -> fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect> {
976        BatchIteratorProxyInterface::r#wait_for_ready(self)
977    }
978}
979
980impl BatchIteratorProxyInterface for BatchIteratorProxy {
981    type GetNextResponseFut = fidl::client::QueryResponseFut<
982        BatchIteratorGetNextResult,
983        fdomain_client::fidl::FDomainResourceDialect,
984    >;
985    fn r#get_next(&self) -> Self::GetNextResponseFut {
986        fn _decode(
987            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
988        ) -> Result<BatchIteratorGetNextResult, fidl::Error> {
989            let _response = fidl::client::decode_transaction_body::<
990                fidl::encoding::FlexibleResultType<BatchIteratorGetNextResponse, ReaderError>,
991                fdomain_client::fidl::FDomainResourceDialect,
992                0x781986486c6254a5,
993            >(_buf?)?
994            .into_result_fdomain::<BatchIteratorMarker>("get_next")?;
995            Ok(_response.map(|x| x.batch))
996        }
997        self.client
998            .send_query_and_decode::<fidl::encoding::EmptyPayload, BatchIteratorGetNextResult>(
999                (),
1000                0x781986486c6254a5,
1001                fidl::encoding::DynamicFlags::FLEXIBLE,
1002                _decode,
1003            )
1004    }
1005
1006    type WaitForReadyResponseFut =
1007        fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect>;
1008    fn r#wait_for_ready(&self) -> Self::WaitForReadyResponseFut {
1009        fn _decode(
1010            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1011        ) -> Result<(), fidl::Error> {
1012            let _response = fidl::client::decode_transaction_body::<
1013                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
1014                fdomain_client::fidl::FDomainResourceDialect,
1015                0x70598ee271597603,
1016            >(_buf?)?
1017            .into_result_fdomain::<BatchIteratorMarker>("wait_for_ready")?;
1018            Ok(_response)
1019        }
1020        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
1021            (),
1022            0x70598ee271597603,
1023            fidl::encoding::DynamicFlags::FLEXIBLE,
1024            _decode,
1025        )
1026    }
1027}
1028
1029pub struct BatchIteratorEventStream {
1030    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
1031}
1032
1033impl std::marker::Unpin for BatchIteratorEventStream {}
1034
1035impl futures::stream::FusedStream for BatchIteratorEventStream {
1036    fn is_terminated(&self) -> bool {
1037        self.event_receiver.is_terminated()
1038    }
1039}
1040
1041impl futures::Stream for BatchIteratorEventStream {
1042    type Item = Result<BatchIteratorEvent, fidl::Error>;
1043
1044    fn poll_next(
1045        mut self: std::pin::Pin<&mut Self>,
1046        cx: &mut std::task::Context<'_>,
1047    ) -> std::task::Poll<Option<Self::Item>> {
1048        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1049            &mut self.event_receiver,
1050            cx
1051        )?) {
1052            Some(buf) => std::task::Poll::Ready(Some(BatchIteratorEvent::decode(buf))),
1053            None => std::task::Poll::Ready(None),
1054        }
1055    }
1056}
1057
1058#[derive(Debug)]
1059pub enum BatchIteratorEvent {
1060    #[non_exhaustive]
1061    _UnknownEvent {
1062        /// Ordinal of the event that was sent.
1063        ordinal: u64,
1064    },
1065}
1066
1067impl BatchIteratorEvent {
1068    /// Decodes a message buffer as a [`BatchIteratorEvent`].
1069    fn decode(
1070        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1071    ) -> Result<BatchIteratorEvent, fidl::Error> {
1072        let (bytes, _handles) = buf.split_mut();
1073        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1074        debug_assert_eq!(tx_header.tx_id, 0);
1075        match tx_header.ordinal {
1076            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1077                Ok(BatchIteratorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1078            }
1079            _ => Err(fidl::Error::UnknownOrdinal {
1080                ordinal: tx_header.ordinal,
1081                protocol_name:
1082                    <BatchIteratorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1083            }),
1084        }
1085    }
1086}
1087
1088/// A Stream of incoming requests for fuchsia.diagnostics/BatchIterator.
1089pub struct BatchIteratorRequestStream {
1090    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1091    is_terminated: bool,
1092}
1093
1094impl std::marker::Unpin for BatchIteratorRequestStream {}
1095
1096impl futures::stream::FusedStream for BatchIteratorRequestStream {
1097    fn is_terminated(&self) -> bool {
1098        self.is_terminated
1099    }
1100}
1101
1102impl fdomain_client::fidl::RequestStream for BatchIteratorRequestStream {
1103    type Protocol = BatchIteratorMarker;
1104    type ControlHandle = BatchIteratorControlHandle;
1105
1106    fn from_channel(channel: fdomain_client::Channel) -> Self {
1107        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1108    }
1109
1110    fn control_handle(&self) -> Self::ControlHandle {
1111        BatchIteratorControlHandle { inner: self.inner.clone() }
1112    }
1113
1114    fn into_inner(
1115        self,
1116    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
1117    {
1118        (self.inner, self.is_terminated)
1119    }
1120
1121    fn from_inner(
1122        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1123        is_terminated: bool,
1124    ) -> Self {
1125        Self { inner, is_terminated }
1126    }
1127}
1128
1129impl futures::Stream for BatchIteratorRequestStream {
1130    type Item = Result<BatchIteratorRequest, fidl::Error>;
1131
1132    fn poll_next(
1133        mut self: std::pin::Pin<&mut Self>,
1134        cx: &mut std::task::Context<'_>,
1135    ) -> std::task::Poll<Option<Self::Item>> {
1136        let this = &mut *self;
1137        if this.inner.check_shutdown(cx) {
1138            this.is_terminated = true;
1139            return std::task::Poll::Ready(None);
1140        }
1141        if this.is_terminated {
1142            panic!("polled BatchIteratorRequestStream after completion");
1143        }
1144        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
1145            |bytes, handles| {
1146                match this.inner.channel().read_etc(cx, bytes, handles) {
1147                    std::task::Poll::Ready(Ok(())) => {}
1148                    std::task::Poll::Pending => return std::task::Poll::Pending,
1149                    std::task::Poll::Ready(Err(None)) => {
1150                        this.is_terminated = true;
1151                        return std::task::Poll::Ready(None);
1152                    }
1153                    std::task::Poll::Ready(Err(Some(e))) => {
1154                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1155                            e.into(),
1156                        ))));
1157                    }
1158                }
1159
1160                // A message has been received from the channel
1161                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1162
1163                std::task::Poll::Ready(Some(match header.ordinal {
1164                0x781986486c6254a5 => {
1165                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1166                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
1167                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1168                    let control_handle = BatchIteratorControlHandle {
1169                        inner: this.inner.clone(),
1170                    };
1171                    Ok(BatchIteratorRequest::GetNext {
1172                        responder: BatchIteratorGetNextResponder {
1173                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1174                            tx_id: header.tx_id,
1175                        },
1176                    })
1177                }
1178                0x70598ee271597603 => {
1179                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1180                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
1181                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1182                    let control_handle = BatchIteratorControlHandle {
1183                        inner: this.inner.clone(),
1184                    };
1185                    Ok(BatchIteratorRequest::WaitForReady {
1186                        responder: BatchIteratorWaitForReadyResponder {
1187                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1188                            tx_id: header.tx_id,
1189                        },
1190                    })
1191                }
1192                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1193                    Ok(BatchIteratorRequest::_UnknownMethod {
1194                        ordinal: header.ordinal,
1195                        control_handle: BatchIteratorControlHandle { inner: this.inner.clone() },
1196                        method_type: fidl::MethodType::OneWay,
1197                    })
1198                }
1199                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1200                    this.inner.send_framework_err(
1201                        fidl::encoding::FrameworkErr::UnknownMethod,
1202                        header.tx_id,
1203                        header.ordinal,
1204                        header.dynamic_flags(),
1205                        (bytes, handles),
1206                    )?;
1207                    Ok(BatchIteratorRequest::_UnknownMethod {
1208                        ordinal: header.ordinal,
1209                        control_handle: BatchIteratorControlHandle { inner: this.inner.clone() },
1210                        method_type: fidl::MethodType::TwoWay,
1211                    })
1212                }
1213                _ => Err(fidl::Error::UnknownOrdinal {
1214                    ordinal: header.ordinal,
1215                    protocol_name: <BatchIteratorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1216                }),
1217            }))
1218            },
1219        )
1220    }
1221}
1222
1223/// Conceptually, a directory iterator, where each element in the iterator is a single
1224/// complete file that can be concatenated with other results.
1225#[derive(Debug)]
1226pub enum BatchIteratorRequest {
1227    /// Returns a vector of [fuchsia.diagnostics/FormattedContent] structs
1228    /// with a format dictated by the format_settings argument provided to the Reader protocol
1229    /// which spawned this BatchIterator.
1230    ///
1231    /// An empty vector implies that the data hierarchy has been fully iterated, and subsequent
1232    /// GetNext calls will always return the empty vector.
1233    ///
1234    /// When the BatchIterator is serving results via subscription model, calls to GetNext will
1235    /// hang until there is new data available, it will not return an empty vector.
1236    ///
1237    /// - returns a vector of FormattedContent structs. Clients connected to a
1238    ///   Batch are expected to call GetNext() until an empty vector
1239    ///   is returned, denoting that the entire data hierarchy has been read.
1240    ///
1241    /// * error a [fuchsia.diagnostics/ReaderError]
1242    ///   value indicating that there was an issue reading the underlying data hierarchies
1243    ///   or formatting those hierarchies to populate the `batch`. Note, these
1244    ///   issues do not include a single component's data hierarchy failing to be read.
1245    ///   The iterator is tolerant of individual component data sources failing to be read,
1246    ///   whether that failure is a timeout or a malformed binary file.
1247    ///   In the event that a GetNext call fails, that subset of the data hierarchy results is
1248    ///   dropped, but future calls to GetNext will provide new subsets of
1249    ///   FormattedDataHierarchies.
1250    GetNext { responder: BatchIteratorGetNextResponder },
1251    /// Indicates that the BatchIterator has been connected. If the
1252    /// BatchIterator hasn't been connected, this method will hang until it is.
1253    WaitForReady { responder: BatchIteratorWaitForReadyResponder },
1254    /// An interaction was received which does not match any known method.
1255    #[non_exhaustive]
1256    _UnknownMethod {
1257        /// Ordinal of the method that was called.
1258        ordinal: u64,
1259        control_handle: BatchIteratorControlHandle,
1260        method_type: fidl::MethodType,
1261    },
1262}
1263
1264impl BatchIteratorRequest {
1265    #[allow(irrefutable_let_patterns)]
1266    pub fn into_get_next(self) -> Option<(BatchIteratorGetNextResponder)> {
1267        if let BatchIteratorRequest::GetNext { responder } = self {
1268            Some((responder))
1269        } else {
1270            None
1271        }
1272    }
1273
1274    #[allow(irrefutable_let_patterns)]
1275    pub fn into_wait_for_ready(self) -> Option<(BatchIteratorWaitForReadyResponder)> {
1276        if let BatchIteratorRequest::WaitForReady { responder } = self {
1277            Some((responder))
1278        } else {
1279            None
1280        }
1281    }
1282
1283    /// Name of the method defined in FIDL
1284    pub fn method_name(&self) -> &'static str {
1285        match *self {
1286            BatchIteratorRequest::GetNext { .. } => "get_next",
1287            BatchIteratorRequest::WaitForReady { .. } => "wait_for_ready",
1288            BatchIteratorRequest::_UnknownMethod {
1289                method_type: fidl::MethodType::OneWay, ..
1290            } => "unknown one-way method",
1291            BatchIteratorRequest::_UnknownMethod {
1292                method_type: fidl::MethodType::TwoWay, ..
1293            } => "unknown two-way method",
1294        }
1295    }
1296}
1297
1298#[derive(Debug, Clone)]
1299pub struct BatchIteratorControlHandle {
1300    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1301}
1302
1303impl BatchIteratorControlHandle {
1304    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1305        self.inner.shutdown_with_epitaph(status.into())
1306    }
1307}
1308
1309impl fdomain_client::fidl::ControlHandle for BatchIteratorControlHandle {
1310    fn shutdown(&self) {
1311        self.inner.shutdown()
1312    }
1313
1314    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1315        self.inner.shutdown_with_epitaph(status)
1316    }
1317
1318    fn is_closed(&self) -> bool {
1319        self.inner.channel().is_closed()
1320    }
1321    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
1322        self.inner.channel().on_closed()
1323    }
1324}
1325
1326impl BatchIteratorControlHandle {}
1327
1328#[must_use = "FIDL methods require a response to be sent"]
1329#[derive(Debug)]
1330pub struct BatchIteratorGetNextResponder {
1331    control_handle: std::mem::ManuallyDrop<BatchIteratorControlHandle>,
1332    tx_id: u32,
1333}
1334
1335/// Set the the channel to be shutdown (see [`BatchIteratorControlHandle::shutdown`])
1336/// if the responder is dropped without sending a response, so that the client
1337/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1338impl std::ops::Drop for BatchIteratorGetNextResponder {
1339    fn drop(&mut self) {
1340        self.control_handle.shutdown();
1341        // Safety: drops once, never accessed again
1342        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1343    }
1344}
1345
1346impl fdomain_client::fidl::Responder for BatchIteratorGetNextResponder {
1347    type ControlHandle = BatchIteratorControlHandle;
1348
1349    fn control_handle(&self) -> &BatchIteratorControlHandle {
1350        &self.control_handle
1351    }
1352
1353    fn drop_without_shutdown(mut self) {
1354        // Safety: drops once, never accessed again due to mem::forget
1355        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1356        // Prevent Drop from running (which would shut down the channel)
1357        std::mem::forget(self);
1358    }
1359}
1360
1361impl BatchIteratorGetNextResponder {
1362    /// Sends a response to the FIDL transaction.
1363    ///
1364    /// Sets the channel to shutdown if an error occurs.
1365    pub fn send(
1366        self,
1367        mut result: Result<Vec<FormattedContent>, ReaderError>,
1368    ) -> Result<(), fidl::Error> {
1369        let _result = self.send_raw(result);
1370        if _result.is_err() {
1371            self.control_handle.shutdown();
1372        }
1373        self.drop_without_shutdown();
1374        _result
1375    }
1376
1377    /// Similar to "send" but does not shutdown the channel if an error occurs.
1378    pub fn send_no_shutdown_on_err(
1379        self,
1380        mut result: Result<Vec<FormattedContent>, ReaderError>,
1381    ) -> Result<(), fidl::Error> {
1382        let _result = self.send_raw(result);
1383        self.drop_without_shutdown();
1384        _result
1385    }
1386
1387    fn send_raw(
1388        &self,
1389        mut result: Result<Vec<FormattedContent>, ReaderError>,
1390    ) -> Result<(), fidl::Error> {
1391        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1392            BatchIteratorGetNextResponse,
1393            ReaderError,
1394        >>(
1395            fidl::encoding::FlexibleResult::new(
1396                result.as_mut().map_err(|e| *e).map(|batch| (batch.as_mut_slice(),)),
1397            ),
1398            self.tx_id,
1399            0x781986486c6254a5,
1400            fidl::encoding::DynamicFlags::FLEXIBLE,
1401        )
1402    }
1403}
1404
1405#[must_use = "FIDL methods require a response to be sent"]
1406#[derive(Debug)]
1407pub struct BatchIteratorWaitForReadyResponder {
1408    control_handle: std::mem::ManuallyDrop<BatchIteratorControlHandle>,
1409    tx_id: u32,
1410}
1411
1412/// Set the the channel to be shutdown (see [`BatchIteratorControlHandle::shutdown`])
1413/// if the responder is dropped without sending a response, so that the client
1414/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1415impl std::ops::Drop for BatchIteratorWaitForReadyResponder {
1416    fn drop(&mut self) {
1417        self.control_handle.shutdown();
1418        // Safety: drops once, never accessed again
1419        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1420    }
1421}
1422
1423impl fdomain_client::fidl::Responder for BatchIteratorWaitForReadyResponder {
1424    type ControlHandle = BatchIteratorControlHandle;
1425
1426    fn control_handle(&self) -> &BatchIteratorControlHandle {
1427        &self.control_handle
1428    }
1429
1430    fn drop_without_shutdown(mut self) {
1431        // Safety: drops once, never accessed again due to mem::forget
1432        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1433        // Prevent Drop from running (which would shut down the channel)
1434        std::mem::forget(self);
1435    }
1436}
1437
1438impl BatchIteratorWaitForReadyResponder {
1439    /// Sends a response to the FIDL transaction.
1440    ///
1441    /// Sets the channel to shutdown if an error occurs.
1442    pub fn send(self) -> Result<(), fidl::Error> {
1443        let _result = self.send_raw();
1444        if _result.is_err() {
1445            self.control_handle.shutdown();
1446        }
1447        self.drop_without_shutdown();
1448        _result
1449    }
1450
1451    /// Similar to "send" but does not shutdown the channel if an error occurs.
1452    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1453        let _result = self.send_raw();
1454        self.drop_without_shutdown();
1455        _result
1456    }
1457
1458    fn send_raw(&self) -> Result<(), fidl::Error> {
1459        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
1460            fidl::encoding::Flexible::new(()),
1461            self.tx_id,
1462            0x70598ee271597603,
1463            fidl::encoding::DynamicFlags::FLEXIBLE,
1464        )
1465    }
1466}
1467
1468#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1469pub struct LogFlusherMarker;
1470
1471impl fdomain_client::fidl::ProtocolMarker for LogFlusherMarker {
1472    type Proxy = LogFlusherProxy;
1473    type RequestStream = LogFlusherRequestStream;
1474
1475    const DEBUG_NAME: &'static str = "fuchsia.diagnostics.LogFlusher";
1476}
1477impl fdomain_client::fidl::DiscoverableProtocolMarker for LogFlusherMarker {}
1478
1479pub trait LogFlusherProxyInterface: Send + Sync {
1480    type WaitUntilFlushedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1481    fn r#wait_until_flushed(&self) -> Self::WaitUntilFlushedResponseFut;
1482}
1483
1484#[derive(Debug, Clone)]
1485pub struct LogFlusherProxy {
1486    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
1487}
1488
1489impl fdomain_client::fidl::Proxy for LogFlusherProxy {
1490    type Protocol = LogFlusherMarker;
1491
1492    fn from_channel(inner: fdomain_client::Channel) -> Self {
1493        Self::new(inner)
1494    }
1495
1496    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
1497        self.client.into_channel().map_err(|client| Self { client })
1498    }
1499
1500    fn as_channel(&self) -> &fdomain_client::Channel {
1501        self.client.as_channel()
1502    }
1503}
1504
1505impl LogFlusherProxy {
1506    /// Create a new Proxy for fuchsia.diagnostics/LogFlusher.
1507    pub fn new(channel: fdomain_client::Channel) -> Self {
1508        let protocol_name = <LogFlusherMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
1509        Self { client: fidl::client::Client::new(channel, protocol_name) }
1510    }
1511
1512    /// Get a Stream of events from the remote end of the protocol.
1513    ///
1514    /// # Panics
1515    ///
1516    /// Panics if the event stream was already taken.
1517    pub fn take_event_stream(&self) -> LogFlusherEventStream {
1518        LogFlusherEventStream { event_receiver: self.client.take_event_receiver() }
1519    }
1520
1521    /// Flushes all pending logs through the logging pipeline
1522    /// to the serial port. Logs written to sockets prior to
1523    /// the call to Flush are guaranteed to be fully written
1524    /// to serial when this returns. Logs written to sockets
1525    /// after this call has been received by Archivist are
1526    /// not guaranteed to be flushed.
1527    /// Additionally, sockets must actually be connected to the Archivist
1528    /// before this call is made. If a socket hasn't been
1529    /// received by Archivist yet, those logs may be dropped.
1530    /// To ensure that logs are properly flushed, make sure
1531    /// to wait for the initial interest when logging.
1532    /// Important note: This may be called from the host,
1533    /// but host sockets will NOT be flushed by this method.
1534    /// If you write data from the host (not on the device,
1535    /// there is no guarantee that such logs will ever be printed).
1536    pub fn r#wait_until_flushed(
1537        &self,
1538    ) -> fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect> {
1539        LogFlusherProxyInterface::r#wait_until_flushed(self)
1540    }
1541}
1542
1543impl LogFlusherProxyInterface for LogFlusherProxy {
1544    type WaitUntilFlushedResponseFut =
1545        fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect>;
1546    fn r#wait_until_flushed(&self) -> Self::WaitUntilFlushedResponseFut {
1547        fn _decode(
1548            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1549        ) -> Result<(), fidl::Error> {
1550            let _response = fidl::client::decode_transaction_body::<
1551                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
1552                fdomain_client::fidl::FDomainResourceDialect,
1553                0x7dc4892e46748b5b,
1554            >(_buf?)?
1555            .into_result_fdomain::<LogFlusherMarker>("wait_until_flushed")?;
1556            Ok(_response)
1557        }
1558        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
1559            (),
1560            0x7dc4892e46748b5b,
1561            fidl::encoding::DynamicFlags::FLEXIBLE,
1562            _decode,
1563        )
1564    }
1565}
1566
1567pub struct LogFlusherEventStream {
1568    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
1569}
1570
1571impl std::marker::Unpin for LogFlusherEventStream {}
1572
1573impl futures::stream::FusedStream for LogFlusherEventStream {
1574    fn is_terminated(&self) -> bool {
1575        self.event_receiver.is_terminated()
1576    }
1577}
1578
1579impl futures::Stream for LogFlusherEventStream {
1580    type Item = Result<LogFlusherEvent, fidl::Error>;
1581
1582    fn poll_next(
1583        mut self: std::pin::Pin<&mut Self>,
1584        cx: &mut std::task::Context<'_>,
1585    ) -> std::task::Poll<Option<Self::Item>> {
1586        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1587            &mut self.event_receiver,
1588            cx
1589        )?) {
1590            Some(buf) => std::task::Poll::Ready(Some(LogFlusherEvent::decode(buf))),
1591            None => std::task::Poll::Ready(None),
1592        }
1593    }
1594}
1595
1596#[derive(Debug)]
1597pub enum LogFlusherEvent {
1598    #[non_exhaustive]
1599    _UnknownEvent {
1600        /// Ordinal of the event that was sent.
1601        ordinal: u64,
1602    },
1603}
1604
1605impl LogFlusherEvent {
1606    /// Decodes a message buffer as a [`LogFlusherEvent`].
1607    fn decode(
1608        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1609    ) -> Result<LogFlusherEvent, fidl::Error> {
1610        let (bytes, _handles) = buf.split_mut();
1611        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1612        debug_assert_eq!(tx_header.tx_id, 0);
1613        match tx_header.ordinal {
1614            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1615                Ok(LogFlusherEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1616            }
1617            _ => Err(fidl::Error::UnknownOrdinal {
1618                ordinal: tx_header.ordinal,
1619                protocol_name:
1620                    <LogFlusherMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1621            }),
1622        }
1623    }
1624}
1625
1626/// A Stream of incoming requests for fuchsia.diagnostics/LogFlusher.
1627pub struct LogFlusherRequestStream {
1628    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1629    is_terminated: bool,
1630}
1631
1632impl std::marker::Unpin for LogFlusherRequestStream {}
1633
1634impl futures::stream::FusedStream for LogFlusherRequestStream {
1635    fn is_terminated(&self) -> bool {
1636        self.is_terminated
1637    }
1638}
1639
1640impl fdomain_client::fidl::RequestStream for LogFlusherRequestStream {
1641    type Protocol = LogFlusherMarker;
1642    type ControlHandle = LogFlusherControlHandle;
1643
1644    fn from_channel(channel: fdomain_client::Channel) -> Self {
1645        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1646    }
1647
1648    fn control_handle(&self) -> Self::ControlHandle {
1649        LogFlusherControlHandle { inner: self.inner.clone() }
1650    }
1651
1652    fn into_inner(
1653        self,
1654    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
1655    {
1656        (self.inner, self.is_terminated)
1657    }
1658
1659    fn from_inner(
1660        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1661        is_terminated: bool,
1662    ) -> Self {
1663        Self { inner, is_terminated }
1664    }
1665}
1666
1667impl futures::Stream for LogFlusherRequestStream {
1668    type Item = Result<LogFlusherRequest, fidl::Error>;
1669
1670    fn poll_next(
1671        mut self: std::pin::Pin<&mut Self>,
1672        cx: &mut std::task::Context<'_>,
1673    ) -> std::task::Poll<Option<Self::Item>> {
1674        let this = &mut *self;
1675        if this.inner.check_shutdown(cx) {
1676            this.is_terminated = true;
1677            return std::task::Poll::Ready(None);
1678        }
1679        if this.is_terminated {
1680            panic!("polled LogFlusherRequestStream after completion");
1681        }
1682        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
1683            |bytes, handles| {
1684                match this.inner.channel().read_etc(cx, bytes, handles) {
1685                    std::task::Poll::Ready(Ok(())) => {}
1686                    std::task::Poll::Pending => return std::task::Poll::Pending,
1687                    std::task::Poll::Ready(Err(None)) => {
1688                        this.is_terminated = true;
1689                        return std::task::Poll::Ready(None);
1690                    }
1691                    std::task::Poll::Ready(Err(Some(e))) => {
1692                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1693                            e.into(),
1694                        ))));
1695                    }
1696                }
1697
1698                // A message has been received from the channel
1699                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1700
1701                std::task::Poll::Ready(Some(match header.ordinal {
1702                    0x7dc4892e46748b5b => {
1703                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1704                        let mut req = fidl::new_empty!(
1705                            fidl::encoding::EmptyPayload,
1706                            fdomain_client::fidl::FDomainResourceDialect
1707                        );
1708                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1709                        let control_handle = LogFlusherControlHandle { inner: this.inner.clone() };
1710                        Ok(LogFlusherRequest::WaitUntilFlushed {
1711                            responder: LogFlusherWaitUntilFlushedResponder {
1712                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1713                                tx_id: header.tx_id,
1714                            },
1715                        })
1716                    }
1717                    _ if header.tx_id == 0
1718                        && header
1719                            .dynamic_flags()
1720                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1721                    {
1722                        Ok(LogFlusherRequest::_UnknownMethod {
1723                            ordinal: header.ordinal,
1724                            control_handle: LogFlusherControlHandle { inner: this.inner.clone() },
1725                            method_type: fidl::MethodType::OneWay,
1726                        })
1727                    }
1728                    _ if header
1729                        .dynamic_flags()
1730                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1731                    {
1732                        this.inner.send_framework_err(
1733                            fidl::encoding::FrameworkErr::UnknownMethod,
1734                            header.tx_id,
1735                            header.ordinal,
1736                            header.dynamic_flags(),
1737                            (bytes, handles),
1738                        )?;
1739                        Ok(LogFlusherRequest::_UnknownMethod {
1740                            ordinal: header.ordinal,
1741                            control_handle: LogFlusherControlHandle { inner: this.inner.clone() },
1742                            method_type: fidl::MethodType::TwoWay,
1743                        })
1744                    }
1745                    _ => Err(fidl::Error::UnknownOrdinal {
1746                        ordinal: header.ordinal,
1747                        protocol_name:
1748                            <LogFlusherMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1749                    }),
1750                }))
1751            },
1752        )
1753    }
1754}
1755
1756#[derive(Debug)]
1757pub enum LogFlusherRequest {
1758    /// Flushes all pending logs through the logging pipeline
1759    /// to the serial port. Logs written to sockets prior to
1760    /// the call to Flush are guaranteed to be fully written
1761    /// to serial when this returns. Logs written to sockets
1762    /// after this call has been received by Archivist are
1763    /// not guaranteed to be flushed.
1764    /// Additionally, sockets must actually be connected to the Archivist
1765    /// before this call is made. If a socket hasn't been
1766    /// received by Archivist yet, those logs may be dropped.
1767    /// To ensure that logs are properly flushed, make sure
1768    /// to wait for the initial interest when logging.
1769    /// Important note: This may be called from the host,
1770    /// but host sockets will NOT be flushed by this method.
1771    /// If you write data from the host (not on the device,
1772    /// there is no guarantee that such logs will ever be printed).
1773    WaitUntilFlushed { responder: LogFlusherWaitUntilFlushedResponder },
1774    /// An interaction was received which does not match any known method.
1775    #[non_exhaustive]
1776    _UnknownMethod {
1777        /// Ordinal of the method that was called.
1778        ordinal: u64,
1779        control_handle: LogFlusherControlHandle,
1780        method_type: fidl::MethodType,
1781    },
1782}
1783
1784impl LogFlusherRequest {
1785    #[allow(irrefutable_let_patterns)]
1786    pub fn into_wait_until_flushed(self) -> Option<(LogFlusherWaitUntilFlushedResponder)> {
1787        if let LogFlusherRequest::WaitUntilFlushed { responder } = self {
1788            Some((responder))
1789        } else {
1790            None
1791        }
1792    }
1793
1794    /// Name of the method defined in FIDL
1795    pub fn method_name(&self) -> &'static str {
1796        match *self {
1797            LogFlusherRequest::WaitUntilFlushed { .. } => "wait_until_flushed",
1798            LogFlusherRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1799                "unknown one-way method"
1800            }
1801            LogFlusherRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1802                "unknown two-way method"
1803            }
1804        }
1805    }
1806}
1807
1808#[derive(Debug, Clone)]
1809pub struct LogFlusherControlHandle {
1810    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1811}
1812
1813impl LogFlusherControlHandle {
1814    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1815        self.inner.shutdown_with_epitaph(status.into())
1816    }
1817}
1818
1819impl fdomain_client::fidl::ControlHandle for LogFlusherControlHandle {
1820    fn shutdown(&self) {
1821        self.inner.shutdown()
1822    }
1823
1824    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1825        self.inner.shutdown_with_epitaph(status)
1826    }
1827
1828    fn is_closed(&self) -> bool {
1829        self.inner.channel().is_closed()
1830    }
1831    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
1832        self.inner.channel().on_closed()
1833    }
1834}
1835
1836impl LogFlusherControlHandle {}
1837
1838#[must_use = "FIDL methods require a response to be sent"]
1839#[derive(Debug)]
1840pub struct LogFlusherWaitUntilFlushedResponder {
1841    control_handle: std::mem::ManuallyDrop<LogFlusherControlHandle>,
1842    tx_id: u32,
1843}
1844
1845/// Set the the channel to be shutdown (see [`LogFlusherControlHandle::shutdown`])
1846/// if the responder is dropped without sending a response, so that the client
1847/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1848impl std::ops::Drop for LogFlusherWaitUntilFlushedResponder {
1849    fn drop(&mut self) {
1850        self.control_handle.shutdown();
1851        // Safety: drops once, never accessed again
1852        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1853    }
1854}
1855
1856impl fdomain_client::fidl::Responder for LogFlusherWaitUntilFlushedResponder {
1857    type ControlHandle = LogFlusherControlHandle;
1858
1859    fn control_handle(&self) -> &LogFlusherControlHandle {
1860        &self.control_handle
1861    }
1862
1863    fn drop_without_shutdown(mut self) {
1864        // Safety: drops once, never accessed again due to mem::forget
1865        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1866        // Prevent Drop from running (which would shut down the channel)
1867        std::mem::forget(self);
1868    }
1869}
1870
1871impl LogFlusherWaitUntilFlushedResponder {
1872    /// Sends a response to the FIDL transaction.
1873    ///
1874    /// Sets the channel to shutdown if an error occurs.
1875    pub fn send(self) -> Result<(), fidl::Error> {
1876        let _result = self.send_raw();
1877        if _result.is_err() {
1878            self.control_handle.shutdown();
1879        }
1880        self.drop_without_shutdown();
1881        _result
1882    }
1883
1884    /// Similar to "send" but does not shutdown the channel if an error occurs.
1885    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1886        let _result = self.send_raw();
1887        self.drop_without_shutdown();
1888        _result
1889    }
1890
1891    fn send_raw(&self) -> Result<(), fidl::Error> {
1892        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
1893            fidl::encoding::Flexible::new(()),
1894            self.tx_id,
1895            0x7dc4892e46748b5b,
1896            fidl::encoding::DynamicFlags::FLEXIBLE,
1897        )
1898    }
1899}
1900
1901#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1902pub struct LogSettingsMarker;
1903
1904impl fdomain_client::fidl::ProtocolMarker for LogSettingsMarker {
1905    type Proxy = LogSettingsProxy;
1906    type RequestStream = LogSettingsRequestStream;
1907
1908    const DEBUG_NAME: &'static str = "fuchsia.diagnostics.LogSettings";
1909}
1910impl fdomain_client::fidl::DiscoverableProtocolMarker for LogSettingsMarker {}
1911
1912pub trait LogSettingsProxyInterface: Send + Sync {
1913    type SetComponentInterestResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
1914        + Send;
1915    fn r#set_component_interest(
1916        &self,
1917        payload: &LogSettingsSetComponentInterestRequest,
1918    ) -> Self::SetComponentInterestResponseFut;
1919}
1920
1921#[derive(Debug, Clone)]
1922pub struct LogSettingsProxy {
1923    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
1924}
1925
1926impl fdomain_client::fidl::Proxy for LogSettingsProxy {
1927    type Protocol = LogSettingsMarker;
1928
1929    fn from_channel(inner: fdomain_client::Channel) -> Self {
1930        Self::new(inner)
1931    }
1932
1933    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
1934        self.client.into_channel().map_err(|client| Self { client })
1935    }
1936
1937    fn as_channel(&self) -> &fdomain_client::Channel {
1938        self.client.as_channel()
1939    }
1940}
1941
1942impl LogSettingsProxy {
1943    /// Create a new Proxy for fuchsia.diagnostics/LogSettings.
1944    pub fn new(channel: fdomain_client::Channel) -> Self {
1945        let protocol_name = <LogSettingsMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
1946        Self { client: fidl::client::Client::new(channel, protocol_name) }
1947    }
1948
1949    /// Get a Stream of events from the remote end of the protocol.
1950    ///
1951    /// # Panics
1952    ///
1953    /// Panics if the event stream was already taken.
1954    pub fn take_event_stream(&self) -> LogSettingsEventStream {
1955        LogSettingsEventStream { event_receiver: self.client.take_event_receiver() }
1956    }
1957
1958    /// Requests a change in interest for the matched components.
1959    ///
1960    /// Each component holds a set of requested interests.
1961    ///
1962    /// When a new request on LogSettings#SetComponentInterest is received,
1963    /// the sets for matched components receive the new minimum interest.
1964    /// If the interest is less than the previous minimum interest, then a
1965    /// `SetComponentInterest` request is sent with the new minimum interest.
1966    ///
1967    /// If a connection to `LogSettings` sends another `SetComponentInterest`
1968    /// request, its previous interest request will be undone.
1969    ///
1970    /// When the connection to `LogSettings` is finished, the interests are
1971    /// undone, unless persist is set to true. Each matched component minimum
1972    /// interest is updated with the new minimum interest in the set.
1973    pub fn r#set_component_interest(
1974        &self,
1975        mut payload: &LogSettingsSetComponentInterestRequest,
1976    ) -> fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect> {
1977        LogSettingsProxyInterface::r#set_component_interest(self, payload)
1978    }
1979}
1980
1981impl LogSettingsProxyInterface for LogSettingsProxy {
1982    type SetComponentInterestResponseFut =
1983        fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect>;
1984    fn r#set_component_interest(
1985        &self,
1986        mut payload: &LogSettingsSetComponentInterestRequest,
1987    ) -> Self::SetComponentInterestResponseFut {
1988        fn _decode(
1989            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1990        ) -> Result<(), fidl::Error> {
1991            let _response = fidl::client::decode_transaction_body::<
1992                fidl::encoding::EmptyPayload,
1993                fdomain_client::fidl::FDomainResourceDialect,
1994                0x35f7004d2367f6c1,
1995            >(_buf?)?;
1996            Ok(_response)
1997        }
1998        self.client.send_query_and_decode::<LogSettingsSetComponentInterestRequest, ()>(
1999            payload,
2000            0x35f7004d2367f6c1,
2001            fidl::encoding::DynamicFlags::empty(),
2002            _decode,
2003        )
2004    }
2005}
2006
2007pub struct LogSettingsEventStream {
2008    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
2009}
2010
2011impl std::marker::Unpin for LogSettingsEventStream {}
2012
2013impl futures::stream::FusedStream for LogSettingsEventStream {
2014    fn is_terminated(&self) -> bool {
2015        self.event_receiver.is_terminated()
2016    }
2017}
2018
2019impl futures::Stream for LogSettingsEventStream {
2020    type Item = Result<LogSettingsEvent, fidl::Error>;
2021
2022    fn poll_next(
2023        mut self: std::pin::Pin<&mut Self>,
2024        cx: &mut std::task::Context<'_>,
2025    ) -> std::task::Poll<Option<Self::Item>> {
2026        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2027            &mut self.event_receiver,
2028            cx
2029        )?) {
2030            Some(buf) => std::task::Poll::Ready(Some(LogSettingsEvent::decode(buf))),
2031            None => std::task::Poll::Ready(None),
2032        }
2033    }
2034}
2035
2036#[derive(Debug)]
2037pub enum LogSettingsEvent {}
2038
2039impl LogSettingsEvent {
2040    /// Decodes a message buffer as a [`LogSettingsEvent`].
2041    fn decode(
2042        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2043    ) -> Result<LogSettingsEvent, fidl::Error> {
2044        let (bytes, _handles) = buf.split_mut();
2045        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2046        debug_assert_eq!(tx_header.tx_id, 0);
2047        match tx_header.ordinal {
2048            _ => Err(fidl::Error::UnknownOrdinal {
2049                ordinal: tx_header.ordinal,
2050                protocol_name:
2051                    <LogSettingsMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
2052            }),
2053        }
2054    }
2055}
2056
2057/// A Stream of incoming requests for fuchsia.diagnostics/LogSettings.
2058pub struct LogSettingsRequestStream {
2059    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2060    is_terminated: bool,
2061}
2062
2063impl std::marker::Unpin for LogSettingsRequestStream {}
2064
2065impl futures::stream::FusedStream for LogSettingsRequestStream {
2066    fn is_terminated(&self) -> bool {
2067        self.is_terminated
2068    }
2069}
2070
2071impl fdomain_client::fidl::RequestStream for LogSettingsRequestStream {
2072    type Protocol = LogSettingsMarker;
2073    type ControlHandle = LogSettingsControlHandle;
2074
2075    fn from_channel(channel: fdomain_client::Channel) -> Self {
2076        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2077    }
2078
2079    fn control_handle(&self) -> Self::ControlHandle {
2080        LogSettingsControlHandle { inner: self.inner.clone() }
2081    }
2082
2083    fn into_inner(
2084        self,
2085    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
2086    {
2087        (self.inner, self.is_terminated)
2088    }
2089
2090    fn from_inner(
2091        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2092        is_terminated: bool,
2093    ) -> Self {
2094        Self { inner, is_terminated }
2095    }
2096}
2097
2098impl futures::Stream for LogSettingsRequestStream {
2099    type Item = Result<LogSettingsRequest, fidl::Error>;
2100
2101    fn poll_next(
2102        mut self: std::pin::Pin<&mut Self>,
2103        cx: &mut std::task::Context<'_>,
2104    ) -> std::task::Poll<Option<Self::Item>> {
2105        let this = &mut *self;
2106        if this.inner.check_shutdown(cx) {
2107            this.is_terminated = true;
2108            return std::task::Poll::Ready(None);
2109        }
2110        if this.is_terminated {
2111            panic!("polled LogSettingsRequestStream after completion");
2112        }
2113        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
2114            |bytes, handles| {
2115                match this.inner.channel().read_etc(cx, bytes, handles) {
2116                    std::task::Poll::Ready(Ok(())) => {}
2117                    std::task::Poll::Pending => return std::task::Poll::Pending,
2118                    std::task::Poll::Ready(Err(None)) => {
2119                        this.is_terminated = true;
2120                        return std::task::Poll::Ready(None);
2121                    }
2122                    std::task::Poll::Ready(Err(Some(e))) => {
2123                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2124                            e.into(),
2125                        ))));
2126                    }
2127                }
2128
2129                // A message has been received from the channel
2130                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2131
2132                std::task::Poll::Ready(Some(match header.ordinal {
2133                    0x35f7004d2367f6c1 => {
2134                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2135                        let mut req = fidl::new_empty!(
2136                            LogSettingsSetComponentInterestRequest,
2137                            fdomain_client::fidl::FDomainResourceDialect
2138                        );
2139                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<LogSettingsSetComponentInterestRequest>(&header, _body_bytes, handles, &mut req)?;
2140                        let control_handle = LogSettingsControlHandle { inner: this.inner.clone() };
2141                        Ok(LogSettingsRequest::SetComponentInterest {
2142                            payload: req,
2143                            responder: LogSettingsSetComponentInterestResponder {
2144                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2145                                tx_id: header.tx_id,
2146                            },
2147                        })
2148                    }
2149                    _ => Err(fidl::Error::UnknownOrdinal {
2150                        ordinal: header.ordinal,
2151                        protocol_name:
2152                            <LogSettingsMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
2153                    }),
2154                }))
2155            },
2156        )
2157    }
2158}
2159
2160/// This protocol allows clients to modify the logging behavior of components
2161/// in the system.
2162#[derive(Debug)]
2163pub enum LogSettingsRequest {
2164    /// Requests a change in interest for the matched components.
2165    ///
2166    /// Each component holds a set of requested interests.
2167    ///
2168    /// When a new request on LogSettings#SetComponentInterest is received,
2169    /// the sets for matched components receive the new minimum interest.
2170    /// If the interest is less than the previous minimum interest, then a
2171    /// `SetComponentInterest` request is sent with the new minimum interest.
2172    ///
2173    /// If a connection to `LogSettings` sends another `SetComponentInterest`
2174    /// request, its previous interest request will be undone.
2175    ///
2176    /// When the connection to `LogSettings` is finished, the interests are
2177    /// undone, unless persist is set to true. Each matched component minimum
2178    /// interest is updated with the new minimum interest in the set.
2179    SetComponentInterest {
2180        payload: LogSettingsSetComponentInterestRequest,
2181        responder: LogSettingsSetComponentInterestResponder,
2182    },
2183}
2184
2185impl LogSettingsRequest {
2186    #[allow(irrefutable_let_patterns)]
2187    pub fn into_set_component_interest(
2188        self,
2189    ) -> Option<(LogSettingsSetComponentInterestRequest, LogSettingsSetComponentInterestResponder)>
2190    {
2191        if let LogSettingsRequest::SetComponentInterest { payload, responder } = self {
2192            Some((payload, responder))
2193        } else {
2194            None
2195        }
2196    }
2197
2198    /// Name of the method defined in FIDL
2199    pub fn method_name(&self) -> &'static str {
2200        match *self {
2201            LogSettingsRequest::SetComponentInterest { .. } => "set_component_interest",
2202        }
2203    }
2204}
2205
2206#[derive(Debug, Clone)]
2207pub struct LogSettingsControlHandle {
2208    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2209}
2210
2211impl LogSettingsControlHandle {
2212    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2213        self.inner.shutdown_with_epitaph(status.into())
2214    }
2215}
2216
2217impl fdomain_client::fidl::ControlHandle for LogSettingsControlHandle {
2218    fn shutdown(&self) {
2219        self.inner.shutdown()
2220    }
2221
2222    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2223        self.inner.shutdown_with_epitaph(status)
2224    }
2225
2226    fn is_closed(&self) -> bool {
2227        self.inner.channel().is_closed()
2228    }
2229    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
2230        self.inner.channel().on_closed()
2231    }
2232}
2233
2234impl LogSettingsControlHandle {}
2235
2236#[must_use = "FIDL methods require a response to be sent"]
2237#[derive(Debug)]
2238pub struct LogSettingsSetComponentInterestResponder {
2239    control_handle: std::mem::ManuallyDrop<LogSettingsControlHandle>,
2240    tx_id: u32,
2241}
2242
2243/// Set the the channel to be shutdown (see [`LogSettingsControlHandle::shutdown`])
2244/// if the responder is dropped without sending a response, so that the client
2245/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2246impl std::ops::Drop for LogSettingsSetComponentInterestResponder {
2247    fn drop(&mut self) {
2248        self.control_handle.shutdown();
2249        // Safety: drops once, never accessed again
2250        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2251    }
2252}
2253
2254impl fdomain_client::fidl::Responder for LogSettingsSetComponentInterestResponder {
2255    type ControlHandle = LogSettingsControlHandle;
2256
2257    fn control_handle(&self) -> &LogSettingsControlHandle {
2258        &self.control_handle
2259    }
2260
2261    fn drop_without_shutdown(mut self) {
2262        // Safety: drops once, never accessed again due to mem::forget
2263        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2264        // Prevent Drop from running (which would shut down the channel)
2265        std::mem::forget(self);
2266    }
2267}
2268
2269impl LogSettingsSetComponentInterestResponder {
2270    /// Sends a response to the FIDL transaction.
2271    ///
2272    /// Sets the channel to shutdown if an error occurs.
2273    pub fn send(self) -> Result<(), fidl::Error> {
2274        let _result = self.send_raw();
2275        if _result.is_err() {
2276            self.control_handle.shutdown();
2277        }
2278        self.drop_without_shutdown();
2279        _result
2280    }
2281
2282    /// Similar to "send" but does not shutdown the channel if an error occurs.
2283    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2284        let _result = self.send_raw();
2285        self.drop_without_shutdown();
2286        _result
2287    }
2288
2289    fn send_raw(&self) -> Result<(), fidl::Error> {
2290        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2291            (),
2292            self.tx_id,
2293            0x35f7004d2367f6c1,
2294            fidl::encoding::DynamicFlags::empty(),
2295        )
2296    }
2297}
2298
2299#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2300pub struct SampleMarker;
2301
2302impl fdomain_client::fidl::ProtocolMarker for SampleMarker {
2303    type Proxy = SampleProxy;
2304    type RequestStream = SampleRequestStream;
2305
2306    const DEBUG_NAME: &'static str = "fuchsia.diagnostics.Sample";
2307}
2308impl fdomain_client::fidl::DiscoverableProtocolMarker for SampleMarker {}
2309pub type SampleCommitResult = Result<(), ConfigurationError>;
2310
2311pub trait SampleProxyInterface: Send + Sync {
2312    fn r#set(&self, sample_parameters: &SampleParameters) -> Result<(), fidl::Error>;
2313    type CommitResponseFut: std::future::Future<Output = Result<SampleCommitResult, fidl::Error>>
2314        + Send;
2315    fn r#commit(
2316        &self,
2317        sink: fdomain_client::fidl::ClientEnd<SampleSinkMarker>,
2318    ) -> Self::CommitResponseFut;
2319}
2320
2321#[derive(Debug, Clone)]
2322pub struct SampleProxy {
2323    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
2324}
2325
2326impl fdomain_client::fidl::Proxy for SampleProxy {
2327    type Protocol = SampleMarker;
2328
2329    fn from_channel(inner: fdomain_client::Channel) -> Self {
2330        Self::new(inner)
2331    }
2332
2333    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
2334        self.client.into_channel().map_err(|client| Self { client })
2335    }
2336
2337    fn as_channel(&self) -> &fdomain_client::Channel {
2338        self.client.as_channel()
2339    }
2340}
2341
2342impl SampleProxy {
2343    /// Create a new Proxy for fuchsia.diagnostics/Sample.
2344    pub fn new(channel: fdomain_client::Channel) -> Self {
2345        let protocol_name = <SampleMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
2346        Self { client: fidl::client::Client::new(channel, protocol_name) }
2347    }
2348
2349    /// Get a Stream of events from the remote end of the protocol.
2350    ///
2351    /// # Panics
2352    ///
2353    /// Panics if the event stream was already taken.
2354    pub fn take_event_stream(&self) -> SampleEventStream {
2355        SampleEventStream { event_receiver: self.client.take_event_receiver() }
2356    }
2357
2358    /// Add sample parameters.
2359    ///
2360    /// Since this is limited by channel size, this API paginates at 300
2361    /// items. That should fit in a channel unless a selector is particularly
2362    /// gigantic.
2363    ///
2364    /// Use `Commit` to indicate that all samples are sent over.
2365    pub fn r#set(&self, mut sample_parameters: &SampleParameters) -> Result<(), fidl::Error> {
2366        SampleProxyInterface::r#set(self, sample_parameters)
2367    }
2368
2369    /// `Commit` returns errors quickly, as all configuration is validated
2370    /// before the first sample is taken.
2371    pub fn r#commit(
2372        &self,
2373        mut sink: fdomain_client::fidl::ClientEnd<SampleSinkMarker>,
2374    ) -> fidl::client::QueryResponseFut<
2375        SampleCommitResult,
2376        fdomain_client::fidl::FDomainResourceDialect,
2377    > {
2378        SampleProxyInterface::r#commit(self, sink)
2379    }
2380}
2381
2382impl SampleProxyInterface for SampleProxy {
2383    fn r#set(&self, mut sample_parameters: &SampleParameters) -> Result<(), fidl::Error> {
2384        self.client.send::<SampleSetRequest>(
2385            (sample_parameters,),
2386            0x421a79bdbf45418e,
2387            fidl::encoding::DynamicFlags::FLEXIBLE,
2388        )
2389    }
2390
2391    type CommitResponseFut = fidl::client::QueryResponseFut<
2392        SampleCommitResult,
2393        fdomain_client::fidl::FDomainResourceDialect,
2394    >;
2395    fn r#commit(
2396        &self,
2397        mut sink: fdomain_client::fidl::ClientEnd<SampleSinkMarker>,
2398    ) -> Self::CommitResponseFut {
2399        fn _decode(
2400            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2401        ) -> Result<SampleCommitResult, fidl::Error> {
2402            let _response = fidl::client::decode_transaction_body::<
2403                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, ConfigurationError>,
2404                fdomain_client::fidl::FDomainResourceDialect,
2405                0x25a3bc5f26787e9b,
2406            >(_buf?)?
2407            .into_result_fdomain::<SampleMarker>("commit")?;
2408            Ok(_response.map(|x| x))
2409        }
2410        self.client.send_query_and_decode::<SampleCommitRequest, SampleCommitResult>(
2411            (sink,),
2412            0x25a3bc5f26787e9b,
2413            fidl::encoding::DynamicFlags::FLEXIBLE,
2414            _decode,
2415        )
2416    }
2417}
2418
2419pub struct SampleEventStream {
2420    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
2421}
2422
2423impl std::marker::Unpin for SampleEventStream {}
2424
2425impl futures::stream::FusedStream for SampleEventStream {
2426    fn is_terminated(&self) -> bool {
2427        self.event_receiver.is_terminated()
2428    }
2429}
2430
2431impl futures::Stream for SampleEventStream {
2432    type Item = Result<SampleEvent, fidl::Error>;
2433
2434    fn poll_next(
2435        mut self: std::pin::Pin<&mut Self>,
2436        cx: &mut std::task::Context<'_>,
2437    ) -> std::task::Poll<Option<Self::Item>> {
2438        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2439            &mut self.event_receiver,
2440            cx
2441        )?) {
2442            Some(buf) => std::task::Poll::Ready(Some(SampleEvent::decode(buf))),
2443            None => std::task::Poll::Ready(None),
2444        }
2445    }
2446}
2447
2448#[derive(Debug)]
2449pub enum SampleEvent {
2450    #[non_exhaustive]
2451    _UnknownEvent {
2452        /// Ordinal of the event that was sent.
2453        ordinal: u64,
2454    },
2455}
2456
2457impl SampleEvent {
2458    /// Decodes a message buffer as a [`SampleEvent`].
2459    fn decode(
2460        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2461    ) -> Result<SampleEvent, fidl::Error> {
2462        let (bytes, _handles) = buf.split_mut();
2463        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2464        debug_assert_eq!(tx_header.tx_id, 0);
2465        match tx_header.ordinal {
2466            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2467                Ok(SampleEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2468            }
2469            _ => Err(fidl::Error::UnknownOrdinal {
2470                ordinal: tx_header.ordinal,
2471                protocol_name: <SampleMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
2472            }),
2473        }
2474    }
2475}
2476
2477/// A Stream of incoming requests for fuchsia.diagnostics/Sample.
2478pub struct SampleRequestStream {
2479    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2480    is_terminated: bool,
2481}
2482
2483impl std::marker::Unpin for SampleRequestStream {}
2484
2485impl futures::stream::FusedStream for SampleRequestStream {
2486    fn is_terminated(&self) -> bool {
2487        self.is_terminated
2488    }
2489}
2490
2491impl fdomain_client::fidl::RequestStream for SampleRequestStream {
2492    type Protocol = SampleMarker;
2493    type ControlHandle = SampleControlHandle;
2494
2495    fn from_channel(channel: fdomain_client::Channel) -> Self {
2496        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2497    }
2498
2499    fn control_handle(&self) -> Self::ControlHandle {
2500        SampleControlHandle { inner: self.inner.clone() }
2501    }
2502
2503    fn into_inner(
2504        self,
2505    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
2506    {
2507        (self.inner, self.is_terminated)
2508    }
2509
2510    fn from_inner(
2511        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2512        is_terminated: bool,
2513    ) -> Self {
2514        Self { inner, is_terminated }
2515    }
2516}
2517
2518impl futures::Stream for SampleRequestStream {
2519    type Item = Result<SampleRequest, fidl::Error>;
2520
2521    fn poll_next(
2522        mut self: std::pin::Pin<&mut Self>,
2523        cx: &mut std::task::Context<'_>,
2524    ) -> std::task::Poll<Option<Self::Item>> {
2525        let this = &mut *self;
2526        if this.inner.check_shutdown(cx) {
2527            this.is_terminated = true;
2528            return std::task::Poll::Ready(None);
2529        }
2530        if this.is_terminated {
2531            panic!("polled SampleRequestStream after completion");
2532        }
2533        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
2534            |bytes, handles| {
2535                match this.inner.channel().read_etc(cx, bytes, handles) {
2536                    std::task::Poll::Ready(Ok(())) => {}
2537                    std::task::Poll::Pending => return std::task::Poll::Pending,
2538                    std::task::Poll::Ready(Err(None)) => {
2539                        this.is_terminated = true;
2540                        return std::task::Poll::Ready(None);
2541                    }
2542                    std::task::Poll::Ready(Err(Some(e))) => {
2543                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2544                            e.into(),
2545                        ))));
2546                    }
2547                }
2548
2549                // A message has been received from the channel
2550                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2551
2552                std::task::Poll::Ready(Some(match header.ordinal {
2553                    0x421a79bdbf45418e => {
2554                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2555                        let mut req = fidl::new_empty!(
2556                            SampleSetRequest,
2557                            fdomain_client::fidl::FDomainResourceDialect
2558                        );
2559                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<SampleSetRequest>(&header, _body_bytes, handles, &mut req)?;
2560                        let control_handle = SampleControlHandle { inner: this.inner.clone() };
2561                        Ok(SampleRequest::Set {
2562                            sample_parameters: req.sample_parameters,
2563
2564                            control_handle,
2565                        })
2566                    }
2567                    0x25a3bc5f26787e9b => {
2568                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2569                        let mut req = fidl::new_empty!(
2570                            SampleCommitRequest,
2571                            fdomain_client::fidl::FDomainResourceDialect
2572                        );
2573                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<SampleCommitRequest>(&header, _body_bytes, handles, &mut req)?;
2574                        let control_handle = SampleControlHandle { inner: this.inner.clone() };
2575                        Ok(SampleRequest::Commit {
2576                            sink: req.sink,
2577
2578                            responder: SampleCommitResponder {
2579                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2580                                tx_id: header.tx_id,
2581                            },
2582                        })
2583                    }
2584                    _ if header.tx_id == 0
2585                        && header
2586                            .dynamic_flags()
2587                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2588                    {
2589                        Ok(SampleRequest::_UnknownMethod {
2590                            ordinal: header.ordinal,
2591                            control_handle: SampleControlHandle { inner: this.inner.clone() },
2592                            method_type: fidl::MethodType::OneWay,
2593                        })
2594                    }
2595                    _ if header
2596                        .dynamic_flags()
2597                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2598                    {
2599                        this.inner.send_framework_err(
2600                            fidl::encoding::FrameworkErr::UnknownMethod,
2601                            header.tx_id,
2602                            header.ordinal,
2603                            header.dynamic_flags(),
2604                            (bytes, handles),
2605                        )?;
2606                        Ok(SampleRequest::_UnknownMethod {
2607                            ordinal: header.ordinal,
2608                            control_handle: SampleControlHandle { inner: this.inner.clone() },
2609                            method_type: fidl::MethodType::TwoWay,
2610                        })
2611                    }
2612                    _ => Err(fidl::Error::UnknownOrdinal {
2613                        ordinal: header.ordinal,
2614                        protocol_name:
2615                            <SampleMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
2616                    }),
2617                }))
2618            },
2619        )
2620    }
2621}
2622
2623/// Configure Archivist to alert you periodically about the state of data
2624/// provided via `SampleParameters`.
2625///
2626/// If the given configuration results in a hit, a `BatchIterator` is sent
2627/// over the `sink` provided. That iterator may be drained, and then the
2628/// `sink` will go quiet until the next hit.
2629///
2630/// Archivist does not inform the client which data result in a success,
2631/// because it has not inherent advantaged ability to do so. Clients who
2632/// need to know which data was queried should cache their selectors and
2633/// use `selectors::select_from_hierarchy` (or similar in C++).
2634#[derive(Debug)]
2635pub enum SampleRequest {
2636    /// Add sample parameters.
2637    ///
2638    /// Since this is limited by channel size, this API paginates at 300
2639    /// items. That should fit in a channel unless a selector is particularly
2640    /// gigantic.
2641    ///
2642    /// Use `Commit` to indicate that all samples are sent over.
2643    Set { sample_parameters: SampleParameters, control_handle: SampleControlHandle },
2644    /// `Commit` returns errors quickly, as all configuration is validated
2645    /// before the first sample is taken.
2646    Commit {
2647        sink: fdomain_client::fidl::ClientEnd<SampleSinkMarker>,
2648        responder: SampleCommitResponder,
2649    },
2650    /// An interaction was received which does not match any known method.
2651    #[non_exhaustive]
2652    _UnknownMethod {
2653        /// Ordinal of the method that was called.
2654        ordinal: u64,
2655        control_handle: SampleControlHandle,
2656        method_type: fidl::MethodType,
2657    },
2658}
2659
2660impl SampleRequest {
2661    #[allow(irrefutable_let_patterns)]
2662    pub fn into_set(self) -> Option<(SampleParameters, SampleControlHandle)> {
2663        if let SampleRequest::Set { sample_parameters, control_handle } = self {
2664            Some((sample_parameters, control_handle))
2665        } else {
2666            None
2667        }
2668    }
2669
2670    #[allow(irrefutable_let_patterns)]
2671    pub fn into_commit(
2672        self,
2673    ) -> Option<(fdomain_client::fidl::ClientEnd<SampleSinkMarker>, SampleCommitResponder)> {
2674        if let SampleRequest::Commit { sink, responder } = self {
2675            Some((sink, responder))
2676        } else {
2677            None
2678        }
2679    }
2680
2681    /// Name of the method defined in FIDL
2682    pub fn method_name(&self) -> &'static str {
2683        match *self {
2684            SampleRequest::Set { .. } => "set",
2685            SampleRequest::Commit { .. } => "commit",
2686            SampleRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
2687                "unknown one-way method"
2688            }
2689            SampleRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
2690                "unknown two-way method"
2691            }
2692        }
2693    }
2694}
2695
2696#[derive(Debug, Clone)]
2697pub struct SampleControlHandle {
2698    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2699}
2700
2701impl SampleControlHandle {
2702    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2703        self.inner.shutdown_with_epitaph(status.into())
2704    }
2705}
2706
2707impl fdomain_client::fidl::ControlHandle for SampleControlHandle {
2708    fn shutdown(&self) {
2709        self.inner.shutdown()
2710    }
2711
2712    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2713        self.inner.shutdown_with_epitaph(status)
2714    }
2715
2716    fn is_closed(&self) -> bool {
2717        self.inner.channel().is_closed()
2718    }
2719    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
2720        self.inner.channel().on_closed()
2721    }
2722}
2723
2724impl SampleControlHandle {}
2725
2726#[must_use = "FIDL methods require a response to be sent"]
2727#[derive(Debug)]
2728pub struct SampleCommitResponder {
2729    control_handle: std::mem::ManuallyDrop<SampleControlHandle>,
2730    tx_id: u32,
2731}
2732
2733/// Set the the channel to be shutdown (see [`SampleControlHandle::shutdown`])
2734/// if the responder is dropped without sending a response, so that the client
2735/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2736impl std::ops::Drop for SampleCommitResponder {
2737    fn drop(&mut self) {
2738        self.control_handle.shutdown();
2739        // Safety: drops once, never accessed again
2740        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2741    }
2742}
2743
2744impl fdomain_client::fidl::Responder for SampleCommitResponder {
2745    type ControlHandle = SampleControlHandle;
2746
2747    fn control_handle(&self) -> &SampleControlHandle {
2748        &self.control_handle
2749    }
2750
2751    fn drop_without_shutdown(mut self) {
2752        // Safety: drops once, never accessed again due to mem::forget
2753        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2754        // Prevent Drop from running (which would shut down the channel)
2755        std::mem::forget(self);
2756    }
2757}
2758
2759impl SampleCommitResponder {
2760    /// Sends a response to the FIDL transaction.
2761    ///
2762    /// Sets the channel to shutdown if an error occurs.
2763    pub fn send(self, mut result: Result<(), ConfigurationError>) -> Result<(), fidl::Error> {
2764        let _result = self.send_raw(result);
2765        if _result.is_err() {
2766            self.control_handle.shutdown();
2767        }
2768        self.drop_without_shutdown();
2769        _result
2770    }
2771
2772    /// Similar to "send" but does not shutdown the channel if an error occurs.
2773    pub fn send_no_shutdown_on_err(
2774        self,
2775        mut result: Result<(), ConfigurationError>,
2776    ) -> Result<(), fidl::Error> {
2777        let _result = self.send_raw(result);
2778        self.drop_without_shutdown();
2779        _result
2780    }
2781
2782    fn send_raw(&self, mut result: Result<(), ConfigurationError>) -> Result<(), fidl::Error> {
2783        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2784            fidl::encoding::EmptyStruct,
2785            ConfigurationError,
2786        >>(
2787            fidl::encoding::FlexibleResult::new(result),
2788            self.tx_id,
2789            0x25a3bc5f26787e9b,
2790            fidl::encoding::DynamicFlags::FLEXIBLE,
2791        )
2792    }
2793}
2794
2795#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2796pub struct SampleSinkMarker;
2797
2798impl fdomain_client::fidl::ProtocolMarker for SampleSinkMarker {
2799    type Proxy = SampleSinkProxy;
2800    type RequestStream = SampleSinkRequestStream;
2801
2802    const DEBUG_NAME: &'static str = "fuchsia.diagnostics.SampleSink";
2803}
2804impl fdomain_client::fidl::DiscoverableProtocolMarker for SampleSinkMarker {}
2805
2806pub trait SampleSinkProxyInterface: Send + Sync {
2807    fn r#on_sample_readied(&self, event: SampleSinkResult) -> Result<(), fidl::Error>;
2808}
2809
2810#[derive(Debug, Clone)]
2811pub struct SampleSinkProxy {
2812    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
2813}
2814
2815impl fdomain_client::fidl::Proxy for SampleSinkProxy {
2816    type Protocol = SampleSinkMarker;
2817
2818    fn from_channel(inner: fdomain_client::Channel) -> Self {
2819        Self::new(inner)
2820    }
2821
2822    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
2823        self.client.into_channel().map_err(|client| Self { client })
2824    }
2825
2826    fn as_channel(&self) -> &fdomain_client::Channel {
2827        self.client.as_channel()
2828    }
2829}
2830
2831impl SampleSinkProxy {
2832    /// Create a new Proxy for fuchsia.diagnostics/SampleSink.
2833    pub fn new(channel: fdomain_client::Channel) -> Self {
2834        let protocol_name = <SampleSinkMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
2835        Self { client: fidl::client::Client::new(channel, protocol_name) }
2836    }
2837
2838    /// Get a Stream of events from the remote end of the protocol.
2839    ///
2840    /// # Panics
2841    ///
2842    /// Panics if the event stream was already taken.
2843    pub fn take_event_stream(&self) -> SampleSinkEventStream {
2844        SampleSinkEventStream { event_receiver: self.client.take_event_receiver() }
2845    }
2846
2847    pub fn r#on_sample_readied(&self, mut event: SampleSinkResult) -> Result<(), fidl::Error> {
2848        SampleSinkProxyInterface::r#on_sample_readied(self, event)
2849    }
2850}
2851
2852impl SampleSinkProxyInterface for SampleSinkProxy {
2853    fn r#on_sample_readied(&self, mut event: SampleSinkResult) -> Result<(), fidl::Error> {
2854        self.client.send::<SampleSinkOnSampleReadiedRequest>(
2855            (&mut event,),
2856            0x39096d97ed03335f,
2857            fidl::encoding::DynamicFlags::FLEXIBLE,
2858        )
2859    }
2860}
2861
2862pub struct SampleSinkEventStream {
2863    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
2864}
2865
2866impl std::marker::Unpin for SampleSinkEventStream {}
2867
2868impl futures::stream::FusedStream for SampleSinkEventStream {
2869    fn is_terminated(&self) -> bool {
2870        self.event_receiver.is_terminated()
2871    }
2872}
2873
2874impl futures::Stream for SampleSinkEventStream {
2875    type Item = Result<SampleSinkEvent, fidl::Error>;
2876
2877    fn poll_next(
2878        mut self: std::pin::Pin<&mut Self>,
2879        cx: &mut std::task::Context<'_>,
2880    ) -> std::task::Poll<Option<Self::Item>> {
2881        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2882            &mut self.event_receiver,
2883            cx
2884        )?) {
2885            Some(buf) => std::task::Poll::Ready(Some(SampleSinkEvent::decode(buf))),
2886            None => std::task::Poll::Ready(None),
2887        }
2888    }
2889}
2890
2891#[derive(Debug)]
2892pub enum SampleSinkEvent {
2893    OnNowOrNever {},
2894    #[non_exhaustive]
2895    _UnknownEvent {
2896        /// Ordinal of the event that was sent.
2897        ordinal: u64,
2898    },
2899}
2900
2901impl SampleSinkEvent {
2902    #[allow(irrefutable_let_patterns)]
2903    pub fn into_on_now_or_never(self) -> Option<()> {
2904        if let SampleSinkEvent::OnNowOrNever {} = self { Some(()) } else { None }
2905    }
2906
2907    /// Decodes a message buffer as a [`SampleSinkEvent`].
2908    fn decode(
2909        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2910    ) -> Result<SampleSinkEvent, fidl::Error> {
2911        let (bytes, _handles) = buf.split_mut();
2912        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2913        debug_assert_eq!(tx_header.tx_id, 0);
2914        match tx_header.ordinal {
2915            0x3dc94ca1e1290894 => {
2916                let mut out = fidl::new_empty!(
2917                    fidl::encoding::EmptyPayload,
2918                    fdomain_client::fidl::FDomainResourceDialect
2919                );
2920                fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
2921                Ok((SampleSinkEvent::OnNowOrNever {}))
2922            }
2923            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2924                Ok(SampleSinkEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2925            }
2926            _ => Err(fidl::Error::UnknownOrdinal {
2927                ordinal: tx_header.ordinal,
2928                protocol_name:
2929                    <SampleSinkMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
2930            }),
2931        }
2932    }
2933}
2934
2935/// A Stream of incoming requests for fuchsia.diagnostics/SampleSink.
2936pub struct SampleSinkRequestStream {
2937    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2938    is_terminated: bool,
2939}
2940
2941impl std::marker::Unpin for SampleSinkRequestStream {}
2942
2943impl futures::stream::FusedStream for SampleSinkRequestStream {
2944    fn is_terminated(&self) -> bool {
2945        self.is_terminated
2946    }
2947}
2948
2949impl fdomain_client::fidl::RequestStream for SampleSinkRequestStream {
2950    type Protocol = SampleSinkMarker;
2951    type ControlHandle = SampleSinkControlHandle;
2952
2953    fn from_channel(channel: fdomain_client::Channel) -> Self {
2954        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2955    }
2956
2957    fn control_handle(&self) -> Self::ControlHandle {
2958        SampleSinkControlHandle { inner: self.inner.clone() }
2959    }
2960
2961    fn into_inner(
2962        self,
2963    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
2964    {
2965        (self.inner, self.is_terminated)
2966    }
2967
2968    fn from_inner(
2969        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2970        is_terminated: bool,
2971    ) -> Self {
2972        Self { inner, is_terminated }
2973    }
2974}
2975
2976impl futures::Stream for SampleSinkRequestStream {
2977    type Item = Result<SampleSinkRequest, fidl::Error>;
2978
2979    fn poll_next(
2980        mut self: std::pin::Pin<&mut Self>,
2981        cx: &mut std::task::Context<'_>,
2982    ) -> std::task::Poll<Option<Self::Item>> {
2983        let this = &mut *self;
2984        if this.inner.check_shutdown(cx) {
2985            this.is_terminated = true;
2986            return std::task::Poll::Ready(None);
2987        }
2988        if this.is_terminated {
2989            panic!("polled SampleSinkRequestStream after completion");
2990        }
2991        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
2992            |bytes, handles| {
2993                match this.inner.channel().read_etc(cx, bytes, handles) {
2994                    std::task::Poll::Ready(Ok(())) => {}
2995                    std::task::Poll::Pending => return std::task::Poll::Pending,
2996                    std::task::Poll::Ready(Err(None)) => {
2997                        this.is_terminated = true;
2998                        return std::task::Poll::Ready(None);
2999                    }
3000                    std::task::Poll::Ready(Err(Some(e))) => {
3001                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3002                            e.into(),
3003                        ))));
3004                    }
3005                }
3006
3007                // A message has been received from the channel
3008                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3009
3010                std::task::Poll::Ready(Some(match header.ordinal {
3011                    0x39096d97ed03335f => {
3012                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3013                        let mut req = fidl::new_empty!(
3014                            SampleSinkOnSampleReadiedRequest,
3015                            fdomain_client::fidl::FDomainResourceDialect
3016                        );
3017                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<SampleSinkOnSampleReadiedRequest>(&header, _body_bytes, handles, &mut req)?;
3018                        let control_handle = SampleSinkControlHandle { inner: this.inner.clone() };
3019                        Ok(SampleSinkRequest::OnSampleReadied { event: req.event, control_handle })
3020                    }
3021                    _ if header.tx_id == 0
3022                        && header
3023                            .dynamic_flags()
3024                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3025                    {
3026                        Ok(SampleSinkRequest::_UnknownMethod {
3027                            ordinal: header.ordinal,
3028                            control_handle: SampleSinkControlHandle { inner: this.inner.clone() },
3029                            method_type: fidl::MethodType::OneWay,
3030                        })
3031                    }
3032                    _ if header
3033                        .dynamic_flags()
3034                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3035                    {
3036                        this.inner.send_framework_err(
3037                            fidl::encoding::FrameworkErr::UnknownMethod,
3038                            header.tx_id,
3039                            header.ordinal,
3040                            header.dynamic_flags(),
3041                            (bytes, handles),
3042                        )?;
3043                        Ok(SampleSinkRequest::_UnknownMethod {
3044                            ordinal: header.ordinal,
3045                            control_handle: SampleSinkControlHandle { inner: this.inner.clone() },
3046                            method_type: fidl::MethodType::TwoWay,
3047                        })
3048                    }
3049                    _ => Err(fidl::Error::UnknownOrdinal {
3050                        ordinal: header.ordinal,
3051                        protocol_name:
3052                            <SampleSinkMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
3053                    }),
3054                }))
3055            },
3056        )
3057    }
3058}
3059
3060/// `SampleSink` is served by the client, in order to be notified when samples
3061/// are ready.
3062#[derive(Debug)]
3063pub enum SampleSinkRequest {
3064    OnSampleReadied {
3065        event: SampleSinkResult,
3066        control_handle: SampleSinkControlHandle,
3067    },
3068    /// An interaction was received which does not match any known method.
3069    #[non_exhaustive]
3070    _UnknownMethod {
3071        /// Ordinal of the method that was called.
3072        ordinal: u64,
3073        control_handle: SampleSinkControlHandle,
3074        method_type: fidl::MethodType,
3075    },
3076}
3077
3078impl SampleSinkRequest {
3079    #[allow(irrefutable_let_patterns)]
3080    pub fn into_on_sample_readied(self) -> Option<(SampleSinkResult, SampleSinkControlHandle)> {
3081        if let SampleSinkRequest::OnSampleReadied { event, control_handle } = self {
3082            Some((event, control_handle))
3083        } else {
3084            None
3085        }
3086    }
3087
3088    /// Name of the method defined in FIDL
3089    pub fn method_name(&self) -> &'static str {
3090        match *self {
3091            SampleSinkRequest::OnSampleReadied { .. } => "on_sample_readied",
3092            SampleSinkRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
3093                "unknown one-way method"
3094            }
3095            SampleSinkRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
3096                "unknown two-way method"
3097            }
3098        }
3099    }
3100}
3101
3102#[derive(Debug, Clone)]
3103pub struct SampleSinkControlHandle {
3104    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
3105}
3106
3107impl SampleSinkControlHandle {
3108    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
3109        self.inner.shutdown_with_epitaph(status.into())
3110    }
3111}
3112
3113impl fdomain_client::fidl::ControlHandle for SampleSinkControlHandle {
3114    fn shutdown(&self) {
3115        self.inner.shutdown()
3116    }
3117
3118    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
3119        self.inner.shutdown_with_epitaph(status)
3120    }
3121
3122    fn is_closed(&self) -> bool {
3123        self.inner.channel().is_closed()
3124    }
3125    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
3126        self.inner.channel().on_closed()
3127    }
3128}
3129
3130impl SampleSinkControlHandle {
3131    pub fn send_on_now_or_never(&self) -> Result<(), fidl::Error> {
3132        self.inner.send::<fidl::encoding::EmptyPayload>(
3133            (),
3134            0,
3135            0x3dc94ca1e1290894,
3136            fidl::encoding::DynamicFlags::FLEXIBLE,
3137        )
3138    }
3139}
3140
3141#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3142pub struct SystemActivityMonitorMarker;
3143
3144impl fdomain_client::fidl::ProtocolMarker for SystemActivityMonitorMarker {
3145    type Proxy = SystemActivityMonitorProxy;
3146    type RequestStream = SystemActivityMonitorRequestStream;
3147
3148    const DEBUG_NAME: &'static str = "fuchsia.diagnostics.SystemActivityMonitor";
3149}
3150impl fdomain_client::fidl::DiscoverableProtocolMarker for SystemActivityMonitorMarker {}
3151
3152pub trait SystemActivityMonitorProxyInterface: Send + Sync {
3153    type GetNextEventResponseFut: std::future::Future<Output = Result<SystemActivityEvent, fidl::Error>>
3154        + Send;
3155    fn r#get_next_event(&self) -> Self::GetNextEventResponseFut;
3156}
3157
3158#[derive(Debug, Clone)]
3159pub struct SystemActivityMonitorProxy {
3160    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
3161}
3162
3163impl fdomain_client::fidl::Proxy for SystemActivityMonitorProxy {
3164    type Protocol = SystemActivityMonitorMarker;
3165
3166    fn from_channel(inner: fdomain_client::Channel) -> Self {
3167        Self::new(inner)
3168    }
3169
3170    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
3171        self.client.into_channel().map_err(|client| Self { client })
3172    }
3173
3174    fn as_channel(&self) -> &fdomain_client::Channel {
3175        self.client.as_channel()
3176    }
3177}
3178
3179impl SystemActivityMonitorProxy {
3180    /// Create a new Proxy for fuchsia.diagnostics/SystemActivityMonitor.
3181    pub fn new(channel: fdomain_client::Channel) -> Self {
3182        let protocol_name =
3183            <SystemActivityMonitorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
3184        Self { client: fidl::client::Client::new(channel, protocol_name) }
3185    }
3186
3187    /// Get a Stream of events from the remote end of the protocol.
3188    ///
3189    /// # Panics
3190    ///
3191    /// Panics if the event stream was already taken.
3192    pub fn take_event_stream(&self) -> SystemActivityMonitorEventStream {
3193        SystemActivityMonitorEventStream { event_receiver: self.client.take_event_receiver() }
3194    }
3195
3196    /// Blocks until a system activity event (e.g. CPU boost starting or ending)
3197    /// occurs, returning the event.
3198    pub fn r#get_next_event(
3199        &self,
3200    ) -> fidl::client::QueryResponseFut<
3201        SystemActivityEvent,
3202        fdomain_client::fidl::FDomainResourceDialect,
3203    > {
3204        SystemActivityMonitorProxyInterface::r#get_next_event(self)
3205    }
3206}
3207
3208impl SystemActivityMonitorProxyInterface for SystemActivityMonitorProxy {
3209    type GetNextEventResponseFut = fidl::client::QueryResponseFut<
3210        SystemActivityEvent,
3211        fdomain_client::fidl::FDomainResourceDialect,
3212    >;
3213    fn r#get_next_event(&self) -> Self::GetNextEventResponseFut {
3214        fn _decode(
3215            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3216        ) -> Result<SystemActivityEvent, fidl::Error> {
3217            let _response = fidl::client::decode_transaction_body::<
3218                fidl::encoding::FlexibleType<SystemActivityMonitorGetNextEventResponse>,
3219                fdomain_client::fidl::FDomainResourceDialect,
3220                0x354b94623dd41af9,
3221            >(_buf?)?
3222            .into_result_fdomain::<SystemActivityMonitorMarker>("get_next_event")?;
3223            Ok(_response.event)
3224        }
3225        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, SystemActivityEvent>(
3226            (),
3227            0x354b94623dd41af9,
3228            fidl::encoding::DynamicFlags::FLEXIBLE,
3229            _decode,
3230        )
3231    }
3232}
3233
3234pub struct SystemActivityMonitorEventStream {
3235    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
3236}
3237
3238impl std::marker::Unpin for SystemActivityMonitorEventStream {}
3239
3240impl futures::stream::FusedStream for SystemActivityMonitorEventStream {
3241    fn is_terminated(&self) -> bool {
3242        self.event_receiver.is_terminated()
3243    }
3244}
3245
3246impl futures::Stream for SystemActivityMonitorEventStream {
3247    type Item = Result<SystemActivityMonitorEvent, fidl::Error>;
3248
3249    fn poll_next(
3250        mut self: std::pin::Pin<&mut Self>,
3251        cx: &mut std::task::Context<'_>,
3252    ) -> std::task::Poll<Option<Self::Item>> {
3253        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3254            &mut self.event_receiver,
3255            cx
3256        )?) {
3257            Some(buf) => std::task::Poll::Ready(Some(SystemActivityMonitorEvent::decode(buf))),
3258            None => std::task::Poll::Ready(None),
3259        }
3260    }
3261}
3262
3263#[derive(Debug)]
3264pub enum SystemActivityMonitorEvent {
3265    #[non_exhaustive]
3266    _UnknownEvent {
3267        /// Ordinal of the event that was sent.
3268        ordinal: u64,
3269    },
3270}
3271
3272impl SystemActivityMonitorEvent {
3273    /// Decodes a message buffer as a [`SystemActivityMonitorEvent`].
3274    fn decode(
3275        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3276    ) -> Result<SystemActivityMonitorEvent, fidl::Error> {
3277        let (bytes, _handles) = buf.split_mut();
3278        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3279        debug_assert_eq!(tx_header.tx_id, 0);
3280        match tx_header.ordinal {
3281            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3282                Ok(SystemActivityMonitorEvent::_UnknownEvent {
3283                    ordinal: tx_header.ordinal,
3284                })
3285            }
3286            _ => Err(fidl::Error::UnknownOrdinal {
3287                ordinal: tx_header.ordinal,
3288                protocol_name: <SystemActivityMonitorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
3289            })
3290        }
3291    }
3292}
3293
3294/// A Stream of incoming requests for fuchsia.diagnostics/SystemActivityMonitor.
3295pub struct SystemActivityMonitorRequestStream {
3296    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
3297    is_terminated: bool,
3298}
3299
3300impl std::marker::Unpin for SystemActivityMonitorRequestStream {}
3301
3302impl futures::stream::FusedStream for SystemActivityMonitorRequestStream {
3303    fn is_terminated(&self) -> bool {
3304        self.is_terminated
3305    }
3306}
3307
3308impl fdomain_client::fidl::RequestStream for SystemActivityMonitorRequestStream {
3309    type Protocol = SystemActivityMonitorMarker;
3310    type ControlHandle = SystemActivityMonitorControlHandle;
3311
3312    fn from_channel(channel: fdomain_client::Channel) -> Self {
3313        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3314    }
3315
3316    fn control_handle(&self) -> Self::ControlHandle {
3317        SystemActivityMonitorControlHandle { inner: self.inner.clone() }
3318    }
3319
3320    fn into_inner(
3321        self,
3322    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
3323    {
3324        (self.inner, self.is_terminated)
3325    }
3326
3327    fn from_inner(
3328        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
3329        is_terminated: bool,
3330    ) -> Self {
3331        Self { inner, is_terminated }
3332    }
3333}
3334
3335impl futures::Stream for SystemActivityMonitorRequestStream {
3336    type Item = Result<SystemActivityMonitorRequest, fidl::Error>;
3337
3338    fn poll_next(
3339        mut self: std::pin::Pin<&mut Self>,
3340        cx: &mut std::task::Context<'_>,
3341    ) -> std::task::Poll<Option<Self::Item>> {
3342        let this = &mut *self;
3343        if this.inner.check_shutdown(cx) {
3344            this.is_terminated = true;
3345            return std::task::Poll::Ready(None);
3346        }
3347        if this.is_terminated {
3348            panic!("polled SystemActivityMonitorRequestStream after completion");
3349        }
3350        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
3351            |bytes, handles| {
3352                match this.inner.channel().read_etc(cx, bytes, handles) {
3353                    std::task::Poll::Ready(Ok(())) => {}
3354                    std::task::Poll::Pending => return std::task::Poll::Pending,
3355                    std::task::Poll::Ready(Err(None)) => {
3356                        this.is_terminated = true;
3357                        return std::task::Poll::Ready(None);
3358                    }
3359                    std::task::Poll::Ready(Err(Some(e))) => {
3360                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3361                            e.into(),
3362                        ))));
3363                    }
3364                }
3365
3366                // A message has been received from the channel
3367                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3368
3369                std::task::Poll::Ready(Some(match header.ordinal {
3370                0x354b94623dd41af9 => {
3371                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3372                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
3373                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3374                    let control_handle = SystemActivityMonitorControlHandle {
3375                        inner: this.inner.clone(),
3376                    };
3377                    Ok(SystemActivityMonitorRequest::GetNextEvent {
3378                        responder: SystemActivityMonitorGetNextEventResponder {
3379                            control_handle: std::mem::ManuallyDrop::new(control_handle),
3380                            tx_id: header.tx_id,
3381                        },
3382                    })
3383                }
3384                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3385                    Ok(SystemActivityMonitorRequest::_UnknownMethod {
3386                        ordinal: header.ordinal,
3387                        control_handle: SystemActivityMonitorControlHandle { inner: this.inner.clone() },
3388                        method_type: fidl::MethodType::OneWay,
3389                    })
3390                }
3391                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3392                    this.inner.send_framework_err(
3393                        fidl::encoding::FrameworkErr::UnknownMethod,
3394                        header.tx_id,
3395                        header.ordinal,
3396                        header.dynamic_flags(),
3397                        (bytes, handles),
3398                    )?;
3399                    Ok(SystemActivityMonitorRequest::_UnknownMethod {
3400                        ordinal: header.ordinal,
3401                        control_handle: SystemActivityMonitorControlHandle { inner: this.inner.clone() },
3402                        method_type: fidl::MethodType::TwoWay,
3403                    })
3404                }
3405                _ => Err(fidl::Error::UnknownOrdinal {
3406                    ordinal: header.ordinal,
3407                    protocol_name: <SystemActivityMonitorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
3408                }),
3409            }))
3410            },
3411        )
3412    }
3413}
3414
3415#[derive(Debug)]
3416pub enum SystemActivityMonitorRequest {
3417    /// Blocks until a system activity event (e.g. CPU boost starting or ending)
3418    /// occurs, returning the event.
3419    GetNextEvent { responder: SystemActivityMonitorGetNextEventResponder },
3420    /// An interaction was received which does not match any known method.
3421    #[non_exhaustive]
3422    _UnknownMethod {
3423        /// Ordinal of the method that was called.
3424        ordinal: u64,
3425        control_handle: SystemActivityMonitorControlHandle,
3426        method_type: fidl::MethodType,
3427    },
3428}
3429
3430impl SystemActivityMonitorRequest {
3431    #[allow(irrefutable_let_patterns)]
3432    pub fn into_get_next_event(self) -> Option<(SystemActivityMonitorGetNextEventResponder)> {
3433        if let SystemActivityMonitorRequest::GetNextEvent { responder } = self {
3434            Some((responder))
3435        } else {
3436            None
3437        }
3438    }
3439
3440    /// Name of the method defined in FIDL
3441    pub fn method_name(&self) -> &'static str {
3442        match *self {
3443            SystemActivityMonitorRequest::GetNextEvent { .. } => "get_next_event",
3444            SystemActivityMonitorRequest::_UnknownMethod {
3445                method_type: fidl::MethodType::OneWay,
3446                ..
3447            } => "unknown one-way method",
3448            SystemActivityMonitorRequest::_UnknownMethod {
3449                method_type: fidl::MethodType::TwoWay,
3450                ..
3451            } => "unknown two-way method",
3452        }
3453    }
3454}
3455
3456#[derive(Debug, Clone)]
3457pub struct SystemActivityMonitorControlHandle {
3458    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
3459}
3460
3461impl SystemActivityMonitorControlHandle {
3462    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
3463        self.inner.shutdown_with_epitaph(status.into())
3464    }
3465}
3466
3467impl fdomain_client::fidl::ControlHandle for SystemActivityMonitorControlHandle {
3468    fn shutdown(&self) {
3469        self.inner.shutdown()
3470    }
3471
3472    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
3473        self.inner.shutdown_with_epitaph(status)
3474    }
3475
3476    fn is_closed(&self) -> bool {
3477        self.inner.channel().is_closed()
3478    }
3479    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
3480        self.inner.channel().on_closed()
3481    }
3482}
3483
3484impl SystemActivityMonitorControlHandle {}
3485
3486#[must_use = "FIDL methods require a response to be sent"]
3487#[derive(Debug)]
3488pub struct SystemActivityMonitorGetNextEventResponder {
3489    control_handle: std::mem::ManuallyDrop<SystemActivityMonitorControlHandle>,
3490    tx_id: u32,
3491}
3492
3493/// Set the the channel to be shutdown (see [`SystemActivityMonitorControlHandle::shutdown`])
3494/// if the responder is dropped without sending a response, so that the client
3495/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3496impl std::ops::Drop for SystemActivityMonitorGetNextEventResponder {
3497    fn drop(&mut self) {
3498        self.control_handle.shutdown();
3499        // Safety: drops once, never accessed again
3500        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3501    }
3502}
3503
3504impl fdomain_client::fidl::Responder for SystemActivityMonitorGetNextEventResponder {
3505    type ControlHandle = SystemActivityMonitorControlHandle;
3506
3507    fn control_handle(&self) -> &SystemActivityMonitorControlHandle {
3508        &self.control_handle
3509    }
3510
3511    fn drop_without_shutdown(mut self) {
3512        // Safety: drops once, never accessed again due to mem::forget
3513        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3514        // Prevent Drop from running (which would shut down the channel)
3515        std::mem::forget(self);
3516    }
3517}
3518
3519impl SystemActivityMonitorGetNextEventResponder {
3520    /// Sends a response to the FIDL transaction.
3521    ///
3522    /// Sets the channel to shutdown if an error occurs.
3523    pub fn send(self, mut event: &SystemActivityEvent) -> Result<(), fidl::Error> {
3524        let _result = self.send_raw(event);
3525        if _result.is_err() {
3526            self.control_handle.shutdown();
3527        }
3528        self.drop_without_shutdown();
3529        _result
3530    }
3531
3532    /// Similar to "send" but does not shutdown the channel if an error occurs.
3533    pub fn send_no_shutdown_on_err(
3534        self,
3535        mut event: &SystemActivityEvent,
3536    ) -> Result<(), fidl::Error> {
3537        let _result = self.send_raw(event);
3538        self.drop_without_shutdown();
3539        _result
3540    }
3541
3542    fn send_raw(&self, mut event: &SystemActivityEvent) -> Result<(), fidl::Error> {
3543        self.control_handle.inner.send::<fidl::encoding::FlexibleType<
3544            SystemActivityMonitorGetNextEventResponse,
3545        >>(
3546            fidl::encoding::Flexible::new((event,)),
3547            self.tx_id,
3548            0x354b94623dd41af9,
3549            fidl::encoding::DynamicFlags::FLEXIBLE,
3550        )
3551    }
3552}
3553
3554mod internal {
3555    use super::*;
3556
3557    impl fidl::encoding::ResourceTypeMarker for ArchiveAccessorStreamDiagnosticsRequest {
3558        type Borrowed<'a> = &'a mut Self;
3559        fn take_or_borrow<'a>(
3560            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3561        ) -> Self::Borrowed<'a> {
3562            value
3563        }
3564    }
3565
3566    unsafe impl fidl::encoding::TypeMarker for ArchiveAccessorStreamDiagnosticsRequest {
3567        type Owned = Self;
3568
3569        #[inline(always)]
3570        fn inline_align(_context: fidl::encoding::Context) -> usize {
3571            8
3572        }
3573
3574        #[inline(always)]
3575        fn inline_size(_context: fidl::encoding::Context) -> usize {
3576            24
3577        }
3578    }
3579
3580    unsafe impl
3581        fidl::encoding::Encode<
3582            ArchiveAccessorStreamDiagnosticsRequest,
3583            fdomain_client::fidl::FDomainResourceDialect,
3584        > for &mut ArchiveAccessorStreamDiagnosticsRequest
3585    {
3586        #[inline]
3587        unsafe fn encode(
3588            self,
3589            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3590            offset: usize,
3591            _depth: fidl::encoding::Depth,
3592        ) -> fidl::Result<()> {
3593            encoder.debug_check_bounds::<ArchiveAccessorStreamDiagnosticsRequest>(offset);
3594            // Delegate to tuple encoding.
3595            fidl::encoding::Encode::<ArchiveAccessorStreamDiagnosticsRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
3596                (
3597                    <StreamParameters as fidl::encoding::ValueTypeMarker>::borrow(&self.stream_parameters),
3598                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<BatchIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.result_stream),
3599                ),
3600                encoder, offset, _depth
3601            )
3602        }
3603    }
3604    unsafe impl<
3605        T0: fidl::encoding::Encode<StreamParameters, fdomain_client::fidl::FDomainResourceDialect>,
3606        T1: fidl::encoding::Encode<
3607                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<BatchIteratorMarker>>,
3608                fdomain_client::fidl::FDomainResourceDialect,
3609            >,
3610    >
3611        fidl::encoding::Encode<
3612            ArchiveAccessorStreamDiagnosticsRequest,
3613            fdomain_client::fidl::FDomainResourceDialect,
3614        > for (T0, T1)
3615    {
3616        #[inline]
3617        unsafe fn encode(
3618            self,
3619            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3620            offset: usize,
3621            depth: fidl::encoding::Depth,
3622        ) -> fidl::Result<()> {
3623            encoder.debug_check_bounds::<ArchiveAccessorStreamDiagnosticsRequest>(offset);
3624            // Zero out padding regions. There's no need to apply masks
3625            // because the unmasked parts will be overwritten by fields.
3626            unsafe {
3627                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
3628                (ptr as *mut u64).write_unaligned(0);
3629            }
3630            // Write the fields.
3631            self.0.encode(encoder, offset + 0, depth)?;
3632            self.1.encode(encoder, offset + 16, depth)?;
3633            Ok(())
3634        }
3635    }
3636
3637    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
3638        for ArchiveAccessorStreamDiagnosticsRequest
3639    {
3640        #[inline(always)]
3641        fn new_empty() -> Self {
3642            Self {
3643                stream_parameters: fidl::new_empty!(
3644                    StreamParameters,
3645                    fdomain_client::fidl::FDomainResourceDialect
3646                ),
3647                result_stream: fidl::new_empty!(
3648                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<BatchIteratorMarker>>,
3649                    fdomain_client::fidl::FDomainResourceDialect
3650                ),
3651            }
3652        }
3653
3654        #[inline]
3655        unsafe fn decode(
3656            &mut self,
3657            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3658            offset: usize,
3659            _depth: fidl::encoding::Depth,
3660        ) -> fidl::Result<()> {
3661            decoder.debug_check_bounds::<Self>(offset);
3662            // Verify that padding bytes are zero.
3663            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
3664            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3665            let mask = 0xffffffff00000000u64;
3666            let maskedval = padval & mask;
3667            if maskedval != 0 {
3668                return Err(fidl::Error::NonZeroPadding {
3669                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
3670                });
3671            }
3672            fidl::decode!(
3673                StreamParameters,
3674                fdomain_client::fidl::FDomainResourceDialect,
3675                &mut self.stream_parameters,
3676                decoder,
3677                offset + 0,
3678                _depth
3679            )?;
3680            fidl::decode!(
3681                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<BatchIteratorMarker>>,
3682                fdomain_client::fidl::FDomainResourceDialect,
3683                &mut self.result_stream,
3684                decoder,
3685                offset + 16,
3686                _depth
3687            )?;
3688            Ok(())
3689        }
3690    }
3691
3692    impl fidl::encoding::ResourceTypeMarker for ArchiveAccessorStreamDiagnosticsToSocketRequest {
3693        type Borrowed<'a> = &'a mut Self;
3694        fn take_or_borrow<'a>(
3695            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3696        ) -> Self::Borrowed<'a> {
3697            value
3698        }
3699    }
3700
3701    unsafe impl fidl::encoding::TypeMarker for ArchiveAccessorStreamDiagnosticsToSocketRequest {
3702        type Owned = Self;
3703
3704        #[inline(always)]
3705        fn inline_align(_context: fidl::encoding::Context) -> usize {
3706            8
3707        }
3708
3709        #[inline(always)]
3710        fn inline_size(_context: fidl::encoding::Context) -> usize {
3711            24
3712        }
3713    }
3714
3715    unsafe impl
3716        fidl::encoding::Encode<
3717            ArchiveAccessorStreamDiagnosticsToSocketRequest,
3718            fdomain_client::fidl::FDomainResourceDialect,
3719        > for &mut ArchiveAccessorStreamDiagnosticsToSocketRequest
3720    {
3721        #[inline]
3722        unsafe fn encode(
3723            self,
3724            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3725            offset: usize,
3726            _depth: fidl::encoding::Depth,
3727        ) -> fidl::Result<()> {
3728            encoder.debug_check_bounds::<ArchiveAccessorStreamDiagnosticsToSocketRequest>(offset);
3729            // Delegate to tuple encoding.
3730            fidl::encoding::Encode::<
3731                ArchiveAccessorStreamDiagnosticsToSocketRequest,
3732                fdomain_client::fidl::FDomainResourceDialect,
3733            >::encode(
3734                (
3735                    <StreamParameters as fidl::encoding::ValueTypeMarker>::borrow(
3736                        &self.stream_parameters,
3737                    ),
3738                    <fidl::encoding::HandleType<
3739                        fdomain_client::Socket,
3740                        { fidl::ObjectType::SOCKET.into_raw() },
3741                        16392,
3742                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3743                        &mut self.stream
3744                    ),
3745                ),
3746                encoder,
3747                offset,
3748                _depth,
3749            )
3750        }
3751    }
3752    unsafe impl<
3753        T0: fidl::encoding::Encode<StreamParameters, fdomain_client::fidl::FDomainResourceDialect>,
3754        T1: fidl::encoding::Encode<
3755                fidl::encoding::HandleType<
3756                    fdomain_client::Socket,
3757                    { fidl::ObjectType::SOCKET.into_raw() },
3758                    16392,
3759                >,
3760                fdomain_client::fidl::FDomainResourceDialect,
3761            >,
3762    >
3763        fidl::encoding::Encode<
3764            ArchiveAccessorStreamDiagnosticsToSocketRequest,
3765            fdomain_client::fidl::FDomainResourceDialect,
3766        > for (T0, T1)
3767    {
3768        #[inline]
3769        unsafe fn encode(
3770            self,
3771            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3772            offset: usize,
3773            depth: fidl::encoding::Depth,
3774        ) -> fidl::Result<()> {
3775            encoder.debug_check_bounds::<ArchiveAccessorStreamDiagnosticsToSocketRequest>(offset);
3776            // Zero out padding regions. There's no need to apply masks
3777            // because the unmasked parts will be overwritten by fields.
3778            unsafe {
3779                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
3780                (ptr as *mut u64).write_unaligned(0);
3781            }
3782            // Write the fields.
3783            self.0.encode(encoder, offset + 0, depth)?;
3784            self.1.encode(encoder, offset + 16, depth)?;
3785            Ok(())
3786        }
3787    }
3788
3789    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
3790        for ArchiveAccessorStreamDiagnosticsToSocketRequest
3791    {
3792        #[inline(always)]
3793        fn new_empty() -> Self {
3794            Self {
3795                stream_parameters: fidl::new_empty!(
3796                    StreamParameters,
3797                    fdomain_client::fidl::FDomainResourceDialect
3798                ),
3799                stream: fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16392>, fdomain_client::fidl::FDomainResourceDialect),
3800            }
3801        }
3802
3803        #[inline]
3804        unsafe fn decode(
3805            &mut self,
3806            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3807            offset: usize,
3808            _depth: fidl::encoding::Depth,
3809        ) -> fidl::Result<()> {
3810            decoder.debug_check_bounds::<Self>(offset);
3811            // Verify that padding bytes are zero.
3812            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
3813            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3814            let mask = 0xffffffff00000000u64;
3815            let maskedval = padval & mask;
3816            if maskedval != 0 {
3817                return Err(fidl::Error::NonZeroPadding {
3818                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
3819                });
3820            }
3821            fidl::decode!(
3822                StreamParameters,
3823                fdomain_client::fidl::FDomainResourceDialect,
3824                &mut self.stream_parameters,
3825                decoder,
3826                offset + 0,
3827                _depth
3828            )?;
3829            fidl::decode!(fidl::encoding::HandleType<fdomain_client::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16392>, fdomain_client::fidl::FDomainResourceDialect, &mut self.stream, decoder, offset + 16, _depth)?;
3830            Ok(())
3831        }
3832    }
3833
3834    impl fidl::encoding::ResourceTypeMarker for BatchIteratorGetNextResponse {
3835        type Borrowed<'a> = &'a mut Self;
3836        fn take_or_borrow<'a>(
3837            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3838        ) -> Self::Borrowed<'a> {
3839            value
3840        }
3841    }
3842
3843    unsafe impl fidl::encoding::TypeMarker for BatchIteratorGetNextResponse {
3844        type Owned = Self;
3845
3846        #[inline(always)]
3847        fn inline_align(_context: fidl::encoding::Context) -> usize {
3848            8
3849        }
3850
3851        #[inline(always)]
3852        fn inline_size(_context: fidl::encoding::Context) -> usize {
3853            16
3854        }
3855    }
3856
3857    unsafe impl
3858        fidl::encoding::Encode<
3859            BatchIteratorGetNextResponse,
3860            fdomain_client::fidl::FDomainResourceDialect,
3861        > for &mut BatchIteratorGetNextResponse
3862    {
3863        #[inline]
3864        unsafe fn encode(
3865            self,
3866            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3867            offset: usize,
3868            _depth: fidl::encoding::Depth,
3869        ) -> fidl::Result<()> {
3870            encoder.debug_check_bounds::<BatchIteratorGetNextResponse>(offset);
3871            // Delegate to tuple encoding.
3872            fidl::encoding::Encode::<BatchIteratorGetNextResponse, fdomain_client::fidl::FDomainResourceDialect>::encode(
3873                (
3874                    <fidl::encoding::Vector<FormattedContent, 64> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.batch),
3875                ),
3876                encoder, offset, _depth
3877            )
3878        }
3879    }
3880    unsafe impl<
3881        T0: fidl::encoding::Encode<
3882                fidl::encoding::Vector<FormattedContent, 64>,
3883                fdomain_client::fidl::FDomainResourceDialect,
3884            >,
3885    >
3886        fidl::encoding::Encode<
3887            BatchIteratorGetNextResponse,
3888            fdomain_client::fidl::FDomainResourceDialect,
3889        > for (T0,)
3890    {
3891        #[inline]
3892        unsafe fn encode(
3893            self,
3894            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3895            offset: usize,
3896            depth: fidl::encoding::Depth,
3897        ) -> fidl::Result<()> {
3898            encoder.debug_check_bounds::<BatchIteratorGetNextResponse>(offset);
3899            // Zero out padding regions. There's no need to apply masks
3900            // because the unmasked parts will be overwritten by fields.
3901            // Write the fields.
3902            self.0.encode(encoder, offset + 0, depth)?;
3903            Ok(())
3904        }
3905    }
3906
3907    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
3908        for BatchIteratorGetNextResponse
3909    {
3910        #[inline(always)]
3911        fn new_empty() -> Self {
3912            Self {
3913                batch: fidl::new_empty!(fidl::encoding::Vector<FormattedContent, 64>, fdomain_client::fidl::FDomainResourceDialect),
3914            }
3915        }
3916
3917        #[inline]
3918        unsafe fn decode(
3919            &mut self,
3920            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3921            offset: usize,
3922            _depth: fidl::encoding::Depth,
3923        ) -> fidl::Result<()> {
3924            decoder.debug_check_bounds::<Self>(offset);
3925            // Verify that padding bytes are zero.
3926            fidl::decode!(fidl::encoding::Vector<FormattedContent, 64>, fdomain_client::fidl::FDomainResourceDialect, &mut self.batch, decoder, offset + 0, _depth)?;
3927            Ok(())
3928        }
3929    }
3930
3931    impl fidl::encoding::ResourceTypeMarker for SampleCommitRequest {
3932        type Borrowed<'a> = &'a mut Self;
3933        fn take_or_borrow<'a>(
3934            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3935        ) -> Self::Borrowed<'a> {
3936            value
3937        }
3938    }
3939
3940    unsafe impl fidl::encoding::TypeMarker for SampleCommitRequest {
3941        type Owned = Self;
3942
3943        #[inline(always)]
3944        fn inline_align(_context: fidl::encoding::Context) -> usize {
3945            4
3946        }
3947
3948        #[inline(always)]
3949        fn inline_size(_context: fidl::encoding::Context) -> usize {
3950            4
3951        }
3952    }
3953
3954    unsafe impl
3955        fidl::encoding::Encode<SampleCommitRequest, fdomain_client::fidl::FDomainResourceDialect>
3956        for &mut SampleCommitRequest
3957    {
3958        #[inline]
3959        unsafe fn encode(
3960            self,
3961            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3962            offset: usize,
3963            _depth: fidl::encoding::Depth,
3964        ) -> fidl::Result<()> {
3965            encoder.debug_check_bounds::<SampleCommitRequest>(offset);
3966            // Delegate to tuple encoding.
3967            fidl::encoding::Encode::<SampleCommitRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
3968                (
3969                    <fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<SampleSinkMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.sink),
3970                ),
3971                encoder, offset, _depth
3972            )
3973        }
3974    }
3975    unsafe impl<
3976        T0: fidl::encoding::Encode<
3977                fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<SampleSinkMarker>>,
3978                fdomain_client::fidl::FDomainResourceDialect,
3979            >,
3980    > fidl::encoding::Encode<SampleCommitRequest, fdomain_client::fidl::FDomainResourceDialect>
3981        for (T0,)
3982    {
3983        #[inline]
3984        unsafe fn encode(
3985            self,
3986            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3987            offset: usize,
3988            depth: fidl::encoding::Depth,
3989        ) -> fidl::Result<()> {
3990            encoder.debug_check_bounds::<SampleCommitRequest>(offset);
3991            // Zero out padding regions. There's no need to apply masks
3992            // because the unmasked parts will be overwritten by fields.
3993            // Write the fields.
3994            self.0.encode(encoder, offset + 0, depth)?;
3995            Ok(())
3996        }
3997    }
3998
3999    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
4000        for SampleCommitRequest
4001    {
4002        #[inline(always)]
4003        fn new_empty() -> Self {
4004            Self {
4005                sink: fidl::new_empty!(
4006                    fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<SampleSinkMarker>>,
4007                    fdomain_client::fidl::FDomainResourceDialect
4008                ),
4009            }
4010        }
4011
4012        #[inline]
4013        unsafe fn decode(
4014            &mut self,
4015            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
4016            offset: usize,
4017            _depth: fidl::encoding::Depth,
4018        ) -> fidl::Result<()> {
4019            decoder.debug_check_bounds::<Self>(offset);
4020            // Verify that padding bytes are zero.
4021            fidl::decode!(
4022                fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<SampleSinkMarker>>,
4023                fdomain_client::fidl::FDomainResourceDialect,
4024                &mut self.sink,
4025                decoder,
4026                offset + 0,
4027                _depth
4028            )?;
4029            Ok(())
4030        }
4031    }
4032
4033    impl fidl::encoding::ResourceTypeMarker for SampleSetRequest {
4034        type Borrowed<'a> = &'a mut Self;
4035        fn take_or_borrow<'a>(
4036            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4037        ) -> Self::Borrowed<'a> {
4038            value
4039        }
4040    }
4041
4042    unsafe impl fidl::encoding::TypeMarker for SampleSetRequest {
4043        type Owned = Self;
4044
4045        #[inline(always)]
4046        fn inline_align(_context: fidl::encoding::Context) -> usize {
4047            8
4048        }
4049
4050        #[inline(always)]
4051        fn inline_size(_context: fidl::encoding::Context) -> usize {
4052            16
4053        }
4054    }
4055
4056    unsafe impl
4057        fidl::encoding::Encode<SampleSetRequest, fdomain_client::fidl::FDomainResourceDialect>
4058        for &mut SampleSetRequest
4059    {
4060        #[inline]
4061        unsafe fn encode(
4062            self,
4063            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
4064            offset: usize,
4065            _depth: fidl::encoding::Depth,
4066        ) -> fidl::Result<()> {
4067            encoder.debug_check_bounds::<SampleSetRequest>(offset);
4068            // Delegate to tuple encoding.
4069            fidl::encoding::Encode::<SampleSetRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
4070                (
4071                    <SampleParameters as fidl::encoding::ValueTypeMarker>::borrow(&self.sample_parameters),
4072                ),
4073                encoder, offset, _depth
4074            )
4075        }
4076    }
4077    unsafe impl<
4078        T0: fidl::encoding::Encode<SampleParameters, fdomain_client::fidl::FDomainResourceDialect>,
4079    > fidl::encoding::Encode<SampleSetRequest, fdomain_client::fidl::FDomainResourceDialect>
4080        for (T0,)
4081    {
4082        #[inline]
4083        unsafe fn encode(
4084            self,
4085            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
4086            offset: usize,
4087            depth: fidl::encoding::Depth,
4088        ) -> fidl::Result<()> {
4089            encoder.debug_check_bounds::<SampleSetRequest>(offset);
4090            // Zero out padding regions. There's no need to apply masks
4091            // because the unmasked parts will be overwritten by fields.
4092            // Write the fields.
4093            self.0.encode(encoder, offset + 0, depth)?;
4094            Ok(())
4095        }
4096    }
4097
4098    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
4099        for SampleSetRequest
4100    {
4101        #[inline(always)]
4102        fn new_empty() -> Self {
4103            Self {
4104                sample_parameters: fidl::new_empty!(
4105                    SampleParameters,
4106                    fdomain_client::fidl::FDomainResourceDialect
4107                ),
4108            }
4109        }
4110
4111        #[inline]
4112        unsafe fn decode(
4113            &mut self,
4114            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
4115            offset: usize,
4116            _depth: fidl::encoding::Depth,
4117        ) -> fidl::Result<()> {
4118            decoder.debug_check_bounds::<Self>(offset);
4119            // Verify that padding bytes are zero.
4120            fidl::decode!(
4121                SampleParameters,
4122                fdomain_client::fidl::FDomainResourceDialect,
4123                &mut self.sample_parameters,
4124                decoder,
4125                offset + 0,
4126                _depth
4127            )?;
4128            Ok(())
4129        }
4130    }
4131
4132    impl fidl::encoding::ResourceTypeMarker for SampleSinkOnSampleReadiedRequest {
4133        type Borrowed<'a> = &'a mut Self;
4134        fn take_or_borrow<'a>(
4135            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4136        ) -> Self::Borrowed<'a> {
4137            value
4138        }
4139    }
4140
4141    unsafe impl fidl::encoding::TypeMarker for SampleSinkOnSampleReadiedRequest {
4142        type Owned = Self;
4143
4144        #[inline(always)]
4145        fn inline_align(_context: fidl::encoding::Context) -> usize {
4146            8
4147        }
4148
4149        #[inline(always)]
4150        fn inline_size(_context: fidl::encoding::Context) -> usize {
4151            16
4152        }
4153    }
4154
4155    unsafe impl
4156        fidl::encoding::Encode<
4157            SampleSinkOnSampleReadiedRequest,
4158            fdomain_client::fidl::FDomainResourceDialect,
4159        > for &mut SampleSinkOnSampleReadiedRequest
4160    {
4161        #[inline]
4162        unsafe fn encode(
4163            self,
4164            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
4165            offset: usize,
4166            _depth: fidl::encoding::Depth,
4167        ) -> fidl::Result<()> {
4168            encoder.debug_check_bounds::<SampleSinkOnSampleReadiedRequest>(offset);
4169            // Delegate to tuple encoding.
4170            fidl::encoding::Encode::<
4171                SampleSinkOnSampleReadiedRequest,
4172                fdomain_client::fidl::FDomainResourceDialect,
4173            >::encode(
4174                (<SampleSinkResult as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4175                    &mut self.event,
4176                ),),
4177                encoder,
4178                offset,
4179                _depth,
4180            )
4181        }
4182    }
4183    unsafe impl<
4184        T0: fidl::encoding::Encode<SampleSinkResult, fdomain_client::fidl::FDomainResourceDialect>,
4185    >
4186        fidl::encoding::Encode<
4187            SampleSinkOnSampleReadiedRequest,
4188            fdomain_client::fidl::FDomainResourceDialect,
4189        > for (T0,)
4190    {
4191        #[inline]
4192        unsafe fn encode(
4193            self,
4194            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
4195            offset: usize,
4196            depth: fidl::encoding::Depth,
4197        ) -> fidl::Result<()> {
4198            encoder.debug_check_bounds::<SampleSinkOnSampleReadiedRequest>(offset);
4199            // Zero out padding regions. There's no need to apply masks
4200            // because the unmasked parts will be overwritten by fields.
4201            // Write the fields.
4202            self.0.encode(encoder, offset + 0, depth)?;
4203            Ok(())
4204        }
4205    }
4206
4207    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
4208        for SampleSinkOnSampleReadiedRequest
4209    {
4210        #[inline(always)]
4211        fn new_empty() -> Self {
4212            Self {
4213                event: fidl::new_empty!(
4214                    SampleSinkResult,
4215                    fdomain_client::fidl::FDomainResourceDialect
4216                ),
4217            }
4218        }
4219
4220        #[inline]
4221        unsafe fn decode(
4222            &mut self,
4223            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
4224            offset: usize,
4225            _depth: fidl::encoding::Depth,
4226        ) -> fidl::Result<()> {
4227            decoder.debug_check_bounds::<Self>(offset);
4228            // Verify that padding bytes are zero.
4229            fidl::decode!(
4230                SampleSinkResult,
4231                fdomain_client::fidl::FDomainResourceDialect,
4232                &mut self.event,
4233                decoder,
4234                offset + 0,
4235                _depth
4236            )?;
4237            Ok(())
4238        }
4239    }
4240
4241    impl SampleReady {
4242        #[inline(always)]
4243        fn max_ordinal_present(&self) -> u64 {
4244            if let Some(_) = self.seconds_since_start {
4245                return 2;
4246            }
4247            if let Some(_) = self.batch_iter {
4248                return 1;
4249            }
4250            0
4251        }
4252    }
4253
4254    impl fidl::encoding::ResourceTypeMarker for SampleReady {
4255        type Borrowed<'a> = &'a mut Self;
4256        fn take_or_borrow<'a>(
4257            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4258        ) -> Self::Borrowed<'a> {
4259            value
4260        }
4261    }
4262
4263    unsafe impl fidl::encoding::TypeMarker for SampleReady {
4264        type Owned = Self;
4265
4266        #[inline(always)]
4267        fn inline_align(_context: fidl::encoding::Context) -> usize {
4268            8
4269        }
4270
4271        #[inline(always)]
4272        fn inline_size(_context: fidl::encoding::Context) -> usize {
4273            16
4274        }
4275    }
4276
4277    unsafe impl fidl::encoding::Encode<SampleReady, fdomain_client::fidl::FDomainResourceDialect>
4278        for &mut SampleReady
4279    {
4280        unsafe fn encode(
4281            self,
4282            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
4283            offset: usize,
4284            mut depth: fidl::encoding::Depth,
4285        ) -> fidl::Result<()> {
4286            encoder.debug_check_bounds::<SampleReady>(offset);
4287            // Vector header
4288            let max_ordinal: u64 = self.max_ordinal_present();
4289            encoder.write_num(max_ordinal, offset);
4290            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4291            // Calling encoder.out_of_line_offset(0) is not allowed.
4292            if max_ordinal == 0 {
4293                return Ok(());
4294            }
4295            depth.increment()?;
4296            let envelope_size = 8;
4297            let bytes_len = max_ordinal as usize * envelope_size;
4298            #[allow(unused_variables)]
4299            let offset = encoder.out_of_line_offset(bytes_len);
4300            let mut _prev_end_offset: usize = 0;
4301            if 1 > max_ordinal {
4302                return Ok(());
4303            }
4304
4305            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4306            // are envelope_size bytes.
4307            let cur_offset: usize = (1 - 1) * envelope_size;
4308
4309            // Zero reserved fields.
4310            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4311
4312            // Safety:
4313            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4314            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4315            //   envelope_size bytes, there is always sufficient room.
4316            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<BatchIteratorMarker>>, fdomain_client::fidl::FDomainResourceDialect>(
4317            self.batch_iter.as_mut().map(<fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<BatchIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
4318            encoder, offset + cur_offset, depth
4319        )?;
4320
4321            _prev_end_offset = cur_offset + envelope_size;
4322            if 2 > max_ordinal {
4323                return Ok(());
4324            }
4325
4326            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4327            // are envelope_size bytes.
4328            let cur_offset: usize = (2 - 1) * envelope_size;
4329
4330            // Zero reserved fields.
4331            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4332
4333            // Safety:
4334            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4335            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4336            //   envelope_size bytes, there is always sufficient room.
4337            fidl::encoding::encode_in_envelope_optional::<
4338                i64,
4339                fdomain_client::fidl::FDomainResourceDialect,
4340            >(
4341                self.seconds_since_start
4342                    .as_ref()
4343                    .map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4344                encoder,
4345                offset + cur_offset,
4346                depth,
4347            )?;
4348
4349            _prev_end_offset = cur_offset + envelope_size;
4350
4351            Ok(())
4352        }
4353    }
4354
4355    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect> for SampleReady {
4356        #[inline(always)]
4357        fn new_empty() -> Self {
4358            Self::default()
4359        }
4360
4361        unsafe fn decode(
4362            &mut self,
4363            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
4364            offset: usize,
4365            mut depth: fidl::encoding::Depth,
4366        ) -> fidl::Result<()> {
4367            decoder.debug_check_bounds::<Self>(offset);
4368            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4369                None => return Err(fidl::Error::NotNullable),
4370                Some(len) => len,
4371            };
4372            // Calling decoder.out_of_line_offset(0) is not allowed.
4373            if len == 0 {
4374                return Ok(());
4375            };
4376            depth.increment()?;
4377            let envelope_size = 8;
4378            let bytes_len = len * envelope_size;
4379            let offset = decoder.out_of_line_offset(bytes_len)?;
4380            // Decode the envelope for each type.
4381            let mut _next_ordinal_to_read = 0;
4382            let mut next_offset = offset;
4383            let end_offset = offset + bytes_len;
4384            _next_ordinal_to_read += 1;
4385            if next_offset >= end_offset {
4386                return Ok(());
4387            }
4388
4389            // Decode unknown envelopes for gaps in ordinals.
4390            while _next_ordinal_to_read < 1 {
4391                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4392                _next_ordinal_to_read += 1;
4393                next_offset += envelope_size;
4394            }
4395
4396            let next_out_of_line = decoder.next_out_of_line();
4397            let handles_before = decoder.remaining_handles();
4398            if let Some((inlined, num_bytes, num_handles)) =
4399                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4400            {
4401                let member_inline_size = <fidl::encoding::Endpoint<
4402                    fdomain_client::fidl::ClientEnd<BatchIteratorMarker>,
4403                > as fidl::encoding::TypeMarker>::inline_size(
4404                    decoder.context
4405                );
4406                if inlined != (member_inline_size <= 4) {
4407                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4408                }
4409                let inner_offset;
4410                let mut inner_depth = depth.clone();
4411                if inlined {
4412                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4413                    inner_offset = next_offset;
4414                } else {
4415                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4416                    inner_depth.increment()?;
4417                }
4418                let val_ref = self.batch_iter.get_or_insert_with(|| {
4419                    fidl::new_empty!(
4420                        fidl::encoding::Endpoint<
4421                            fdomain_client::fidl::ClientEnd<BatchIteratorMarker>,
4422                        >,
4423                        fdomain_client::fidl::FDomainResourceDialect
4424                    )
4425                });
4426                fidl::decode!(
4427                    fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<BatchIteratorMarker>>,
4428                    fdomain_client::fidl::FDomainResourceDialect,
4429                    val_ref,
4430                    decoder,
4431                    inner_offset,
4432                    inner_depth
4433                )?;
4434                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4435                {
4436                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4437                }
4438                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4439                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4440                }
4441            }
4442
4443            next_offset += envelope_size;
4444            _next_ordinal_to_read += 1;
4445            if next_offset >= end_offset {
4446                return Ok(());
4447            }
4448
4449            // Decode unknown envelopes for gaps in ordinals.
4450            while _next_ordinal_to_read < 2 {
4451                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4452                _next_ordinal_to_read += 1;
4453                next_offset += envelope_size;
4454            }
4455
4456            let next_out_of_line = decoder.next_out_of_line();
4457            let handles_before = decoder.remaining_handles();
4458            if let Some((inlined, num_bytes, num_handles)) =
4459                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4460            {
4461                let member_inline_size =
4462                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4463                if inlined != (member_inline_size <= 4) {
4464                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4465                }
4466                let inner_offset;
4467                let mut inner_depth = depth.clone();
4468                if inlined {
4469                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4470                    inner_offset = next_offset;
4471                } else {
4472                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4473                    inner_depth.increment()?;
4474                }
4475                let val_ref = self.seconds_since_start.get_or_insert_with(|| {
4476                    fidl::new_empty!(i64, fdomain_client::fidl::FDomainResourceDialect)
4477                });
4478                fidl::decode!(
4479                    i64,
4480                    fdomain_client::fidl::FDomainResourceDialect,
4481                    val_ref,
4482                    decoder,
4483                    inner_offset,
4484                    inner_depth
4485                )?;
4486                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4487                {
4488                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4489                }
4490                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4491                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4492                }
4493            }
4494
4495            next_offset += envelope_size;
4496
4497            // Decode the remaining unknown envelopes.
4498            while next_offset < end_offset {
4499                _next_ordinal_to_read += 1;
4500                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4501                next_offset += envelope_size;
4502            }
4503
4504            Ok(())
4505        }
4506    }
4507
4508    impl fidl::encoding::ResourceTypeMarker for FormattedContent {
4509        type Borrowed<'a> = &'a mut Self;
4510        fn take_or_borrow<'a>(
4511            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4512        ) -> Self::Borrowed<'a> {
4513            value
4514        }
4515    }
4516
4517    unsafe impl fidl::encoding::TypeMarker for FormattedContent {
4518        type Owned = Self;
4519
4520        #[inline(always)]
4521        fn inline_align(_context: fidl::encoding::Context) -> usize {
4522            8
4523        }
4524
4525        #[inline(always)]
4526        fn inline_size(_context: fidl::encoding::Context) -> usize {
4527            16
4528        }
4529    }
4530
4531    unsafe impl
4532        fidl::encoding::Encode<FormattedContent, fdomain_client::fidl::FDomainResourceDialect>
4533        for &mut FormattedContent
4534    {
4535        #[inline]
4536        unsafe fn encode(
4537            self,
4538            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
4539            offset: usize,
4540            _depth: fidl::encoding::Depth,
4541        ) -> fidl::Result<()> {
4542            encoder.debug_check_bounds::<FormattedContent>(offset);
4543            encoder.write_num::<u64>(self.ordinal(), offset);
4544            match self {
4545            FormattedContent::Json(ref mut val) => {
4546                fidl::encoding::encode_in_envelope::<fdomain_fuchsia_mem::Buffer, fdomain_client::fidl::FDomainResourceDialect>(
4547                    <fdomain_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
4548                    encoder, offset + 8, _depth
4549                )
4550            }
4551            FormattedContent::Cbor(ref mut val) => {
4552                fidl::encoding::encode_in_envelope::<fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect>(
4553                    <fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
4554                    encoder, offset + 8, _depth
4555                )
4556            }
4557            FormattedContent::Fxt(ref mut val) => {
4558                fidl::encoding::encode_in_envelope::<fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect>(
4559                    <fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
4560                    encoder, offset + 8, _depth
4561                )
4562            }
4563            FormattedContent::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
4564        }
4565        }
4566    }
4567
4568    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
4569        for FormattedContent
4570    {
4571        #[inline(always)]
4572        fn new_empty() -> Self {
4573            Self::__SourceBreaking { unknown_ordinal: 0 }
4574        }
4575
4576        #[inline]
4577        unsafe fn decode(
4578            &mut self,
4579            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
4580            offset: usize,
4581            mut depth: fidl::encoding::Depth,
4582        ) -> fidl::Result<()> {
4583            decoder.debug_check_bounds::<Self>(offset);
4584            #[allow(unused_variables)]
4585            let next_out_of_line = decoder.next_out_of_line();
4586            let handles_before = decoder.remaining_handles();
4587            let (ordinal, inlined, num_bytes, num_handles) =
4588                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
4589
4590            let member_inline_size = match ordinal {
4591                1 => <fdomain_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
4592                    decoder.context,
4593                ),
4594                3 => <fidl::encoding::HandleType<
4595                    fdomain_client::Vmo,
4596                    { fidl::ObjectType::VMO.into_raw() },
4597                    2147483648,
4598                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4599                4 => <fidl::encoding::HandleType<
4600                    fdomain_client::Vmo,
4601                    { fidl::ObjectType::VMO.into_raw() },
4602                    2147483648,
4603                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4604                0 => return Err(fidl::Error::UnknownUnionTag),
4605                _ => num_bytes as usize,
4606            };
4607
4608            if inlined != (member_inline_size <= 4) {
4609                return Err(fidl::Error::InvalidInlineBitInEnvelope);
4610            }
4611            let _inner_offset;
4612            if inlined {
4613                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
4614                _inner_offset = offset + 8;
4615            } else {
4616                depth.increment()?;
4617                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4618            }
4619            match ordinal {
4620                1 => {
4621                    #[allow(irrefutable_let_patterns)]
4622                    if let FormattedContent::Json(_) = self {
4623                        // Do nothing, read the value into the object
4624                    } else {
4625                        // Initialize `self` to the right variant
4626                        *self = FormattedContent::Json(fidl::new_empty!(
4627                            fdomain_fuchsia_mem::Buffer,
4628                            fdomain_client::fidl::FDomainResourceDialect
4629                        ));
4630                    }
4631                    #[allow(irrefutable_let_patterns)]
4632                    if let FormattedContent::Json(ref mut val) = self {
4633                        fidl::decode!(
4634                            fdomain_fuchsia_mem::Buffer,
4635                            fdomain_client::fidl::FDomainResourceDialect,
4636                            val,
4637                            decoder,
4638                            _inner_offset,
4639                            depth
4640                        )?;
4641                    } else {
4642                        unreachable!()
4643                    }
4644                }
4645                3 => {
4646                    #[allow(irrefutable_let_patterns)]
4647                    if let FormattedContent::Cbor(_) = self {
4648                        // Do nothing, read the value into the object
4649                    } else {
4650                        // Initialize `self` to the right variant
4651                        *self = FormattedContent::Cbor(
4652                            fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect),
4653                        );
4654                    }
4655                    #[allow(irrefutable_let_patterns)]
4656                    if let FormattedContent::Cbor(ref mut val) = self {
4657                        fidl::decode!(fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect, val, decoder, _inner_offset, depth)?;
4658                    } else {
4659                        unreachable!()
4660                    }
4661                }
4662                4 => {
4663                    #[allow(irrefutable_let_patterns)]
4664                    if let FormattedContent::Fxt(_) = self {
4665                        // Do nothing, read the value into the object
4666                    } else {
4667                        // Initialize `self` to the right variant
4668                        *self = FormattedContent::Fxt(
4669                            fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect),
4670                        );
4671                    }
4672                    #[allow(irrefutable_let_patterns)]
4673                    if let FormattedContent::Fxt(ref mut val) = self {
4674                        fidl::decode!(fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect, val, decoder, _inner_offset, depth)?;
4675                    } else {
4676                        unreachable!()
4677                    }
4678                }
4679                #[allow(deprecated)]
4680                ordinal => {
4681                    for _ in 0..num_handles {
4682                        decoder.drop_next_handle()?;
4683                    }
4684                    *self = FormattedContent::__SourceBreaking { unknown_ordinal: ordinal };
4685                }
4686            }
4687            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
4688                return Err(fidl::Error::InvalidNumBytesInEnvelope);
4689            }
4690            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4691                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4692            }
4693            Ok(())
4694        }
4695    }
4696
4697    impl fidl::encoding::ResourceTypeMarker for SampleSinkResult {
4698        type Borrowed<'a> = &'a mut Self;
4699        fn take_or_borrow<'a>(
4700            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4701        ) -> Self::Borrowed<'a> {
4702            value
4703        }
4704    }
4705
4706    unsafe impl fidl::encoding::TypeMarker for SampleSinkResult {
4707        type Owned = Self;
4708
4709        #[inline(always)]
4710        fn inline_align(_context: fidl::encoding::Context) -> usize {
4711            8
4712        }
4713
4714        #[inline(always)]
4715        fn inline_size(_context: fidl::encoding::Context) -> usize {
4716            16
4717        }
4718    }
4719
4720    unsafe impl
4721        fidl::encoding::Encode<SampleSinkResult, fdomain_client::fidl::FDomainResourceDialect>
4722        for &mut SampleSinkResult
4723    {
4724        #[inline]
4725        unsafe fn encode(
4726            self,
4727            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
4728            offset: usize,
4729            _depth: fidl::encoding::Depth,
4730        ) -> fidl::Result<()> {
4731            encoder.debug_check_bounds::<SampleSinkResult>(offset);
4732            encoder.write_num::<u64>(self.ordinal(), offset);
4733            match self {
4734                SampleSinkResult::Ready(ref mut val) => fidl::encoding::encode_in_envelope::<
4735                    SampleReady,
4736                    fdomain_client::fidl::FDomainResourceDialect,
4737                >(
4738                    <SampleReady as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
4739                    encoder,
4740                    offset + 8,
4741                    _depth,
4742                ),
4743                SampleSinkResult::Error(ref val) => fidl::encoding::encode_in_envelope::<
4744                    RuntimeError,
4745                    fdomain_client::fidl::FDomainResourceDialect,
4746                >(
4747                    <RuntimeError as fidl::encoding::ValueTypeMarker>::borrow(val),
4748                    encoder,
4749                    offset + 8,
4750                    _depth,
4751                ),
4752                SampleSinkResult::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
4753            }
4754        }
4755    }
4756
4757    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
4758        for SampleSinkResult
4759    {
4760        #[inline(always)]
4761        fn new_empty() -> Self {
4762            Self::__SourceBreaking { unknown_ordinal: 0 }
4763        }
4764
4765        #[inline]
4766        unsafe fn decode(
4767            &mut self,
4768            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
4769            offset: usize,
4770            mut depth: fidl::encoding::Depth,
4771        ) -> fidl::Result<()> {
4772            decoder.debug_check_bounds::<Self>(offset);
4773            #[allow(unused_variables)]
4774            let next_out_of_line = decoder.next_out_of_line();
4775            let handles_before = decoder.remaining_handles();
4776            let (ordinal, inlined, num_bytes, num_handles) =
4777                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
4778
4779            let member_inline_size = match ordinal {
4780                1 => <SampleReady as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4781                2 => <RuntimeError as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4782                0 => return Err(fidl::Error::UnknownUnionTag),
4783                _ => num_bytes as usize,
4784            };
4785
4786            if inlined != (member_inline_size <= 4) {
4787                return Err(fidl::Error::InvalidInlineBitInEnvelope);
4788            }
4789            let _inner_offset;
4790            if inlined {
4791                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
4792                _inner_offset = offset + 8;
4793            } else {
4794                depth.increment()?;
4795                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4796            }
4797            match ordinal {
4798                1 => {
4799                    #[allow(irrefutable_let_patterns)]
4800                    if let SampleSinkResult::Ready(_) = self {
4801                        // Do nothing, read the value into the object
4802                    } else {
4803                        // Initialize `self` to the right variant
4804                        *self = SampleSinkResult::Ready(fidl::new_empty!(
4805                            SampleReady,
4806                            fdomain_client::fidl::FDomainResourceDialect
4807                        ));
4808                    }
4809                    #[allow(irrefutable_let_patterns)]
4810                    if let SampleSinkResult::Ready(ref mut val) = self {
4811                        fidl::decode!(
4812                            SampleReady,
4813                            fdomain_client::fidl::FDomainResourceDialect,
4814                            val,
4815                            decoder,
4816                            _inner_offset,
4817                            depth
4818                        )?;
4819                    } else {
4820                        unreachable!()
4821                    }
4822                }
4823                2 => {
4824                    #[allow(irrefutable_let_patterns)]
4825                    if let SampleSinkResult::Error(_) = self {
4826                        // Do nothing, read the value into the object
4827                    } else {
4828                        // Initialize `self` to the right variant
4829                        *self = SampleSinkResult::Error(fidl::new_empty!(
4830                            RuntimeError,
4831                            fdomain_client::fidl::FDomainResourceDialect
4832                        ));
4833                    }
4834                    #[allow(irrefutable_let_patterns)]
4835                    if let SampleSinkResult::Error(ref mut val) = self {
4836                        fidl::decode!(
4837                            RuntimeError,
4838                            fdomain_client::fidl::FDomainResourceDialect,
4839                            val,
4840                            decoder,
4841                            _inner_offset,
4842                            depth
4843                        )?;
4844                    } else {
4845                        unreachable!()
4846                    }
4847                }
4848                #[allow(deprecated)]
4849                ordinal => {
4850                    for _ in 0..num_handles {
4851                        decoder.drop_next_handle()?;
4852                    }
4853                    *self = SampleSinkResult::__SourceBreaking { unknown_ordinal: ordinal };
4854                }
4855            }
4856            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
4857                return Err(fidl::Error::InvalidNumBytesInEnvelope);
4858            }
4859            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4860                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4861            }
4862            Ok(())
4863        }
4864    }
4865}