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