Skip to main content

fidl_fuchsia_diagnostics/
fidl_fuchsia_diagnostics.rs

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