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