fidl_fuchsia_diagnostics_host/
fidl_fuchsia_diagnostics_host.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_diagnostics_host_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct ArchiveAccessorStreamDiagnosticsRequest {
16    pub parameters: fidl_fuchsia_diagnostics::StreamParameters,
17    pub stream: fidl::Socket,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21    for ArchiveAccessorStreamDiagnosticsRequest
22{
23}
24
25#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
26pub struct ArchiveAccessorMarker;
27
28impl fidl::endpoints::ProtocolMarker for ArchiveAccessorMarker {
29    type Proxy = ArchiveAccessorProxy;
30    type RequestStream = ArchiveAccessorRequestStream;
31    #[cfg(target_os = "fuchsia")]
32    type SynchronousProxy = ArchiveAccessorSynchronousProxy;
33
34    const DEBUG_NAME: &'static str = "fuchsia.diagnostics.host.ArchiveAccessor";
35}
36impl fidl::endpoints::DiscoverableProtocolMarker for ArchiveAccessorMarker {}
37
38pub trait ArchiveAccessorProxyInterface: Send + Sync {
39    type StreamDiagnosticsResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
40    fn r#stream_diagnostics(
41        &self,
42        parameters: &fidl_fuchsia_diagnostics::StreamParameters,
43        stream: fidl::Socket,
44    ) -> Self::StreamDiagnosticsResponseFut;
45}
46#[derive(Debug)]
47#[cfg(target_os = "fuchsia")]
48pub struct ArchiveAccessorSynchronousProxy {
49    client: fidl::client::sync::Client,
50}
51
52#[cfg(target_os = "fuchsia")]
53impl fidl::endpoints::SynchronousProxy for ArchiveAccessorSynchronousProxy {
54    type Proxy = ArchiveAccessorProxy;
55    type Protocol = ArchiveAccessorMarker;
56
57    fn from_channel(inner: fidl::Channel) -> Self {
58        Self::new(inner)
59    }
60
61    fn into_channel(self) -> fidl::Channel {
62        self.client.into_channel()
63    }
64
65    fn as_channel(&self) -> &fidl::Channel {
66        self.client.as_channel()
67    }
68}
69
70#[cfg(target_os = "fuchsia")]
71impl ArchiveAccessorSynchronousProxy {
72    pub fn new(channel: fidl::Channel) -> Self {
73        let protocol_name = <ArchiveAccessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
74        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
75    }
76
77    pub fn into_channel(self) -> fidl::Channel {
78        self.client.into_channel()
79    }
80
81    /// Waits until an event arrives and returns it. It is safe for other
82    /// threads to make concurrent requests while waiting for an event.
83    pub fn wait_for_event(
84        &self,
85        deadline: zx::MonotonicInstant,
86    ) -> Result<ArchiveAccessorEvent, fidl::Error> {
87        ArchiveAccessorEvent::decode(self.client.wait_for_event(deadline)?)
88    }
89
90    /// Creates an iterator over diagnostics data on the system.
91    ///   * The iterator may be finite by streaming in SNAPSHOT mode, serving only the
92    ///     current state of diagnostics data on the system.
93    ///   * The iterator may be infinite by streaming in either SNAPSHOT_THEN_SUBSCRIBE
94    ///     or SUBSCRIBE mode; the prior first provides iteration over the current state of
95    ///     the sytem, and then both provide ongoing iteration over newly arriving diagnostics
96    ///     data.
97    ///
98    /// `stream` is a socket that diagnostic records are exposed to the client over.
99    ///
100    /// `parameters` is a [fuchsia.diagnostics/StreamParameter] which
101    ///   specifies how to configure the stream.
102    ///
103    /// The stream will carry data using the format documented in
104    /// [Diagnostics schema][https://fuchsia.dev/fuchsia-src/reference/platform-spec/diagnostics/schema]
105    pub fn r#stream_diagnostics(
106        &self,
107        mut parameters: &fidl_fuchsia_diagnostics::StreamParameters,
108        mut stream: fidl::Socket,
109        ___deadline: zx::MonotonicInstant,
110    ) -> Result<(), fidl::Error> {
111        let _response = self.client.send_query::<
112            ArchiveAccessorStreamDiagnosticsRequest,
113            fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
114        >(
115            (parameters, stream,),
116            0x29635237a23c495b,
117            fidl::encoding::DynamicFlags::FLEXIBLE,
118            ___deadline,
119        )?
120        .into_result::<ArchiveAccessorMarker>("stream_diagnostics")?;
121        Ok(_response)
122    }
123}
124
125#[derive(Debug, Clone)]
126pub struct ArchiveAccessorProxy {
127    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
128}
129
130impl fidl::endpoints::Proxy for ArchiveAccessorProxy {
131    type Protocol = ArchiveAccessorMarker;
132
133    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
134        Self::new(inner)
135    }
136
137    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
138        self.client.into_channel().map_err(|client| Self { client })
139    }
140
141    fn as_channel(&self) -> &::fidl::AsyncChannel {
142        self.client.as_channel()
143    }
144}
145
146impl ArchiveAccessorProxy {
147    /// Create a new Proxy for fuchsia.diagnostics.host/ArchiveAccessor.
148    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
149        let protocol_name = <ArchiveAccessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
150        Self { client: fidl::client::Client::new(channel, protocol_name) }
151    }
152
153    /// Get a Stream of events from the remote end of the protocol.
154    ///
155    /// # Panics
156    ///
157    /// Panics if the event stream was already taken.
158    pub fn take_event_stream(&self) -> ArchiveAccessorEventStream {
159        ArchiveAccessorEventStream { event_receiver: self.client.take_event_receiver() }
160    }
161
162    /// Creates an iterator over diagnostics data on the system.
163    ///   * The iterator may be finite by streaming in SNAPSHOT mode, serving only the
164    ///     current state of diagnostics data on the system.
165    ///   * The iterator may be infinite by streaming in either SNAPSHOT_THEN_SUBSCRIBE
166    ///     or SUBSCRIBE mode; the prior first provides iteration over the current state of
167    ///     the sytem, and then both provide ongoing iteration over newly arriving diagnostics
168    ///     data.
169    ///
170    /// `stream` is a socket that diagnostic records are exposed to the client over.
171    ///
172    /// `parameters` is a [fuchsia.diagnostics/StreamParameter] which
173    ///   specifies how to configure the stream.
174    ///
175    /// The stream will carry data using the format documented in
176    /// [Diagnostics schema][https://fuchsia.dev/fuchsia-src/reference/platform-spec/diagnostics/schema]
177    pub fn r#stream_diagnostics(
178        &self,
179        mut parameters: &fidl_fuchsia_diagnostics::StreamParameters,
180        mut stream: fidl::Socket,
181    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
182        ArchiveAccessorProxyInterface::r#stream_diagnostics(self, parameters, stream)
183    }
184}
185
186impl ArchiveAccessorProxyInterface for ArchiveAccessorProxy {
187    type StreamDiagnosticsResponseFut =
188        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
189    fn r#stream_diagnostics(
190        &self,
191        mut parameters: &fidl_fuchsia_diagnostics::StreamParameters,
192        mut stream: fidl::Socket,
193    ) -> Self::StreamDiagnosticsResponseFut {
194        fn _decode(
195            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
196        ) -> Result<(), fidl::Error> {
197            let _response = fidl::client::decode_transaction_body::<
198                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
199                fidl::encoding::DefaultFuchsiaResourceDialect,
200                0x29635237a23c495b,
201            >(_buf?)?
202            .into_result::<ArchiveAccessorMarker>("stream_diagnostics")?;
203            Ok(_response)
204        }
205        self.client.send_query_and_decode::<ArchiveAccessorStreamDiagnosticsRequest, ()>(
206            (parameters, stream),
207            0x29635237a23c495b,
208            fidl::encoding::DynamicFlags::FLEXIBLE,
209            _decode,
210        )
211    }
212}
213
214pub struct ArchiveAccessorEventStream {
215    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
216}
217
218impl std::marker::Unpin for ArchiveAccessorEventStream {}
219
220impl futures::stream::FusedStream for ArchiveAccessorEventStream {
221    fn is_terminated(&self) -> bool {
222        self.event_receiver.is_terminated()
223    }
224}
225
226impl futures::Stream for ArchiveAccessorEventStream {
227    type Item = Result<ArchiveAccessorEvent, fidl::Error>;
228
229    fn poll_next(
230        mut self: std::pin::Pin<&mut Self>,
231        cx: &mut std::task::Context<'_>,
232    ) -> std::task::Poll<Option<Self::Item>> {
233        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
234            &mut self.event_receiver,
235            cx
236        )?) {
237            Some(buf) => std::task::Poll::Ready(Some(ArchiveAccessorEvent::decode(buf))),
238            None => std::task::Poll::Ready(None),
239        }
240    }
241}
242
243#[derive(Debug)]
244pub enum ArchiveAccessorEvent {
245    #[non_exhaustive]
246    _UnknownEvent {
247        /// Ordinal of the event that was sent.
248        ordinal: u64,
249    },
250}
251
252impl ArchiveAccessorEvent {
253    /// Decodes a message buffer as a [`ArchiveAccessorEvent`].
254    fn decode(
255        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
256    ) -> Result<ArchiveAccessorEvent, fidl::Error> {
257        let (bytes, _handles) = buf.split_mut();
258        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
259        debug_assert_eq!(tx_header.tx_id, 0);
260        match tx_header.ordinal {
261            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
262                Ok(ArchiveAccessorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
263            }
264            _ => Err(fidl::Error::UnknownOrdinal {
265                ordinal: tx_header.ordinal,
266                protocol_name:
267                    <ArchiveAccessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
268            }),
269        }
270    }
271}
272
273/// A Stream of incoming requests for fuchsia.diagnostics.host/ArchiveAccessor.
274pub struct ArchiveAccessorRequestStream {
275    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
276    is_terminated: bool,
277}
278
279impl std::marker::Unpin for ArchiveAccessorRequestStream {}
280
281impl futures::stream::FusedStream for ArchiveAccessorRequestStream {
282    fn is_terminated(&self) -> bool {
283        self.is_terminated
284    }
285}
286
287impl fidl::endpoints::RequestStream for ArchiveAccessorRequestStream {
288    type Protocol = ArchiveAccessorMarker;
289    type ControlHandle = ArchiveAccessorControlHandle;
290
291    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
292        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
293    }
294
295    fn control_handle(&self) -> Self::ControlHandle {
296        ArchiveAccessorControlHandle { inner: self.inner.clone() }
297    }
298
299    fn into_inner(
300        self,
301    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
302    {
303        (self.inner, self.is_terminated)
304    }
305
306    fn from_inner(
307        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
308        is_terminated: bool,
309    ) -> Self {
310        Self { inner, is_terminated }
311    }
312}
313
314impl futures::Stream for ArchiveAccessorRequestStream {
315    type Item = Result<ArchiveAccessorRequest, fidl::Error>;
316
317    fn poll_next(
318        mut self: std::pin::Pin<&mut Self>,
319        cx: &mut std::task::Context<'_>,
320    ) -> std::task::Poll<Option<Self::Item>> {
321        let this = &mut *self;
322        if this.inner.check_shutdown(cx) {
323            this.is_terminated = true;
324            return std::task::Poll::Ready(None);
325        }
326        if this.is_terminated {
327            panic!("polled ArchiveAccessorRequestStream after completion");
328        }
329        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
330            |bytes, handles| {
331                match this.inner.channel().read_etc(cx, bytes, handles) {
332                    std::task::Poll::Ready(Ok(())) => {}
333                    std::task::Poll::Pending => return std::task::Poll::Pending,
334                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
335                        this.is_terminated = true;
336                        return std::task::Poll::Ready(None);
337                    }
338                    std::task::Poll::Ready(Err(e)) => {
339                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
340                            e.into(),
341                        ))))
342                    }
343                }
344
345                // A message has been received from the channel
346                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
347
348                std::task::Poll::Ready(Some(match header.ordinal {
349                    0x29635237a23c495b => {
350                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
351                        let mut req = fidl::new_empty!(
352                            ArchiveAccessorStreamDiagnosticsRequest,
353                            fidl::encoding::DefaultFuchsiaResourceDialect
354                        );
355                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ArchiveAccessorStreamDiagnosticsRequest>(&header, _body_bytes, handles, &mut req)?;
356                        let control_handle =
357                            ArchiveAccessorControlHandle { inner: this.inner.clone() };
358                        Ok(ArchiveAccessorRequest::StreamDiagnostics {
359                            parameters: req.parameters,
360                            stream: req.stream,
361
362                            responder: ArchiveAccessorStreamDiagnosticsResponder {
363                                control_handle: std::mem::ManuallyDrop::new(control_handle),
364                                tx_id: header.tx_id,
365                            },
366                        })
367                    }
368                    _ if header.tx_id == 0
369                        && header
370                            .dynamic_flags()
371                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
372                    {
373                        Ok(ArchiveAccessorRequest::_UnknownMethod {
374                            ordinal: header.ordinal,
375                            control_handle: ArchiveAccessorControlHandle {
376                                inner: this.inner.clone(),
377                            },
378                            method_type: fidl::MethodType::OneWay,
379                        })
380                    }
381                    _ if header
382                        .dynamic_flags()
383                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
384                    {
385                        this.inner.send_framework_err(
386                            fidl::encoding::FrameworkErr::UnknownMethod,
387                            header.tx_id,
388                            header.ordinal,
389                            header.dynamic_flags(),
390                            (bytes, handles),
391                        )?;
392                        Ok(ArchiveAccessorRequest::_UnknownMethod {
393                            ordinal: header.ordinal,
394                            control_handle: ArchiveAccessorControlHandle {
395                                inner: this.inner.clone(),
396                            },
397                            method_type: fidl::MethodType::TwoWay,
398                        })
399                    }
400                    _ => Err(fidl::Error::UnknownOrdinal {
401                        ordinal: header.ordinal,
402                        protocol_name:
403                            <ArchiveAccessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
404                    }),
405                }))
406            },
407        )
408    }
409}
410
411#[derive(Debug)]
412pub enum ArchiveAccessorRequest {
413    /// Creates an iterator over diagnostics data on the system.
414    ///   * The iterator may be finite by streaming in SNAPSHOT mode, serving only the
415    ///     current state of diagnostics data on the system.
416    ///   * The iterator may be infinite by streaming in either SNAPSHOT_THEN_SUBSCRIBE
417    ///     or SUBSCRIBE mode; the prior first provides iteration over the current state of
418    ///     the sytem, and then both provide ongoing iteration over newly arriving diagnostics
419    ///     data.
420    ///
421    /// `stream` is a socket that diagnostic records are exposed to the client over.
422    ///
423    /// `parameters` is a [fuchsia.diagnostics/StreamParameter] which
424    ///   specifies how to configure the stream.
425    ///
426    /// The stream will carry data using the format documented in
427    /// [Diagnostics schema][https://fuchsia.dev/fuchsia-src/reference/platform-spec/diagnostics/schema]
428    StreamDiagnostics {
429        parameters: fidl_fuchsia_diagnostics::StreamParameters,
430        stream: fidl::Socket,
431        responder: ArchiveAccessorStreamDiagnosticsResponder,
432    },
433    /// An interaction was received which does not match any known method.
434    #[non_exhaustive]
435    _UnknownMethod {
436        /// Ordinal of the method that was called.
437        ordinal: u64,
438        control_handle: ArchiveAccessorControlHandle,
439        method_type: fidl::MethodType,
440    },
441}
442
443impl ArchiveAccessorRequest {
444    #[allow(irrefutable_let_patterns)]
445    pub fn into_stream_diagnostics(
446        self,
447    ) -> Option<(
448        fidl_fuchsia_diagnostics::StreamParameters,
449        fidl::Socket,
450        ArchiveAccessorStreamDiagnosticsResponder,
451    )> {
452        if let ArchiveAccessorRequest::StreamDiagnostics { parameters, stream, responder } = self {
453            Some((parameters, stream, responder))
454        } else {
455            None
456        }
457    }
458
459    /// Name of the method defined in FIDL
460    pub fn method_name(&self) -> &'static str {
461        match *self {
462            ArchiveAccessorRequest::StreamDiagnostics { .. } => "stream_diagnostics",
463            ArchiveAccessorRequest::_UnknownMethod {
464                method_type: fidl::MethodType::OneWay,
465                ..
466            } => "unknown one-way method",
467            ArchiveAccessorRequest::_UnknownMethod {
468                method_type: fidl::MethodType::TwoWay,
469                ..
470            } => "unknown two-way method",
471        }
472    }
473}
474
475#[derive(Debug, Clone)]
476pub struct ArchiveAccessorControlHandle {
477    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
478}
479
480impl fidl::endpoints::ControlHandle for ArchiveAccessorControlHandle {
481    fn shutdown(&self) {
482        self.inner.shutdown()
483    }
484    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
485        self.inner.shutdown_with_epitaph(status)
486    }
487
488    fn is_closed(&self) -> bool {
489        self.inner.channel().is_closed()
490    }
491    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
492        self.inner.channel().on_closed()
493    }
494
495    #[cfg(target_os = "fuchsia")]
496    fn signal_peer(
497        &self,
498        clear_mask: zx::Signals,
499        set_mask: zx::Signals,
500    ) -> Result<(), zx_status::Status> {
501        use fidl::Peered;
502        self.inner.channel().signal_peer(clear_mask, set_mask)
503    }
504}
505
506impl ArchiveAccessorControlHandle {}
507
508#[must_use = "FIDL methods require a response to be sent"]
509#[derive(Debug)]
510pub struct ArchiveAccessorStreamDiagnosticsResponder {
511    control_handle: std::mem::ManuallyDrop<ArchiveAccessorControlHandle>,
512    tx_id: u32,
513}
514
515/// Set the the channel to be shutdown (see [`ArchiveAccessorControlHandle::shutdown`])
516/// if the responder is dropped without sending a response, so that the client
517/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
518impl std::ops::Drop for ArchiveAccessorStreamDiagnosticsResponder {
519    fn drop(&mut self) {
520        self.control_handle.shutdown();
521        // Safety: drops once, never accessed again
522        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
523    }
524}
525
526impl fidl::endpoints::Responder for ArchiveAccessorStreamDiagnosticsResponder {
527    type ControlHandle = ArchiveAccessorControlHandle;
528
529    fn control_handle(&self) -> &ArchiveAccessorControlHandle {
530        &self.control_handle
531    }
532
533    fn drop_without_shutdown(mut self) {
534        // Safety: drops once, never accessed again due to mem::forget
535        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
536        // Prevent Drop from running (which would shut down the channel)
537        std::mem::forget(self);
538    }
539}
540
541impl ArchiveAccessorStreamDiagnosticsResponder {
542    /// Sends a response to the FIDL transaction.
543    ///
544    /// Sets the channel to shutdown if an error occurs.
545    pub fn send(self) -> Result<(), fidl::Error> {
546        let _result = self.send_raw();
547        if _result.is_err() {
548            self.control_handle.shutdown();
549        }
550        self.drop_without_shutdown();
551        _result
552    }
553
554    /// Similar to "send" but does not shutdown the channel if an error occurs.
555    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
556        let _result = self.send_raw();
557        self.drop_without_shutdown();
558        _result
559    }
560
561    fn send_raw(&self) -> Result<(), fidl::Error> {
562        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
563            fidl::encoding::Flexible::new(()),
564            self.tx_id,
565            0x29635237a23c495b,
566            fidl::encoding::DynamicFlags::FLEXIBLE,
567        )
568    }
569}
570
571mod internal {
572    use super::*;
573
574    impl fidl::encoding::ResourceTypeMarker for ArchiveAccessorStreamDiagnosticsRequest {
575        type Borrowed<'a> = &'a mut Self;
576        fn take_or_borrow<'a>(
577            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
578        ) -> Self::Borrowed<'a> {
579            value
580        }
581    }
582
583    unsafe impl fidl::encoding::TypeMarker for ArchiveAccessorStreamDiagnosticsRequest {
584        type Owned = Self;
585
586        #[inline(always)]
587        fn inline_align(_context: fidl::encoding::Context) -> usize {
588            8
589        }
590
591        #[inline(always)]
592        fn inline_size(_context: fidl::encoding::Context) -> usize {
593            24
594        }
595    }
596
597    unsafe impl
598        fidl::encoding::Encode<
599            ArchiveAccessorStreamDiagnosticsRequest,
600            fidl::encoding::DefaultFuchsiaResourceDialect,
601        > for &mut ArchiveAccessorStreamDiagnosticsRequest
602    {
603        #[inline]
604        unsafe fn encode(
605            self,
606            encoder: &mut fidl::encoding::Encoder<
607                '_,
608                fidl::encoding::DefaultFuchsiaResourceDialect,
609            >,
610            offset: usize,
611            _depth: fidl::encoding::Depth,
612        ) -> fidl::Result<()> {
613            encoder.debug_check_bounds::<ArchiveAccessorStreamDiagnosticsRequest>(offset);
614            // Delegate to tuple encoding.
615            fidl::encoding::Encode::<ArchiveAccessorStreamDiagnosticsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
616                (
617                    <fidl_fuchsia_diagnostics::StreamParameters as fidl::encoding::ValueTypeMarker>::borrow(&self.parameters),
618                    <fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16392> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.stream),
619                ),
620                encoder, offset, _depth
621            )
622        }
623    }
624    unsafe impl<
625            T0: fidl::encoding::Encode<
626                fidl_fuchsia_diagnostics::StreamParameters,
627                fidl::encoding::DefaultFuchsiaResourceDialect,
628            >,
629            T1: fidl::encoding::Encode<
630                fidl::encoding::HandleType<
631                    fidl::Socket,
632                    { fidl::ObjectType::SOCKET.into_raw() },
633                    16392,
634                >,
635                fidl::encoding::DefaultFuchsiaResourceDialect,
636            >,
637        >
638        fidl::encoding::Encode<
639            ArchiveAccessorStreamDiagnosticsRequest,
640            fidl::encoding::DefaultFuchsiaResourceDialect,
641        > for (T0, T1)
642    {
643        #[inline]
644        unsafe fn encode(
645            self,
646            encoder: &mut fidl::encoding::Encoder<
647                '_,
648                fidl::encoding::DefaultFuchsiaResourceDialect,
649            >,
650            offset: usize,
651            depth: fidl::encoding::Depth,
652        ) -> fidl::Result<()> {
653            encoder.debug_check_bounds::<ArchiveAccessorStreamDiagnosticsRequest>(offset);
654            // Zero out padding regions. There's no need to apply masks
655            // because the unmasked parts will be overwritten by fields.
656            unsafe {
657                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
658                (ptr as *mut u64).write_unaligned(0);
659            }
660            // Write the fields.
661            self.0.encode(encoder, offset + 0, depth)?;
662            self.1.encode(encoder, offset + 16, depth)?;
663            Ok(())
664        }
665    }
666
667    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
668        for ArchiveAccessorStreamDiagnosticsRequest
669    {
670        #[inline(always)]
671        fn new_empty() -> Self {
672            Self {
673                parameters: fidl::new_empty!(
674                    fidl_fuchsia_diagnostics::StreamParameters,
675                    fidl::encoding::DefaultFuchsiaResourceDialect
676                ),
677                stream: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16392>, fidl::encoding::DefaultFuchsiaResourceDialect),
678            }
679        }
680
681        #[inline]
682        unsafe fn decode(
683            &mut self,
684            decoder: &mut fidl::encoding::Decoder<
685                '_,
686                fidl::encoding::DefaultFuchsiaResourceDialect,
687            >,
688            offset: usize,
689            _depth: fidl::encoding::Depth,
690        ) -> fidl::Result<()> {
691            decoder.debug_check_bounds::<Self>(offset);
692            // Verify that padding bytes are zero.
693            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
694            let padval = unsafe { (ptr as *const u64).read_unaligned() };
695            let mask = 0xffffffff00000000u64;
696            let maskedval = padval & mask;
697            if maskedval != 0 {
698                return Err(fidl::Error::NonZeroPadding {
699                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
700                });
701            }
702            fidl::decode!(
703                fidl_fuchsia_diagnostics::StreamParameters,
704                fidl::encoding::DefaultFuchsiaResourceDialect,
705                &mut self.parameters,
706                decoder,
707                offset + 0,
708                _depth
709            )?;
710            fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16392>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.stream, decoder, offset + 16, _depth)?;
711            Ok(())
712        }
713    }
714}