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