fidl_cf_sc_internal_triagedetectconfig/
fidl_cf_sc_internal_triagedetectconfig.rs1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
14pub struct Config {
15 pub check_every: String,
16 pub test_only: bool,
17}
18
19impl fidl::Persistable for Config {}
20
21mod internal {
22 use super::*;
23
24 impl fidl::encoding::ValueTypeMarker for Config {
25 type Borrowed<'a> = &'a Self;
26 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
27 value
28 }
29 }
30
31 unsafe impl fidl::encoding::TypeMarker for Config {
32 type Owned = Self;
33
34 #[inline(always)]
35 fn inline_align(_context: fidl::encoding::Context) -> usize {
36 8
37 }
38
39 #[inline(always)]
40 fn inline_size(_context: fidl::encoding::Context) -> usize {
41 24
42 }
43 }
44
45 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Config, D> for &Config {
46 #[inline]
47 unsafe fn encode(
48 self,
49 encoder: &mut fidl::encoding::Encoder<'_, D>,
50 offset: usize,
51 _depth: fidl::encoding::Depth,
52 ) -> fidl::Result<()> {
53 encoder.debug_check_bounds::<Config>(offset);
54 fidl::encoding::Encode::<Config, D>::encode(
56 (
57 <fidl::encoding::BoundedString<100> as fidl::encoding::ValueTypeMarker>::borrow(
58 &self.check_every,
59 ),
60 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.test_only),
61 ),
62 encoder,
63 offset,
64 _depth,
65 )
66 }
67 }
68 unsafe impl<
69 D: fidl::encoding::ResourceDialect,
70 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<100>, D>,
71 T1: fidl::encoding::Encode<bool, D>,
72 > fidl::encoding::Encode<Config, D> for (T0, T1)
73 {
74 #[inline]
75 unsafe fn encode(
76 self,
77 encoder: &mut fidl::encoding::Encoder<'_, D>,
78 offset: usize,
79 depth: fidl::encoding::Depth,
80 ) -> fidl::Result<()> {
81 encoder.debug_check_bounds::<Config>(offset);
82 unsafe {
85 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
86 (ptr as *mut u64).write_unaligned(0);
87 }
88 self.0.encode(encoder, offset + 0, depth)?;
90 self.1.encode(encoder, offset + 16, depth)?;
91 Ok(())
92 }
93 }
94
95 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Config {
96 #[inline(always)]
97 fn new_empty() -> Self {
98 Self {
99 check_every: fidl::new_empty!(fidl::encoding::BoundedString<100>, D),
100 test_only: fidl::new_empty!(bool, D),
101 }
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 ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
114 let padval = unsafe { (ptr as *const u64).read_unaligned() };
115 let mask = 0xffffffffffffff00u64;
116 let maskedval = padval & mask;
117 if maskedval != 0 {
118 return Err(fidl::Error::NonZeroPadding {
119 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
120 });
121 }
122 fidl::decode!(
123 fidl::encoding::BoundedString<100>,
124 D,
125 &mut self.check_every,
126 decoder,
127 offset + 0,
128 _depth
129 )?;
130 fidl::decode!(bool, D, &mut self.test_only, decoder, offset + 16, _depth)?;
131 Ok(())
132 }
133 }
134}