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