Skip to main content

fdomain_fuchsia_diagnostics/
fdomain_fuchsia_diagnostics.rs

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