fidl_fuchsia_crashdriver_test__common/
fidl_fuchsia_crashdriver_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 CrasherPingResponse {
14 pub pong: u64,
15}
16
17impl fidl::Persistable for CrasherPingResponse {}
18
19pub mod crasher_ordinals {
20 pub const PING: u64 = 0x63e0c4d973e4b1f9;
21 pub const CRASH: u64 = 0x15290e84d9b74bd2;
22}
23
24mod internal {
25 use super::*;
26
27 impl fidl::encoding::ValueTypeMarker for CrasherPingResponse {
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 CrasherPingResponse {
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 8
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<CrasherPingResponse, D>
58 for &CrasherPingResponse
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::<CrasherPingResponse>(offset);
68 unsafe {
69 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
71 (buf_ptr as *mut CrasherPingResponse)
72 .write_unaligned((self as *const CrasherPingResponse).read());
73 }
76 Ok(())
77 }
78 }
79 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
80 fidl::encoding::Encode<CrasherPingResponse, 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::<CrasherPingResponse>(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 CrasherPingResponse {
99 #[inline(always)]
100 fn new_empty() -> Self {
101 Self { pong: fidl::new_empty!(u64, 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, 8);
117 }
118 Ok(())
119 }
120 }
121}