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