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