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