fidl_componentmanager_test_common/
fidl_componentmanager_test_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 TestOutcomeReportReportRequest {
14 pub backstop: i64,
15 pub current_time: i64,
16}
17
18impl fidl::Persistable for TestOutcomeReportReportRequest {}
19
20mod internal {
21 use super::*;
22
23 impl fidl::encoding::ValueTypeMarker for TestOutcomeReportReportRequest {
24 type Borrowed<'a> = &'a Self;
25 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
26 value
27 }
28 }
29
30 unsafe impl fidl::encoding::TypeMarker for TestOutcomeReportReportRequest {
31 type Owned = Self;
32
33 #[inline(always)]
34 fn inline_align(_context: fidl::encoding::Context) -> usize {
35 8
36 }
37
38 #[inline(always)]
39 fn inline_size(_context: fidl::encoding::Context) -> usize {
40 16
41 }
42 #[inline(always)]
43 fn encode_is_copy() -> bool {
44 true
45 }
46
47 #[inline(always)]
48 fn decode_is_copy() -> bool {
49 true
50 }
51 }
52
53 unsafe impl<D: fidl::encoding::ResourceDialect>
54 fidl::encoding::Encode<TestOutcomeReportReportRequest, D>
55 for &TestOutcomeReportReportRequest
56 {
57 #[inline]
58 unsafe fn encode(
59 self,
60 encoder: &mut fidl::encoding::Encoder<'_, D>,
61 offset: usize,
62 _depth: fidl::encoding::Depth,
63 ) -> fidl::Result<()> {
64 encoder.debug_check_bounds::<TestOutcomeReportReportRequest>(offset);
65 unsafe {
66 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
68 (buf_ptr as *mut TestOutcomeReportReportRequest)
69 .write_unaligned((self as *const TestOutcomeReportReportRequest).read());
70 }
73 Ok(())
74 }
75 }
76 unsafe impl<
77 D: fidl::encoding::ResourceDialect,
78 T0: fidl::encoding::Encode<i64, D>,
79 T1: fidl::encoding::Encode<i64, D>,
80 > fidl::encoding::Encode<TestOutcomeReportReportRequest, D> for (T0, T1)
81 {
82 #[inline]
83 unsafe fn encode(
84 self,
85 encoder: &mut fidl::encoding::Encoder<'_, D>,
86 offset: usize,
87 depth: fidl::encoding::Depth,
88 ) -> fidl::Result<()> {
89 encoder.debug_check_bounds::<TestOutcomeReportReportRequest>(offset);
90 self.0.encode(encoder, offset + 0, depth)?;
94 self.1.encode(encoder, offset + 8, depth)?;
95 Ok(())
96 }
97 }
98
99 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
100 for TestOutcomeReportReportRequest
101 {
102 #[inline(always)]
103 fn new_empty() -> Self {
104 Self { backstop: fidl::new_empty!(i64, D), current_time: fidl::new_empty!(i64, D) }
105 }
106
107 #[inline]
108 unsafe fn decode(
109 &mut self,
110 decoder: &mut fidl::encoding::Decoder<'_, D>,
111 offset: usize,
112 _depth: fidl::encoding::Depth,
113 ) -> fidl::Result<()> {
114 decoder.debug_check_bounds::<Self>(offset);
115 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
116 unsafe {
119 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
120 }
121 Ok(())
122 }
123 }
124}