fidl_fuchsia_power_clientlevel__common/
fidl_fuchsia_power_clientlevel__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(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
20pub enum ClientType {
21 Wlan,
22 #[doc(hidden)]
23 __SourceBreaking {
24 unknown_ordinal: u32,
25 },
26}
27
28#[macro_export]
30macro_rules! ClientTypeUnknown {
31 () => {
32 _
33 };
34}
35
36impl ClientType {
37 #[inline]
38 pub fn from_primitive(prim: u32) -> Option<Self> {
39 match prim {
40 1 => Some(Self::Wlan),
41 _ => None,
42 }
43 }
44
45 #[inline]
46 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
47 match prim {
48 1 => Self::Wlan,
49 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
50 }
51 }
52
53 #[inline]
54 pub fn unknown() -> Self {
55 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
56 }
57
58 #[inline]
59 pub const fn into_primitive(self) -> u32 {
60 match self {
61 Self::Wlan => 1,
62 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
63 }
64 }
65
66 #[inline]
67 pub fn is_unknown(&self) -> bool {
68 match self {
69 Self::__SourceBreaking { unknown_ordinal: _ } => true,
70 _ => false,
71 }
72 }
73}
74
75#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
76#[repr(C)]
77pub struct WatcherWatchResponse {
78 pub level: u64,
79}
80
81impl fidl::Persistable for WatcherWatchResponse {}
82
83pub mod connector_ordinals {
84 pub const CONNECT: u64 = 0x29e603fe743fd08a;
85}
86
87pub mod watcher_ordinals {
88 pub const WATCH: u64 = 0x29592d2e62f4101a;
89}
90
91mod internal {
92 use super::*;
93 unsafe impl fidl::encoding::TypeMarker for ClientType {
94 type Owned = Self;
95
96 #[inline(always)]
97 fn inline_align(_context: fidl::encoding::Context) -> usize {
98 std::mem::align_of::<u32>()
99 }
100
101 #[inline(always)]
102 fn inline_size(_context: fidl::encoding::Context) -> usize {
103 std::mem::size_of::<u32>()
104 }
105
106 #[inline(always)]
107 fn encode_is_copy() -> bool {
108 false
109 }
110
111 #[inline(always)]
112 fn decode_is_copy() -> bool {
113 false
114 }
115 }
116
117 impl fidl::encoding::ValueTypeMarker for ClientType {
118 type Borrowed<'a> = Self;
119 #[inline(always)]
120 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
121 *value
122 }
123 }
124
125 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ClientType {
126 #[inline]
127 unsafe fn encode(
128 self,
129 encoder: &mut fidl::encoding::Encoder<'_, D>,
130 offset: usize,
131 _depth: fidl::encoding::Depth,
132 ) -> fidl::Result<()> {
133 encoder.debug_check_bounds::<Self>(offset);
134 encoder.write_num(self.into_primitive(), offset);
135 Ok(())
136 }
137 }
138
139 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ClientType {
140 #[inline(always)]
141 fn new_empty() -> Self {
142 Self::unknown()
143 }
144
145 #[inline]
146 unsafe fn decode(
147 &mut self,
148 decoder: &mut fidl::encoding::Decoder<'_, D>,
149 offset: usize,
150 _depth: fidl::encoding::Depth,
151 ) -> fidl::Result<()> {
152 decoder.debug_check_bounds::<Self>(offset);
153 let prim = decoder.read_num::<u32>(offset);
154
155 *self = Self::from_primitive_allow_unknown(prim);
156 Ok(())
157 }
158 }
159
160 impl fidl::encoding::ValueTypeMarker for WatcherWatchResponse {
161 type Borrowed<'a> = &'a Self;
162 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
163 value
164 }
165 }
166
167 unsafe impl fidl::encoding::TypeMarker for WatcherWatchResponse {
168 type Owned = Self;
169
170 #[inline(always)]
171 fn inline_align(_context: fidl::encoding::Context) -> usize {
172 8
173 }
174
175 #[inline(always)]
176 fn inline_size(_context: fidl::encoding::Context) -> usize {
177 8
178 }
179 #[inline(always)]
180 fn encode_is_copy() -> bool {
181 true
182 }
183
184 #[inline(always)]
185 fn decode_is_copy() -> bool {
186 true
187 }
188 }
189
190 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WatcherWatchResponse, D>
191 for &WatcherWatchResponse
192 {
193 #[inline]
194 unsafe fn encode(
195 self,
196 encoder: &mut fidl::encoding::Encoder<'_, D>,
197 offset: usize,
198 _depth: fidl::encoding::Depth,
199 ) -> fidl::Result<()> {
200 encoder.debug_check_bounds::<WatcherWatchResponse>(offset);
201 unsafe {
202 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
204 (buf_ptr as *mut WatcherWatchResponse)
205 .write_unaligned((self as *const WatcherWatchResponse).read());
206 }
209 Ok(())
210 }
211 }
212 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
213 fidl::encoding::Encode<WatcherWatchResponse, D> for (T0,)
214 {
215 #[inline]
216 unsafe fn encode(
217 self,
218 encoder: &mut fidl::encoding::Encoder<'_, D>,
219 offset: usize,
220 depth: fidl::encoding::Depth,
221 ) -> fidl::Result<()> {
222 encoder.debug_check_bounds::<WatcherWatchResponse>(offset);
223 self.0.encode(encoder, offset + 0, depth)?;
227 Ok(())
228 }
229 }
230
231 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WatcherWatchResponse {
232 #[inline(always)]
233 fn new_empty() -> Self {
234 Self { level: fidl::new_empty!(u64, D) }
235 }
236
237 #[inline]
238 unsafe fn decode(
239 &mut self,
240 decoder: &mut fidl::encoding::Decoder<'_, D>,
241 offset: usize,
242 _depth: fidl::encoding::Depth,
243 ) -> fidl::Result<()> {
244 decoder.debug_check_bounds::<Self>(offset);
245 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
246 unsafe {
249 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
250 }
251 Ok(())
252 }
253 }
254}