fidl_cf_sc_internal_config/
fidl_cf_sc_internal_config.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 _};
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
14pub struct Config {
15    pub addend: u8,
16    pub augend: u8,
17    pub do_in_process: bool,
18}
19
20impl fidl::Persistable for Config {}
21
22mod internal {
23    use super::*;
24
25    impl fidl::encoding::ValueTypeMarker for Config {
26        type Borrowed<'a> = &'a Self;
27        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
28            value
29        }
30    }
31
32    unsafe impl fidl::encoding::TypeMarker for Config {
33        type Owned = Self;
34
35        #[inline(always)]
36        fn inline_align(_context: fidl::encoding::Context) -> usize {
37            1
38        }
39
40        #[inline(always)]
41        fn inline_size(_context: fidl::encoding::Context) -> usize {
42            3
43        }
44    }
45
46    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Config, D> for &Config {
47        #[inline]
48        unsafe fn encode(
49            self,
50            encoder: &mut fidl::encoding::Encoder<'_, D>,
51            offset: usize,
52            _depth: fidl::encoding::Depth,
53        ) -> fidl::Result<()> {
54            encoder.debug_check_bounds::<Config>(offset);
55            // Delegate to tuple encoding.
56            fidl::encoding::Encode::<Config, D>::encode(
57                (
58                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.addend),
59                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.augend),
60                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.do_in_process),
61                ),
62                encoder,
63                offset,
64                _depth,
65            )
66        }
67    }
68    unsafe impl<
69            D: fidl::encoding::ResourceDialect,
70            T0: fidl::encoding::Encode<u8, D>,
71            T1: fidl::encoding::Encode<u8, D>,
72            T2: fidl::encoding::Encode<bool, D>,
73        > fidl::encoding::Encode<Config, D> for (T0, T1, T2)
74    {
75        #[inline]
76        unsafe fn encode(
77            self,
78            encoder: &mut fidl::encoding::Encoder<'_, D>,
79            offset: usize,
80            depth: fidl::encoding::Depth,
81        ) -> fidl::Result<()> {
82            encoder.debug_check_bounds::<Config>(offset);
83            // Zero out padding regions. There's no need to apply masks
84            // because the unmasked parts will be overwritten by fields.
85            // Write the fields.
86            self.0.encode(encoder, offset + 0, depth)?;
87            self.1.encode(encoder, offset + 1, depth)?;
88            self.2.encode(encoder, offset + 2, depth)?;
89            Ok(())
90        }
91    }
92
93    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Config {
94        #[inline(always)]
95        fn new_empty() -> Self {
96            Self {
97                addend: fidl::new_empty!(u8, D),
98                augend: fidl::new_empty!(u8, D),
99                do_in_process: fidl::new_empty!(bool, D),
100            }
101        }
102
103        #[inline]
104        unsafe fn decode(
105            &mut self,
106            decoder: &mut fidl::encoding::Decoder<'_, D>,
107            offset: usize,
108            _depth: fidl::encoding::Depth,
109        ) -> fidl::Result<()> {
110            decoder.debug_check_bounds::<Self>(offset);
111            // Verify that padding bytes are zero.
112            fidl::decode!(u8, D, &mut self.addend, decoder, offset + 0, _depth)?;
113            fidl::decode!(u8, D, &mut self.augend, decoder, offset + 1, _depth)?;
114            fidl::decode!(bool, D, &mut self.do_in_process, decoder, offset + 2, _depth)?;
115            Ok(())
116        }
117    }
118}