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