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