Skip to main content

fidl_fuchsia_feedback_testing__common/
fidl_fuchsia_feedback_testing__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 FakeCrashReporterQuerierWatchFileResponse {
14    pub num_filed: u64,
15}
16
17impl fidl::Persistable for FakeCrashReporterQuerierWatchFileResponse {}
18
19pub mod fake_crash_reporter_querier_ordinals {
20    pub const WATCH_FILE: u64 = 0x45bf84bcc085b82c;
21}
22
23mod internal {
24    use super::*;
25
26    impl fidl::encoding::ValueTypeMarker for FakeCrashReporterQuerierWatchFileResponse {
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 FakeCrashReporterQuerierWatchFileResponse {
34        type Owned = Self;
35
36        #[inline(always)]
37        fn inline_align(_context: fidl::encoding::Context) -> usize {
38            8
39        }
40
41        #[inline(always)]
42        fn inline_size(_context: fidl::encoding::Context) -> usize {
43            8
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<FakeCrashReporterQuerierWatchFileResponse, D>
58        for &FakeCrashReporterQuerierWatchFileResponse
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::<FakeCrashReporterQuerierWatchFileResponse>(offset);
68            unsafe {
69                // Copy the object into the buffer.
70                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
71                (buf_ptr as *mut FakeCrashReporterQuerierWatchFileResponse).write_unaligned(
72                    (self as *const FakeCrashReporterQuerierWatchFileResponse).read(),
73                );
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<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
81        fidl::encoding::Encode<FakeCrashReporterQuerierWatchFileResponse, D> for (T0,)
82    {
83        #[inline]
84        unsafe fn encode(
85            self,
86            encoder: &mut fidl::encoding::Encoder<'_, D>,
87            offset: usize,
88            depth: fidl::encoding::Depth,
89        ) -> fidl::Result<()> {
90            encoder.debug_check_bounds::<FakeCrashReporterQuerierWatchFileResponse>(offset);
91            // Zero out padding regions. There's no need to apply masks
92            // because the unmasked parts will be overwritten by fields.
93            // Write the fields.
94            self.0.encode(encoder, offset + 0, depth)?;
95            Ok(())
96        }
97    }
98
99    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
100        for FakeCrashReporterQuerierWatchFileResponse
101    {
102        #[inline(always)]
103        fn new_empty() -> Self {
104            Self { num_filed: fidl::new_empty!(u64, 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            // Verify that padding bytes are zero.
117            // Copy from the buffer into the object.
118            unsafe {
119                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
120            }
121            Ok(())
122        }
123    }
124}