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