1#![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
11pub type AlarmId = String;
12
13#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
16pub enum WakeError {
17 Unspecified,
21 Dropped,
24 Internal,
28 #[doc(hidden)]
29 __SourceBreaking { unknown_ordinal: u32 },
30}
31
32#[macro_export]
34macro_rules! WakeErrorUnknown {
35 () => {
36 _
37 };
38}
39
40impl WakeError {
41 #[inline]
42 pub fn from_primitive(prim: u32) -> Option<Self> {
43 match prim {
44 1 => Some(Self::Unspecified),
45 2 => Some(Self::Dropped),
46 3 => Some(Self::Internal),
47 _ => None,
48 }
49 }
50
51 #[inline]
52 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
53 match prim {
54 1 => Self::Unspecified,
55 2 => Self::Dropped,
56 3 => Self::Internal,
57 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
58 }
59 }
60
61 #[inline]
62 pub fn unknown() -> Self {
63 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
64 }
65
66 #[inline]
67 pub const fn into_primitive(self) -> u32 {
68 match self {
69 Self::Unspecified => 1,
70 Self::Dropped => 2,
71 Self::Internal => 3,
72 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
73 }
74 }
75
76 #[inline]
77 pub fn is_unknown(&self) -> bool {
78 match self {
79 Self::__SourceBreaking { unknown_ordinal: _ } => true,
80 _ => false,
81 }
82 }
83}
84
85#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
86pub struct ClientSideBatonManagementCancelRequest {
87 pub alarm_id: String,
97}
98
99impl fidl::Persistable for ClientSideBatonManagementCancelRequest {}
100
101#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
102pub struct ClientSideBatonManagementCancelSyncRequest {
103 pub alarm_id: String,
104}
105
106impl fidl::Persistable for ClientSideBatonManagementCancelSyncRequest {}
107
108#[derive(Clone, Debug, Default, PartialEq)]
109pub struct WakeGetPropertiesResponse {
110 pub is_supported: Option<bool>,
114 #[doc(hidden)]
115 pub __source_breaking: fidl::marker::SourceBreaking,
116}
117
118impl fidl::Persistable for WakeGetPropertiesResponse {}
119
120mod internal {
121 use super::*;
122 unsafe impl fidl::encoding::TypeMarker for WakeError {
123 type Owned = Self;
124
125 #[inline(always)]
126 fn inline_align(_context: fidl::encoding::Context) -> usize {
127 std::mem::align_of::<u32>()
128 }
129
130 #[inline(always)]
131 fn inline_size(_context: fidl::encoding::Context) -> usize {
132 std::mem::size_of::<u32>()
133 }
134
135 #[inline(always)]
136 fn encode_is_copy() -> bool {
137 false
138 }
139
140 #[inline(always)]
141 fn decode_is_copy() -> bool {
142 false
143 }
144 }
145
146 impl fidl::encoding::ValueTypeMarker for WakeError {
147 type Borrowed<'a> = Self;
148 #[inline(always)]
149 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
150 *value
151 }
152 }
153
154 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for WakeError {
155 #[inline]
156 unsafe fn encode(
157 self,
158 encoder: &mut fidl::encoding::Encoder<'_, D>,
159 offset: usize,
160 _depth: fidl::encoding::Depth,
161 ) -> fidl::Result<()> {
162 encoder.debug_check_bounds::<Self>(offset);
163 encoder.write_num(self.into_primitive(), offset);
164 Ok(())
165 }
166 }
167
168 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WakeError {
169 #[inline(always)]
170 fn new_empty() -> Self {
171 Self::unknown()
172 }
173
174 #[inline]
175 unsafe fn decode(
176 &mut self,
177 decoder: &mut fidl::encoding::Decoder<'_, D>,
178 offset: usize,
179 _depth: fidl::encoding::Depth,
180 ) -> fidl::Result<()> {
181 decoder.debug_check_bounds::<Self>(offset);
182 let prim = decoder.read_num::<u32>(offset);
183
184 *self = Self::from_primitive_allow_unknown(prim);
185 Ok(())
186 }
187 }
188
189 impl fidl::encoding::ValueTypeMarker for ClientSideBatonManagementCancelRequest {
190 type Borrowed<'a> = &'a Self;
191 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
192 value
193 }
194 }
195
196 unsafe impl fidl::encoding::TypeMarker for ClientSideBatonManagementCancelRequest {
197 type Owned = Self;
198
199 #[inline(always)]
200 fn inline_align(_context: fidl::encoding::Context) -> usize {
201 8
202 }
203
204 #[inline(always)]
205 fn inline_size(_context: fidl::encoding::Context) -> usize {
206 16
207 }
208 }
209
210 unsafe impl<D: fidl::encoding::ResourceDialect>
211 fidl::encoding::Encode<ClientSideBatonManagementCancelRequest, D>
212 for &ClientSideBatonManagementCancelRequest
213 {
214 #[inline]
215 unsafe fn encode(
216 self,
217 encoder: &mut fidl::encoding::Encoder<'_, D>,
218 offset: usize,
219 _depth: fidl::encoding::Depth,
220 ) -> fidl::Result<()> {
221 encoder.debug_check_bounds::<ClientSideBatonManagementCancelRequest>(offset);
222 fidl::encoding::Encode::<ClientSideBatonManagementCancelRequest, D>::encode(
224 (<fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow(
225 &self.alarm_id,
226 ),),
227 encoder,
228 offset,
229 _depth,
230 )
231 }
232 }
233 unsafe impl<
234 D: fidl::encoding::ResourceDialect,
235 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<128>, D>,
236 > fidl::encoding::Encode<ClientSideBatonManagementCancelRequest, D> for (T0,)
237 {
238 #[inline]
239 unsafe fn encode(
240 self,
241 encoder: &mut fidl::encoding::Encoder<'_, D>,
242 offset: usize,
243 depth: fidl::encoding::Depth,
244 ) -> fidl::Result<()> {
245 encoder.debug_check_bounds::<ClientSideBatonManagementCancelRequest>(offset);
246 self.0.encode(encoder, offset + 0, depth)?;
250 Ok(())
251 }
252 }
253
254 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
255 for ClientSideBatonManagementCancelRequest
256 {
257 #[inline(always)]
258 fn new_empty() -> Self {
259 Self { alarm_id: fidl::new_empty!(fidl::encoding::BoundedString<128>, D) }
260 }
261
262 #[inline]
263 unsafe fn decode(
264 &mut self,
265 decoder: &mut fidl::encoding::Decoder<'_, D>,
266 offset: usize,
267 _depth: fidl::encoding::Depth,
268 ) -> fidl::Result<()> {
269 decoder.debug_check_bounds::<Self>(offset);
270 fidl::decode!(
272 fidl::encoding::BoundedString<128>,
273 D,
274 &mut self.alarm_id,
275 decoder,
276 offset + 0,
277 _depth
278 )?;
279 Ok(())
280 }
281 }
282
283 impl fidl::encoding::ValueTypeMarker for ClientSideBatonManagementCancelSyncRequest {
284 type Borrowed<'a> = &'a Self;
285 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
286 value
287 }
288 }
289
290 unsafe impl fidl::encoding::TypeMarker for ClientSideBatonManagementCancelSyncRequest {
291 type Owned = Self;
292
293 #[inline(always)]
294 fn inline_align(_context: fidl::encoding::Context) -> usize {
295 8
296 }
297
298 #[inline(always)]
299 fn inline_size(_context: fidl::encoding::Context) -> usize {
300 16
301 }
302 }
303
304 unsafe impl<D: fidl::encoding::ResourceDialect>
305 fidl::encoding::Encode<ClientSideBatonManagementCancelSyncRequest, D>
306 for &ClientSideBatonManagementCancelSyncRequest
307 {
308 #[inline]
309 unsafe fn encode(
310 self,
311 encoder: &mut fidl::encoding::Encoder<'_, D>,
312 offset: usize,
313 _depth: fidl::encoding::Depth,
314 ) -> fidl::Result<()> {
315 encoder.debug_check_bounds::<ClientSideBatonManagementCancelSyncRequest>(offset);
316 fidl::encoding::Encode::<ClientSideBatonManagementCancelSyncRequest, D>::encode(
318 (<fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow(
319 &self.alarm_id,
320 ),),
321 encoder,
322 offset,
323 _depth,
324 )
325 }
326 }
327 unsafe impl<
328 D: fidl::encoding::ResourceDialect,
329 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<128>, D>,
330 > fidl::encoding::Encode<ClientSideBatonManagementCancelSyncRequest, D> for (T0,)
331 {
332 #[inline]
333 unsafe fn encode(
334 self,
335 encoder: &mut fidl::encoding::Encoder<'_, D>,
336 offset: usize,
337 depth: fidl::encoding::Depth,
338 ) -> fidl::Result<()> {
339 encoder.debug_check_bounds::<ClientSideBatonManagementCancelSyncRequest>(offset);
340 self.0.encode(encoder, offset + 0, depth)?;
344 Ok(())
345 }
346 }
347
348 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
349 for ClientSideBatonManagementCancelSyncRequest
350 {
351 #[inline(always)]
352 fn new_empty() -> Self {
353 Self { alarm_id: fidl::new_empty!(fidl::encoding::BoundedString<128>, D) }
354 }
355
356 #[inline]
357 unsafe fn decode(
358 &mut self,
359 decoder: &mut fidl::encoding::Decoder<'_, D>,
360 offset: usize,
361 _depth: fidl::encoding::Depth,
362 ) -> fidl::Result<()> {
363 decoder.debug_check_bounds::<Self>(offset);
364 fidl::decode!(
366 fidl::encoding::BoundedString<128>,
367 D,
368 &mut self.alarm_id,
369 decoder,
370 offset + 0,
371 _depth
372 )?;
373 Ok(())
374 }
375 }
376
377 impl WakeGetPropertiesResponse {
378 #[inline(always)]
379 fn max_ordinal_present(&self) -> u64 {
380 if let Some(_) = self.is_supported {
381 return 1;
382 }
383 0
384 }
385 }
386
387 impl fidl::encoding::ValueTypeMarker for WakeGetPropertiesResponse {
388 type Borrowed<'a> = &'a Self;
389 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
390 value
391 }
392 }
393
394 unsafe impl fidl::encoding::TypeMarker for WakeGetPropertiesResponse {
395 type Owned = Self;
396
397 #[inline(always)]
398 fn inline_align(_context: fidl::encoding::Context) -> usize {
399 8
400 }
401
402 #[inline(always)]
403 fn inline_size(_context: fidl::encoding::Context) -> usize {
404 16
405 }
406 }
407
408 unsafe impl<D: fidl::encoding::ResourceDialect>
409 fidl::encoding::Encode<WakeGetPropertiesResponse, D> for &WakeGetPropertiesResponse
410 {
411 unsafe fn encode(
412 self,
413 encoder: &mut fidl::encoding::Encoder<'_, D>,
414 offset: usize,
415 mut depth: fidl::encoding::Depth,
416 ) -> fidl::Result<()> {
417 encoder.debug_check_bounds::<WakeGetPropertiesResponse>(offset);
418 let max_ordinal: u64 = self.max_ordinal_present();
420 encoder.write_num(max_ordinal, offset);
421 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
422 if max_ordinal == 0 {
424 return Ok(());
425 }
426 depth.increment()?;
427 let envelope_size = 8;
428 let bytes_len = max_ordinal as usize * envelope_size;
429 #[allow(unused_variables)]
430 let offset = encoder.out_of_line_offset(bytes_len);
431 let mut _prev_end_offset: usize = 0;
432 if 1 > max_ordinal {
433 return Ok(());
434 }
435
436 let cur_offset: usize = (1 - 1) * envelope_size;
439
440 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
442
443 fidl::encoding::encode_in_envelope_optional::<bool, D>(
448 self.is_supported.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
449 encoder,
450 offset + cur_offset,
451 depth,
452 )?;
453
454 _prev_end_offset = cur_offset + envelope_size;
455
456 Ok(())
457 }
458 }
459
460 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
461 for WakeGetPropertiesResponse
462 {
463 #[inline(always)]
464 fn new_empty() -> Self {
465 Self::default()
466 }
467
468 unsafe fn decode(
469 &mut self,
470 decoder: &mut fidl::encoding::Decoder<'_, D>,
471 offset: usize,
472 mut depth: fidl::encoding::Depth,
473 ) -> fidl::Result<()> {
474 decoder.debug_check_bounds::<Self>(offset);
475 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
476 None => return Err(fidl::Error::NotNullable),
477 Some(len) => len,
478 };
479 if len == 0 {
481 return Ok(());
482 };
483 depth.increment()?;
484 let envelope_size = 8;
485 let bytes_len = len * envelope_size;
486 let offset = decoder.out_of_line_offset(bytes_len)?;
487 let mut _next_ordinal_to_read = 0;
489 let mut next_offset = offset;
490 let end_offset = offset + bytes_len;
491 _next_ordinal_to_read += 1;
492 if next_offset >= end_offset {
493 return Ok(());
494 }
495
496 while _next_ordinal_to_read < 1 {
498 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
499 _next_ordinal_to_read += 1;
500 next_offset += envelope_size;
501 }
502
503 let next_out_of_line = decoder.next_out_of_line();
504 let handles_before = decoder.remaining_handles();
505 if let Some((inlined, num_bytes, num_handles)) =
506 fidl::encoding::decode_envelope_header(decoder, next_offset)?
507 {
508 let member_inline_size =
509 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
510 if inlined != (member_inline_size <= 4) {
511 return Err(fidl::Error::InvalidInlineBitInEnvelope);
512 }
513 let inner_offset;
514 let mut inner_depth = depth.clone();
515 if inlined {
516 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
517 inner_offset = next_offset;
518 } else {
519 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
520 inner_depth.increment()?;
521 }
522 let val_ref = self.is_supported.get_or_insert_with(|| fidl::new_empty!(bool, D));
523 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
524 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
525 {
526 return Err(fidl::Error::InvalidNumBytesInEnvelope);
527 }
528 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
529 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
530 }
531 }
532
533 next_offset += envelope_size;
534
535 while next_offset < end_offset {
537 _next_ordinal_to_read += 1;
538 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
539 next_offset += envelope_size;
540 }
541
542 Ok(())
543 }
544 }
545}