fidl_cf_sc_internal_ns3config_common/
fidl_cf_sc_internal_ns3config_common.rs1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
12pub struct Config {
13 pub debug_logs: bool,
14 pub num_threads: u8,
15 pub opaque_iids: bool,
16 pub suspend_enabled: 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 4
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 fidl::encoding::Encode::<Config, D>::encode(
56 (
57 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.debug_logs),
58 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.num_threads),
59 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.opaque_iids),
60 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.suspend_enabled),
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<u8, D>,
72 T2: fidl::encoding::Encode<bool, D>,
73 T3: fidl::encoding::Encode<bool, D>,
74 > fidl::encoding::Encode<Config, D> for (T0, T1, T2, T3)
75 {
76 #[inline]
77 unsafe fn encode(
78 self,
79 encoder: &mut fidl::encoding::Encoder<'_, D>,
80 offset: usize,
81 depth: fidl::encoding::Depth,
82 ) -> fidl::Result<()> {
83 encoder.debug_check_bounds::<Config>(offset);
84 self.0.encode(encoder, offset + 0, depth)?;
88 self.1.encode(encoder, offset + 1, depth)?;
89 self.2.encode(encoder, offset + 2, depth)?;
90 self.3.encode(encoder, offset + 3, depth)?;
91 Ok(())
92 }
93 }
94
95 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Config {
96 #[inline(always)]
97 fn new_empty() -> Self {
98 Self {
99 debug_logs: fidl::new_empty!(bool, D),
100 num_threads: fidl::new_empty!(u8, D),
101 opaque_iids: fidl::new_empty!(bool, D),
102 suspend_enabled: fidl::new_empty!(bool, D),
103 }
104 }
105
106 #[inline]
107 unsafe fn decode(
108 &mut self,
109 decoder: &mut fidl::encoding::Decoder<'_, D>,
110 offset: usize,
111 _depth: fidl::encoding::Depth,
112 ) -> fidl::Result<()> {
113 decoder.debug_check_bounds::<Self>(offset);
114 fidl::decode!(bool, D, &mut self.debug_logs, decoder, offset + 0, _depth)?;
116 fidl::decode!(u8, D, &mut self.num_threads, decoder, offset + 1, _depth)?;
117 fidl::decode!(bool, D, &mut self.opaque_iids, decoder, offset + 2, _depth)?;
118 fidl::decode!(bool, D, &mut self.suspend_enabled, decoder, offset + 3, _depth)?;
119 Ok(())
120 }
121 }
122}