fidl_fuchsia_test_syscalls__common/
fidl_fuchsia_test_syscalls__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)]
12#[repr(C)]
13pub struct ControlSetSuspendEnterResultRequest {
14 pub status: i32,
15}
16
17impl fidl::Persistable for ControlSetSuspendEnterResultRequest {}
18
19#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
21#[repr(C)]
22pub struct State {
23 pub zx_system_suspend_enter_calls_count: u32,
26}
27
28impl fidl::Persistable for State {}
29
30pub mod control_ordinals {
31 pub const SET_SUSPEND_ENTER_RESULT: u64 = 0x138f77664d2dcd4;
32 pub const GET_STATE: u64 = 0x759e8e871c4a33d1;
33}
34
35mod internal {
36 use super::*;
37
38 impl fidl::encoding::ValueTypeMarker for ControlSetSuspendEnterResultRequest {
39 type Borrowed<'a> = &'a Self;
40 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
41 value
42 }
43 }
44
45 unsafe impl fidl::encoding::TypeMarker for ControlSetSuspendEnterResultRequest {
46 type Owned = Self;
47
48 #[inline(always)]
49 fn inline_align(_context: fidl::encoding::Context) -> usize {
50 4
51 }
52
53 #[inline(always)]
54 fn inline_size(_context: fidl::encoding::Context) -> usize {
55 4
56 }
57 #[inline(always)]
58 fn encode_is_copy() -> bool {
59 true
60 }
61
62 #[inline(always)]
63 fn decode_is_copy() -> bool {
64 true
65 }
66 }
67
68 unsafe impl<D: fidl::encoding::ResourceDialect>
69 fidl::encoding::Encode<ControlSetSuspendEnterResultRequest, D>
70 for &ControlSetSuspendEnterResultRequest
71 {
72 #[inline]
73 unsafe fn encode(
74 self,
75 encoder: &mut fidl::encoding::Encoder<'_, D>,
76 offset: usize,
77 _depth: fidl::encoding::Depth,
78 ) -> fidl::Result<()> {
79 encoder.debug_check_bounds::<ControlSetSuspendEnterResultRequest>(offset);
80 unsafe {
81 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
83 (buf_ptr as *mut ControlSetSuspendEnterResultRequest)
84 .write_unaligned((self as *const ControlSetSuspendEnterResultRequest).read());
85 }
88 Ok(())
89 }
90 }
91 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
92 fidl::encoding::Encode<ControlSetSuspendEnterResultRequest, D> for (T0,)
93 {
94 #[inline]
95 unsafe fn encode(
96 self,
97 encoder: &mut fidl::encoding::Encoder<'_, D>,
98 offset: usize,
99 depth: fidl::encoding::Depth,
100 ) -> fidl::Result<()> {
101 encoder.debug_check_bounds::<ControlSetSuspendEnterResultRequest>(offset);
102 self.0.encode(encoder, offset + 0, depth)?;
106 Ok(())
107 }
108 }
109
110 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
111 for ControlSetSuspendEnterResultRequest
112 {
113 #[inline(always)]
114 fn new_empty() -> Self {
115 Self { status: fidl::new_empty!(i32, D) }
116 }
117
118 #[inline]
119 unsafe fn decode(
120 &mut self,
121 decoder: &mut fidl::encoding::Decoder<'_, D>,
122 offset: usize,
123 _depth: fidl::encoding::Depth,
124 ) -> fidl::Result<()> {
125 decoder.debug_check_bounds::<Self>(offset);
126 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
127 unsafe {
130 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
131 }
132 Ok(())
133 }
134 }
135
136 impl fidl::encoding::ValueTypeMarker for State {
137 type Borrowed<'a> = &'a Self;
138 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
139 value
140 }
141 }
142
143 unsafe impl fidl::encoding::TypeMarker for State {
144 type Owned = Self;
145
146 #[inline(always)]
147 fn inline_align(_context: fidl::encoding::Context) -> usize {
148 4
149 }
150
151 #[inline(always)]
152 fn inline_size(_context: fidl::encoding::Context) -> usize {
153 4
154 }
155 #[inline(always)]
156 fn encode_is_copy() -> bool {
157 true
158 }
159
160 #[inline(always)]
161 fn decode_is_copy() -> bool {
162 true
163 }
164 }
165
166 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<State, D> for &State {
167 #[inline]
168 unsafe fn encode(
169 self,
170 encoder: &mut fidl::encoding::Encoder<'_, D>,
171 offset: usize,
172 _depth: fidl::encoding::Depth,
173 ) -> fidl::Result<()> {
174 encoder.debug_check_bounds::<State>(offset);
175 unsafe {
176 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
178 (buf_ptr as *mut State).write_unaligned((self as *const State).read());
179 }
182 Ok(())
183 }
184 }
185 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
186 fidl::encoding::Encode<State, D> for (T0,)
187 {
188 #[inline]
189 unsafe fn encode(
190 self,
191 encoder: &mut fidl::encoding::Encoder<'_, D>,
192 offset: usize,
193 depth: fidl::encoding::Depth,
194 ) -> fidl::Result<()> {
195 encoder.debug_check_bounds::<State>(offset);
196 self.0.encode(encoder, offset + 0, depth)?;
200 Ok(())
201 }
202 }
203
204 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for State {
205 #[inline(always)]
206 fn new_empty() -> Self {
207 Self { zx_system_suspend_enter_calls_count: fidl::new_empty!(u32, D) }
208 }
209
210 #[inline]
211 unsafe fn decode(
212 &mut self,
213 decoder: &mut fidl::encoding::Decoder<'_, D>,
214 offset: usize,
215 _depth: fidl::encoding::Depth,
216 ) -> fidl::Result<()> {
217 decoder.debug_check_bounds::<Self>(offset);
218 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
219 unsafe {
222 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
223 }
224 Ok(())
225 }
226 }
227}