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