Skip to main content

fidl_fuchsia_trf_mockcontrol_reversertrftest_common/
fidl_fuchsia_trf_mockcontrol_reversertrftest_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, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
12pub struct MockReplacerControlSetReplacementRequest {
13    pub target: String,
14    pub replacement: String,
15}
16
17impl fidl::Persistable for MockReplacerControlSetReplacementRequest {}
18
19pub mod mock_replacer_control_ordinals {
20    pub const SET_REPLACEMENT: u64 = 0x266f2bdf5b12edbf;
21}
22
23mod internal {
24    use super::*;
25
26    impl fidl::encoding::ValueTypeMarker for MockReplacerControlSetReplacementRequest {
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 MockReplacerControlSetReplacementRequest {
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            32
44        }
45    }
46
47    unsafe impl<D: fidl::encoding::ResourceDialect>
48        fidl::encoding::Encode<MockReplacerControlSetReplacementRequest, D>
49        for &MockReplacerControlSetReplacementRequest
50    {
51        #[inline]
52        unsafe fn encode(
53            self,
54            encoder: &mut fidl::encoding::Encoder<'_, D>,
55            offset: usize,
56            _depth: fidl::encoding::Depth,
57        ) -> fidl::Result<()> {
58            encoder.debug_check_bounds::<MockReplacerControlSetReplacementRequest>(offset);
59            // Delegate to tuple encoding.
60            fidl::encoding::Encode::<MockReplacerControlSetReplacementRequest, D>::encode(
61                (
62                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
63                        &self.target,
64                    ),
65                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
66                        &self.replacement,
67                    ),
68                ),
69                encoder,
70                offset,
71                _depth,
72            )
73        }
74    }
75    unsafe impl<
76        D: fidl::encoding::ResourceDialect,
77        T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
78        T1: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
79    > fidl::encoding::Encode<MockReplacerControlSetReplacementRequest, D> for (T0, T1)
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::<MockReplacerControlSetReplacementRequest>(offset);
89            // Zero out padding regions. There's no need to apply masks
90            // because the unmasked parts will be overwritten by fields.
91            // Write the fields.
92            self.0.encode(encoder, offset + 0, depth)?;
93            self.1.encode(encoder, offset + 16, depth)?;
94            Ok(())
95        }
96    }
97
98    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
99        for MockReplacerControlSetReplacementRequest
100    {
101        #[inline(always)]
102        fn new_empty() -> Self {
103            Self {
104                target: fidl::new_empty!(fidl::encoding::UnboundedString, D),
105                replacement: fidl::new_empty!(fidl::encoding::UnboundedString, D),
106            }
107        }
108
109        #[inline]
110        unsafe fn decode(
111            &mut self,
112            decoder: &mut fidl::encoding::Decoder<'_, D>,
113            offset: usize,
114            _depth: fidl::encoding::Depth,
115        ) -> fidl::Result<()> {
116            decoder.debug_check_bounds::<Self>(offset);
117            // Verify that padding bytes are zero.
118            fidl::decode!(
119                fidl::encoding::UnboundedString,
120                D,
121                &mut self.target,
122                decoder,
123                offset + 0,
124                _depth
125            )?;
126            fidl::decode!(
127                fidl::encoding::UnboundedString,
128                D,
129                &mut self.replacement,
130                decoder,
131                offset + 16,
132                _depth
133            )?;
134            Ok(())
135        }
136    }
137}