Skip to main content

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