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