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/// A fidl union containing a complete hierarchy of structured diagnostics
43/// data, such that the content can be parsed into a file by itself.
44#[derive(Debug)]
45pub enum FormattedContent {
46    /// A diagnostics schema encoded as json.
47    /// The VMO will contain up to 1mb of diagnostics data.
48    Json(fdomain_fuchsia_mem::Buffer),
49    /// A diagnostics schema encoded as text.
50    /// The VMO will contain up to 1mb of diagnostics data.
51    Text(fdomain_fuchsia_mem::Buffer),
52    /// A diagnostics schema encoded as cbor.
53    /// The VMO will contain up to 1mb of diagnostics data.
54    /// The size will be in ZX_PROP_VMO_CONTENT_SIZE.
55    Cbor(fdomain_client::Vmo),
56    /// A diagnostics schema encoded as FXT.
57    /// This is only valid for logs data.
58    /// The VMO will contain up to PerformanceConfiguration/max_aggregate_content_size_bytes
59    /// of diagnostics data, or 1mb if not specified.
60    /// The size will be in ZX_PROP_VMO_CONTENT_SIZE.
61    Fxt(fdomain_client::Vmo),
62    #[doc(hidden)]
63    __SourceBreaking { unknown_ordinal: u64 },
64}
65
66/// Pattern that matches an unknown `FormattedContent` member.
67#[macro_export]
68macro_rules! FormattedContentUnknown {
69    () => {
70        _
71    };
72}
73
74// Custom PartialEq so that unknown variants are not equal to themselves.
75impl PartialEq for FormattedContent {
76    fn eq(&self, other: &Self) -> bool {
77        match (self, other) {
78            (Self::Json(x), Self::Json(y)) => *x == *y,
79            (Self::Text(x), Self::Text(y)) => *x == *y,
80            (Self::Cbor(x), Self::Cbor(y)) => *x == *y,
81            (Self::Fxt(x), Self::Fxt(y)) => *x == *y,
82            _ => false,
83        }
84    }
85}
86
87impl FormattedContent {
88    #[inline]
89    pub fn ordinal(&self) -> u64 {
90        match *self {
91            Self::Json(_) => 1,
92            Self::Text(_) => 2,
93            Self::Cbor(_) => 3,
94            Self::Fxt(_) => 4,
95            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
96        }
97    }
98
99    #[inline]
100    pub fn unknown_variant_for_testing() -> Self {
101        Self::__SourceBreaking { unknown_ordinal: 0 }
102    }
103
104    #[inline]
105    pub fn is_unknown(&self) -> bool {
106        match self {
107            Self::__SourceBreaking { .. } => true,
108            _ => false,
109        }
110    }
111}
112
113impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for FormattedContent {}
114
115#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
116pub struct ArchiveAccessorMarker;
117
118impl fdomain_client::fidl::ProtocolMarker for ArchiveAccessorMarker {
119    type Proxy = ArchiveAccessorProxy;
120    type RequestStream = ArchiveAccessorRequestStream;
121
122    const DEBUG_NAME: &'static str = "fuchsia.diagnostics.ArchiveAccessor";
123}
124impl fdomain_client::fidl::DiscoverableProtocolMarker for ArchiveAccessorMarker {}
125
126pub trait ArchiveAccessorProxyInterface: Send + Sync {
127    fn r#stream_diagnostics(
128        &self,
129        stream_parameters: &StreamParameters,
130        result_stream: fdomain_client::fidl::ServerEnd<BatchIteratorMarker>,
131    ) -> Result<(), fidl::Error>;
132    type WaitForReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
133    fn r#wait_for_ready(&self) -> Self::WaitForReadyResponseFut;
134}
135
136#[derive(Debug, Clone)]
137pub struct ArchiveAccessorProxy {
138    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
139}
140
141impl fdomain_client::fidl::Proxy for ArchiveAccessorProxy {
142    type Protocol = ArchiveAccessorMarker;
143
144    fn from_channel(inner: fdomain_client::Channel) -> Self {
145        Self::new(inner)
146    }
147
148    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
149        self.client.into_channel().map_err(|client| Self { client })
150    }
151
152    fn as_channel(&self) -> &fdomain_client::Channel {
153        self.client.as_channel()
154    }
155}
156
157impl ArchiveAccessorProxy {
158    /// Create a new Proxy for fuchsia.diagnostics/ArchiveAccessor.
159    pub fn new(channel: fdomain_client::Channel) -> Self {
160        let protocol_name =
161            <ArchiveAccessorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
162        Self { client: fidl::client::Client::new(channel, protocol_name) }
163    }
164
165    /// Get a Stream of events from the remote end of the protocol.
166    ///
167    /// # Panics
168    ///
169    /// Panics if the event stream was already taken.
170    pub fn take_event_stream(&self) -> ArchiveAccessorEventStream {
171        ArchiveAccessorEventStream { event_receiver: self.client.take_event_receiver() }
172    }
173
174    /// Creates an iterator over diagnostics data on the system.
175    ///   * The iterator may be finite by streaming in SNAPSHOT mode, serving only the
176    ///     current state of diagnostics data on the system.
177    ///   * The iterator may be infinite by streaming in either SNAPSHOT_THEN_SUBSCRIBE
178    ///     or SUBSCRIBE mode; the prior first provides iteration over the current state of
179    ///     the sytem, and then both provide ongoing iteration over newly arriving diagnostics
180    ///     data.
181    ///
182    /// + request `result stream` a [fuchsia.diagnostics/BatchIterator] that diagnostic
183    ///   records are exposed to the client over.
184    ///   * epitaphs:
185    ///      - INVALID_ARGS: A required argument in the StreamParameters struct was missing.
186    ///      - WRONG_TYPE: A selector provided by the StreamParameters struct was incorrectly
187    ///                    formatted.
188    ///
189    /// + request `stream_parameters` is a [fuchsia.diagnostics/StreamParameter] which
190    ///   specifies how to configure the stream.
191    pub fn r#stream_diagnostics(
192        &self,
193        mut stream_parameters: &StreamParameters,
194        mut result_stream: fdomain_client::fidl::ServerEnd<BatchIteratorMarker>,
195    ) -> Result<(), fidl::Error> {
196        ArchiveAccessorProxyInterface::r#stream_diagnostics(self, stream_parameters, result_stream)
197    }
198
199    /// Ensures that the connection with the server was established to prevent
200    /// races when using other pipelined methods of this protocol.
201    pub fn r#wait_for_ready(
202        &self,
203    ) -> fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect> {
204        ArchiveAccessorProxyInterface::r#wait_for_ready(self)
205    }
206}
207
208impl ArchiveAccessorProxyInterface for ArchiveAccessorProxy {
209    fn r#stream_diagnostics(
210        &self,
211        mut stream_parameters: &StreamParameters,
212        mut result_stream: fdomain_client::fidl::ServerEnd<BatchIteratorMarker>,
213    ) -> Result<(), fidl::Error> {
214        self.client.send::<ArchiveAccessorStreamDiagnosticsRequest>(
215            (stream_parameters, result_stream),
216            0x20c73e2ecd653c3e,
217            fidl::encoding::DynamicFlags::FLEXIBLE,
218        )
219    }
220
221    type WaitForReadyResponseFut =
222        fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect>;
223    fn r#wait_for_ready(&self) -> Self::WaitForReadyResponseFut {
224        fn _decode(
225            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
226        ) -> Result<(), fidl::Error> {
227            let _response = fidl::client::decode_transaction_body::<
228                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
229                fdomain_client::fidl::FDomainResourceDialect,
230                0x122963198011bd24,
231            >(_buf?)?
232            .into_result_fdomain::<ArchiveAccessorMarker>("wait_for_ready")?;
233            Ok(_response)
234        }
235        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
236            (),
237            0x122963198011bd24,
238            fidl::encoding::DynamicFlags::FLEXIBLE,
239            _decode,
240        )
241    }
242}
243
244pub struct ArchiveAccessorEventStream {
245    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
246}
247
248impl std::marker::Unpin for ArchiveAccessorEventStream {}
249
250impl futures::stream::FusedStream for ArchiveAccessorEventStream {
251    fn is_terminated(&self) -> bool {
252        self.event_receiver.is_terminated()
253    }
254}
255
256impl futures::Stream for ArchiveAccessorEventStream {
257    type Item = Result<ArchiveAccessorEvent, fidl::Error>;
258
259    fn poll_next(
260        mut self: std::pin::Pin<&mut Self>,
261        cx: &mut std::task::Context<'_>,
262    ) -> std::task::Poll<Option<Self::Item>> {
263        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
264            &mut self.event_receiver,
265            cx
266        )?) {
267            Some(buf) => std::task::Poll::Ready(Some(ArchiveAccessorEvent::decode(buf))),
268            None => std::task::Poll::Ready(None),
269        }
270    }
271}
272
273#[derive(Debug)]
274pub enum ArchiveAccessorEvent {
275    #[non_exhaustive]
276    _UnknownEvent {
277        /// Ordinal of the event that was sent.
278        ordinal: u64,
279    },
280}
281
282impl ArchiveAccessorEvent {
283    /// Decodes a message buffer as a [`ArchiveAccessorEvent`].
284    fn decode(
285        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
286    ) -> Result<ArchiveAccessorEvent, fidl::Error> {
287        let (bytes, _handles) = buf.split_mut();
288        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
289        debug_assert_eq!(tx_header.tx_id, 0);
290        match tx_header.ordinal {
291            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
292                Ok(ArchiveAccessorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
293            }
294            _ => Err(fidl::Error::UnknownOrdinal {
295                ordinal: tx_header.ordinal,
296                protocol_name:
297                    <ArchiveAccessorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
298            }),
299        }
300    }
301}
302
303/// A Stream of incoming requests for fuchsia.diagnostics/ArchiveAccessor.
304pub struct ArchiveAccessorRequestStream {
305    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
306    is_terminated: bool,
307}
308
309impl std::marker::Unpin for ArchiveAccessorRequestStream {}
310
311impl futures::stream::FusedStream for ArchiveAccessorRequestStream {
312    fn is_terminated(&self) -> bool {
313        self.is_terminated
314    }
315}
316
317impl fdomain_client::fidl::RequestStream for ArchiveAccessorRequestStream {
318    type Protocol = ArchiveAccessorMarker;
319    type ControlHandle = ArchiveAccessorControlHandle;
320
321    fn from_channel(channel: fdomain_client::Channel) -> Self {
322        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
323    }
324
325    fn control_handle(&self) -> Self::ControlHandle {
326        ArchiveAccessorControlHandle { inner: self.inner.clone() }
327    }
328
329    fn into_inner(
330        self,
331    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
332    {
333        (self.inner, self.is_terminated)
334    }
335
336    fn from_inner(
337        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
338        is_terminated: bool,
339    ) -> Self {
340        Self { inner, is_terminated }
341    }
342}
343
344impl futures::Stream for ArchiveAccessorRequestStream {
345    type Item = Result<ArchiveAccessorRequest, fidl::Error>;
346
347    fn poll_next(
348        mut self: std::pin::Pin<&mut Self>,
349        cx: &mut std::task::Context<'_>,
350    ) -> std::task::Poll<Option<Self::Item>> {
351        let this = &mut *self;
352        if this.inner.check_shutdown(cx) {
353            this.is_terminated = true;
354            return std::task::Poll::Ready(None);
355        }
356        if this.is_terminated {
357            panic!("polled ArchiveAccessorRequestStream after completion");
358        }
359        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
360            |bytes, handles| {
361                match this.inner.channel().read_etc(cx, bytes, handles) {
362                    std::task::Poll::Ready(Ok(())) => {}
363                    std::task::Poll::Pending => return std::task::Poll::Pending,
364                    std::task::Poll::Ready(Err(None)) => {
365                        this.is_terminated = true;
366                        return std::task::Poll::Ready(None);
367                    }
368                    std::task::Poll::Ready(Err(Some(e))) => {
369                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
370                            e.into(),
371                        ))));
372                    }
373                }
374
375                // A message has been received from the channel
376                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
377
378                std::task::Poll::Ready(Some(match header.ordinal {
379                0x20c73e2ecd653c3e => {
380                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
381                    let mut req = fidl::new_empty!(ArchiveAccessorStreamDiagnosticsRequest, fdomain_client::fidl::FDomainResourceDialect);
382                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<ArchiveAccessorStreamDiagnosticsRequest>(&header, _body_bytes, handles, &mut req)?;
383                    let control_handle = ArchiveAccessorControlHandle {
384                        inner: this.inner.clone(),
385                    };
386                    Ok(ArchiveAccessorRequest::StreamDiagnostics {stream_parameters: req.stream_parameters,
387result_stream: req.result_stream,
388
389                        control_handle,
390                    })
391                }
392                0x122963198011bd24 => {
393                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
394                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
395                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
396                    let control_handle = ArchiveAccessorControlHandle {
397                        inner: this.inner.clone(),
398                    };
399                    Ok(ArchiveAccessorRequest::WaitForReady {
400                        responder: ArchiveAccessorWaitForReadyResponder {
401                            control_handle: std::mem::ManuallyDrop::new(control_handle),
402                            tx_id: header.tx_id,
403                        },
404                    })
405                }
406                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
407                    Ok(ArchiveAccessorRequest::_UnknownMethod {
408                        ordinal: header.ordinal,
409                        control_handle: ArchiveAccessorControlHandle { inner: this.inner.clone() },
410                        method_type: fidl::MethodType::OneWay,
411                    })
412                }
413                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
414                    this.inner.send_framework_err(
415                        fidl::encoding::FrameworkErr::UnknownMethod,
416                        header.tx_id,
417                        header.ordinal,
418                        header.dynamic_flags(),
419                        (bytes, handles),
420                    )?;
421                    Ok(ArchiveAccessorRequest::_UnknownMethod {
422                        ordinal: header.ordinal,
423                        control_handle: ArchiveAccessorControlHandle { inner: this.inner.clone() },
424                        method_type: fidl::MethodType::TwoWay,
425                    })
426                }
427                _ => Err(fidl::Error::UnknownOrdinal {
428                    ordinal: header.ordinal,
429                    protocol_name: <ArchiveAccessorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
430                }),
431            }))
432            },
433        )
434    }
435}
436
437/// Outer protocol for interacting with the different diagnostics data sources.
438#[derive(Debug)]
439pub enum ArchiveAccessorRequest {
440    /// Creates an iterator over diagnostics data on the system.
441    ///   * The iterator may be finite by streaming in SNAPSHOT mode, serving only the
442    ///     current state of diagnostics data on the system.
443    ///   * The iterator may be infinite by streaming in either SNAPSHOT_THEN_SUBSCRIBE
444    ///     or SUBSCRIBE mode; the prior first provides iteration over the current state of
445    ///     the sytem, and then both provide ongoing iteration over newly arriving diagnostics
446    ///     data.
447    ///
448    /// + request `result stream` a [fuchsia.diagnostics/BatchIterator] that diagnostic
449    ///   records are exposed to the client over.
450    ///   * epitaphs:
451    ///      - INVALID_ARGS: A required argument in the StreamParameters struct was missing.
452    ///      - WRONG_TYPE: A selector provided by the StreamParameters struct was incorrectly
453    ///                    formatted.
454    ///
455    /// + request `stream_parameters` is a [fuchsia.diagnostics/StreamParameter] which
456    ///   specifies how to configure the stream.
457    StreamDiagnostics {
458        stream_parameters: StreamParameters,
459        result_stream: fdomain_client::fidl::ServerEnd<BatchIteratorMarker>,
460        control_handle: ArchiveAccessorControlHandle,
461    },
462    /// Ensures that the connection with the server was established to prevent
463    /// races when using other pipelined methods of this protocol.
464    WaitForReady { responder: ArchiveAccessorWaitForReadyResponder },
465    /// An interaction was received which does not match any known method.
466    #[non_exhaustive]
467    _UnknownMethod {
468        /// Ordinal of the method that was called.
469        ordinal: u64,
470        control_handle: ArchiveAccessorControlHandle,
471        method_type: fidl::MethodType,
472    },
473}
474
475impl ArchiveAccessorRequest {
476    #[allow(irrefutable_let_patterns)]
477    pub fn into_stream_diagnostics(
478        self,
479    ) -> Option<(
480        StreamParameters,
481        fdomain_client::fidl::ServerEnd<BatchIteratorMarker>,
482        ArchiveAccessorControlHandle,
483    )> {
484        if let ArchiveAccessorRequest::StreamDiagnostics {
485            stream_parameters,
486            result_stream,
487            control_handle,
488        } = self
489        {
490            Some((stream_parameters, result_stream, control_handle))
491        } else {
492            None
493        }
494    }
495
496    #[allow(irrefutable_let_patterns)]
497    pub fn into_wait_for_ready(self) -> Option<(ArchiveAccessorWaitForReadyResponder)> {
498        if let ArchiveAccessorRequest::WaitForReady { responder } = self {
499            Some((responder))
500        } else {
501            None
502        }
503    }
504
505    /// Name of the method defined in FIDL
506    pub fn method_name(&self) -> &'static str {
507        match *self {
508            ArchiveAccessorRequest::StreamDiagnostics { .. } => "stream_diagnostics",
509            ArchiveAccessorRequest::WaitForReady { .. } => "wait_for_ready",
510            ArchiveAccessorRequest::_UnknownMethod {
511                method_type: fidl::MethodType::OneWay,
512                ..
513            } => "unknown one-way method",
514            ArchiveAccessorRequest::_UnknownMethod {
515                method_type: fidl::MethodType::TwoWay,
516                ..
517            } => "unknown two-way method",
518        }
519    }
520}
521
522#[derive(Debug, Clone)]
523pub struct ArchiveAccessorControlHandle {
524    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
525}
526
527impl fdomain_client::fidl::ControlHandle for ArchiveAccessorControlHandle {
528    fn shutdown(&self) {
529        self.inner.shutdown()
530    }
531
532    fn is_closed(&self) -> bool {
533        self.inner.channel().is_closed()
534    }
535    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
536        self.inner.channel().on_closed()
537    }
538}
539
540impl ArchiveAccessorControlHandle {}
541
542#[must_use = "FIDL methods require a response to be sent"]
543#[derive(Debug)]
544pub struct ArchiveAccessorWaitForReadyResponder {
545    control_handle: std::mem::ManuallyDrop<ArchiveAccessorControlHandle>,
546    tx_id: u32,
547}
548
549/// Set the the channel to be shutdown (see [`ArchiveAccessorControlHandle::shutdown`])
550/// if the responder is dropped without sending a response, so that the client
551/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
552impl std::ops::Drop for ArchiveAccessorWaitForReadyResponder {
553    fn drop(&mut self) {
554        self.control_handle.shutdown();
555        // Safety: drops once, never accessed again
556        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
557    }
558}
559
560impl fdomain_client::fidl::Responder for ArchiveAccessorWaitForReadyResponder {
561    type ControlHandle = ArchiveAccessorControlHandle;
562
563    fn control_handle(&self) -> &ArchiveAccessorControlHandle {
564        &self.control_handle
565    }
566
567    fn drop_without_shutdown(mut self) {
568        // Safety: drops once, never accessed again due to mem::forget
569        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
570        // Prevent Drop from running (which would shut down the channel)
571        std::mem::forget(self);
572    }
573}
574
575impl ArchiveAccessorWaitForReadyResponder {
576    /// Sends a response to the FIDL transaction.
577    ///
578    /// Sets the channel to shutdown if an error occurs.
579    pub fn send(self) -> Result<(), fidl::Error> {
580        let _result = self.send_raw();
581        if _result.is_err() {
582            self.control_handle.shutdown();
583        }
584        self.drop_without_shutdown();
585        _result
586    }
587
588    /// Similar to "send" but does not shutdown the channel if an error occurs.
589    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
590        let _result = self.send_raw();
591        self.drop_without_shutdown();
592        _result
593    }
594
595    fn send_raw(&self) -> Result<(), fidl::Error> {
596        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
597            fidl::encoding::Flexible::new(()),
598            self.tx_id,
599            0x122963198011bd24,
600            fidl::encoding::DynamicFlags::FLEXIBLE,
601        )
602    }
603}
604
605#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
606pub struct BatchIteratorMarker;
607
608impl fdomain_client::fidl::ProtocolMarker for BatchIteratorMarker {
609    type Proxy = BatchIteratorProxy;
610    type RequestStream = BatchIteratorRequestStream;
611
612    const DEBUG_NAME: &'static str = "(anonymous) BatchIterator";
613}
614pub type BatchIteratorGetNextResult = Result<Vec<FormattedContent>, ReaderError>;
615
616pub trait BatchIteratorProxyInterface: Send + Sync {
617    type GetNextResponseFut: std::future::Future<Output = Result<BatchIteratorGetNextResult, fidl::Error>>
618        + Send;
619    fn r#get_next(&self) -> Self::GetNextResponseFut;
620    type WaitForReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
621    fn r#wait_for_ready(&self) -> Self::WaitForReadyResponseFut;
622}
623
624#[derive(Debug, Clone)]
625pub struct BatchIteratorProxy {
626    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
627}
628
629impl fdomain_client::fidl::Proxy for BatchIteratorProxy {
630    type Protocol = BatchIteratorMarker;
631
632    fn from_channel(inner: fdomain_client::Channel) -> Self {
633        Self::new(inner)
634    }
635
636    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
637        self.client.into_channel().map_err(|client| Self { client })
638    }
639
640    fn as_channel(&self) -> &fdomain_client::Channel {
641        self.client.as_channel()
642    }
643}
644
645impl BatchIteratorProxy {
646    /// Create a new Proxy for fuchsia.diagnostics/BatchIterator.
647    pub fn new(channel: fdomain_client::Channel) -> Self {
648        let protocol_name =
649            <BatchIteratorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
650        Self { client: fidl::client::Client::new(channel, protocol_name) }
651    }
652
653    /// Get a Stream of events from the remote end of the protocol.
654    ///
655    /// # Panics
656    ///
657    /// Panics if the event stream was already taken.
658    pub fn take_event_stream(&self) -> BatchIteratorEventStream {
659        BatchIteratorEventStream { event_receiver: self.client.take_event_receiver() }
660    }
661
662    /// Returns a vector of [fuchsia.diagnostics/FormattedContent] structs
663    /// with a format dictated by the format_settings argument provided to the Reader protocol
664    /// which spawned this BatchIterator.
665    ///
666    /// An empty vector implies that the data hierarchy has been fully iterated, and subsequent
667    /// GetNext calls will always return the empty vector.
668    ///
669    /// When the BatchIterator is serving results via subscription model, calls to GetNext will
670    /// hang until there is new data available, it will not return an empty vector.
671    ///
672    /// - returns a vector of FormattedContent structs. Clients connected to a
673    ///   Batch are expected to call GetNext() until an empty vector
674    ///   is returned, denoting that the entire data hierarchy has been read.
675    ///
676    /// * error a [fuchsia.diagnostics/ReaderError]
677    ///   value indicating that there was an issue reading the underlying data hierarchies
678    ///   or formatting those hierarchies to populate the `batch`. Note, these
679    ///   issues do not include a single component's data hierarchy failing to be read.
680    ///   The iterator is tolerant of individual component data sources failing to be read,
681    ///   whether that failure is a timeout or a malformed binary file.
682    ///   In the event that a GetNext call fails, that subset of the data hierarchy results is
683    ///   dropped, but future calls to GetNext will provide new subsets of
684    ///   FormattedDataHierarchies.
685    pub fn r#get_next(
686        &self,
687    ) -> fidl::client::QueryResponseFut<
688        BatchIteratorGetNextResult,
689        fdomain_client::fidl::FDomainResourceDialect,
690    > {
691        BatchIteratorProxyInterface::r#get_next(self)
692    }
693
694    /// Indicates that the BatchIterator has been connected. If the
695    /// BatchIterator hasn't been connected, this method will hang until it is.
696    pub fn r#wait_for_ready(
697        &self,
698    ) -> fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect> {
699        BatchIteratorProxyInterface::r#wait_for_ready(self)
700    }
701}
702
703impl BatchIteratorProxyInterface for BatchIteratorProxy {
704    type GetNextResponseFut = fidl::client::QueryResponseFut<
705        BatchIteratorGetNextResult,
706        fdomain_client::fidl::FDomainResourceDialect,
707    >;
708    fn r#get_next(&self) -> Self::GetNextResponseFut {
709        fn _decode(
710            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
711        ) -> Result<BatchIteratorGetNextResult, fidl::Error> {
712            let _response = fidl::client::decode_transaction_body::<
713                fidl::encoding::FlexibleResultType<BatchIteratorGetNextResponse, ReaderError>,
714                fdomain_client::fidl::FDomainResourceDialect,
715                0x781986486c6254a5,
716            >(_buf?)?
717            .into_result_fdomain::<BatchIteratorMarker>("get_next")?;
718            Ok(_response.map(|x| x.batch))
719        }
720        self.client
721            .send_query_and_decode::<fidl::encoding::EmptyPayload, BatchIteratorGetNextResult>(
722                (),
723                0x781986486c6254a5,
724                fidl::encoding::DynamicFlags::FLEXIBLE,
725                _decode,
726            )
727    }
728
729    type WaitForReadyResponseFut =
730        fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect>;
731    fn r#wait_for_ready(&self) -> Self::WaitForReadyResponseFut {
732        fn _decode(
733            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
734        ) -> Result<(), fidl::Error> {
735            let _response = fidl::client::decode_transaction_body::<
736                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
737                fdomain_client::fidl::FDomainResourceDialect,
738                0x70598ee271597603,
739            >(_buf?)?
740            .into_result_fdomain::<BatchIteratorMarker>("wait_for_ready")?;
741            Ok(_response)
742        }
743        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
744            (),
745            0x70598ee271597603,
746            fidl::encoding::DynamicFlags::FLEXIBLE,
747            _decode,
748        )
749    }
750}
751
752pub struct BatchIteratorEventStream {
753    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
754}
755
756impl std::marker::Unpin for BatchIteratorEventStream {}
757
758impl futures::stream::FusedStream for BatchIteratorEventStream {
759    fn is_terminated(&self) -> bool {
760        self.event_receiver.is_terminated()
761    }
762}
763
764impl futures::Stream for BatchIteratorEventStream {
765    type Item = Result<BatchIteratorEvent, fidl::Error>;
766
767    fn poll_next(
768        mut self: std::pin::Pin<&mut Self>,
769        cx: &mut std::task::Context<'_>,
770    ) -> std::task::Poll<Option<Self::Item>> {
771        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
772            &mut self.event_receiver,
773            cx
774        )?) {
775            Some(buf) => std::task::Poll::Ready(Some(BatchIteratorEvent::decode(buf))),
776            None => std::task::Poll::Ready(None),
777        }
778    }
779}
780
781#[derive(Debug)]
782pub enum BatchIteratorEvent {
783    #[non_exhaustive]
784    _UnknownEvent {
785        /// Ordinal of the event that was sent.
786        ordinal: u64,
787    },
788}
789
790impl BatchIteratorEvent {
791    /// Decodes a message buffer as a [`BatchIteratorEvent`].
792    fn decode(
793        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
794    ) -> Result<BatchIteratorEvent, fidl::Error> {
795        let (bytes, _handles) = buf.split_mut();
796        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
797        debug_assert_eq!(tx_header.tx_id, 0);
798        match tx_header.ordinal {
799            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
800                Ok(BatchIteratorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
801            }
802            _ => Err(fidl::Error::UnknownOrdinal {
803                ordinal: tx_header.ordinal,
804                protocol_name:
805                    <BatchIteratorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
806            }),
807        }
808    }
809}
810
811/// A Stream of incoming requests for fuchsia.diagnostics/BatchIterator.
812pub struct BatchIteratorRequestStream {
813    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
814    is_terminated: bool,
815}
816
817impl std::marker::Unpin for BatchIteratorRequestStream {}
818
819impl futures::stream::FusedStream for BatchIteratorRequestStream {
820    fn is_terminated(&self) -> bool {
821        self.is_terminated
822    }
823}
824
825impl fdomain_client::fidl::RequestStream for BatchIteratorRequestStream {
826    type Protocol = BatchIteratorMarker;
827    type ControlHandle = BatchIteratorControlHandle;
828
829    fn from_channel(channel: fdomain_client::Channel) -> Self {
830        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
831    }
832
833    fn control_handle(&self) -> Self::ControlHandle {
834        BatchIteratorControlHandle { inner: self.inner.clone() }
835    }
836
837    fn into_inner(
838        self,
839    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
840    {
841        (self.inner, self.is_terminated)
842    }
843
844    fn from_inner(
845        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
846        is_terminated: bool,
847    ) -> Self {
848        Self { inner, is_terminated }
849    }
850}
851
852impl futures::Stream for BatchIteratorRequestStream {
853    type Item = Result<BatchIteratorRequest, fidl::Error>;
854
855    fn poll_next(
856        mut self: std::pin::Pin<&mut Self>,
857        cx: &mut std::task::Context<'_>,
858    ) -> std::task::Poll<Option<Self::Item>> {
859        let this = &mut *self;
860        if this.inner.check_shutdown(cx) {
861            this.is_terminated = true;
862            return std::task::Poll::Ready(None);
863        }
864        if this.is_terminated {
865            panic!("polled BatchIteratorRequestStream after completion");
866        }
867        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
868            |bytes, handles| {
869                match this.inner.channel().read_etc(cx, bytes, handles) {
870                    std::task::Poll::Ready(Ok(())) => {}
871                    std::task::Poll::Pending => return std::task::Poll::Pending,
872                    std::task::Poll::Ready(Err(None)) => {
873                        this.is_terminated = true;
874                        return std::task::Poll::Ready(None);
875                    }
876                    std::task::Poll::Ready(Err(Some(e))) => {
877                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
878                            e.into(),
879                        ))));
880                    }
881                }
882
883                // A message has been received from the channel
884                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
885
886                std::task::Poll::Ready(Some(match header.ordinal {
887                0x781986486c6254a5 => {
888                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
889                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
890                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
891                    let control_handle = BatchIteratorControlHandle {
892                        inner: this.inner.clone(),
893                    };
894                    Ok(BatchIteratorRequest::GetNext {
895                        responder: BatchIteratorGetNextResponder {
896                            control_handle: std::mem::ManuallyDrop::new(control_handle),
897                            tx_id: header.tx_id,
898                        },
899                    })
900                }
901                0x70598ee271597603 => {
902                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
903                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
904                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
905                    let control_handle = BatchIteratorControlHandle {
906                        inner: this.inner.clone(),
907                    };
908                    Ok(BatchIteratorRequest::WaitForReady {
909                        responder: BatchIteratorWaitForReadyResponder {
910                            control_handle: std::mem::ManuallyDrop::new(control_handle),
911                            tx_id: header.tx_id,
912                        },
913                    })
914                }
915                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
916                    Ok(BatchIteratorRequest::_UnknownMethod {
917                        ordinal: header.ordinal,
918                        control_handle: BatchIteratorControlHandle { inner: this.inner.clone() },
919                        method_type: fidl::MethodType::OneWay,
920                    })
921                }
922                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
923                    this.inner.send_framework_err(
924                        fidl::encoding::FrameworkErr::UnknownMethod,
925                        header.tx_id,
926                        header.ordinal,
927                        header.dynamic_flags(),
928                        (bytes, handles),
929                    )?;
930                    Ok(BatchIteratorRequest::_UnknownMethod {
931                        ordinal: header.ordinal,
932                        control_handle: BatchIteratorControlHandle { inner: this.inner.clone() },
933                        method_type: fidl::MethodType::TwoWay,
934                    })
935                }
936                _ => Err(fidl::Error::UnknownOrdinal {
937                    ordinal: header.ordinal,
938                    protocol_name: <BatchIteratorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
939                }),
940            }))
941            },
942        )
943    }
944}
945
946/// Conceptually, a directory iterator, where each element in the iterator is a single
947/// complete file that can be concatenated with other results.
948#[derive(Debug)]
949pub enum BatchIteratorRequest {
950    /// Returns a vector of [fuchsia.diagnostics/FormattedContent] structs
951    /// with a format dictated by the format_settings argument provided to the Reader protocol
952    /// which spawned this BatchIterator.
953    ///
954    /// An empty vector implies that the data hierarchy has been fully iterated, and subsequent
955    /// GetNext calls will always return the empty vector.
956    ///
957    /// When the BatchIterator is serving results via subscription model, calls to GetNext will
958    /// hang until there is new data available, it will not return an empty vector.
959    ///
960    /// - returns a vector of FormattedContent structs. Clients connected to a
961    ///   Batch are expected to call GetNext() until an empty vector
962    ///   is returned, denoting that the entire data hierarchy has been read.
963    ///
964    /// * error a [fuchsia.diagnostics/ReaderError]
965    ///   value indicating that there was an issue reading the underlying data hierarchies
966    ///   or formatting those hierarchies to populate the `batch`. Note, these
967    ///   issues do not include a single component's data hierarchy failing to be read.
968    ///   The iterator is tolerant of individual component data sources failing to be read,
969    ///   whether that failure is a timeout or a malformed binary file.
970    ///   In the event that a GetNext call fails, that subset of the data hierarchy results is
971    ///   dropped, but future calls to GetNext will provide new subsets of
972    ///   FormattedDataHierarchies.
973    GetNext { responder: BatchIteratorGetNextResponder },
974    /// Indicates that the BatchIterator has been connected. If the
975    /// BatchIterator hasn't been connected, this method will hang until it is.
976    WaitForReady { responder: BatchIteratorWaitForReadyResponder },
977    /// An interaction was received which does not match any known method.
978    #[non_exhaustive]
979    _UnknownMethod {
980        /// Ordinal of the method that was called.
981        ordinal: u64,
982        control_handle: BatchIteratorControlHandle,
983        method_type: fidl::MethodType,
984    },
985}
986
987impl BatchIteratorRequest {
988    #[allow(irrefutable_let_patterns)]
989    pub fn into_get_next(self) -> Option<(BatchIteratorGetNextResponder)> {
990        if let BatchIteratorRequest::GetNext { responder } = self {
991            Some((responder))
992        } else {
993            None
994        }
995    }
996
997    #[allow(irrefutable_let_patterns)]
998    pub fn into_wait_for_ready(self) -> Option<(BatchIteratorWaitForReadyResponder)> {
999        if let BatchIteratorRequest::WaitForReady { responder } = self {
1000            Some((responder))
1001        } else {
1002            None
1003        }
1004    }
1005
1006    /// Name of the method defined in FIDL
1007    pub fn method_name(&self) -> &'static str {
1008        match *self {
1009            BatchIteratorRequest::GetNext { .. } => "get_next",
1010            BatchIteratorRequest::WaitForReady { .. } => "wait_for_ready",
1011            BatchIteratorRequest::_UnknownMethod {
1012                method_type: fidl::MethodType::OneWay, ..
1013            } => "unknown one-way method",
1014            BatchIteratorRequest::_UnknownMethod {
1015                method_type: fidl::MethodType::TwoWay, ..
1016            } => "unknown two-way method",
1017        }
1018    }
1019}
1020
1021#[derive(Debug, Clone)]
1022pub struct BatchIteratorControlHandle {
1023    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1024}
1025
1026impl fdomain_client::fidl::ControlHandle for BatchIteratorControlHandle {
1027    fn shutdown(&self) {
1028        self.inner.shutdown()
1029    }
1030
1031    fn is_closed(&self) -> bool {
1032        self.inner.channel().is_closed()
1033    }
1034    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
1035        self.inner.channel().on_closed()
1036    }
1037}
1038
1039impl BatchIteratorControlHandle {}
1040
1041#[must_use = "FIDL methods require a response to be sent"]
1042#[derive(Debug)]
1043pub struct BatchIteratorGetNextResponder {
1044    control_handle: std::mem::ManuallyDrop<BatchIteratorControlHandle>,
1045    tx_id: u32,
1046}
1047
1048/// Set the the channel to be shutdown (see [`BatchIteratorControlHandle::shutdown`])
1049/// if the responder is dropped without sending a response, so that the client
1050/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1051impl std::ops::Drop for BatchIteratorGetNextResponder {
1052    fn drop(&mut self) {
1053        self.control_handle.shutdown();
1054        // Safety: drops once, never accessed again
1055        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1056    }
1057}
1058
1059impl fdomain_client::fidl::Responder for BatchIteratorGetNextResponder {
1060    type ControlHandle = BatchIteratorControlHandle;
1061
1062    fn control_handle(&self) -> &BatchIteratorControlHandle {
1063        &self.control_handle
1064    }
1065
1066    fn drop_without_shutdown(mut self) {
1067        // Safety: drops once, never accessed again due to mem::forget
1068        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1069        // Prevent Drop from running (which would shut down the channel)
1070        std::mem::forget(self);
1071    }
1072}
1073
1074impl BatchIteratorGetNextResponder {
1075    /// Sends a response to the FIDL transaction.
1076    ///
1077    /// Sets the channel to shutdown if an error occurs.
1078    pub fn send(
1079        self,
1080        mut result: Result<Vec<FormattedContent>, ReaderError>,
1081    ) -> Result<(), fidl::Error> {
1082        let _result = self.send_raw(result);
1083        if _result.is_err() {
1084            self.control_handle.shutdown();
1085        }
1086        self.drop_without_shutdown();
1087        _result
1088    }
1089
1090    /// Similar to "send" but does not shutdown the channel if an error occurs.
1091    pub fn send_no_shutdown_on_err(
1092        self,
1093        mut result: Result<Vec<FormattedContent>, ReaderError>,
1094    ) -> Result<(), fidl::Error> {
1095        let _result = self.send_raw(result);
1096        self.drop_without_shutdown();
1097        _result
1098    }
1099
1100    fn send_raw(
1101        &self,
1102        mut result: Result<Vec<FormattedContent>, ReaderError>,
1103    ) -> Result<(), fidl::Error> {
1104        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1105            BatchIteratorGetNextResponse,
1106            ReaderError,
1107        >>(
1108            fidl::encoding::FlexibleResult::new(
1109                result.as_mut().map_err(|e| *e).map(|batch| (batch.as_mut_slice(),)),
1110            ),
1111            self.tx_id,
1112            0x781986486c6254a5,
1113            fidl::encoding::DynamicFlags::FLEXIBLE,
1114        )
1115    }
1116}
1117
1118#[must_use = "FIDL methods require a response to be sent"]
1119#[derive(Debug)]
1120pub struct BatchIteratorWaitForReadyResponder {
1121    control_handle: std::mem::ManuallyDrop<BatchIteratorControlHandle>,
1122    tx_id: u32,
1123}
1124
1125/// Set the the channel to be shutdown (see [`BatchIteratorControlHandle::shutdown`])
1126/// if the responder is dropped without sending a response, so that the client
1127/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1128impl std::ops::Drop for BatchIteratorWaitForReadyResponder {
1129    fn drop(&mut self) {
1130        self.control_handle.shutdown();
1131        // Safety: drops once, never accessed again
1132        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1133    }
1134}
1135
1136impl fdomain_client::fidl::Responder for BatchIteratorWaitForReadyResponder {
1137    type ControlHandle = BatchIteratorControlHandle;
1138
1139    fn control_handle(&self) -> &BatchIteratorControlHandle {
1140        &self.control_handle
1141    }
1142
1143    fn drop_without_shutdown(mut self) {
1144        // Safety: drops once, never accessed again due to mem::forget
1145        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1146        // Prevent Drop from running (which would shut down the channel)
1147        std::mem::forget(self);
1148    }
1149}
1150
1151impl BatchIteratorWaitForReadyResponder {
1152    /// Sends a response to the FIDL transaction.
1153    ///
1154    /// Sets the channel to shutdown if an error occurs.
1155    pub fn send(self) -> Result<(), fidl::Error> {
1156        let _result = self.send_raw();
1157        if _result.is_err() {
1158            self.control_handle.shutdown();
1159        }
1160        self.drop_without_shutdown();
1161        _result
1162    }
1163
1164    /// Similar to "send" but does not shutdown the channel if an error occurs.
1165    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1166        let _result = self.send_raw();
1167        self.drop_without_shutdown();
1168        _result
1169    }
1170
1171    fn send_raw(&self) -> Result<(), fidl::Error> {
1172        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
1173            fidl::encoding::Flexible::new(()),
1174            self.tx_id,
1175            0x70598ee271597603,
1176            fidl::encoding::DynamicFlags::FLEXIBLE,
1177        )
1178    }
1179}
1180
1181#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1182pub struct LogFlusherMarker;
1183
1184impl fdomain_client::fidl::ProtocolMarker for LogFlusherMarker {
1185    type Proxy = LogFlusherProxy;
1186    type RequestStream = LogFlusherRequestStream;
1187
1188    const DEBUG_NAME: &'static str = "fuchsia.diagnostics.LogFlusher";
1189}
1190impl fdomain_client::fidl::DiscoverableProtocolMarker for LogFlusherMarker {}
1191
1192pub trait LogFlusherProxyInterface: Send + Sync {
1193    type WaitUntilFlushedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1194    fn r#wait_until_flushed(&self) -> Self::WaitUntilFlushedResponseFut;
1195}
1196
1197#[derive(Debug, Clone)]
1198pub struct LogFlusherProxy {
1199    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
1200}
1201
1202impl fdomain_client::fidl::Proxy for LogFlusherProxy {
1203    type Protocol = LogFlusherMarker;
1204
1205    fn from_channel(inner: fdomain_client::Channel) -> Self {
1206        Self::new(inner)
1207    }
1208
1209    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
1210        self.client.into_channel().map_err(|client| Self { client })
1211    }
1212
1213    fn as_channel(&self) -> &fdomain_client::Channel {
1214        self.client.as_channel()
1215    }
1216}
1217
1218impl LogFlusherProxy {
1219    /// Create a new Proxy for fuchsia.diagnostics/LogFlusher.
1220    pub fn new(channel: fdomain_client::Channel) -> Self {
1221        let protocol_name = <LogFlusherMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
1222        Self { client: fidl::client::Client::new(channel, protocol_name) }
1223    }
1224
1225    /// Get a Stream of events from the remote end of the protocol.
1226    ///
1227    /// # Panics
1228    ///
1229    /// Panics if the event stream was already taken.
1230    pub fn take_event_stream(&self) -> LogFlusherEventStream {
1231        LogFlusherEventStream { event_receiver: self.client.take_event_receiver() }
1232    }
1233
1234    /// Flushes all pending logs through the logging pipeline
1235    /// to the serial port. Logs written to sockets prior to
1236    /// the call to Flush are guaranteed to be fully written
1237    /// to serial when this returns. Logs written to sockets
1238    /// after this call has been received by Archivist are
1239    /// not guaranteed to be flushed.
1240    /// Additionally, sockets must actually be connected to the Archivist
1241    /// before this call is made. If a socket hasn't been
1242    /// received by Archivist yet, those logs may be dropped.
1243    /// To ensure that logs are properly flushed, make sure
1244    /// to wait for the initial interest when logging.
1245    /// Important note: This may be called from the host,
1246    /// but host sockets will NOT be flushed by this method.
1247    /// If you write data from the host (not on the device,
1248    /// there is no guarantee that such logs will ever be printed).
1249    pub fn r#wait_until_flushed(
1250        &self,
1251    ) -> fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect> {
1252        LogFlusherProxyInterface::r#wait_until_flushed(self)
1253    }
1254}
1255
1256impl LogFlusherProxyInterface for LogFlusherProxy {
1257    type WaitUntilFlushedResponseFut =
1258        fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect>;
1259    fn r#wait_until_flushed(&self) -> Self::WaitUntilFlushedResponseFut {
1260        fn _decode(
1261            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1262        ) -> Result<(), fidl::Error> {
1263            let _response = fidl::client::decode_transaction_body::<
1264                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
1265                fdomain_client::fidl::FDomainResourceDialect,
1266                0x7dc4892e46748b5b,
1267            >(_buf?)?
1268            .into_result_fdomain::<LogFlusherMarker>("wait_until_flushed")?;
1269            Ok(_response)
1270        }
1271        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
1272            (),
1273            0x7dc4892e46748b5b,
1274            fidl::encoding::DynamicFlags::FLEXIBLE,
1275            _decode,
1276        )
1277    }
1278}
1279
1280pub struct LogFlusherEventStream {
1281    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
1282}
1283
1284impl std::marker::Unpin for LogFlusherEventStream {}
1285
1286impl futures::stream::FusedStream for LogFlusherEventStream {
1287    fn is_terminated(&self) -> bool {
1288        self.event_receiver.is_terminated()
1289    }
1290}
1291
1292impl futures::Stream for LogFlusherEventStream {
1293    type Item = Result<LogFlusherEvent, fidl::Error>;
1294
1295    fn poll_next(
1296        mut self: std::pin::Pin<&mut Self>,
1297        cx: &mut std::task::Context<'_>,
1298    ) -> std::task::Poll<Option<Self::Item>> {
1299        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1300            &mut self.event_receiver,
1301            cx
1302        )?) {
1303            Some(buf) => std::task::Poll::Ready(Some(LogFlusherEvent::decode(buf))),
1304            None => std::task::Poll::Ready(None),
1305        }
1306    }
1307}
1308
1309#[derive(Debug)]
1310pub enum LogFlusherEvent {
1311    #[non_exhaustive]
1312    _UnknownEvent {
1313        /// Ordinal of the event that was sent.
1314        ordinal: u64,
1315    },
1316}
1317
1318impl LogFlusherEvent {
1319    /// Decodes a message buffer as a [`LogFlusherEvent`].
1320    fn decode(
1321        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1322    ) -> Result<LogFlusherEvent, fidl::Error> {
1323        let (bytes, _handles) = buf.split_mut();
1324        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1325        debug_assert_eq!(tx_header.tx_id, 0);
1326        match tx_header.ordinal {
1327            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1328                Ok(LogFlusherEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1329            }
1330            _ => Err(fidl::Error::UnknownOrdinal {
1331                ordinal: tx_header.ordinal,
1332                protocol_name:
1333                    <LogFlusherMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1334            }),
1335        }
1336    }
1337}
1338
1339/// A Stream of incoming requests for fuchsia.diagnostics/LogFlusher.
1340pub struct LogFlusherRequestStream {
1341    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1342    is_terminated: bool,
1343}
1344
1345impl std::marker::Unpin for LogFlusherRequestStream {}
1346
1347impl futures::stream::FusedStream for LogFlusherRequestStream {
1348    fn is_terminated(&self) -> bool {
1349        self.is_terminated
1350    }
1351}
1352
1353impl fdomain_client::fidl::RequestStream for LogFlusherRequestStream {
1354    type Protocol = LogFlusherMarker;
1355    type ControlHandle = LogFlusherControlHandle;
1356
1357    fn from_channel(channel: fdomain_client::Channel) -> Self {
1358        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1359    }
1360
1361    fn control_handle(&self) -> Self::ControlHandle {
1362        LogFlusherControlHandle { inner: self.inner.clone() }
1363    }
1364
1365    fn into_inner(
1366        self,
1367    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
1368    {
1369        (self.inner, self.is_terminated)
1370    }
1371
1372    fn from_inner(
1373        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1374        is_terminated: bool,
1375    ) -> Self {
1376        Self { inner, is_terminated }
1377    }
1378}
1379
1380impl futures::Stream for LogFlusherRequestStream {
1381    type Item = Result<LogFlusherRequest, fidl::Error>;
1382
1383    fn poll_next(
1384        mut self: std::pin::Pin<&mut Self>,
1385        cx: &mut std::task::Context<'_>,
1386    ) -> std::task::Poll<Option<Self::Item>> {
1387        let this = &mut *self;
1388        if this.inner.check_shutdown(cx) {
1389            this.is_terminated = true;
1390            return std::task::Poll::Ready(None);
1391        }
1392        if this.is_terminated {
1393            panic!("polled LogFlusherRequestStream after completion");
1394        }
1395        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
1396            |bytes, handles| {
1397                match this.inner.channel().read_etc(cx, bytes, handles) {
1398                    std::task::Poll::Ready(Ok(())) => {}
1399                    std::task::Poll::Pending => return std::task::Poll::Pending,
1400                    std::task::Poll::Ready(Err(None)) => {
1401                        this.is_terminated = true;
1402                        return std::task::Poll::Ready(None);
1403                    }
1404                    std::task::Poll::Ready(Err(Some(e))) => {
1405                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1406                            e.into(),
1407                        ))));
1408                    }
1409                }
1410
1411                // A message has been received from the channel
1412                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1413
1414                std::task::Poll::Ready(Some(match header.ordinal {
1415                    0x7dc4892e46748b5b => {
1416                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1417                        let mut req = fidl::new_empty!(
1418                            fidl::encoding::EmptyPayload,
1419                            fdomain_client::fidl::FDomainResourceDialect
1420                        );
1421                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1422                        let control_handle = LogFlusherControlHandle { inner: this.inner.clone() };
1423                        Ok(LogFlusherRequest::WaitUntilFlushed {
1424                            responder: LogFlusherWaitUntilFlushedResponder {
1425                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1426                                tx_id: header.tx_id,
1427                            },
1428                        })
1429                    }
1430                    _ if header.tx_id == 0
1431                        && header
1432                            .dynamic_flags()
1433                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1434                    {
1435                        Ok(LogFlusherRequest::_UnknownMethod {
1436                            ordinal: header.ordinal,
1437                            control_handle: LogFlusherControlHandle { inner: this.inner.clone() },
1438                            method_type: fidl::MethodType::OneWay,
1439                        })
1440                    }
1441                    _ if header
1442                        .dynamic_flags()
1443                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1444                    {
1445                        this.inner.send_framework_err(
1446                            fidl::encoding::FrameworkErr::UnknownMethod,
1447                            header.tx_id,
1448                            header.ordinal,
1449                            header.dynamic_flags(),
1450                            (bytes, handles),
1451                        )?;
1452                        Ok(LogFlusherRequest::_UnknownMethod {
1453                            ordinal: header.ordinal,
1454                            control_handle: LogFlusherControlHandle { inner: this.inner.clone() },
1455                            method_type: fidl::MethodType::TwoWay,
1456                        })
1457                    }
1458                    _ => Err(fidl::Error::UnknownOrdinal {
1459                        ordinal: header.ordinal,
1460                        protocol_name:
1461                            <LogFlusherMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1462                    }),
1463                }))
1464            },
1465        )
1466    }
1467}
1468
1469#[derive(Debug)]
1470pub enum LogFlusherRequest {
1471    /// Flushes all pending logs through the logging pipeline
1472    /// to the serial port. Logs written to sockets prior to
1473    /// the call to Flush are guaranteed to be fully written
1474    /// to serial when this returns. Logs written to sockets
1475    /// after this call has been received by Archivist are
1476    /// not guaranteed to be flushed.
1477    /// Additionally, sockets must actually be connected to the Archivist
1478    /// before this call is made. If a socket hasn't been
1479    /// received by Archivist yet, those logs may be dropped.
1480    /// To ensure that logs are properly flushed, make sure
1481    /// to wait for the initial interest when logging.
1482    /// Important note: This may be called from the host,
1483    /// but host sockets will NOT be flushed by this method.
1484    /// If you write data from the host (not on the device,
1485    /// there is no guarantee that such logs will ever be printed).
1486    WaitUntilFlushed { responder: LogFlusherWaitUntilFlushedResponder },
1487    /// An interaction was received which does not match any known method.
1488    #[non_exhaustive]
1489    _UnknownMethod {
1490        /// Ordinal of the method that was called.
1491        ordinal: u64,
1492        control_handle: LogFlusherControlHandle,
1493        method_type: fidl::MethodType,
1494    },
1495}
1496
1497impl LogFlusherRequest {
1498    #[allow(irrefutable_let_patterns)]
1499    pub fn into_wait_until_flushed(self) -> Option<(LogFlusherWaitUntilFlushedResponder)> {
1500        if let LogFlusherRequest::WaitUntilFlushed { responder } = self {
1501            Some((responder))
1502        } else {
1503            None
1504        }
1505    }
1506
1507    /// Name of the method defined in FIDL
1508    pub fn method_name(&self) -> &'static str {
1509        match *self {
1510            LogFlusherRequest::WaitUntilFlushed { .. } => "wait_until_flushed",
1511            LogFlusherRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1512                "unknown one-way method"
1513            }
1514            LogFlusherRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1515                "unknown two-way method"
1516            }
1517        }
1518    }
1519}
1520
1521#[derive(Debug, Clone)]
1522pub struct LogFlusherControlHandle {
1523    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1524}
1525
1526impl fdomain_client::fidl::ControlHandle for LogFlusherControlHandle {
1527    fn shutdown(&self) {
1528        self.inner.shutdown()
1529    }
1530
1531    fn is_closed(&self) -> bool {
1532        self.inner.channel().is_closed()
1533    }
1534    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
1535        self.inner.channel().on_closed()
1536    }
1537}
1538
1539impl LogFlusherControlHandle {}
1540
1541#[must_use = "FIDL methods require a response to be sent"]
1542#[derive(Debug)]
1543pub struct LogFlusherWaitUntilFlushedResponder {
1544    control_handle: std::mem::ManuallyDrop<LogFlusherControlHandle>,
1545    tx_id: u32,
1546}
1547
1548/// Set the the channel to be shutdown (see [`LogFlusherControlHandle::shutdown`])
1549/// if the responder is dropped without sending a response, so that the client
1550/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1551impl std::ops::Drop for LogFlusherWaitUntilFlushedResponder {
1552    fn drop(&mut self) {
1553        self.control_handle.shutdown();
1554        // Safety: drops once, never accessed again
1555        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1556    }
1557}
1558
1559impl fdomain_client::fidl::Responder for LogFlusherWaitUntilFlushedResponder {
1560    type ControlHandle = LogFlusherControlHandle;
1561
1562    fn control_handle(&self) -> &LogFlusherControlHandle {
1563        &self.control_handle
1564    }
1565
1566    fn drop_without_shutdown(mut self) {
1567        // Safety: drops once, never accessed again due to mem::forget
1568        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1569        // Prevent Drop from running (which would shut down the channel)
1570        std::mem::forget(self);
1571    }
1572}
1573
1574impl LogFlusherWaitUntilFlushedResponder {
1575    /// Sends a response to the FIDL transaction.
1576    ///
1577    /// Sets the channel to shutdown if an error occurs.
1578    pub fn send(self) -> Result<(), fidl::Error> {
1579        let _result = self.send_raw();
1580        if _result.is_err() {
1581            self.control_handle.shutdown();
1582        }
1583        self.drop_without_shutdown();
1584        _result
1585    }
1586
1587    /// Similar to "send" but does not shutdown the channel if an error occurs.
1588    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1589        let _result = self.send_raw();
1590        self.drop_without_shutdown();
1591        _result
1592    }
1593
1594    fn send_raw(&self) -> Result<(), fidl::Error> {
1595        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
1596            fidl::encoding::Flexible::new(()),
1597            self.tx_id,
1598            0x7dc4892e46748b5b,
1599            fidl::encoding::DynamicFlags::FLEXIBLE,
1600        )
1601    }
1602}
1603
1604#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1605pub struct LogSettingsMarker;
1606
1607impl fdomain_client::fidl::ProtocolMarker for LogSettingsMarker {
1608    type Proxy = LogSettingsProxy;
1609    type RequestStream = LogSettingsRequestStream;
1610
1611    const DEBUG_NAME: &'static str = "fuchsia.diagnostics.LogSettings";
1612}
1613impl fdomain_client::fidl::DiscoverableProtocolMarker for LogSettingsMarker {}
1614
1615pub trait LogSettingsProxyInterface: Send + Sync {
1616    type SetInterestResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1617    fn r#set_interest(&self, selectors: &[LogInterestSelector]) -> Self::SetInterestResponseFut;
1618    type SetComponentInterestResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
1619        + Send;
1620    fn r#set_component_interest(
1621        &self,
1622        payload: &LogSettingsSetComponentInterestRequest,
1623    ) -> Self::SetComponentInterestResponseFut;
1624}
1625
1626#[derive(Debug, Clone)]
1627pub struct LogSettingsProxy {
1628    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
1629}
1630
1631impl fdomain_client::fidl::Proxy for LogSettingsProxy {
1632    type Protocol = LogSettingsMarker;
1633
1634    fn from_channel(inner: fdomain_client::Channel) -> Self {
1635        Self::new(inner)
1636    }
1637
1638    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
1639        self.client.into_channel().map_err(|client| Self { client })
1640    }
1641
1642    fn as_channel(&self) -> &fdomain_client::Channel {
1643        self.client.as_channel()
1644    }
1645}
1646
1647impl LogSettingsProxy {
1648    /// Create a new Proxy for fuchsia.diagnostics/LogSettings.
1649    pub fn new(channel: fdomain_client::Channel) -> Self {
1650        let protocol_name = <LogSettingsMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
1651        Self { client: fidl::client::Client::new(channel, protocol_name) }
1652    }
1653
1654    /// Get a Stream of events from the remote end of the protocol.
1655    ///
1656    /// # Panics
1657    ///
1658    /// Panics if the event stream was already taken.
1659    pub fn take_event_stream(&self) -> LogSettingsEventStream {
1660        LogSettingsEventStream { event_receiver: self.client.take_event_receiver() }
1661    }
1662
1663    /// Requests a change in interest for the matched components.
1664    ///
1665    /// Each component holds a set of requested interests.
1666    ///
1667    /// When a new request on LogSettings#SetInterest is received,
1668    /// the sets for matched components receive the new minimum interest.
1669    /// If the interest is less than the previous minimum interest, then a
1670    /// `SetInterest` request is sent with the new minimum interest.
1671    ///
1672    /// If a connection to `LogSettings` sends another `SetInterest`
1673    /// request, its previous interest request will be undone.
1674    ///
1675    /// When the connection to `LogSettings` is finished, the interests are
1676    /// undone. Each matched component minimum interest is updated with the
1677    /// new minimum interest in the set.
1678    pub fn r#set_interest(
1679        &self,
1680        mut selectors: &[LogInterestSelector],
1681    ) -> fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect> {
1682        LogSettingsProxyInterface::r#set_interest(self, selectors)
1683    }
1684
1685    /// Requests a change in interest for the matched components.
1686    ///
1687    /// Each component holds a set of requested interests.
1688    ///
1689    /// When a new request on LogSettings#SetComponentInterest is received,
1690    /// the sets for matched components receive the new minimum interest.
1691    /// If the interest is less than the previous minimum interest, then a
1692    /// `SetComponentInterest` request is sent with the new minimum interest.
1693    ///
1694    /// If a connection to `LogSettings` sends another `SetComponentInterest`
1695    /// request, its previous interest request will be undone.
1696    ///
1697    /// When the connection to `LogSettings` is finished, the interests are
1698    /// undone, unless persist is set to true. Each matched component minimum
1699    /// interest is updated with the new minimum interest in the set.
1700    pub fn r#set_component_interest(
1701        &self,
1702        mut payload: &LogSettingsSetComponentInterestRequest,
1703    ) -> fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect> {
1704        LogSettingsProxyInterface::r#set_component_interest(self, payload)
1705    }
1706}
1707
1708impl LogSettingsProxyInterface for LogSettingsProxy {
1709    type SetInterestResponseFut =
1710        fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect>;
1711    fn r#set_interest(
1712        &self,
1713        mut selectors: &[LogInterestSelector],
1714    ) -> Self::SetInterestResponseFut {
1715        fn _decode(
1716            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1717        ) -> Result<(), fidl::Error> {
1718            let _response = fidl::client::decode_transaction_body::<
1719                fidl::encoding::EmptyPayload,
1720                fdomain_client::fidl::FDomainResourceDialect,
1721                0x71beced9d2411f90,
1722            >(_buf?)?;
1723            Ok(_response)
1724        }
1725        self.client.send_query_and_decode::<LogSettingsSetInterestRequest, ()>(
1726            (selectors,),
1727            0x71beced9d2411f90,
1728            fidl::encoding::DynamicFlags::empty(),
1729            _decode,
1730        )
1731    }
1732
1733    type SetComponentInterestResponseFut =
1734        fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect>;
1735    fn r#set_component_interest(
1736        &self,
1737        mut payload: &LogSettingsSetComponentInterestRequest,
1738    ) -> Self::SetComponentInterestResponseFut {
1739        fn _decode(
1740            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1741        ) -> Result<(), fidl::Error> {
1742            let _response = fidl::client::decode_transaction_body::<
1743                fidl::encoding::EmptyPayload,
1744                fdomain_client::fidl::FDomainResourceDialect,
1745                0x35f7004d2367f6c1,
1746            >(_buf?)?;
1747            Ok(_response)
1748        }
1749        self.client.send_query_and_decode::<LogSettingsSetComponentInterestRequest, ()>(
1750            payload,
1751            0x35f7004d2367f6c1,
1752            fidl::encoding::DynamicFlags::empty(),
1753            _decode,
1754        )
1755    }
1756}
1757
1758pub struct LogSettingsEventStream {
1759    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
1760}
1761
1762impl std::marker::Unpin for LogSettingsEventStream {}
1763
1764impl futures::stream::FusedStream for LogSettingsEventStream {
1765    fn is_terminated(&self) -> bool {
1766        self.event_receiver.is_terminated()
1767    }
1768}
1769
1770impl futures::Stream for LogSettingsEventStream {
1771    type Item = Result<LogSettingsEvent, fidl::Error>;
1772
1773    fn poll_next(
1774        mut self: std::pin::Pin<&mut Self>,
1775        cx: &mut std::task::Context<'_>,
1776    ) -> std::task::Poll<Option<Self::Item>> {
1777        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1778            &mut self.event_receiver,
1779            cx
1780        )?) {
1781            Some(buf) => std::task::Poll::Ready(Some(LogSettingsEvent::decode(buf))),
1782            None => std::task::Poll::Ready(None),
1783        }
1784    }
1785}
1786
1787#[derive(Debug)]
1788pub enum LogSettingsEvent {}
1789
1790impl LogSettingsEvent {
1791    /// Decodes a message buffer as a [`LogSettingsEvent`].
1792    fn decode(
1793        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1794    ) -> Result<LogSettingsEvent, fidl::Error> {
1795        let (bytes, _handles) = buf.split_mut();
1796        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1797        debug_assert_eq!(tx_header.tx_id, 0);
1798        match tx_header.ordinal {
1799            _ => Err(fidl::Error::UnknownOrdinal {
1800                ordinal: tx_header.ordinal,
1801                protocol_name:
1802                    <LogSettingsMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1803            }),
1804        }
1805    }
1806}
1807
1808/// A Stream of incoming requests for fuchsia.diagnostics/LogSettings.
1809pub struct LogSettingsRequestStream {
1810    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1811    is_terminated: bool,
1812}
1813
1814impl std::marker::Unpin for LogSettingsRequestStream {}
1815
1816impl futures::stream::FusedStream for LogSettingsRequestStream {
1817    fn is_terminated(&self) -> bool {
1818        self.is_terminated
1819    }
1820}
1821
1822impl fdomain_client::fidl::RequestStream for LogSettingsRequestStream {
1823    type Protocol = LogSettingsMarker;
1824    type ControlHandle = LogSettingsControlHandle;
1825
1826    fn from_channel(channel: fdomain_client::Channel) -> Self {
1827        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1828    }
1829
1830    fn control_handle(&self) -> Self::ControlHandle {
1831        LogSettingsControlHandle { inner: self.inner.clone() }
1832    }
1833
1834    fn into_inner(
1835        self,
1836    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
1837    {
1838        (self.inner, self.is_terminated)
1839    }
1840
1841    fn from_inner(
1842        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1843        is_terminated: bool,
1844    ) -> Self {
1845        Self { inner, is_terminated }
1846    }
1847}
1848
1849impl futures::Stream for LogSettingsRequestStream {
1850    type Item = Result<LogSettingsRequest, fidl::Error>;
1851
1852    fn poll_next(
1853        mut self: std::pin::Pin<&mut Self>,
1854        cx: &mut std::task::Context<'_>,
1855    ) -> std::task::Poll<Option<Self::Item>> {
1856        let this = &mut *self;
1857        if this.inner.check_shutdown(cx) {
1858            this.is_terminated = true;
1859            return std::task::Poll::Ready(None);
1860        }
1861        if this.is_terminated {
1862            panic!("polled LogSettingsRequestStream after completion");
1863        }
1864        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
1865            |bytes, handles| {
1866                match this.inner.channel().read_etc(cx, bytes, handles) {
1867                    std::task::Poll::Ready(Ok(())) => {}
1868                    std::task::Poll::Pending => return std::task::Poll::Pending,
1869                    std::task::Poll::Ready(Err(None)) => {
1870                        this.is_terminated = true;
1871                        return std::task::Poll::Ready(None);
1872                    }
1873                    std::task::Poll::Ready(Err(Some(e))) => {
1874                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1875                            e.into(),
1876                        ))));
1877                    }
1878                }
1879
1880                // A message has been received from the channel
1881                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1882
1883                std::task::Poll::Ready(Some(match header.ordinal {
1884                    0x71beced9d2411f90 => {
1885                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1886                        let mut req = fidl::new_empty!(
1887                            LogSettingsSetInterestRequest,
1888                            fdomain_client::fidl::FDomainResourceDialect
1889                        );
1890                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<LogSettingsSetInterestRequest>(&header, _body_bytes, handles, &mut req)?;
1891                        let control_handle = LogSettingsControlHandle { inner: this.inner.clone() };
1892                        Ok(LogSettingsRequest::SetInterest {
1893                            selectors: req.selectors,
1894
1895                            responder: LogSettingsSetInterestResponder {
1896                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1897                                tx_id: header.tx_id,
1898                            },
1899                        })
1900                    }
1901                    0x35f7004d2367f6c1 => {
1902                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1903                        let mut req = fidl::new_empty!(
1904                            LogSettingsSetComponentInterestRequest,
1905                            fdomain_client::fidl::FDomainResourceDialect
1906                        );
1907                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<LogSettingsSetComponentInterestRequest>(&header, _body_bytes, handles, &mut req)?;
1908                        let control_handle = LogSettingsControlHandle { inner: this.inner.clone() };
1909                        Ok(LogSettingsRequest::SetComponentInterest {
1910                            payload: req,
1911                            responder: LogSettingsSetComponentInterestResponder {
1912                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1913                                tx_id: header.tx_id,
1914                            },
1915                        })
1916                    }
1917                    _ => Err(fidl::Error::UnknownOrdinal {
1918                        ordinal: header.ordinal,
1919                        protocol_name:
1920                            <LogSettingsMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1921                    }),
1922                }))
1923            },
1924        )
1925    }
1926}
1927
1928/// This protocol allows clients to modify the logging behavior of components
1929/// in the system.
1930#[derive(Debug)]
1931pub enum LogSettingsRequest {
1932    /// Requests a change in interest for the matched components.
1933    ///
1934    /// Each component holds a set of requested interests.
1935    ///
1936    /// When a new request on LogSettings#SetInterest is received,
1937    /// the sets for matched components receive the new minimum interest.
1938    /// If the interest is less than the previous minimum interest, then a
1939    /// `SetInterest` request is sent with the new minimum interest.
1940    ///
1941    /// If a connection to `LogSettings` sends another `SetInterest`
1942    /// request, its previous interest request will be undone.
1943    ///
1944    /// When the connection to `LogSettings` is finished, the interests are
1945    /// undone. Each matched component minimum interest is updated with the
1946    /// new minimum interest in the set.
1947    SetInterest { selectors: Vec<LogInterestSelector>, responder: LogSettingsSetInterestResponder },
1948    /// Requests a change in interest for the matched components.
1949    ///
1950    /// Each component holds a set of requested interests.
1951    ///
1952    /// When a new request on LogSettings#SetComponentInterest is received,
1953    /// the sets for matched components receive the new minimum interest.
1954    /// If the interest is less than the previous minimum interest, then a
1955    /// `SetComponentInterest` request is sent with the new minimum interest.
1956    ///
1957    /// If a connection to `LogSettings` sends another `SetComponentInterest`
1958    /// request, its previous interest request will be undone.
1959    ///
1960    /// When the connection to `LogSettings` is finished, the interests are
1961    /// undone, unless persist is set to true. Each matched component minimum
1962    /// interest is updated with the new minimum interest in the set.
1963    SetComponentInterest {
1964        payload: LogSettingsSetComponentInterestRequest,
1965        responder: LogSettingsSetComponentInterestResponder,
1966    },
1967}
1968
1969impl LogSettingsRequest {
1970    #[allow(irrefutable_let_patterns)]
1971    pub fn into_set_interest(
1972        self,
1973    ) -> Option<(Vec<LogInterestSelector>, LogSettingsSetInterestResponder)> {
1974        if let LogSettingsRequest::SetInterest { selectors, responder } = self {
1975            Some((selectors, responder))
1976        } else {
1977            None
1978        }
1979    }
1980
1981    #[allow(irrefutable_let_patterns)]
1982    pub fn into_set_component_interest(
1983        self,
1984    ) -> Option<(LogSettingsSetComponentInterestRequest, LogSettingsSetComponentInterestResponder)>
1985    {
1986        if let LogSettingsRequest::SetComponentInterest { payload, responder } = self {
1987            Some((payload, responder))
1988        } else {
1989            None
1990        }
1991    }
1992
1993    /// Name of the method defined in FIDL
1994    pub fn method_name(&self) -> &'static str {
1995        match *self {
1996            LogSettingsRequest::SetInterest { .. } => "set_interest",
1997            LogSettingsRequest::SetComponentInterest { .. } => "set_component_interest",
1998        }
1999    }
2000}
2001
2002#[derive(Debug, Clone)]
2003pub struct LogSettingsControlHandle {
2004    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2005}
2006
2007impl fdomain_client::fidl::ControlHandle for LogSettingsControlHandle {
2008    fn shutdown(&self) {
2009        self.inner.shutdown()
2010    }
2011
2012    fn is_closed(&self) -> bool {
2013        self.inner.channel().is_closed()
2014    }
2015    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
2016        self.inner.channel().on_closed()
2017    }
2018}
2019
2020impl LogSettingsControlHandle {}
2021
2022#[must_use = "FIDL methods require a response to be sent"]
2023#[derive(Debug)]
2024pub struct LogSettingsSetInterestResponder {
2025    control_handle: std::mem::ManuallyDrop<LogSettingsControlHandle>,
2026    tx_id: u32,
2027}
2028
2029/// Set the the channel to be shutdown (see [`LogSettingsControlHandle::shutdown`])
2030/// if the responder is dropped without sending a response, so that the client
2031/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2032impl std::ops::Drop for LogSettingsSetInterestResponder {
2033    fn drop(&mut self) {
2034        self.control_handle.shutdown();
2035        // Safety: drops once, never accessed again
2036        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2037    }
2038}
2039
2040impl fdomain_client::fidl::Responder for LogSettingsSetInterestResponder {
2041    type ControlHandle = LogSettingsControlHandle;
2042
2043    fn control_handle(&self) -> &LogSettingsControlHandle {
2044        &self.control_handle
2045    }
2046
2047    fn drop_without_shutdown(mut self) {
2048        // Safety: drops once, never accessed again due to mem::forget
2049        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2050        // Prevent Drop from running (which would shut down the channel)
2051        std::mem::forget(self);
2052    }
2053}
2054
2055impl LogSettingsSetInterestResponder {
2056    /// Sends a response to the FIDL transaction.
2057    ///
2058    /// Sets the channel to shutdown if an error occurs.
2059    pub fn send(self) -> Result<(), fidl::Error> {
2060        let _result = self.send_raw();
2061        if _result.is_err() {
2062            self.control_handle.shutdown();
2063        }
2064        self.drop_without_shutdown();
2065        _result
2066    }
2067
2068    /// Similar to "send" but does not shutdown the channel if an error occurs.
2069    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2070        let _result = self.send_raw();
2071        self.drop_without_shutdown();
2072        _result
2073    }
2074
2075    fn send_raw(&self) -> Result<(), fidl::Error> {
2076        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2077            (),
2078            self.tx_id,
2079            0x71beced9d2411f90,
2080            fidl::encoding::DynamicFlags::empty(),
2081        )
2082    }
2083}
2084
2085#[must_use = "FIDL methods require a response to be sent"]
2086#[derive(Debug)]
2087pub struct LogSettingsSetComponentInterestResponder {
2088    control_handle: std::mem::ManuallyDrop<LogSettingsControlHandle>,
2089    tx_id: u32,
2090}
2091
2092/// Set the the channel to be shutdown (see [`LogSettingsControlHandle::shutdown`])
2093/// if the responder is dropped without sending a response, so that the client
2094/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2095impl std::ops::Drop for LogSettingsSetComponentInterestResponder {
2096    fn drop(&mut self) {
2097        self.control_handle.shutdown();
2098        // Safety: drops once, never accessed again
2099        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2100    }
2101}
2102
2103impl fdomain_client::fidl::Responder for LogSettingsSetComponentInterestResponder {
2104    type ControlHandle = LogSettingsControlHandle;
2105
2106    fn control_handle(&self) -> &LogSettingsControlHandle {
2107        &self.control_handle
2108    }
2109
2110    fn drop_without_shutdown(mut self) {
2111        // Safety: drops once, never accessed again due to mem::forget
2112        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2113        // Prevent Drop from running (which would shut down the channel)
2114        std::mem::forget(self);
2115    }
2116}
2117
2118impl LogSettingsSetComponentInterestResponder {
2119    /// Sends a response to the FIDL transaction.
2120    ///
2121    /// Sets the channel to shutdown if an error occurs.
2122    pub fn send(self) -> Result<(), fidl::Error> {
2123        let _result = self.send_raw();
2124        if _result.is_err() {
2125            self.control_handle.shutdown();
2126        }
2127        self.drop_without_shutdown();
2128        _result
2129    }
2130
2131    /// Similar to "send" but does not shutdown the channel if an error occurs.
2132    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2133        let _result = self.send_raw();
2134        self.drop_without_shutdown();
2135        _result
2136    }
2137
2138    fn send_raw(&self) -> Result<(), fidl::Error> {
2139        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2140            (),
2141            self.tx_id,
2142            0x35f7004d2367f6c1,
2143            fidl::encoding::DynamicFlags::empty(),
2144        )
2145    }
2146}
2147
2148#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2149pub struct LogStreamMarker;
2150
2151impl fdomain_client::fidl::ProtocolMarker for LogStreamMarker {
2152    type Proxy = LogStreamProxy;
2153    type RequestStream = LogStreamRequestStream;
2154
2155    const DEBUG_NAME: &'static str = "fuchsia.diagnostics.LogStream";
2156}
2157impl fdomain_client::fidl::DiscoverableProtocolMarker for LogStreamMarker {}
2158
2159pub trait LogStreamProxyInterface: Send + Sync {
2160    fn r#connect(
2161        &self,
2162        socket: fdomain_client::Socket,
2163        opts: &LogStreamOptions,
2164    ) -> Result<(), fidl::Error>;
2165}
2166
2167#[derive(Debug, Clone)]
2168pub struct LogStreamProxy {
2169    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
2170}
2171
2172impl fdomain_client::fidl::Proxy for LogStreamProxy {
2173    type Protocol = LogStreamMarker;
2174
2175    fn from_channel(inner: fdomain_client::Channel) -> Self {
2176        Self::new(inner)
2177    }
2178
2179    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
2180        self.client.into_channel().map_err(|client| Self { client })
2181    }
2182
2183    fn as_channel(&self) -> &fdomain_client::Channel {
2184        self.client.as_channel()
2185    }
2186}
2187
2188impl LogStreamProxy {
2189    /// Create a new Proxy for fuchsia.diagnostics/LogStream.
2190    pub fn new(channel: fdomain_client::Channel) -> Self {
2191        let protocol_name = <LogStreamMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
2192        Self { client: fidl::client::Client::new(channel, protocol_name) }
2193    }
2194
2195    /// Get a Stream of events from the remote end of the protocol.
2196    ///
2197    /// # Panics
2198    ///
2199    /// Panics if the event stream was already taken.
2200    pub fn take_event_stream(&self) -> LogStreamEventStream {
2201        LogStreamEventStream { event_receiver: self.client.take_event_receiver() }
2202    }
2203
2204    /// Enables clients to stream all logs stored in the Archivist.
2205    /// Expects a Datagram socket handle that can be written to.
2206    ///
2207    /// Logs will be written in the original FXT format with two additional
2208    /// arguments appended at the end of the record depending on the options
2209    /// passed:
2210    ///
2211    ///     - `$__moniker`: the moniker of the component that emitted the log.
2212    ///     - `$__url`: the URL of the component that emitted the log.
2213    ///     - `$__rolled_out`: the number of logs that were rolled out from the
2214    ///       buffer before this one.
2215    pub fn r#connect(
2216        &self,
2217        mut socket: fdomain_client::Socket,
2218        mut opts: &LogStreamOptions,
2219    ) -> Result<(), fidl::Error> {
2220        LogStreamProxyInterface::r#connect(self, socket, opts)
2221    }
2222}
2223
2224impl LogStreamProxyInterface for LogStreamProxy {
2225    fn r#connect(
2226        &self,
2227        mut socket: fdomain_client::Socket,
2228        mut opts: &LogStreamOptions,
2229    ) -> Result<(), fidl::Error> {
2230        self.client.send::<LogStreamConnectRequest>(
2231            (socket, opts),
2232            0x745eb34f10d51a88,
2233            fidl::encoding::DynamicFlags::FLEXIBLE,
2234        )
2235    }
2236}
2237
2238pub struct LogStreamEventStream {
2239    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
2240}
2241
2242impl std::marker::Unpin for LogStreamEventStream {}
2243
2244impl futures::stream::FusedStream for LogStreamEventStream {
2245    fn is_terminated(&self) -> bool {
2246        self.event_receiver.is_terminated()
2247    }
2248}
2249
2250impl futures::Stream for LogStreamEventStream {
2251    type Item = Result<LogStreamEvent, fidl::Error>;
2252
2253    fn poll_next(
2254        mut self: std::pin::Pin<&mut Self>,
2255        cx: &mut std::task::Context<'_>,
2256    ) -> std::task::Poll<Option<Self::Item>> {
2257        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2258            &mut self.event_receiver,
2259            cx
2260        )?) {
2261            Some(buf) => std::task::Poll::Ready(Some(LogStreamEvent::decode(buf))),
2262            None => std::task::Poll::Ready(None),
2263        }
2264    }
2265}
2266
2267#[derive(Debug)]
2268pub enum LogStreamEvent {
2269    #[non_exhaustive]
2270    _UnknownEvent {
2271        /// Ordinal of the event that was sent.
2272        ordinal: u64,
2273    },
2274}
2275
2276impl LogStreamEvent {
2277    /// Decodes a message buffer as a [`LogStreamEvent`].
2278    fn decode(
2279        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2280    ) -> Result<LogStreamEvent, fidl::Error> {
2281        let (bytes, _handles) = buf.split_mut();
2282        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2283        debug_assert_eq!(tx_header.tx_id, 0);
2284        match tx_header.ordinal {
2285            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2286                Ok(LogStreamEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2287            }
2288            _ => Err(fidl::Error::UnknownOrdinal {
2289                ordinal: tx_header.ordinal,
2290                protocol_name:
2291                    <LogStreamMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
2292            }),
2293        }
2294    }
2295}
2296
2297/// A Stream of incoming requests for fuchsia.diagnostics/LogStream.
2298pub struct LogStreamRequestStream {
2299    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2300    is_terminated: bool,
2301}
2302
2303impl std::marker::Unpin for LogStreamRequestStream {}
2304
2305impl futures::stream::FusedStream for LogStreamRequestStream {
2306    fn is_terminated(&self) -> bool {
2307        self.is_terminated
2308    }
2309}
2310
2311impl fdomain_client::fidl::RequestStream for LogStreamRequestStream {
2312    type Protocol = LogStreamMarker;
2313    type ControlHandle = LogStreamControlHandle;
2314
2315    fn from_channel(channel: fdomain_client::Channel) -> Self {
2316        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2317    }
2318
2319    fn control_handle(&self) -> Self::ControlHandle {
2320        LogStreamControlHandle { inner: self.inner.clone() }
2321    }
2322
2323    fn into_inner(
2324        self,
2325    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
2326    {
2327        (self.inner, self.is_terminated)
2328    }
2329
2330    fn from_inner(
2331        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2332        is_terminated: bool,
2333    ) -> Self {
2334        Self { inner, is_terminated }
2335    }
2336}
2337
2338impl futures::Stream for LogStreamRequestStream {
2339    type Item = Result<LogStreamRequest, fidl::Error>;
2340
2341    fn poll_next(
2342        mut self: std::pin::Pin<&mut Self>,
2343        cx: &mut std::task::Context<'_>,
2344    ) -> std::task::Poll<Option<Self::Item>> {
2345        let this = &mut *self;
2346        if this.inner.check_shutdown(cx) {
2347            this.is_terminated = true;
2348            return std::task::Poll::Ready(None);
2349        }
2350        if this.is_terminated {
2351            panic!("polled LogStreamRequestStream after completion");
2352        }
2353        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
2354            |bytes, handles| {
2355                match this.inner.channel().read_etc(cx, bytes, handles) {
2356                    std::task::Poll::Ready(Ok(())) => {}
2357                    std::task::Poll::Pending => return std::task::Poll::Pending,
2358                    std::task::Poll::Ready(Err(None)) => {
2359                        this.is_terminated = true;
2360                        return std::task::Poll::Ready(None);
2361                    }
2362                    std::task::Poll::Ready(Err(Some(e))) => {
2363                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2364                            e.into(),
2365                        ))));
2366                    }
2367                }
2368
2369                // A message has been received from the channel
2370                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2371
2372                std::task::Poll::Ready(Some(match header.ordinal {
2373                    0x745eb34f10d51a88 => {
2374                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2375                        let mut req = fidl::new_empty!(
2376                            LogStreamConnectRequest,
2377                            fdomain_client::fidl::FDomainResourceDialect
2378                        );
2379                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<LogStreamConnectRequest>(&header, _body_bytes, handles, &mut req)?;
2380                        let control_handle = LogStreamControlHandle { inner: this.inner.clone() };
2381                        Ok(LogStreamRequest::Connect {
2382                            socket: req.socket,
2383                            opts: req.opts,
2384
2385                            control_handle,
2386                        })
2387                    }
2388                    _ if header.tx_id == 0
2389                        && header
2390                            .dynamic_flags()
2391                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2392                    {
2393                        Ok(LogStreamRequest::_UnknownMethod {
2394                            ordinal: header.ordinal,
2395                            control_handle: LogStreamControlHandle { inner: this.inner.clone() },
2396                            method_type: fidl::MethodType::OneWay,
2397                        })
2398                    }
2399                    _ if header
2400                        .dynamic_flags()
2401                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2402                    {
2403                        this.inner.send_framework_err(
2404                            fidl::encoding::FrameworkErr::UnknownMethod,
2405                            header.tx_id,
2406                            header.ordinal,
2407                            header.dynamic_flags(),
2408                            (bytes, handles),
2409                        )?;
2410                        Ok(LogStreamRequest::_UnknownMethod {
2411                            ordinal: header.ordinal,
2412                            control_handle: LogStreamControlHandle { inner: this.inner.clone() },
2413                            method_type: fidl::MethodType::TwoWay,
2414                        })
2415                    }
2416                    _ => Err(fidl::Error::UnknownOrdinal {
2417                        ordinal: header.ordinal,
2418                        protocol_name:
2419                            <LogStreamMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
2420                    }),
2421                }))
2422            },
2423        )
2424    }
2425}
2426
2427#[derive(Debug)]
2428pub enum LogStreamRequest {
2429    /// Enables clients to stream all logs stored in the Archivist.
2430    /// Expects a Datagram socket handle that can be written to.
2431    ///
2432    /// Logs will be written in the original FXT format with two additional
2433    /// arguments appended at the end of the record depending on the options
2434    /// passed:
2435    ///
2436    ///     - `$__moniker`: the moniker of the component that emitted the log.
2437    ///     - `$__url`: the URL of the component that emitted the log.
2438    ///     - `$__rolled_out`: the number of logs that were rolled out from the
2439    ///       buffer before this one.
2440    Connect {
2441        socket: fdomain_client::Socket,
2442        opts: LogStreamOptions,
2443        control_handle: LogStreamControlHandle,
2444    },
2445    /// An interaction was received which does not match any known method.
2446    #[non_exhaustive]
2447    _UnknownMethod {
2448        /// Ordinal of the method that was called.
2449        ordinal: u64,
2450        control_handle: LogStreamControlHandle,
2451        method_type: fidl::MethodType,
2452    },
2453}
2454
2455impl LogStreamRequest {
2456    #[allow(irrefutable_let_patterns)]
2457    pub fn into_connect(
2458        self,
2459    ) -> Option<(fdomain_client::Socket, LogStreamOptions, LogStreamControlHandle)> {
2460        if let LogStreamRequest::Connect { socket, opts, control_handle } = self {
2461            Some((socket, opts, control_handle))
2462        } else {
2463            None
2464        }
2465    }
2466
2467    /// Name of the method defined in FIDL
2468    pub fn method_name(&self) -> &'static str {
2469        match *self {
2470            LogStreamRequest::Connect { .. } => "connect",
2471            LogStreamRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
2472                "unknown one-way method"
2473            }
2474            LogStreamRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
2475                "unknown two-way method"
2476            }
2477        }
2478    }
2479}
2480
2481#[derive(Debug, Clone)]
2482pub struct LogStreamControlHandle {
2483    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2484}
2485
2486impl fdomain_client::fidl::ControlHandle for LogStreamControlHandle {
2487    fn shutdown(&self) {
2488        self.inner.shutdown()
2489    }
2490
2491    fn is_closed(&self) -> bool {
2492        self.inner.channel().is_closed()
2493    }
2494    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
2495        self.inner.channel().on_closed()
2496    }
2497}
2498
2499impl LogStreamControlHandle {}
2500
2501mod internal {
2502    use super::*;
2503
2504    impl fidl::encoding::ResourceTypeMarker for ArchiveAccessorStreamDiagnosticsRequest {
2505        type Borrowed<'a> = &'a mut Self;
2506        fn take_or_borrow<'a>(
2507            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2508        ) -> Self::Borrowed<'a> {
2509            value
2510        }
2511    }
2512
2513    unsafe impl fidl::encoding::TypeMarker for ArchiveAccessorStreamDiagnosticsRequest {
2514        type Owned = Self;
2515
2516        #[inline(always)]
2517        fn inline_align(_context: fidl::encoding::Context) -> usize {
2518            8
2519        }
2520
2521        #[inline(always)]
2522        fn inline_size(_context: fidl::encoding::Context) -> usize {
2523            24
2524        }
2525    }
2526
2527    unsafe impl
2528        fidl::encoding::Encode<
2529            ArchiveAccessorStreamDiagnosticsRequest,
2530            fdomain_client::fidl::FDomainResourceDialect,
2531        > for &mut ArchiveAccessorStreamDiagnosticsRequest
2532    {
2533        #[inline]
2534        unsafe fn encode(
2535            self,
2536            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2537            offset: usize,
2538            _depth: fidl::encoding::Depth,
2539        ) -> fidl::Result<()> {
2540            encoder.debug_check_bounds::<ArchiveAccessorStreamDiagnosticsRequest>(offset);
2541            // Delegate to tuple encoding.
2542            fidl::encoding::Encode::<ArchiveAccessorStreamDiagnosticsRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
2543                (
2544                    <StreamParameters as fidl::encoding::ValueTypeMarker>::borrow(&self.stream_parameters),
2545                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<BatchIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.result_stream),
2546                ),
2547                encoder, offset, _depth
2548            )
2549        }
2550    }
2551    unsafe impl<
2552        T0: fidl::encoding::Encode<StreamParameters, fdomain_client::fidl::FDomainResourceDialect>,
2553        T1: fidl::encoding::Encode<
2554                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<BatchIteratorMarker>>,
2555                fdomain_client::fidl::FDomainResourceDialect,
2556            >,
2557    >
2558        fidl::encoding::Encode<
2559            ArchiveAccessorStreamDiagnosticsRequest,
2560            fdomain_client::fidl::FDomainResourceDialect,
2561        > for (T0, T1)
2562    {
2563        #[inline]
2564        unsafe fn encode(
2565            self,
2566            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2567            offset: usize,
2568            depth: fidl::encoding::Depth,
2569        ) -> fidl::Result<()> {
2570            encoder.debug_check_bounds::<ArchiveAccessorStreamDiagnosticsRequest>(offset);
2571            // Zero out padding regions. There's no need to apply masks
2572            // because the unmasked parts will be overwritten by fields.
2573            unsafe {
2574                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2575                (ptr as *mut u64).write_unaligned(0);
2576            }
2577            // Write the fields.
2578            self.0.encode(encoder, offset + 0, depth)?;
2579            self.1.encode(encoder, offset + 16, depth)?;
2580            Ok(())
2581        }
2582    }
2583
2584    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
2585        for ArchiveAccessorStreamDiagnosticsRequest
2586    {
2587        #[inline(always)]
2588        fn new_empty() -> Self {
2589            Self {
2590                stream_parameters: fidl::new_empty!(
2591                    StreamParameters,
2592                    fdomain_client::fidl::FDomainResourceDialect
2593                ),
2594                result_stream: fidl::new_empty!(
2595                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<BatchIteratorMarker>>,
2596                    fdomain_client::fidl::FDomainResourceDialect
2597                ),
2598            }
2599        }
2600
2601        #[inline]
2602        unsafe fn decode(
2603            &mut self,
2604            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2605            offset: usize,
2606            _depth: fidl::encoding::Depth,
2607        ) -> fidl::Result<()> {
2608            decoder.debug_check_bounds::<Self>(offset);
2609            // Verify that padding bytes are zero.
2610            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2611            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2612            let mask = 0xffffffff00000000u64;
2613            let maskedval = padval & mask;
2614            if maskedval != 0 {
2615                return Err(fidl::Error::NonZeroPadding {
2616                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2617                });
2618            }
2619            fidl::decode!(
2620                StreamParameters,
2621                fdomain_client::fidl::FDomainResourceDialect,
2622                &mut self.stream_parameters,
2623                decoder,
2624                offset + 0,
2625                _depth
2626            )?;
2627            fidl::decode!(
2628                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<BatchIteratorMarker>>,
2629                fdomain_client::fidl::FDomainResourceDialect,
2630                &mut self.result_stream,
2631                decoder,
2632                offset + 16,
2633                _depth
2634            )?;
2635            Ok(())
2636        }
2637    }
2638
2639    impl fidl::encoding::ResourceTypeMarker for BatchIteratorGetNextResponse {
2640        type Borrowed<'a> = &'a mut Self;
2641        fn take_or_borrow<'a>(
2642            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2643        ) -> Self::Borrowed<'a> {
2644            value
2645        }
2646    }
2647
2648    unsafe impl fidl::encoding::TypeMarker for BatchIteratorGetNextResponse {
2649        type Owned = Self;
2650
2651        #[inline(always)]
2652        fn inline_align(_context: fidl::encoding::Context) -> usize {
2653            8
2654        }
2655
2656        #[inline(always)]
2657        fn inline_size(_context: fidl::encoding::Context) -> usize {
2658            16
2659        }
2660    }
2661
2662    unsafe impl
2663        fidl::encoding::Encode<
2664            BatchIteratorGetNextResponse,
2665            fdomain_client::fidl::FDomainResourceDialect,
2666        > for &mut BatchIteratorGetNextResponse
2667    {
2668        #[inline]
2669        unsafe fn encode(
2670            self,
2671            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2672            offset: usize,
2673            _depth: fidl::encoding::Depth,
2674        ) -> fidl::Result<()> {
2675            encoder.debug_check_bounds::<BatchIteratorGetNextResponse>(offset);
2676            // Delegate to tuple encoding.
2677            fidl::encoding::Encode::<BatchIteratorGetNextResponse, fdomain_client::fidl::FDomainResourceDialect>::encode(
2678                (
2679                    <fidl::encoding::Vector<FormattedContent, 64> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.batch),
2680                ),
2681                encoder, offset, _depth
2682            )
2683        }
2684    }
2685    unsafe impl<
2686        T0: fidl::encoding::Encode<
2687                fidl::encoding::Vector<FormattedContent, 64>,
2688                fdomain_client::fidl::FDomainResourceDialect,
2689            >,
2690    >
2691        fidl::encoding::Encode<
2692            BatchIteratorGetNextResponse,
2693            fdomain_client::fidl::FDomainResourceDialect,
2694        > for (T0,)
2695    {
2696        #[inline]
2697        unsafe fn encode(
2698            self,
2699            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2700            offset: usize,
2701            depth: fidl::encoding::Depth,
2702        ) -> fidl::Result<()> {
2703            encoder.debug_check_bounds::<BatchIteratorGetNextResponse>(offset);
2704            // Zero out padding regions. There's no need to apply masks
2705            // because the unmasked parts will be overwritten by fields.
2706            // Write the fields.
2707            self.0.encode(encoder, offset + 0, depth)?;
2708            Ok(())
2709        }
2710    }
2711
2712    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
2713        for BatchIteratorGetNextResponse
2714    {
2715        #[inline(always)]
2716        fn new_empty() -> Self {
2717            Self {
2718                batch: fidl::new_empty!(fidl::encoding::Vector<FormattedContent, 64>, fdomain_client::fidl::FDomainResourceDialect),
2719            }
2720        }
2721
2722        #[inline]
2723        unsafe fn decode(
2724            &mut self,
2725            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2726            offset: usize,
2727            _depth: fidl::encoding::Depth,
2728        ) -> fidl::Result<()> {
2729            decoder.debug_check_bounds::<Self>(offset);
2730            // Verify that padding bytes are zero.
2731            fidl::decode!(fidl::encoding::Vector<FormattedContent, 64>, fdomain_client::fidl::FDomainResourceDialect, &mut self.batch, decoder, offset + 0, _depth)?;
2732            Ok(())
2733        }
2734    }
2735
2736    impl fidl::encoding::ResourceTypeMarker for LogStreamConnectRequest {
2737        type Borrowed<'a> = &'a mut Self;
2738        fn take_or_borrow<'a>(
2739            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2740        ) -> Self::Borrowed<'a> {
2741            value
2742        }
2743    }
2744
2745    unsafe impl fidl::encoding::TypeMarker for LogStreamConnectRequest {
2746        type Owned = Self;
2747
2748        #[inline(always)]
2749        fn inline_align(_context: fidl::encoding::Context) -> usize {
2750            8
2751        }
2752
2753        #[inline(always)]
2754        fn inline_size(_context: fidl::encoding::Context) -> usize {
2755            24
2756        }
2757    }
2758
2759    unsafe impl
2760        fidl::encoding::Encode<
2761            LogStreamConnectRequest,
2762            fdomain_client::fidl::FDomainResourceDialect,
2763        > for &mut LogStreamConnectRequest
2764    {
2765        #[inline]
2766        unsafe fn encode(
2767            self,
2768            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2769            offset: usize,
2770            _depth: fidl::encoding::Depth,
2771        ) -> fidl::Result<()> {
2772            encoder.debug_check_bounds::<LogStreamConnectRequest>(offset);
2773            // Delegate to tuple encoding.
2774            fidl::encoding::Encode::<
2775                LogStreamConnectRequest,
2776                fdomain_client::fidl::FDomainResourceDialect,
2777            >::encode(
2778                (
2779                    <fidl::encoding::HandleType<
2780                        fdomain_client::Socket,
2781                        { fidl::ObjectType::SOCKET.into_raw() },
2782                        16392,
2783                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2784                        &mut self.socket
2785                    ),
2786                    <LogStreamOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.opts),
2787                ),
2788                encoder,
2789                offset,
2790                _depth,
2791            )
2792        }
2793    }
2794    unsafe impl<
2795        T0: fidl::encoding::Encode<
2796                fidl::encoding::HandleType<
2797                    fdomain_client::Socket,
2798                    { fidl::ObjectType::SOCKET.into_raw() },
2799                    16392,
2800                >,
2801                fdomain_client::fidl::FDomainResourceDialect,
2802            >,
2803        T1: fidl::encoding::Encode<LogStreamOptions, fdomain_client::fidl::FDomainResourceDialect>,
2804    >
2805        fidl::encoding::Encode<
2806            LogStreamConnectRequest,
2807            fdomain_client::fidl::FDomainResourceDialect,
2808        > for (T0, T1)
2809    {
2810        #[inline]
2811        unsafe fn encode(
2812            self,
2813            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2814            offset: usize,
2815            depth: fidl::encoding::Depth,
2816        ) -> fidl::Result<()> {
2817            encoder.debug_check_bounds::<LogStreamConnectRequest>(offset);
2818            // Zero out padding regions. There's no need to apply masks
2819            // because the unmasked parts will be overwritten by fields.
2820            unsafe {
2821                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2822                (ptr as *mut u64).write_unaligned(0);
2823            }
2824            // Write the fields.
2825            self.0.encode(encoder, offset + 0, depth)?;
2826            self.1.encode(encoder, offset + 8, depth)?;
2827            Ok(())
2828        }
2829    }
2830
2831    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
2832        for LogStreamConnectRequest
2833    {
2834        #[inline(always)]
2835        fn new_empty() -> Self {
2836            Self {
2837                socket: fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16392>, fdomain_client::fidl::FDomainResourceDialect),
2838                opts: fidl::new_empty!(
2839                    LogStreamOptions,
2840                    fdomain_client::fidl::FDomainResourceDialect
2841                ),
2842            }
2843        }
2844
2845        #[inline]
2846        unsafe fn decode(
2847            &mut self,
2848            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2849            offset: usize,
2850            _depth: fidl::encoding::Depth,
2851        ) -> fidl::Result<()> {
2852            decoder.debug_check_bounds::<Self>(offset);
2853            // Verify that padding bytes are zero.
2854            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2855            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2856            let mask = 0xffffffff00000000u64;
2857            let maskedval = padval & mask;
2858            if maskedval != 0 {
2859                return Err(fidl::Error::NonZeroPadding {
2860                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2861                });
2862            }
2863            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)?;
2864            fidl::decode!(
2865                LogStreamOptions,
2866                fdomain_client::fidl::FDomainResourceDialect,
2867                &mut self.opts,
2868                decoder,
2869                offset + 8,
2870                _depth
2871            )?;
2872            Ok(())
2873        }
2874    }
2875
2876    impl fidl::encoding::ResourceTypeMarker for FormattedContent {
2877        type Borrowed<'a> = &'a mut Self;
2878        fn take_or_borrow<'a>(
2879            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2880        ) -> Self::Borrowed<'a> {
2881            value
2882        }
2883    }
2884
2885    unsafe impl fidl::encoding::TypeMarker for FormattedContent {
2886        type Owned = Self;
2887
2888        #[inline(always)]
2889        fn inline_align(_context: fidl::encoding::Context) -> usize {
2890            8
2891        }
2892
2893        #[inline(always)]
2894        fn inline_size(_context: fidl::encoding::Context) -> usize {
2895            16
2896        }
2897    }
2898
2899    unsafe impl
2900        fidl::encoding::Encode<FormattedContent, fdomain_client::fidl::FDomainResourceDialect>
2901        for &mut FormattedContent
2902    {
2903        #[inline]
2904        unsafe fn encode(
2905            self,
2906            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2907            offset: usize,
2908            _depth: fidl::encoding::Depth,
2909        ) -> fidl::Result<()> {
2910            encoder.debug_check_bounds::<FormattedContent>(offset);
2911            encoder.write_num::<u64>(self.ordinal(), offset);
2912            match self {
2913            FormattedContent::Json(ref mut val) => {
2914                fidl::encoding::encode_in_envelope::<fdomain_fuchsia_mem::Buffer, fdomain_client::fidl::FDomainResourceDialect>(
2915                    <fdomain_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
2916                    encoder, offset + 8, _depth
2917                )
2918            }
2919            FormattedContent::Text(ref mut val) => {
2920                fidl::encoding::encode_in_envelope::<fdomain_fuchsia_mem::Buffer, fdomain_client::fidl::FDomainResourceDialect>(
2921                    <fdomain_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
2922                    encoder, offset + 8, _depth
2923                )
2924            }
2925            FormattedContent::Cbor(ref mut val) => {
2926                fidl::encoding::encode_in_envelope::<fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect>(
2927                    <fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
2928                    encoder, offset + 8, _depth
2929                )
2930            }
2931            FormattedContent::Fxt(ref mut val) => {
2932                fidl::encoding::encode_in_envelope::<fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect>(
2933                    <fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
2934                    encoder, offset + 8, _depth
2935                )
2936            }
2937            FormattedContent::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2938        }
2939        }
2940    }
2941
2942    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
2943        for FormattedContent
2944    {
2945        #[inline(always)]
2946        fn new_empty() -> Self {
2947            Self::__SourceBreaking { unknown_ordinal: 0 }
2948        }
2949
2950        #[inline]
2951        unsafe fn decode(
2952            &mut self,
2953            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2954            offset: usize,
2955            mut depth: fidl::encoding::Depth,
2956        ) -> fidl::Result<()> {
2957            decoder.debug_check_bounds::<Self>(offset);
2958            #[allow(unused_variables)]
2959            let next_out_of_line = decoder.next_out_of_line();
2960            let handles_before = decoder.remaining_handles();
2961            let (ordinal, inlined, num_bytes, num_handles) =
2962                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2963
2964            let member_inline_size = match ordinal {
2965                1 => <fdomain_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
2966                    decoder.context,
2967                ),
2968                2 => <fdomain_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
2969                    decoder.context,
2970                ),
2971                3 => <fidl::encoding::HandleType<
2972                    fdomain_client::Vmo,
2973                    { fidl::ObjectType::VMO.into_raw() },
2974                    2147483648,
2975                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2976                4 => <fidl::encoding::HandleType<
2977                    fdomain_client::Vmo,
2978                    { fidl::ObjectType::VMO.into_raw() },
2979                    2147483648,
2980                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2981                0 => return Err(fidl::Error::UnknownUnionTag),
2982                _ => num_bytes as usize,
2983            };
2984
2985            if inlined != (member_inline_size <= 4) {
2986                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2987            }
2988            let _inner_offset;
2989            if inlined {
2990                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2991                _inner_offset = offset + 8;
2992            } else {
2993                depth.increment()?;
2994                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2995            }
2996            match ordinal {
2997                1 => {
2998                    #[allow(irrefutable_let_patterns)]
2999                    if let FormattedContent::Json(_) = self {
3000                        // Do nothing, read the value into the object
3001                    } else {
3002                        // Initialize `self` to the right variant
3003                        *self = FormattedContent::Json(fidl::new_empty!(
3004                            fdomain_fuchsia_mem::Buffer,
3005                            fdomain_client::fidl::FDomainResourceDialect
3006                        ));
3007                    }
3008                    #[allow(irrefutable_let_patterns)]
3009                    if let FormattedContent::Json(ref mut val) = self {
3010                        fidl::decode!(
3011                            fdomain_fuchsia_mem::Buffer,
3012                            fdomain_client::fidl::FDomainResourceDialect,
3013                            val,
3014                            decoder,
3015                            _inner_offset,
3016                            depth
3017                        )?;
3018                    } else {
3019                        unreachable!()
3020                    }
3021                }
3022                2 => {
3023                    #[allow(irrefutable_let_patterns)]
3024                    if let FormattedContent::Text(_) = self {
3025                        // Do nothing, read the value into the object
3026                    } else {
3027                        // Initialize `self` to the right variant
3028                        *self = FormattedContent::Text(fidl::new_empty!(
3029                            fdomain_fuchsia_mem::Buffer,
3030                            fdomain_client::fidl::FDomainResourceDialect
3031                        ));
3032                    }
3033                    #[allow(irrefutable_let_patterns)]
3034                    if let FormattedContent::Text(ref mut val) = self {
3035                        fidl::decode!(
3036                            fdomain_fuchsia_mem::Buffer,
3037                            fdomain_client::fidl::FDomainResourceDialect,
3038                            val,
3039                            decoder,
3040                            _inner_offset,
3041                            depth
3042                        )?;
3043                    } else {
3044                        unreachable!()
3045                    }
3046                }
3047                3 => {
3048                    #[allow(irrefutable_let_patterns)]
3049                    if let FormattedContent::Cbor(_) = self {
3050                        // Do nothing, read the value into the object
3051                    } else {
3052                        // Initialize `self` to the right variant
3053                        *self = FormattedContent::Cbor(
3054                            fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect),
3055                        );
3056                    }
3057                    #[allow(irrefutable_let_patterns)]
3058                    if let FormattedContent::Cbor(ref mut val) = self {
3059                        fidl::decode!(fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect, val, decoder, _inner_offset, depth)?;
3060                    } else {
3061                        unreachable!()
3062                    }
3063                }
3064                4 => {
3065                    #[allow(irrefutable_let_patterns)]
3066                    if let FormattedContent::Fxt(_) = self {
3067                        // Do nothing, read the value into the object
3068                    } else {
3069                        // Initialize `self` to the right variant
3070                        *self = FormattedContent::Fxt(
3071                            fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect),
3072                        );
3073                    }
3074                    #[allow(irrefutable_let_patterns)]
3075                    if let FormattedContent::Fxt(ref mut val) = self {
3076                        fidl::decode!(fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect, val, decoder, _inner_offset, depth)?;
3077                    } else {
3078                        unreachable!()
3079                    }
3080                }
3081                #[allow(deprecated)]
3082                ordinal => {
3083                    for _ in 0..num_handles {
3084                        decoder.drop_next_handle()?;
3085                    }
3086                    *self = FormattedContent::__SourceBreaking { unknown_ordinal: ordinal };
3087                }
3088            }
3089            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3090                return Err(fidl::Error::InvalidNumBytesInEnvelope);
3091            }
3092            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3093                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3094            }
3095            Ok(())
3096        }
3097    }
3098}