fidl_test_fidl_connector__common/
fidl_test_fidl_connector__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 TestPingResponse {
14 pub gen: u32,
15}
16
17impl fidl::Persistable for TestPingResponse {}
18
19pub mod test_ordinals {
20 pub const PING: u64 = 0x23aa1eb7d24346cf;
21 pub const DISCONNECT: u64 = 0x5a1b547382bf672e;
22}
23
24mod internal {
25 use super::*;
26
27 impl fidl::encoding::ValueTypeMarker for TestPingResponse {
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 TestPingResponse {
35 type Owned = Self;
36
37 #[inline(always)]
38 fn inline_align(_context: fidl::encoding::Context) -> usize {
39 4
40 }
41
42 #[inline(always)]
43 fn inline_size(_context: fidl::encoding::Context) -> usize {
44 4
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> fidl::encoding::Encode<TestPingResponse, D>
58 for &TestPingResponse
59 {
60 #[inline]
61 unsafe fn encode(
62 self,
63 encoder: &mut fidl::encoding::Encoder<'_, D>,
64 offset: usize,
65 _depth: fidl::encoding::Depth,
66 ) -> fidl::Result<()> {
67 encoder.debug_check_bounds::<TestPingResponse>(offset);
68 unsafe {
69 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
71 (buf_ptr as *mut TestPingResponse)
72 .write_unaligned((self as *const TestPingResponse).read());
73 }
76 Ok(())
77 }
78 }
79 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
80 fidl::encoding::Encode<TestPingResponse, D> for (T0,)
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::<TestPingResponse>(offset);
90 self.0.encode(encoder, offset + 0, depth)?;
94 Ok(())
95 }
96 }
97
98 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TestPingResponse {
99 #[inline(always)]
100 fn new_empty() -> Self {
101 Self { gen: fidl::new_empty!(u32, D) }
102 }
103
104 #[inline]
105 unsafe fn decode(
106 &mut self,
107 decoder: &mut fidl::encoding::Decoder<'_, D>,
108 offset: usize,
109 _depth: fidl::encoding::Depth,
110 ) -> fidl::Result<()> {
111 decoder.debug_check_bounds::<Self>(offset);
112 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
113 unsafe {
116 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
117 }
118 Ok(())
119 }
120 }
121}