fidl_cf_sc_internal_sessionmanagerconfig__common/
fidl_cf_sc_internal_sessionmanagerconfig__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, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
12pub struct Config {
13 pub autolaunch: bool,
14 pub enable_debug_shortcut: bool,
15 pub session_url: String,
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 8
37 }
38
39 #[inline(always)]
40 fn inline_size(_context: fidl::encoding::Context) -> usize {
41 32
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.autolaunch),
58 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enable_debug_shortcut),
59 <fidl::encoding::BoundedString<512> as fidl::encoding::ValueTypeMarker>::borrow(
60 &self.session_url,
61 ),
62 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.suspend_enabled),
63 ),
64 encoder,
65 offset,
66 _depth,
67 )
68 }
69 }
70 unsafe impl<
71 D: fidl::encoding::ResourceDialect,
72 T0: fidl::encoding::Encode<bool, D>,
73 T1: fidl::encoding::Encode<bool, D>,
74 T2: fidl::encoding::Encode<fidl::encoding::BoundedString<512>, D>,
75 T3: fidl::encoding::Encode<bool, D>,
76 > fidl::encoding::Encode<Config, D> for (T0, T1, T2, T3)
77 {
78 #[inline]
79 unsafe fn encode(
80 self,
81 encoder: &mut fidl::encoding::Encoder<'_, D>,
82 offset: usize,
83 depth: fidl::encoding::Depth,
84 ) -> fidl::Result<()> {
85 encoder.debug_check_bounds::<Config>(offset);
86 unsafe {
89 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
90 (ptr as *mut u64).write_unaligned(0);
91 }
92 unsafe {
93 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
94 (ptr as *mut u64).write_unaligned(0);
95 }
96 self.0.encode(encoder, offset + 0, depth)?;
98 self.1.encode(encoder, offset + 1, depth)?;
99 self.2.encode(encoder, offset + 8, depth)?;
100 self.3.encode(encoder, offset + 24, depth)?;
101 Ok(())
102 }
103 }
104
105 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Config {
106 #[inline(always)]
107 fn new_empty() -> Self {
108 Self {
109 autolaunch: fidl::new_empty!(bool, D),
110 enable_debug_shortcut: fidl::new_empty!(bool, D),
111 session_url: fidl::new_empty!(fidl::encoding::BoundedString<512>, D),
112 suspend_enabled: fidl::new_empty!(bool, D),
113 }
114 }
115
116 #[inline]
117 unsafe fn decode(
118 &mut self,
119 decoder: &mut fidl::encoding::Decoder<'_, D>,
120 offset: usize,
121 _depth: fidl::encoding::Depth,
122 ) -> fidl::Result<()> {
123 decoder.debug_check_bounds::<Self>(offset);
124 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
126 let padval = unsafe { (ptr as *const u64).read_unaligned() };
127 let mask = 0xffffffffffff0000u64;
128 let maskedval = padval & mask;
129 if maskedval != 0 {
130 return Err(fidl::Error::NonZeroPadding {
131 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
132 });
133 }
134 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
135 let padval = unsafe { (ptr as *const u64).read_unaligned() };
136 let mask = 0xffffffffffffff00u64;
137 let maskedval = padval & mask;
138 if maskedval != 0 {
139 return Err(fidl::Error::NonZeroPadding {
140 padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
141 });
142 }
143 fidl::decode!(bool, D, &mut self.autolaunch, decoder, offset + 0, _depth)?;
144 fidl::decode!(bool, D, &mut self.enable_debug_shortcut, decoder, offset + 1, _depth)?;
145 fidl::decode!(
146 fidl::encoding::BoundedString<512>,
147 D,
148 &mut self.session_url,
149 decoder,
150 offset + 8,
151 _depth
152 )?;
153 fidl::decode!(bool, D, &mut self.suspend_enabled, decoder, offset + 24, _depth)?;
154 Ok(())
155 }
156 }
157}