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