fidl_fuchsia_bluetooth_bredr_test__common/
fidl_fuchsia_bluetooth_bredr_test__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, PartialEq)]
12pub struct PeerObserverPeerConnectedRequest {
13    pub peer_id: fidl_fuchsia_bluetooth__common::PeerId,
14    pub protocol: Vec<fidl_fuchsia_bluetooth_bredr__common::ProtocolDescriptor>,
15}
16
17impl fidl::Persistable for PeerObserverPeerConnectedRequest {}
18
19#[derive(Clone, Debug, PartialEq)]
20pub struct PeerObserverServiceFoundRequest {
21    pub peer_id: fidl_fuchsia_bluetooth__common::PeerId,
22    pub protocol: Option<Vec<fidl_fuchsia_bluetooth_bredr__common::ProtocolDescriptor>>,
23    pub attributes: Vec<fidl_fuchsia_bluetooth_bredr__common::Attribute>,
24}
25
26impl fidl::Persistable for PeerObserverServiceFoundRequest {}
27
28mod internal {
29    use super::*;
30
31    impl fidl::encoding::ValueTypeMarker for PeerObserverPeerConnectedRequest {
32        type Borrowed<'a> = &'a Self;
33        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
34            value
35        }
36    }
37
38    unsafe impl fidl::encoding::TypeMarker for PeerObserverPeerConnectedRequest {
39        type Owned = Self;
40
41        #[inline(always)]
42        fn inline_align(_context: fidl::encoding::Context) -> usize {
43            8
44        }
45
46        #[inline(always)]
47        fn inline_size(_context: fidl::encoding::Context) -> usize {
48            24
49        }
50    }
51
52    unsafe impl<D: fidl::encoding::ResourceDialect>
53        fidl::encoding::Encode<PeerObserverPeerConnectedRequest, D>
54        for &PeerObserverPeerConnectedRequest
55    {
56        #[inline]
57        unsafe fn encode(
58            self,
59            encoder: &mut fidl::encoding::Encoder<'_, D>,
60            offset: usize,
61            _depth: fidl::encoding::Depth,
62        ) -> fidl::Result<()> {
63            encoder.debug_check_bounds::<PeerObserverPeerConnectedRequest>(offset);
64            // Delegate to tuple encoding.
65            fidl::encoding::Encode::<PeerObserverPeerConnectedRequest, D>::encode(
66                (
67                    <fidl_fuchsia_bluetooth__common::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.peer_id),
68                    <fidl::encoding::Vector<fidl_fuchsia_bluetooth_bredr__common::ProtocolDescriptor, 255> as fidl::encoding::ValueTypeMarker>::borrow(&self.protocol),
69                ),
70                encoder, offset, _depth
71            )
72        }
73    }
74    unsafe impl<
75            D: fidl::encoding::ResourceDialect,
76            T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth__common::PeerId, D>,
77            T1: fidl::encoding::Encode<
78                fidl::encoding::Vector<
79                    fidl_fuchsia_bluetooth_bredr__common::ProtocolDescriptor,
80                    255,
81                >,
82                D,
83            >,
84        > fidl::encoding::Encode<PeerObserverPeerConnectedRequest, D> for (T0, T1)
85    {
86        #[inline]
87        unsafe fn encode(
88            self,
89            encoder: &mut fidl::encoding::Encoder<'_, D>,
90            offset: usize,
91            depth: fidl::encoding::Depth,
92        ) -> fidl::Result<()> {
93            encoder.debug_check_bounds::<PeerObserverPeerConnectedRequest>(offset);
94            // Zero out padding regions. There's no need to apply masks
95            // because the unmasked parts will be overwritten by fields.
96            // Write the fields.
97            self.0.encode(encoder, offset + 0, depth)?;
98            self.1.encode(encoder, offset + 8, depth)?;
99            Ok(())
100        }
101    }
102
103    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
104        for PeerObserverPeerConnectedRequest
105    {
106        #[inline(always)]
107        fn new_empty() -> Self {
108            Self {
109                peer_id: fidl::new_empty!(fidl_fuchsia_bluetooth__common::PeerId, D),
110                protocol: fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_bluetooth_bredr__common::ProtocolDescriptor, 255>, D),
111            }
112        }
113
114        #[inline]
115        unsafe fn decode(
116            &mut self,
117            decoder: &mut fidl::encoding::Decoder<'_, D>,
118            offset: usize,
119            _depth: fidl::encoding::Depth,
120        ) -> fidl::Result<()> {
121            decoder.debug_check_bounds::<Self>(offset);
122            // Verify that padding bytes are zero.
123            fidl::decode!(
124                fidl_fuchsia_bluetooth__common::PeerId,
125                D,
126                &mut self.peer_id,
127                decoder,
128                offset + 0,
129                _depth
130            )?;
131            fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_bluetooth_bredr__common::ProtocolDescriptor, 255>, D, &mut self.protocol, decoder, offset + 8, _depth)?;
132            Ok(())
133        }
134    }
135
136    impl fidl::encoding::ValueTypeMarker for PeerObserverServiceFoundRequest {
137        type Borrowed<'a> = &'a Self;
138        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
139            value
140        }
141    }
142
143    unsafe impl fidl::encoding::TypeMarker for PeerObserverServiceFoundRequest {
144        type Owned = Self;
145
146        #[inline(always)]
147        fn inline_align(_context: fidl::encoding::Context) -> usize {
148            8
149        }
150
151        #[inline(always)]
152        fn inline_size(_context: fidl::encoding::Context) -> usize {
153            40
154        }
155    }
156
157    unsafe impl<D: fidl::encoding::ResourceDialect>
158        fidl::encoding::Encode<PeerObserverServiceFoundRequest, D>
159        for &PeerObserverServiceFoundRequest
160    {
161        #[inline]
162        unsafe fn encode(
163            self,
164            encoder: &mut fidl::encoding::Encoder<'_, D>,
165            offset: usize,
166            _depth: fidl::encoding::Depth,
167        ) -> fidl::Result<()> {
168            encoder.debug_check_bounds::<PeerObserverServiceFoundRequest>(offset);
169            // Delegate to tuple encoding.
170            fidl::encoding::Encode::<PeerObserverServiceFoundRequest, D>::encode(
171                (
172                    <fidl_fuchsia_bluetooth__common::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.peer_id),
173                    <fidl::encoding::Optional<fidl::encoding::Vector<fidl_fuchsia_bluetooth_bredr__common::ProtocolDescriptor, 255>> as fidl::encoding::ValueTypeMarker>::borrow(&self.protocol),
174                    <fidl::encoding::Vector<fidl_fuchsia_bluetooth_bredr__common::Attribute, 512> as fidl::encoding::ValueTypeMarker>::borrow(&self.attributes),
175                ),
176                encoder, offset, _depth
177            )
178        }
179    }
180    unsafe impl<
181            D: fidl::encoding::ResourceDialect,
182            T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth__common::PeerId, D>,
183            T1: fidl::encoding::Encode<
184                fidl::encoding::Optional<
185                    fidl::encoding::Vector<
186                        fidl_fuchsia_bluetooth_bredr__common::ProtocolDescriptor,
187                        255,
188                    >,
189                >,
190                D,
191            >,
192            T2: fidl::encoding::Encode<
193                fidl::encoding::Vector<fidl_fuchsia_bluetooth_bredr__common::Attribute, 512>,
194                D,
195            >,
196        > fidl::encoding::Encode<PeerObserverServiceFoundRequest, D> for (T0, T1, T2)
197    {
198        #[inline]
199        unsafe fn encode(
200            self,
201            encoder: &mut fidl::encoding::Encoder<'_, D>,
202            offset: usize,
203            depth: fidl::encoding::Depth,
204        ) -> fidl::Result<()> {
205            encoder.debug_check_bounds::<PeerObserverServiceFoundRequest>(offset);
206            // Zero out padding regions. There's no need to apply masks
207            // because the unmasked parts will be overwritten by fields.
208            // Write the fields.
209            self.0.encode(encoder, offset + 0, depth)?;
210            self.1.encode(encoder, offset + 8, depth)?;
211            self.2.encode(encoder, offset + 24, depth)?;
212            Ok(())
213        }
214    }
215
216    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
217        for PeerObserverServiceFoundRequest
218    {
219        #[inline(always)]
220        fn new_empty() -> Self {
221            Self {
222                peer_id: fidl::new_empty!(fidl_fuchsia_bluetooth__common::PeerId, D),
223                protocol: fidl::new_empty!(
224                    fidl::encoding::Optional<
225                        fidl::encoding::Vector<
226                            fidl_fuchsia_bluetooth_bredr__common::ProtocolDescriptor,
227                            255,
228                        >,
229                    >,
230                    D
231                ),
232                attributes: fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_bluetooth_bredr__common::Attribute, 512>, D),
233            }
234        }
235
236        #[inline]
237        unsafe fn decode(
238            &mut self,
239            decoder: &mut fidl::encoding::Decoder<'_, D>,
240            offset: usize,
241            _depth: fidl::encoding::Depth,
242        ) -> fidl::Result<()> {
243            decoder.debug_check_bounds::<Self>(offset);
244            // Verify that padding bytes are zero.
245            fidl::decode!(
246                fidl_fuchsia_bluetooth__common::PeerId,
247                D,
248                &mut self.peer_id,
249                decoder,
250                offset + 0,
251                _depth
252            )?;
253            fidl::decode!(
254                fidl::encoding::Optional<
255                    fidl::encoding::Vector<
256                        fidl_fuchsia_bluetooth_bredr__common::ProtocolDescriptor,
257                        255,
258                    >,
259                >,
260                D,
261                &mut self.protocol,
262                decoder,
263                offset + 8,
264                _depth
265            )?;
266            fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_bluetooth_bredr__common::Attribute, 512>, D, &mut self.attributes, decoder, offset + 24, _depth)?;
267            Ok(())
268        }
269    }
270}