Skip to main content

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