fidl_componentmanager_test__common/
fidl_componentmanager_test__common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![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 TestOutcomeReportReportRequest {
14    pub backstop: i64,
15    pub current_time: i64,
16}
17
18impl fidl::Persistable for TestOutcomeReportReportRequest {}
19
20pub mod test_outcome_report_ordinals {
21    pub const REPORT: u64 = 0xeab49d3f96e4950;
22}
23
24mod internal {
25    use super::*;
26
27    impl fidl::encoding::ValueTypeMarker for TestOutcomeReportReportRequest {
28        type Borrowed<'a> = &'a Self;
29        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
30            value
31        }
32    }
33
34    unsafe impl fidl::encoding::TypeMarker for TestOutcomeReportReportRequest {
35        type Owned = Self;
36
37        #[inline(always)]
38        fn inline_align(_context: fidl::encoding::Context) -> usize {
39            8
40        }
41
42        #[inline(always)]
43        fn inline_size(_context: fidl::encoding::Context) -> usize {
44            16
45        }
46        #[inline(always)]
47        fn encode_is_copy() -> bool {
48            true
49        }
50
51        #[inline(always)]
52        fn decode_is_copy() -> bool {
53            true
54        }
55    }
56
57    unsafe impl<D: fidl::encoding::ResourceDialect>
58        fidl::encoding::Encode<TestOutcomeReportReportRequest, D>
59        for &TestOutcomeReportReportRequest
60    {
61        #[inline]
62        unsafe fn encode(
63            self,
64            encoder: &mut fidl::encoding::Encoder<'_, D>,
65            offset: usize,
66            _depth: fidl::encoding::Depth,
67        ) -> fidl::Result<()> {
68            encoder.debug_check_bounds::<TestOutcomeReportReportRequest>(offset);
69            unsafe {
70                // Copy the object into the buffer.
71                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
72                (buf_ptr as *mut TestOutcomeReportReportRequest)
73                    .write_unaligned((self as *const TestOutcomeReportReportRequest).read());
74                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
75                // done second because the memcpy will write garbage to these bytes.
76            }
77            Ok(())
78        }
79    }
80    unsafe impl<
81            D: fidl::encoding::ResourceDialect,
82            T0: fidl::encoding::Encode<i64, D>,
83            T1: fidl::encoding::Encode<i64, D>,
84        > fidl::encoding::Encode<TestOutcomeReportReportRequest, D> for (T0, T1)
85    {
86        #[inline]
87        unsafe fn encode(
88            self,
89            encoder: &mut fidl::encoding::Encoder<'_, D>,
90            offset: usize,
91            depth: fidl::encoding::Depth,
92        ) -> fidl::Result<()> {
93            encoder.debug_check_bounds::<TestOutcomeReportReportRequest>(offset);
94            // Zero out padding regions. There's no need to apply masks
95            // because the unmasked parts will be overwritten by fields.
96            // Write the fields.
97            self.0.encode(encoder, offset + 0, depth)?;
98            self.1.encode(encoder, offset + 8, depth)?;
99            Ok(())
100        }
101    }
102
103    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
104        for TestOutcomeReportReportRequest
105    {
106        #[inline(always)]
107        fn new_empty() -> Self {
108            Self { backstop: fidl::new_empty!(i64, D), current_time: fidl::new_empty!(i64, D) }
109        }
110
111        #[inline]
112        unsafe fn decode(
113            &mut self,
114            decoder: &mut fidl::encoding::Decoder<'_, D>,
115            offset: usize,
116            _depth: fidl::encoding::Depth,
117        ) -> fidl::Result<()> {
118            decoder.debug_check_bounds::<Self>(offset);
119            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
120            // Verify that padding bytes are zero.
121            // Copy from the buffer into the object.
122            unsafe {
123                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
124            }
125            Ok(())
126        }
127    }
128}