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
11#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
13#[repr(u32)]
14pub enum DeadlineEventType {
15 Set = 1,
17 Expired = 2,
19}
20
21impl DeadlineEventType {
22 #[inline]
23 pub fn from_primitive(prim: u32) -> Option<Self> {
24 match prim {
25 1 => Some(Self::Set),
26 2 => Some(Self::Expired),
27 _ => None,
28 }
29 }
30
31 #[inline]
32 pub const fn into_primitive(self) -> u32 {
33 self as u32
34 }
35}
36
37#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
38pub struct FakeClockControlAdvanceRequest {
39 pub increment: Increment,
40}
41
42impl fidl::Persistable for FakeClockControlAdvanceRequest {}
43
44#[derive(Clone, Debug, PartialEq)]
45pub struct FakeClockControlIgnoreNamedDeadlineRequest {
46 pub deadline_id: fidl_fuchsia_testing_deadline__common::DeadlineId,
47}
48
49impl fidl::Persistable for FakeClockControlIgnoreNamedDeadlineRequest {}
50
51#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
52#[repr(C)]
53pub struct FakeClockControlIncrementMonoToBootOffsetByRequest {
54 pub increment: i64,
55}
56
57impl fidl::Persistable for FakeClockControlIncrementMonoToBootOffsetByRequest {}
58
59#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
60pub struct FakeClockControlResumeWithIncrementsRequest {
61 pub real: i64,
62 pub increment: Increment,
63}
64
65impl fidl::Persistable for FakeClockControlResumeWithIncrementsRequest {}
66
67#[derive(Clone, Debug, PartialEq)]
68pub struct FakeClockCreateNamedDeadlineInBootRequest {
69 pub id: fidl_fuchsia_testing_deadline__common::DeadlineId,
70 pub duration: i64,
71}
72
73impl fidl::Persistable for FakeClockCreateNamedDeadlineInBootRequest {}
74
75#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
76#[repr(C)]
77pub struct FakeClockCreateNamedDeadlineInBootResponse {
78 pub deadline: fidl::BootInstant,
79}
80
81impl fidl::Persistable for FakeClockCreateNamedDeadlineInBootResponse {}
82
83#[derive(Clone, Debug, PartialEq)]
84pub struct FakeClockCreateNamedDeadlineInMonotonicRequest {
85 pub id: fidl_fuchsia_testing_deadline__common::DeadlineId,
86 pub duration: i64,
87}
88
89impl fidl::Persistable for FakeClockCreateNamedDeadlineInMonotonicRequest {}
90
91#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
92#[repr(C)]
93pub struct FakeClockCreateNamedDeadlineInMonotonicResponse {
94 pub deadline: fidl::MonotonicInstant,
95}
96
97impl fidl::Persistable for FakeClockCreateNamedDeadlineInMonotonicResponse {}
98
99#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
100#[repr(C)]
101pub struct FakeClockGetResponse {
102 pub boot_time: fidl::BootInstant,
103 pub monotonic_time: fidl::MonotonicInstant,
104}
105
106impl fidl::Persistable for FakeClockGetResponse {}
107
108#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
110#[repr(C)]
111pub struct RandomRange {
112 pub min_rand: i64,
114 pub max_rand: i64,
116}
117
118impl fidl::Persistable for RandomRange {}
119
120#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
122pub enum Increment {
123 Determined(i64),
125 Random(RandomRange),
127}
128
129impl Increment {
130 #[inline]
131 pub fn ordinal(&self) -> u64 {
132 match *self {
133 Self::Determined(_) => 1,
134 Self::Random(_) => 2,
135 }
136 }
137}
138
139impl fidl::Persistable for Increment {}
140
141pub mod fake_clock_ordinals {
142 pub const GET: u64 = 0x2a08c060e0b95e7c;
143 pub const REGISTER_EVENT_IN_MONOTONIC: u64 = 0xe88536afd142a72;
144 pub const REGISTER_EVENT_IN_BOOT: u64 = 0x5cacbe472ce51cc4;
145 pub const RESCHEDULE_EVENT_IN_MONOTONIC: u64 = 0x5d35cdbfc1e464ae;
146 pub const RESCHEDULE_EVENT_IN_BOOT: u64 = 0xdb8b1c8c4732adb;
147 pub const CANCEL_EVENT: u64 = 0x18bbdb18faa6cac0;
148 pub const CREATE_NAMED_DEADLINE_IN_MONOTONIC: u64 = 0x6ae636f6a0c93b3e;
149 pub const CREATE_NAMED_DEADLINE_IN_BOOT: u64 = 0x15b0b36a16b354d8;
150}
151
152pub mod fake_clock_control_ordinals {
153 pub const ADVANCE: u64 = 0x42f2265fb495497a;
154 pub const INCREMENT_MONO_TO_BOOT_OFFSET_BY: u64 = 0x294f89fe62a18857;
155 pub const RESUME_WITH_INCREMENTS: u64 = 0x259be1eeba0bdd4a;
156 pub const ADD_STOP_POINT: u64 = 0x3b52fe2cba8c4245;
157 pub const PAUSE: u64 = 0x260df03b49199ba4;
158 pub const IGNORE_NAMED_DEADLINE: u64 = 0x2e445152a80d44aa;
159}
160
161mod internal {
162 use super::*;
163 unsafe impl fidl::encoding::TypeMarker for DeadlineEventType {
164 type Owned = Self;
165
166 #[inline(always)]
167 fn inline_align(_context: fidl::encoding::Context) -> usize {
168 std::mem::align_of::<u32>()
169 }
170
171 #[inline(always)]
172 fn inline_size(_context: fidl::encoding::Context) -> usize {
173 std::mem::size_of::<u32>()
174 }
175
176 #[inline(always)]
177 fn encode_is_copy() -> bool {
178 true
179 }
180
181 #[inline(always)]
182 fn decode_is_copy() -> bool {
183 false
184 }
185 }
186
187 impl fidl::encoding::ValueTypeMarker for DeadlineEventType {
188 type Borrowed<'a> = Self;
189 #[inline(always)]
190 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
191 *value
192 }
193 }
194
195 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
196 for DeadlineEventType
197 {
198 #[inline]
199 unsafe fn encode(
200 self,
201 encoder: &mut fidl::encoding::Encoder<'_, D>,
202 offset: usize,
203 _depth: fidl::encoding::Depth,
204 ) -> fidl::Result<()> {
205 encoder.debug_check_bounds::<Self>(offset);
206 encoder.write_num(self.into_primitive(), offset);
207 Ok(())
208 }
209 }
210
211 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeadlineEventType {
212 #[inline(always)]
213 fn new_empty() -> Self {
214 Self::Set
215 }
216
217 #[inline]
218 unsafe fn decode(
219 &mut self,
220 decoder: &mut fidl::encoding::Decoder<'_, D>,
221 offset: usize,
222 _depth: fidl::encoding::Depth,
223 ) -> fidl::Result<()> {
224 decoder.debug_check_bounds::<Self>(offset);
225 let prim = decoder.read_num::<u32>(offset);
226
227 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
228 Ok(())
229 }
230 }
231
232 impl fidl::encoding::ValueTypeMarker for FakeClockControlAdvanceRequest {
233 type Borrowed<'a> = &'a Self;
234 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
235 value
236 }
237 }
238
239 unsafe impl fidl::encoding::TypeMarker for FakeClockControlAdvanceRequest {
240 type Owned = Self;
241
242 #[inline(always)]
243 fn inline_align(_context: fidl::encoding::Context) -> usize {
244 8
245 }
246
247 #[inline(always)]
248 fn inline_size(_context: fidl::encoding::Context) -> usize {
249 16
250 }
251 }
252
253 unsafe impl<D: fidl::encoding::ResourceDialect>
254 fidl::encoding::Encode<FakeClockControlAdvanceRequest, D>
255 for &FakeClockControlAdvanceRequest
256 {
257 #[inline]
258 unsafe fn encode(
259 self,
260 encoder: &mut fidl::encoding::Encoder<'_, D>,
261 offset: usize,
262 _depth: fidl::encoding::Depth,
263 ) -> fidl::Result<()> {
264 encoder.debug_check_bounds::<FakeClockControlAdvanceRequest>(offset);
265 fidl::encoding::Encode::<FakeClockControlAdvanceRequest, D>::encode(
267 (<Increment as fidl::encoding::ValueTypeMarker>::borrow(&self.increment),),
268 encoder,
269 offset,
270 _depth,
271 )
272 }
273 }
274 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Increment, D>>
275 fidl::encoding::Encode<FakeClockControlAdvanceRequest, D> for (T0,)
276 {
277 #[inline]
278 unsafe fn encode(
279 self,
280 encoder: &mut fidl::encoding::Encoder<'_, D>,
281 offset: usize,
282 depth: fidl::encoding::Depth,
283 ) -> fidl::Result<()> {
284 encoder.debug_check_bounds::<FakeClockControlAdvanceRequest>(offset);
285 self.0.encode(encoder, offset + 0, depth)?;
289 Ok(())
290 }
291 }
292
293 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
294 for FakeClockControlAdvanceRequest
295 {
296 #[inline(always)]
297 fn new_empty() -> Self {
298 Self { increment: fidl::new_empty!(Increment, D) }
299 }
300
301 #[inline]
302 unsafe fn decode(
303 &mut self,
304 decoder: &mut fidl::encoding::Decoder<'_, D>,
305 offset: usize,
306 _depth: fidl::encoding::Depth,
307 ) -> fidl::Result<()> {
308 decoder.debug_check_bounds::<Self>(offset);
309 fidl::decode!(Increment, D, &mut self.increment, decoder, offset + 0, _depth)?;
311 Ok(())
312 }
313 }
314
315 impl fidl::encoding::ValueTypeMarker for FakeClockControlIgnoreNamedDeadlineRequest {
316 type Borrowed<'a> = &'a Self;
317 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
318 value
319 }
320 }
321
322 unsafe impl fidl::encoding::TypeMarker for FakeClockControlIgnoreNamedDeadlineRequest {
323 type Owned = Self;
324
325 #[inline(always)]
326 fn inline_align(_context: fidl::encoding::Context) -> usize {
327 8
328 }
329
330 #[inline(always)]
331 fn inline_size(_context: fidl::encoding::Context) -> usize {
332 32
333 }
334 }
335
336 unsafe impl<D: fidl::encoding::ResourceDialect>
337 fidl::encoding::Encode<FakeClockControlIgnoreNamedDeadlineRequest, D>
338 for &FakeClockControlIgnoreNamedDeadlineRequest
339 {
340 #[inline]
341 unsafe fn encode(
342 self,
343 encoder: &mut fidl::encoding::Encoder<'_, D>,
344 offset: usize,
345 _depth: fidl::encoding::Depth,
346 ) -> fidl::Result<()> {
347 encoder.debug_check_bounds::<FakeClockControlIgnoreNamedDeadlineRequest>(offset);
348 fidl::encoding::Encode::<FakeClockControlIgnoreNamedDeadlineRequest, D>::encode(
350 (
351 <fidl_fuchsia_testing_deadline__common::DeadlineId as fidl::encoding::ValueTypeMarker>::borrow(&self.deadline_id),
352 ),
353 encoder, offset, _depth
354 )
355 }
356 }
357 unsafe impl<
358 D: fidl::encoding::ResourceDialect,
359 T0: fidl::encoding::Encode<fidl_fuchsia_testing_deadline__common::DeadlineId, D>,
360 > fidl::encoding::Encode<FakeClockControlIgnoreNamedDeadlineRequest, D> for (T0,)
361 {
362 #[inline]
363 unsafe fn encode(
364 self,
365 encoder: &mut fidl::encoding::Encoder<'_, D>,
366 offset: usize,
367 depth: fidl::encoding::Depth,
368 ) -> fidl::Result<()> {
369 encoder.debug_check_bounds::<FakeClockControlIgnoreNamedDeadlineRequest>(offset);
370 self.0.encode(encoder, offset + 0, depth)?;
374 Ok(())
375 }
376 }
377
378 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
379 for FakeClockControlIgnoreNamedDeadlineRequest
380 {
381 #[inline(always)]
382 fn new_empty() -> Self {
383 Self {
384 deadline_id: fidl::new_empty!(fidl_fuchsia_testing_deadline__common::DeadlineId, D),
385 }
386 }
387
388 #[inline]
389 unsafe fn decode(
390 &mut self,
391 decoder: &mut fidl::encoding::Decoder<'_, D>,
392 offset: usize,
393 _depth: fidl::encoding::Depth,
394 ) -> fidl::Result<()> {
395 decoder.debug_check_bounds::<Self>(offset);
396 fidl::decode!(
398 fidl_fuchsia_testing_deadline__common::DeadlineId,
399 D,
400 &mut self.deadline_id,
401 decoder,
402 offset + 0,
403 _depth
404 )?;
405 Ok(())
406 }
407 }
408
409 impl fidl::encoding::ValueTypeMarker for FakeClockControlIncrementMonoToBootOffsetByRequest {
410 type Borrowed<'a> = &'a Self;
411 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
412 value
413 }
414 }
415
416 unsafe impl fidl::encoding::TypeMarker for FakeClockControlIncrementMonoToBootOffsetByRequest {
417 type Owned = Self;
418
419 #[inline(always)]
420 fn inline_align(_context: fidl::encoding::Context) -> usize {
421 8
422 }
423
424 #[inline(always)]
425 fn inline_size(_context: fidl::encoding::Context) -> usize {
426 8
427 }
428 #[inline(always)]
429 fn encode_is_copy() -> bool {
430 true
431 }
432
433 #[inline(always)]
434 fn decode_is_copy() -> bool {
435 true
436 }
437 }
438
439 unsafe impl<D: fidl::encoding::ResourceDialect>
440 fidl::encoding::Encode<FakeClockControlIncrementMonoToBootOffsetByRequest, D>
441 for &FakeClockControlIncrementMonoToBootOffsetByRequest
442 {
443 #[inline]
444 unsafe fn encode(
445 self,
446 encoder: &mut fidl::encoding::Encoder<'_, D>,
447 offset: usize,
448 _depth: fidl::encoding::Depth,
449 ) -> fidl::Result<()> {
450 encoder
451 .debug_check_bounds::<FakeClockControlIncrementMonoToBootOffsetByRequest>(offset);
452 unsafe {
453 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
455 (buf_ptr as *mut FakeClockControlIncrementMonoToBootOffsetByRequest)
456 .write_unaligned(
457 (self as *const FakeClockControlIncrementMonoToBootOffsetByRequest).read(),
458 );
459 }
462 Ok(())
463 }
464 }
465 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i64, D>>
466 fidl::encoding::Encode<FakeClockControlIncrementMonoToBootOffsetByRequest, D> for (T0,)
467 {
468 #[inline]
469 unsafe fn encode(
470 self,
471 encoder: &mut fidl::encoding::Encoder<'_, D>,
472 offset: usize,
473 depth: fidl::encoding::Depth,
474 ) -> fidl::Result<()> {
475 encoder
476 .debug_check_bounds::<FakeClockControlIncrementMonoToBootOffsetByRequest>(offset);
477 self.0.encode(encoder, offset + 0, depth)?;
481 Ok(())
482 }
483 }
484
485 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
486 for FakeClockControlIncrementMonoToBootOffsetByRequest
487 {
488 #[inline(always)]
489 fn new_empty() -> Self {
490 Self { increment: fidl::new_empty!(i64, D) }
491 }
492
493 #[inline]
494 unsafe fn decode(
495 &mut self,
496 decoder: &mut fidl::encoding::Decoder<'_, D>,
497 offset: usize,
498 _depth: fidl::encoding::Depth,
499 ) -> fidl::Result<()> {
500 decoder.debug_check_bounds::<Self>(offset);
501 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
502 unsafe {
505 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
506 }
507 Ok(())
508 }
509 }
510
511 impl fidl::encoding::ValueTypeMarker for FakeClockControlResumeWithIncrementsRequest {
512 type Borrowed<'a> = &'a Self;
513 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
514 value
515 }
516 }
517
518 unsafe impl fidl::encoding::TypeMarker for FakeClockControlResumeWithIncrementsRequest {
519 type Owned = Self;
520
521 #[inline(always)]
522 fn inline_align(_context: fidl::encoding::Context) -> usize {
523 8
524 }
525
526 #[inline(always)]
527 fn inline_size(_context: fidl::encoding::Context) -> usize {
528 24
529 }
530 }
531
532 unsafe impl<D: fidl::encoding::ResourceDialect>
533 fidl::encoding::Encode<FakeClockControlResumeWithIncrementsRequest, D>
534 for &FakeClockControlResumeWithIncrementsRequest
535 {
536 #[inline]
537 unsafe fn encode(
538 self,
539 encoder: &mut fidl::encoding::Encoder<'_, D>,
540 offset: usize,
541 _depth: fidl::encoding::Depth,
542 ) -> fidl::Result<()> {
543 encoder.debug_check_bounds::<FakeClockControlResumeWithIncrementsRequest>(offset);
544 fidl::encoding::Encode::<FakeClockControlResumeWithIncrementsRequest, D>::encode(
546 (
547 <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.real),
548 <Increment as fidl::encoding::ValueTypeMarker>::borrow(&self.increment),
549 ),
550 encoder,
551 offset,
552 _depth,
553 )
554 }
555 }
556 unsafe impl<
557 D: fidl::encoding::ResourceDialect,
558 T0: fidl::encoding::Encode<i64, D>,
559 T1: fidl::encoding::Encode<Increment, D>,
560 > fidl::encoding::Encode<FakeClockControlResumeWithIncrementsRequest, D> for (T0, T1)
561 {
562 #[inline]
563 unsafe fn encode(
564 self,
565 encoder: &mut fidl::encoding::Encoder<'_, D>,
566 offset: usize,
567 depth: fidl::encoding::Depth,
568 ) -> fidl::Result<()> {
569 encoder.debug_check_bounds::<FakeClockControlResumeWithIncrementsRequest>(offset);
570 self.0.encode(encoder, offset + 0, depth)?;
574 self.1.encode(encoder, offset + 8, depth)?;
575 Ok(())
576 }
577 }
578
579 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
580 for FakeClockControlResumeWithIncrementsRequest
581 {
582 #[inline(always)]
583 fn new_empty() -> Self {
584 Self { real: fidl::new_empty!(i64, D), increment: fidl::new_empty!(Increment, D) }
585 }
586
587 #[inline]
588 unsafe fn decode(
589 &mut self,
590 decoder: &mut fidl::encoding::Decoder<'_, D>,
591 offset: usize,
592 _depth: fidl::encoding::Depth,
593 ) -> fidl::Result<()> {
594 decoder.debug_check_bounds::<Self>(offset);
595 fidl::decode!(i64, D, &mut self.real, decoder, offset + 0, _depth)?;
597 fidl::decode!(Increment, D, &mut self.increment, decoder, offset + 8, _depth)?;
598 Ok(())
599 }
600 }
601
602 impl fidl::encoding::ValueTypeMarker for FakeClockCreateNamedDeadlineInBootRequest {
603 type Borrowed<'a> = &'a Self;
604 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
605 value
606 }
607 }
608
609 unsafe impl fidl::encoding::TypeMarker for FakeClockCreateNamedDeadlineInBootRequest {
610 type Owned = Self;
611
612 #[inline(always)]
613 fn inline_align(_context: fidl::encoding::Context) -> usize {
614 8
615 }
616
617 #[inline(always)]
618 fn inline_size(_context: fidl::encoding::Context) -> usize {
619 40
620 }
621 }
622
623 unsafe impl<D: fidl::encoding::ResourceDialect>
624 fidl::encoding::Encode<FakeClockCreateNamedDeadlineInBootRequest, D>
625 for &FakeClockCreateNamedDeadlineInBootRequest
626 {
627 #[inline]
628 unsafe fn encode(
629 self,
630 encoder: &mut fidl::encoding::Encoder<'_, D>,
631 offset: usize,
632 _depth: fidl::encoding::Depth,
633 ) -> fidl::Result<()> {
634 encoder.debug_check_bounds::<FakeClockCreateNamedDeadlineInBootRequest>(offset);
635 fidl::encoding::Encode::<FakeClockCreateNamedDeadlineInBootRequest, D>::encode(
637 (
638 <fidl_fuchsia_testing_deadline__common::DeadlineId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
639 <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.duration),
640 ),
641 encoder, offset, _depth
642 )
643 }
644 }
645 unsafe impl<
646 D: fidl::encoding::ResourceDialect,
647 T0: fidl::encoding::Encode<fidl_fuchsia_testing_deadline__common::DeadlineId, D>,
648 T1: fidl::encoding::Encode<i64, D>,
649 > fidl::encoding::Encode<FakeClockCreateNamedDeadlineInBootRequest, D> for (T0, T1)
650 {
651 #[inline]
652 unsafe fn encode(
653 self,
654 encoder: &mut fidl::encoding::Encoder<'_, D>,
655 offset: usize,
656 depth: fidl::encoding::Depth,
657 ) -> fidl::Result<()> {
658 encoder.debug_check_bounds::<FakeClockCreateNamedDeadlineInBootRequest>(offset);
659 self.0.encode(encoder, offset + 0, depth)?;
663 self.1.encode(encoder, offset + 32, depth)?;
664 Ok(())
665 }
666 }
667
668 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
669 for FakeClockCreateNamedDeadlineInBootRequest
670 {
671 #[inline(always)]
672 fn new_empty() -> Self {
673 Self {
674 id: fidl::new_empty!(fidl_fuchsia_testing_deadline__common::DeadlineId, D),
675 duration: fidl::new_empty!(i64, D),
676 }
677 }
678
679 #[inline]
680 unsafe fn decode(
681 &mut self,
682 decoder: &mut fidl::encoding::Decoder<'_, D>,
683 offset: usize,
684 _depth: fidl::encoding::Depth,
685 ) -> fidl::Result<()> {
686 decoder.debug_check_bounds::<Self>(offset);
687 fidl::decode!(
689 fidl_fuchsia_testing_deadline__common::DeadlineId,
690 D,
691 &mut self.id,
692 decoder,
693 offset + 0,
694 _depth
695 )?;
696 fidl::decode!(i64, D, &mut self.duration, decoder, offset + 32, _depth)?;
697 Ok(())
698 }
699 }
700
701 impl fidl::encoding::ValueTypeMarker for FakeClockCreateNamedDeadlineInBootResponse {
702 type Borrowed<'a> = &'a Self;
703 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
704 value
705 }
706 }
707
708 unsafe impl fidl::encoding::TypeMarker for FakeClockCreateNamedDeadlineInBootResponse {
709 type Owned = Self;
710
711 #[inline(always)]
712 fn inline_align(_context: fidl::encoding::Context) -> usize {
713 8
714 }
715
716 #[inline(always)]
717 fn inline_size(_context: fidl::encoding::Context) -> usize {
718 8
719 }
720 #[inline(always)]
721 fn encode_is_copy() -> bool {
722 true
723 }
724
725 #[inline(always)]
726 fn decode_is_copy() -> bool {
727 true
728 }
729 }
730
731 unsafe impl<D: fidl::encoding::ResourceDialect>
732 fidl::encoding::Encode<FakeClockCreateNamedDeadlineInBootResponse, D>
733 for &FakeClockCreateNamedDeadlineInBootResponse
734 {
735 #[inline]
736 unsafe fn encode(
737 self,
738 encoder: &mut fidl::encoding::Encoder<'_, D>,
739 offset: usize,
740 _depth: fidl::encoding::Depth,
741 ) -> fidl::Result<()> {
742 encoder.debug_check_bounds::<FakeClockCreateNamedDeadlineInBootResponse>(offset);
743 unsafe {
744 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
746 (buf_ptr as *mut FakeClockCreateNamedDeadlineInBootResponse).write_unaligned(
747 (self as *const FakeClockCreateNamedDeadlineInBootResponse).read(),
748 );
749 }
752 Ok(())
753 }
754 }
755 unsafe impl<
756 D: fidl::encoding::ResourceDialect,
757 T0: fidl::encoding::Encode<fidl::BootInstant, D>,
758 > fidl::encoding::Encode<FakeClockCreateNamedDeadlineInBootResponse, D> for (T0,)
759 {
760 #[inline]
761 unsafe fn encode(
762 self,
763 encoder: &mut fidl::encoding::Encoder<'_, D>,
764 offset: usize,
765 depth: fidl::encoding::Depth,
766 ) -> fidl::Result<()> {
767 encoder.debug_check_bounds::<FakeClockCreateNamedDeadlineInBootResponse>(offset);
768 self.0.encode(encoder, offset + 0, depth)?;
772 Ok(())
773 }
774 }
775
776 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
777 for FakeClockCreateNamedDeadlineInBootResponse
778 {
779 #[inline(always)]
780 fn new_empty() -> Self {
781 Self { deadline: fidl::new_empty!(fidl::BootInstant, D) }
782 }
783
784 #[inline]
785 unsafe fn decode(
786 &mut self,
787 decoder: &mut fidl::encoding::Decoder<'_, D>,
788 offset: usize,
789 _depth: fidl::encoding::Depth,
790 ) -> fidl::Result<()> {
791 decoder.debug_check_bounds::<Self>(offset);
792 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
793 unsafe {
796 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
797 }
798 Ok(())
799 }
800 }
801
802 impl fidl::encoding::ValueTypeMarker for FakeClockCreateNamedDeadlineInMonotonicRequest {
803 type Borrowed<'a> = &'a Self;
804 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
805 value
806 }
807 }
808
809 unsafe impl fidl::encoding::TypeMarker for FakeClockCreateNamedDeadlineInMonotonicRequest {
810 type Owned = Self;
811
812 #[inline(always)]
813 fn inline_align(_context: fidl::encoding::Context) -> usize {
814 8
815 }
816
817 #[inline(always)]
818 fn inline_size(_context: fidl::encoding::Context) -> usize {
819 40
820 }
821 }
822
823 unsafe impl<D: fidl::encoding::ResourceDialect>
824 fidl::encoding::Encode<FakeClockCreateNamedDeadlineInMonotonicRequest, D>
825 for &FakeClockCreateNamedDeadlineInMonotonicRequest
826 {
827 #[inline]
828 unsafe fn encode(
829 self,
830 encoder: &mut fidl::encoding::Encoder<'_, D>,
831 offset: usize,
832 _depth: fidl::encoding::Depth,
833 ) -> fidl::Result<()> {
834 encoder.debug_check_bounds::<FakeClockCreateNamedDeadlineInMonotonicRequest>(offset);
835 fidl::encoding::Encode::<FakeClockCreateNamedDeadlineInMonotonicRequest, D>::encode(
837 (
838 <fidl_fuchsia_testing_deadline__common::DeadlineId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
839 <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.duration),
840 ),
841 encoder, offset, _depth
842 )
843 }
844 }
845 unsafe impl<
846 D: fidl::encoding::ResourceDialect,
847 T0: fidl::encoding::Encode<fidl_fuchsia_testing_deadline__common::DeadlineId, D>,
848 T1: fidl::encoding::Encode<i64, D>,
849 > fidl::encoding::Encode<FakeClockCreateNamedDeadlineInMonotonicRequest, D> for (T0, T1)
850 {
851 #[inline]
852 unsafe fn encode(
853 self,
854 encoder: &mut fidl::encoding::Encoder<'_, D>,
855 offset: usize,
856 depth: fidl::encoding::Depth,
857 ) -> fidl::Result<()> {
858 encoder.debug_check_bounds::<FakeClockCreateNamedDeadlineInMonotonicRequest>(offset);
859 self.0.encode(encoder, offset + 0, depth)?;
863 self.1.encode(encoder, offset + 32, depth)?;
864 Ok(())
865 }
866 }
867
868 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
869 for FakeClockCreateNamedDeadlineInMonotonicRequest
870 {
871 #[inline(always)]
872 fn new_empty() -> Self {
873 Self {
874 id: fidl::new_empty!(fidl_fuchsia_testing_deadline__common::DeadlineId, D),
875 duration: fidl::new_empty!(i64, D),
876 }
877 }
878
879 #[inline]
880 unsafe fn decode(
881 &mut self,
882 decoder: &mut fidl::encoding::Decoder<'_, D>,
883 offset: usize,
884 _depth: fidl::encoding::Depth,
885 ) -> fidl::Result<()> {
886 decoder.debug_check_bounds::<Self>(offset);
887 fidl::decode!(
889 fidl_fuchsia_testing_deadline__common::DeadlineId,
890 D,
891 &mut self.id,
892 decoder,
893 offset + 0,
894 _depth
895 )?;
896 fidl::decode!(i64, D, &mut self.duration, decoder, offset + 32, _depth)?;
897 Ok(())
898 }
899 }
900
901 impl fidl::encoding::ValueTypeMarker for FakeClockCreateNamedDeadlineInMonotonicResponse {
902 type Borrowed<'a> = &'a Self;
903 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
904 value
905 }
906 }
907
908 unsafe impl fidl::encoding::TypeMarker for FakeClockCreateNamedDeadlineInMonotonicResponse {
909 type Owned = Self;
910
911 #[inline(always)]
912 fn inline_align(_context: fidl::encoding::Context) -> usize {
913 8
914 }
915
916 #[inline(always)]
917 fn inline_size(_context: fidl::encoding::Context) -> usize {
918 8
919 }
920 #[inline(always)]
921 fn encode_is_copy() -> bool {
922 true
923 }
924
925 #[inline(always)]
926 fn decode_is_copy() -> bool {
927 true
928 }
929 }
930
931 unsafe impl<D: fidl::encoding::ResourceDialect>
932 fidl::encoding::Encode<FakeClockCreateNamedDeadlineInMonotonicResponse, D>
933 for &FakeClockCreateNamedDeadlineInMonotonicResponse
934 {
935 #[inline]
936 unsafe fn encode(
937 self,
938 encoder: &mut fidl::encoding::Encoder<'_, D>,
939 offset: usize,
940 _depth: fidl::encoding::Depth,
941 ) -> fidl::Result<()> {
942 encoder.debug_check_bounds::<FakeClockCreateNamedDeadlineInMonotonicResponse>(offset);
943 unsafe {
944 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
946 (buf_ptr as *mut FakeClockCreateNamedDeadlineInMonotonicResponse).write_unaligned(
947 (self as *const FakeClockCreateNamedDeadlineInMonotonicResponse).read(),
948 );
949 }
952 Ok(())
953 }
954 }
955 unsafe impl<
956 D: fidl::encoding::ResourceDialect,
957 T0: fidl::encoding::Encode<fidl::MonotonicInstant, D>,
958 > fidl::encoding::Encode<FakeClockCreateNamedDeadlineInMonotonicResponse, D> for (T0,)
959 {
960 #[inline]
961 unsafe fn encode(
962 self,
963 encoder: &mut fidl::encoding::Encoder<'_, D>,
964 offset: usize,
965 depth: fidl::encoding::Depth,
966 ) -> fidl::Result<()> {
967 encoder.debug_check_bounds::<FakeClockCreateNamedDeadlineInMonotonicResponse>(offset);
968 self.0.encode(encoder, offset + 0, depth)?;
972 Ok(())
973 }
974 }
975
976 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
977 for FakeClockCreateNamedDeadlineInMonotonicResponse
978 {
979 #[inline(always)]
980 fn new_empty() -> Self {
981 Self { deadline: fidl::new_empty!(fidl::MonotonicInstant, D) }
982 }
983
984 #[inline]
985 unsafe fn decode(
986 &mut self,
987 decoder: &mut fidl::encoding::Decoder<'_, D>,
988 offset: usize,
989 _depth: fidl::encoding::Depth,
990 ) -> fidl::Result<()> {
991 decoder.debug_check_bounds::<Self>(offset);
992 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
993 unsafe {
996 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
997 }
998 Ok(())
999 }
1000 }
1001
1002 impl fidl::encoding::ValueTypeMarker for FakeClockGetResponse {
1003 type Borrowed<'a> = &'a Self;
1004 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1005 value
1006 }
1007 }
1008
1009 unsafe impl fidl::encoding::TypeMarker for FakeClockGetResponse {
1010 type Owned = Self;
1011
1012 #[inline(always)]
1013 fn inline_align(_context: fidl::encoding::Context) -> usize {
1014 8
1015 }
1016
1017 #[inline(always)]
1018 fn inline_size(_context: fidl::encoding::Context) -> usize {
1019 16
1020 }
1021 #[inline(always)]
1022 fn encode_is_copy() -> bool {
1023 true
1024 }
1025
1026 #[inline(always)]
1027 fn decode_is_copy() -> bool {
1028 true
1029 }
1030 }
1031
1032 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FakeClockGetResponse, D>
1033 for &FakeClockGetResponse
1034 {
1035 #[inline]
1036 unsafe fn encode(
1037 self,
1038 encoder: &mut fidl::encoding::Encoder<'_, D>,
1039 offset: usize,
1040 _depth: fidl::encoding::Depth,
1041 ) -> fidl::Result<()> {
1042 encoder.debug_check_bounds::<FakeClockGetResponse>(offset);
1043 unsafe {
1044 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1046 (buf_ptr as *mut FakeClockGetResponse)
1047 .write_unaligned((self as *const FakeClockGetResponse).read());
1048 }
1051 Ok(())
1052 }
1053 }
1054 unsafe impl<
1055 D: fidl::encoding::ResourceDialect,
1056 T0: fidl::encoding::Encode<fidl::BootInstant, D>,
1057 T1: fidl::encoding::Encode<fidl::MonotonicInstant, D>,
1058 > fidl::encoding::Encode<FakeClockGetResponse, D> for (T0, T1)
1059 {
1060 #[inline]
1061 unsafe fn encode(
1062 self,
1063 encoder: &mut fidl::encoding::Encoder<'_, D>,
1064 offset: usize,
1065 depth: fidl::encoding::Depth,
1066 ) -> fidl::Result<()> {
1067 encoder.debug_check_bounds::<FakeClockGetResponse>(offset);
1068 self.0.encode(encoder, offset + 0, depth)?;
1072 self.1.encode(encoder, offset + 8, depth)?;
1073 Ok(())
1074 }
1075 }
1076
1077 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FakeClockGetResponse {
1078 #[inline(always)]
1079 fn new_empty() -> Self {
1080 Self {
1081 boot_time: fidl::new_empty!(fidl::BootInstant, D),
1082 monotonic_time: fidl::new_empty!(fidl::MonotonicInstant, D),
1083 }
1084 }
1085
1086 #[inline]
1087 unsafe fn decode(
1088 &mut self,
1089 decoder: &mut fidl::encoding::Decoder<'_, D>,
1090 offset: usize,
1091 _depth: fidl::encoding::Depth,
1092 ) -> fidl::Result<()> {
1093 decoder.debug_check_bounds::<Self>(offset);
1094 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1095 unsafe {
1098 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
1099 }
1100 Ok(())
1101 }
1102 }
1103
1104 impl fidl::encoding::ValueTypeMarker for RandomRange {
1105 type Borrowed<'a> = &'a Self;
1106 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1107 value
1108 }
1109 }
1110
1111 unsafe impl fidl::encoding::TypeMarker for RandomRange {
1112 type Owned = Self;
1113
1114 #[inline(always)]
1115 fn inline_align(_context: fidl::encoding::Context) -> usize {
1116 8
1117 }
1118
1119 #[inline(always)]
1120 fn inline_size(_context: fidl::encoding::Context) -> usize {
1121 16
1122 }
1123 #[inline(always)]
1124 fn encode_is_copy() -> bool {
1125 true
1126 }
1127
1128 #[inline(always)]
1129 fn decode_is_copy() -> bool {
1130 true
1131 }
1132 }
1133
1134 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RandomRange, D>
1135 for &RandomRange
1136 {
1137 #[inline]
1138 unsafe fn encode(
1139 self,
1140 encoder: &mut fidl::encoding::Encoder<'_, D>,
1141 offset: usize,
1142 _depth: fidl::encoding::Depth,
1143 ) -> fidl::Result<()> {
1144 encoder.debug_check_bounds::<RandomRange>(offset);
1145 unsafe {
1146 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1148 (buf_ptr as *mut RandomRange).write_unaligned((self as *const RandomRange).read());
1149 }
1152 Ok(())
1153 }
1154 }
1155 unsafe impl<
1156 D: fidl::encoding::ResourceDialect,
1157 T0: fidl::encoding::Encode<i64, D>,
1158 T1: fidl::encoding::Encode<i64, D>,
1159 > fidl::encoding::Encode<RandomRange, D> for (T0, T1)
1160 {
1161 #[inline]
1162 unsafe fn encode(
1163 self,
1164 encoder: &mut fidl::encoding::Encoder<'_, D>,
1165 offset: usize,
1166 depth: fidl::encoding::Depth,
1167 ) -> fidl::Result<()> {
1168 encoder.debug_check_bounds::<RandomRange>(offset);
1169 self.0.encode(encoder, offset + 0, depth)?;
1173 self.1.encode(encoder, offset + 8, depth)?;
1174 Ok(())
1175 }
1176 }
1177
1178 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RandomRange {
1179 #[inline(always)]
1180 fn new_empty() -> Self {
1181 Self { min_rand: fidl::new_empty!(i64, D), max_rand: fidl::new_empty!(i64, D) }
1182 }
1183
1184 #[inline]
1185 unsafe fn decode(
1186 &mut self,
1187 decoder: &mut fidl::encoding::Decoder<'_, D>,
1188 offset: usize,
1189 _depth: fidl::encoding::Depth,
1190 ) -> fidl::Result<()> {
1191 decoder.debug_check_bounds::<Self>(offset);
1192 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1193 unsafe {
1196 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
1197 }
1198 Ok(())
1199 }
1200 }
1201
1202 impl fidl::encoding::ValueTypeMarker for Increment {
1203 type Borrowed<'a> = &'a Self;
1204 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1205 value
1206 }
1207 }
1208
1209 unsafe impl fidl::encoding::TypeMarker for Increment {
1210 type Owned = Self;
1211
1212 #[inline(always)]
1213 fn inline_align(_context: fidl::encoding::Context) -> usize {
1214 8
1215 }
1216
1217 #[inline(always)]
1218 fn inline_size(_context: fidl::encoding::Context) -> usize {
1219 16
1220 }
1221 }
1222
1223 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Increment, D>
1224 for &Increment
1225 {
1226 #[inline]
1227 unsafe fn encode(
1228 self,
1229 encoder: &mut fidl::encoding::Encoder<'_, D>,
1230 offset: usize,
1231 _depth: fidl::encoding::Depth,
1232 ) -> fidl::Result<()> {
1233 encoder.debug_check_bounds::<Increment>(offset);
1234 encoder.write_num::<u64>(self.ordinal(), offset);
1235 match self {
1236 Increment::Determined(ref val) => fidl::encoding::encode_in_envelope::<i64, D>(
1237 <i64 as fidl::encoding::ValueTypeMarker>::borrow(val),
1238 encoder,
1239 offset + 8,
1240 _depth,
1241 ),
1242 Increment::Random(ref val) => fidl::encoding::encode_in_envelope::<RandomRange, D>(
1243 <RandomRange as fidl::encoding::ValueTypeMarker>::borrow(val),
1244 encoder,
1245 offset + 8,
1246 _depth,
1247 ),
1248 }
1249 }
1250 }
1251
1252 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Increment {
1253 #[inline(always)]
1254 fn new_empty() -> Self {
1255 Self::Determined(fidl::new_empty!(i64, D))
1256 }
1257
1258 #[inline]
1259 unsafe fn decode(
1260 &mut self,
1261 decoder: &mut fidl::encoding::Decoder<'_, D>,
1262 offset: usize,
1263 mut depth: fidl::encoding::Depth,
1264 ) -> fidl::Result<()> {
1265 decoder.debug_check_bounds::<Self>(offset);
1266 #[allow(unused_variables)]
1267 let next_out_of_line = decoder.next_out_of_line();
1268 let handles_before = decoder.remaining_handles();
1269 let (ordinal, inlined, num_bytes, num_handles) =
1270 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
1271
1272 let member_inline_size = match ordinal {
1273 1 => <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1274 2 => <RandomRange as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1275 _ => return Err(fidl::Error::UnknownUnionTag),
1276 };
1277
1278 if inlined != (member_inline_size <= 4) {
1279 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1280 }
1281 let _inner_offset;
1282 if inlined {
1283 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
1284 _inner_offset = offset + 8;
1285 } else {
1286 depth.increment()?;
1287 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1288 }
1289 match ordinal {
1290 1 => {
1291 #[allow(irrefutable_let_patterns)]
1292 if let Increment::Determined(_) = self {
1293 } else {
1295 *self = Increment::Determined(fidl::new_empty!(i64, D));
1297 }
1298 #[allow(irrefutable_let_patterns)]
1299 if let Increment::Determined(ref mut val) = self {
1300 fidl::decode!(i64, D, val, decoder, _inner_offset, depth)?;
1301 } else {
1302 unreachable!()
1303 }
1304 }
1305 2 => {
1306 #[allow(irrefutable_let_patterns)]
1307 if let Increment::Random(_) = self {
1308 } else {
1310 *self = Increment::Random(fidl::new_empty!(RandomRange, D));
1312 }
1313 #[allow(irrefutable_let_patterns)]
1314 if let Increment::Random(ref mut val) = self {
1315 fidl::decode!(RandomRange, D, val, decoder, _inner_offset, depth)?;
1316 } else {
1317 unreachable!()
1318 }
1319 }
1320 ordinal => panic!("unexpected ordinal {:?}", ordinal),
1321 }
1322 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
1323 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1324 }
1325 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1326 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1327 }
1328 Ok(())
1329 }
1330 }
1331}