1#![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
11pub type Psm = u16;
15
16pub const MAX_BROADCAST_NAME_OCTETS: u8 = 128;
17
18pub const MAX_ISO_PACKET_SIZE: u16 = 4095;
21
22pub const MAX_MANUFACTURER_DATA_LENGTH: u8 = 252;
23
24pub const MAX_SERVICE_DATA_LENGTH: u8 = 252;
25
26pub const MAX_URI_LENGTH: u16 = 278;
27
28#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
36#[repr(u8)]
37pub enum AdvertisingModeHint {
38 VeryFast = 1,
42 Fast = 2,
45 Slow = 3,
48}
49
50impl AdvertisingModeHint {
51 #[inline]
52 pub fn from_primitive(prim: u8) -> Option<Self> {
53 match prim {
54 1 => Some(Self::VeryFast),
55 2 => Some(Self::Fast),
56 3 => Some(Self::Slow),
57 _ => None,
58 }
59 }
60
61 #[inline]
62 pub const fn into_primitive(self) -> u8 {
63 self as u8
64 }
65
66 #[deprecated = "Strict enums should not use `is_unknown`"]
67 #[inline]
68 pub fn is_unknown(&self) -> bool {
69 false
70 }
71}
72
73#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
74#[repr(u32)]
75pub enum CentralError {
76 Aborted = 1,
78 InProgress = 2,
80 InvalidParameters = 3,
82 Failed = 4,
84}
85
86impl CentralError {
87 #[inline]
88 pub fn from_primitive(prim: u32) -> Option<Self> {
89 match prim {
90 1 => Some(Self::Aborted),
91 2 => Some(Self::InProgress),
92 3 => Some(Self::InvalidParameters),
93 4 => Some(Self::Failed),
94 _ => None,
95 }
96 }
97
98 #[inline]
99 pub const fn into_primitive(self) -> u32 {
100 self as u32
101 }
102
103 #[deprecated = "Strict enums should not use `is_unknown`"]
104 #[inline]
105 pub fn is_unknown(&self) -> bool {
106 false
107 }
108}
109
110#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
112#[repr(u8)]
113pub enum IsoPacketStatusFlag {
114 ValidData = 0,
116 DataWithPossibleErrors = 1,
119 LostData = 2,
121}
122
123impl IsoPacketStatusFlag {
124 #[inline]
125 pub fn from_primitive(prim: u8) -> Option<Self> {
126 match prim {
127 0 => Some(Self::ValidData),
128 1 => Some(Self::DataWithPossibleErrors),
129 2 => Some(Self::LostData),
130 _ => None,
131 }
132 }
133
134 #[inline]
135 pub const fn into_primitive(self) -> u8 {
136 self as u8
137 }
138
139 #[deprecated = "Strict enums should not use `is_unknown`"]
140 #[inline]
141 pub fn is_unknown(&self) -> bool {
142 false
143 }
144}
145
146#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
147#[repr(u32)]
148pub enum PeripheralError {
149 NotSupported = 1,
151 AdvertisingDataTooLong = 2,
153 ScanResponseDataTooLong = 3,
155 InvalidParameters = 4,
157 Aborted = 5,
160 Failed = 6,
162}
163
164impl PeripheralError {
165 #[inline]
166 pub fn from_primitive(prim: u32) -> Option<Self> {
167 match prim {
168 1 => Some(Self::NotSupported),
169 2 => Some(Self::AdvertisingDataTooLong),
170 3 => Some(Self::ScanResponseDataTooLong),
171 4 => Some(Self::InvalidParameters),
172 5 => Some(Self::Aborted),
173 6 => Some(Self::Failed),
174 _ => None,
175 }
176 }
177
178 #[inline]
179 pub const fn into_primitive(self) -> u32 {
180 self as u32
181 }
182
183 #[deprecated = "Strict enums should not use `is_unknown`"]
184 #[inline]
185 pub fn is_unknown(&self) -> bool {
186 false
187 }
188}
189
190#[derive(Clone, Debug, PartialEq)]
192pub struct AdvertisingDataDeprecated {
193 pub name: Option<String>,
195 pub tx_power_level: Option<Box<fidl_fuchsia_bluetooth::Int8>>,
197 pub appearance: Option<Box<fidl_fuchsia_bluetooth::UInt16>>,
199 pub service_uuids: Option<Vec<String>>,
201 pub service_data: Option<Vec<ServiceDataEntry>>,
203 pub manufacturer_specific_data: Option<Vec<ManufacturerSpecificDataEntry>>,
205 pub solicited_service_uuids: Option<Vec<String>>,
208 pub uris: Option<Vec<String>>,
211}
212
213impl fidl::Persistable for AdvertisingDataDeprecated {}
214
215#[derive(Clone, Debug, PartialEq)]
216pub struct CentralConnectPeripheralResponse {
217 pub status: fidl_fuchsia_bluetooth::Status,
218}
219
220impl fidl::Persistable for CentralConnectPeripheralResponse {}
221
222#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
223pub struct CentralDisconnectPeripheralRequest {
224 pub identifier: String,
225}
226
227impl fidl::Persistable for CentralDisconnectPeripheralRequest {}
228
229#[derive(Clone, Debug, PartialEq)]
230pub struct CentralDisconnectPeripheralResponse {
231 pub status: fidl_fuchsia_bluetooth::Status,
232}
233
234impl fidl::Persistable for CentralDisconnectPeripheralResponse {}
235
236#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
237pub struct CentralGetPeripheralRequest {
238 pub identifier: String,
239}
240
241impl fidl::Persistable for CentralGetPeripheralRequest {}
242
243#[derive(Clone, Debug, PartialEq)]
244pub struct CentralGetPeripheralResponse {
245 pub peripheral: Option<Box<RemoteDevice>>,
246}
247
248impl fidl::Persistable for CentralGetPeripheralResponse {}
249
250#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
251pub struct CentralGetPeripheralsRequest {
252 pub service_uuids: Option<Vec<String>>,
253}
254
255impl fidl::Persistable for CentralGetPeripheralsRequest {}
256
257#[derive(Clone, Debug, PartialEq)]
258pub struct CentralGetPeripheralsResponse {
259 pub peripherals: Vec<RemoteDevice>,
260}
261
262impl fidl::Persistable for CentralGetPeripheralsResponse {}
263
264#[derive(Clone, Debug, PartialEq)]
265pub struct CentralOnDeviceDiscoveredRequest {
266 pub device: RemoteDevice,
267}
268
269impl fidl::Persistable for CentralOnDeviceDiscoveredRequest {}
270
271#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
272pub struct CentralOnPeripheralDisconnectedRequest {
273 pub identifier: String,
274}
275
276impl fidl::Persistable for CentralOnPeripheralDisconnectedRequest {}
277
278#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
279pub struct CentralOnScanStateChangedRequest {
280 pub scanning: bool,
281}
282
283impl fidl::Persistable for CentralOnScanStateChangedRequest {}
284
285#[derive(Clone, Debug, PartialEq)]
286pub struct CentralStartScanRequest {
287 pub filter: Option<Box<ScanFilter>>,
288}
289
290impl fidl::Persistable for CentralStartScanRequest {}
291
292#[derive(Clone, Debug, PartialEq)]
293pub struct CentralStartScanResponse {
294 pub status: fidl_fuchsia_bluetooth::Status,
295}
296
297impl fidl::Persistable for CentralStartScanResponse {}
298
299#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
301pub struct ManufacturerData {
302 pub company_id: u16,
303 pub data: Vec<u8>,
304}
305
306impl fidl::Persistable for ManufacturerData {}
307
308#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
309pub struct ManufacturerSpecificDataEntry {
310 pub company_id: u16,
311 pub data: Vec<u8>,
312}
313
314impl fidl::Persistable for ManufacturerSpecificDataEntry {}
315
316#[derive(Clone, Debug, PartialEq)]
319pub struct RemoteDevice {
320 pub identifier: String,
322 pub connectable: bool,
325 pub rssi: Option<Box<fidl_fuchsia_bluetooth::Int8>>,
327 pub advertising_data: Option<Box<AdvertisingDataDeprecated>>,
329}
330
331impl fidl::Persistable for RemoteDevice {}
332
333#[derive(Clone, Debug, PartialEq)]
337pub struct ScanFilter {
338 pub service_uuids: Option<Vec<String>>,
341 pub service_data_uuids: Option<Vec<String>>,
343 pub manufacturer_identifier: Option<Box<fidl_fuchsia_bluetooth::UInt16>>,
347 pub connectable: Option<Box<fidl_fuchsia_bluetooth::Bool>>,
351 pub name_substring: Option<String>,
353 pub max_path_loss: Option<Box<fidl_fuchsia_bluetooth::Int8>>,
359}
360
361impl fidl::Persistable for ScanFilter {}
362
363#[derive(Clone, Debug, PartialEq)]
364pub struct ScanResultWatcherWatchResponse {
365 pub updated: Vec<Peer>,
366}
367
368impl fidl::Persistable for ScanResultWatcherWatchResponse {}
369
370#[derive(Clone, Debug, PartialEq)]
372pub struct ServiceData {
373 pub uuid: fidl_fuchsia_bluetooth::Uuid,
374 pub data: Vec<u8>,
375}
376
377impl fidl::Persistable for ServiceData {}
378
379#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
380pub struct ServiceDataEntry {
381 pub uuid: String,
382 pub data: Vec<u8>,
383}
384
385impl fidl::Persistable for ServiceDataEntry {}
386
387#[derive(Clone, Debug, Default, PartialEq)]
392pub struct AcceptedChannelParameters {
393 pub accepted_channel_modes: Option<Vec<fidl_fuchsia_bluetooth::ChannelMode>>,
398 pub max_packet_size: Option<u16>,
402 #[doc(hidden)]
403 pub __source_breaking: fidl::marker::SourceBreaking,
404}
405
406impl fidl::Persistable for AcceptedChannelParameters {}
407
408#[derive(Clone, Debug, Default, PartialEq)]
411pub struct AdvertisingData {
412 pub name: Option<String>,
414 pub appearance: Option<fidl_fuchsia_bluetooth::Appearance>,
416 pub tx_power_level: Option<i8>,
417 pub service_uuids: Option<Vec<fidl_fuchsia_bluetooth::Uuid>>,
419 pub service_data: Option<Vec<ServiceData>>,
421 pub manufacturer_data: Option<Vec<ManufacturerData>>,
423 pub uris: Option<Vec<String>>,
429 pub include_tx_power_level: Option<bool>,
431 pub resolvable_set_identifier: Option<[u8; 6]>,
435 pub broadcast_name: Option<String>,
444 #[doc(hidden)]
445 pub __source_breaking: fidl::marker::SourceBreaking,
446}
447
448impl fidl::Persistable for AdvertisingData {}
449
450#[derive(Clone, Debug, Default, PartialEq)]
452pub struct AdvertisingParameters {
453 pub data: Option<AdvertisingData>,
457 pub scan_response: Option<AdvertisingData>,
463 pub mode_hint: Option<AdvertisingModeHint>,
466 pub connectable: Option<bool>,
470 pub connection_options: Option<ConnectionOptions>,
475 pub advertising_procedure: Option<AdvertisingProcedure>,
481 pub address_type: Option<fidl_fuchsia_bluetooth::AddressType>,
493 #[doc(hidden)]
494 pub __source_breaking: fidl::marker::SourceBreaking,
495}
496
497impl fidl::Persistable for AdvertisingParameters {}
498
499#[derive(Clone, Debug, Default, PartialEq)]
500pub struct ChannelListenerRegistryListenL2capResponse {
501 pub psm: Option<u16>,
504 #[doc(hidden)]
505 pub __source_breaking: fidl::marker::SourceBreaking,
506}
507
508impl fidl::Persistable for ChannelListenerRegistryListenL2capResponse {}
509
510#[derive(Clone, Debug, Default, PartialEq)]
512pub struct CisEstablishedParameters {
513 pub cig_sync_delay: Option<i64>,
518 pub cis_sync_delay: Option<i64>,
523 pub max_subevents: Option<u8>,
527 pub iso_interval: Option<i64>,
531 pub central_to_peripheral_params: Option<CisUnidirectionalParams>,
536 pub peripheral_to_central_params: Option<CisUnidirectionalParams>,
541 #[doc(hidden)]
542 pub __source_breaking: fidl::marker::SourceBreaking,
543}
544
545impl fidl::Persistable for CisEstablishedParameters {}
546
547#[derive(Clone, Debug, Default, PartialEq)]
549pub struct CisUnidirectionalParams {
550 pub transport_latency: Option<i64>,
554 pub burst_number: Option<u8>,
558 pub flush_timeout: Option<u8>,
562 #[doc(hidden)]
563 pub __source_breaking: fidl::marker::SourceBreaking,
564}
565
566impl fidl::Persistable for CisUnidirectionalParams {}
567
568#[derive(Clone, Debug, Default, PartialEq)]
569pub struct CodecDelayGetCodecLocalDelayRangeRequest {
570 pub logical_transport_type: Option<fidl_fuchsia_bluetooth::LogicalTransportType>,
573 pub data_direction: Option<fidl_fuchsia_bluetooth::DataDirection>,
575 pub codec_attributes: Option<fidl_fuchsia_bluetooth::CodecAttributes>,
577 #[doc(hidden)]
578 pub __source_breaking: fidl::marker::SourceBreaking,
579}
580
581impl fidl::Persistable for CodecDelayGetCodecLocalDelayRangeRequest {}
582
583#[derive(Clone, Debug, Default, PartialEq)]
584pub struct CodecDelayGetCodecLocalDelayRangeResponse {
585 pub min_controller_delay: Option<i64>,
588 pub max_controller_delay: Option<i64>,
591 #[doc(hidden)]
592 pub __source_breaking: fidl::marker::SourceBreaking,
593}
594
595impl fidl::Persistable for CodecDelayGetCodecLocalDelayRangeResponse {}
596
597#[derive(Clone, Debug, Default, PartialEq)]
600pub struct ConnectionOptions {
601 pub bondable_mode: Option<bool>,
606 pub service_filter: Option<fidl_fuchsia_bluetooth::Uuid>,
609 #[doc(hidden)]
610 pub __source_breaking: fidl::marker::SourceBreaking,
611}
612
613impl fidl::Persistable for ConnectionOptions {}
614
615#[derive(Clone, Debug, Default, PartialEq)]
616pub struct Extended {
617 #[doc(hidden)]
618 pub __source_breaking: fidl::marker::SourceBreaking,
619}
620
621impl fidl::Persistable for Extended {}
622
623#[derive(Clone, Debug, Default, PartialEq)]
626pub struct Filter {
627 pub service_uuid: Option<fidl_fuchsia_bluetooth::Uuid>,
629 pub service_data_uuid: Option<fidl_fuchsia_bluetooth::Uuid>,
631 pub manufacturer_id: Option<u16>,
637 pub connectable: Option<bool>,
642 pub name: Option<String>,
645 pub max_path_loss: Option<i8>,
657 pub solicitation_uuid: Option<fidl_fuchsia_bluetooth::Uuid>,
661 #[doc(hidden)]
662 pub __source_breaking: fidl::marker::SourceBreaking,
663}
664
665impl fidl::Persistable for Filter {}
666
667#[derive(Clone, Debug, Default, PartialEq)]
668pub struct IsochronousStreamOnEstablishedRequest {
669 pub result: Option<i32>,
672 pub established_params: Option<CisEstablishedParameters>,
674 #[doc(hidden)]
675 pub __source_breaking: fidl::marker::SourceBreaking,
676}
677
678impl fidl::Persistable for IsochronousStreamOnEstablishedRequest {}
679
680#[derive(Clone, Debug, Default, PartialEq)]
681pub struct IsochronousStreamSetupDataPathRequest {
682 pub data_direction: Option<fidl_fuchsia_bluetooth::DataDirection>,
685 pub codec_attributes: Option<fidl_fuchsia_bluetooth::CodecAttributes>,
688 pub controller_delay: Option<i64>,
692 #[doc(hidden)]
693 pub __source_breaking: fidl::marker::SourceBreaking,
694}
695
696impl fidl::Persistable for IsochronousStreamSetupDataPathRequest {}
697
698#[derive(Clone, Debug, Default, PartialEq)]
699pub struct IsochronousStreamWriteRequest {
700 pub data: Option<Vec<u8>>,
702 #[doc(hidden)]
703 pub __source_breaking: fidl::marker::SourceBreaking,
704}
705
706impl fidl::Persistable for IsochronousStreamWriteRequest {}
707
708#[derive(Clone, Debug, Default, PartialEq)]
709pub struct IsochronousStreamReadResponse {
710 pub data: Option<Vec<u8>>,
713 pub sequence_number: Option<u16>,
716 pub status_flag: Option<IsoPacketStatusFlag>,
719 pub timestamp: Option<i64>,
722 #[doc(hidden)]
723 pub __source_breaking: fidl::marker::SourceBreaking,
724}
725
726impl fidl::Persistable for IsochronousStreamReadResponse {}
727
728#[derive(Clone, Debug, Default, PartialEq)]
729pub struct Legacy {
730 #[doc(hidden)]
731 pub __source_breaking: fidl::marker::SourceBreaking,
732}
733
734impl fidl::Persistable for Legacy {}
735
736#[derive(Clone, Debug, Default, PartialEq)]
739pub struct Peer {
740 pub id: Option<fidl_fuchsia_bluetooth::PeerId>,
744 pub connectable: Option<bool>,
749 pub rssi: Option<i8>,
755 pub advertising_data: Option<AdvertisingData>,
756 pub name: Option<String>,
761 pub data: Option<ScanData>,
764 pub bonded: Option<bool>,
768 pub last_updated: Option<i64>,
773 pub advertising_sid: Option<u8>,
777 pub periodic_advertising_interval: Option<u16>,
781 #[doc(hidden)]
782 pub __source_breaking: fidl::marker::SourceBreaking,
783}
784
785impl fidl::Persistable for Peer {}
786
787#[derive(Clone, Debug, Default, PartialEq)]
789pub struct ScanData {
790 pub tx_power: Option<i8>,
795 pub appearance: Option<fidl_fuchsia_bluetooth::Appearance>,
797 pub service_uuids: Option<Vec<fidl_fuchsia_bluetooth::Uuid>>,
799 pub service_data: Option<Vec<ServiceData>>,
801 pub manufacturer_data: Option<Vec<ManufacturerData>>,
803 pub uris: Option<Vec<String>>,
809 pub timestamp: Option<i64>,
811 #[doc(hidden)]
812 pub __source_breaking: fidl::marker::SourceBreaking,
813}
814
815impl fidl::Persistable for ScanData {}
816
817#[derive(Clone, Debug, Default, PartialEq)]
819pub struct ScanOptions {
820 pub filters: Option<Vec<Filter>>,
825 #[doc(hidden)]
826 pub __source_breaking: fidl::marker::SourceBreaking,
827}
828
829impl fidl::Persistable for ScanOptions {}
830
831#[derive(Clone, Debug)]
832pub enum AdvertisingProcedure {
833 Legacy(Legacy),
836 Extended(Extended),
846 #[doc(hidden)]
847 __SourceBreaking { unknown_ordinal: u64 },
848}
849
850#[macro_export]
852macro_rules! AdvertisingProcedureUnknown {
853 () => {
854 _
855 };
856}
857
858impl PartialEq for AdvertisingProcedure {
860 fn eq(&self, other: &Self) -> bool {
861 match (self, other) {
862 (Self::Legacy(x), Self::Legacy(y)) => *x == *y,
863 (Self::Extended(x), Self::Extended(y)) => *x == *y,
864 _ => false,
865 }
866 }
867}
868
869impl AdvertisingProcedure {
870 #[inline]
871 pub fn ordinal(&self) -> u64 {
872 match *self {
873 Self::Legacy(_) => 1,
874 Self::Extended(_) => 2,
875 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
876 }
877 }
878
879 #[inline]
880 pub fn unknown_variant_for_testing() -> Self {
881 Self::__SourceBreaking { unknown_ordinal: 0 }
882 }
883
884 #[inline]
885 pub fn is_unknown(&self) -> bool {
886 match self {
887 Self::__SourceBreaking { .. } => true,
888 _ => false,
889 }
890 }
891}
892
893impl fidl::Persistable for AdvertisingProcedure {}
894
895mod internal {
896 use super::*;
897 unsafe impl fidl::encoding::TypeMarker for AdvertisingModeHint {
898 type Owned = Self;
899
900 #[inline(always)]
901 fn inline_align(_context: fidl::encoding::Context) -> usize {
902 std::mem::align_of::<u8>()
903 }
904
905 #[inline(always)]
906 fn inline_size(_context: fidl::encoding::Context) -> usize {
907 std::mem::size_of::<u8>()
908 }
909
910 #[inline(always)]
911 fn encode_is_copy() -> bool {
912 true
913 }
914
915 #[inline(always)]
916 fn decode_is_copy() -> bool {
917 false
918 }
919 }
920
921 impl fidl::encoding::ValueTypeMarker for AdvertisingModeHint {
922 type Borrowed<'a> = Self;
923 #[inline(always)]
924 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
925 *value
926 }
927 }
928
929 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
930 for AdvertisingModeHint
931 {
932 #[inline]
933 unsafe fn encode(
934 self,
935 encoder: &mut fidl::encoding::Encoder<'_, D>,
936 offset: usize,
937 _depth: fidl::encoding::Depth,
938 ) -> fidl::Result<()> {
939 encoder.debug_check_bounds::<Self>(offset);
940 encoder.write_num(self.into_primitive(), offset);
941 Ok(())
942 }
943 }
944
945 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AdvertisingModeHint {
946 #[inline(always)]
947 fn new_empty() -> Self {
948 Self::VeryFast
949 }
950
951 #[inline]
952 unsafe fn decode(
953 &mut self,
954 decoder: &mut fidl::encoding::Decoder<'_, D>,
955 offset: usize,
956 _depth: fidl::encoding::Depth,
957 ) -> fidl::Result<()> {
958 decoder.debug_check_bounds::<Self>(offset);
959 let prim = decoder.read_num::<u8>(offset);
960
961 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
962 Ok(())
963 }
964 }
965 unsafe impl fidl::encoding::TypeMarker for CentralError {
966 type Owned = Self;
967
968 #[inline(always)]
969 fn inline_align(_context: fidl::encoding::Context) -> usize {
970 std::mem::align_of::<u32>()
971 }
972
973 #[inline(always)]
974 fn inline_size(_context: fidl::encoding::Context) -> usize {
975 std::mem::size_of::<u32>()
976 }
977
978 #[inline(always)]
979 fn encode_is_copy() -> bool {
980 true
981 }
982
983 #[inline(always)]
984 fn decode_is_copy() -> bool {
985 false
986 }
987 }
988
989 impl fidl::encoding::ValueTypeMarker for CentralError {
990 type Borrowed<'a> = Self;
991 #[inline(always)]
992 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
993 *value
994 }
995 }
996
997 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for CentralError {
998 #[inline]
999 unsafe fn encode(
1000 self,
1001 encoder: &mut fidl::encoding::Encoder<'_, D>,
1002 offset: usize,
1003 _depth: fidl::encoding::Depth,
1004 ) -> fidl::Result<()> {
1005 encoder.debug_check_bounds::<Self>(offset);
1006 encoder.write_num(self.into_primitive(), offset);
1007 Ok(())
1008 }
1009 }
1010
1011 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CentralError {
1012 #[inline(always)]
1013 fn new_empty() -> Self {
1014 Self::Aborted
1015 }
1016
1017 #[inline]
1018 unsafe fn decode(
1019 &mut self,
1020 decoder: &mut fidl::encoding::Decoder<'_, D>,
1021 offset: usize,
1022 _depth: fidl::encoding::Depth,
1023 ) -> fidl::Result<()> {
1024 decoder.debug_check_bounds::<Self>(offset);
1025 let prim = decoder.read_num::<u32>(offset);
1026
1027 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1028 Ok(())
1029 }
1030 }
1031 unsafe impl fidl::encoding::TypeMarker for IsoPacketStatusFlag {
1032 type Owned = Self;
1033
1034 #[inline(always)]
1035 fn inline_align(_context: fidl::encoding::Context) -> usize {
1036 std::mem::align_of::<u8>()
1037 }
1038
1039 #[inline(always)]
1040 fn inline_size(_context: fidl::encoding::Context) -> usize {
1041 std::mem::size_of::<u8>()
1042 }
1043
1044 #[inline(always)]
1045 fn encode_is_copy() -> bool {
1046 true
1047 }
1048
1049 #[inline(always)]
1050 fn decode_is_copy() -> bool {
1051 false
1052 }
1053 }
1054
1055 impl fidl::encoding::ValueTypeMarker for IsoPacketStatusFlag {
1056 type Borrowed<'a> = Self;
1057 #[inline(always)]
1058 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1059 *value
1060 }
1061 }
1062
1063 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1064 for IsoPacketStatusFlag
1065 {
1066 #[inline]
1067 unsafe fn encode(
1068 self,
1069 encoder: &mut fidl::encoding::Encoder<'_, D>,
1070 offset: usize,
1071 _depth: fidl::encoding::Depth,
1072 ) -> fidl::Result<()> {
1073 encoder.debug_check_bounds::<Self>(offset);
1074 encoder.write_num(self.into_primitive(), offset);
1075 Ok(())
1076 }
1077 }
1078
1079 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for IsoPacketStatusFlag {
1080 #[inline(always)]
1081 fn new_empty() -> Self {
1082 Self::ValidData
1083 }
1084
1085 #[inline]
1086 unsafe fn decode(
1087 &mut self,
1088 decoder: &mut fidl::encoding::Decoder<'_, D>,
1089 offset: usize,
1090 _depth: fidl::encoding::Depth,
1091 ) -> fidl::Result<()> {
1092 decoder.debug_check_bounds::<Self>(offset);
1093 let prim = decoder.read_num::<u8>(offset);
1094
1095 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1096 Ok(())
1097 }
1098 }
1099 unsafe impl fidl::encoding::TypeMarker for PeripheralError {
1100 type Owned = Self;
1101
1102 #[inline(always)]
1103 fn inline_align(_context: fidl::encoding::Context) -> usize {
1104 std::mem::align_of::<u32>()
1105 }
1106
1107 #[inline(always)]
1108 fn inline_size(_context: fidl::encoding::Context) -> usize {
1109 std::mem::size_of::<u32>()
1110 }
1111
1112 #[inline(always)]
1113 fn encode_is_copy() -> bool {
1114 true
1115 }
1116
1117 #[inline(always)]
1118 fn decode_is_copy() -> bool {
1119 false
1120 }
1121 }
1122
1123 impl fidl::encoding::ValueTypeMarker for PeripheralError {
1124 type Borrowed<'a> = Self;
1125 #[inline(always)]
1126 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1127 *value
1128 }
1129 }
1130
1131 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1132 for PeripheralError
1133 {
1134 #[inline]
1135 unsafe fn encode(
1136 self,
1137 encoder: &mut fidl::encoding::Encoder<'_, D>,
1138 offset: usize,
1139 _depth: fidl::encoding::Depth,
1140 ) -> fidl::Result<()> {
1141 encoder.debug_check_bounds::<Self>(offset);
1142 encoder.write_num(self.into_primitive(), offset);
1143 Ok(())
1144 }
1145 }
1146
1147 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PeripheralError {
1148 #[inline(always)]
1149 fn new_empty() -> Self {
1150 Self::NotSupported
1151 }
1152
1153 #[inline]
1154 unsafe fn decode(
1155 &mut self,
1156 decoder: &mut fidl::encoding::Decoder<'_, D>,
1157 offset: usize,
1158 _depth: fidl::encoding::Depth,
1159 ) -> fidl::Result<()> {
1160 decoder.debug_check_bounds::<Self>(offset);
1161 let prim = decoder.read_num::<u32>(offset);
1162
1163 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1164 Ok(())
1165 }
1166 }
1167
1168 impl fidl::encoding::ValueTypeMarker for AdvertisingDataDeprecated {
1169 type Borrowed<'a> = &'a Self;
1170 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1171 value
1172 }
1173 }
1174
1175 unsafe impl fidl::encoding::TypeMarker for AdvertisingDataDeprecated {
1176 type Owned = Self;
1177
1178 #[inline(always)]
1179 fn inline_align(_context: fidl::encoding::Context) -> usize {
1180 8
1181 }
1182
1183 #[inline(always)]
1184 fn inline_size(_context: fidl::encoding::Context) -> usize {
1185 112
1186 }
1187 }
1188
1189 unsafe impl<D: fidl::encoding::ResourceDialect>
1190 fidl::encoding::Encode<AdvertisingDataDeprecated, D> for &AdvertisingDataDeprecated
1191 {
1192 #[inline]
1193 unsafe fn encode(
1194 self,
1195 encoder: &mut fidl::encoding::Encoder<'_, D>,
1196 offset: usize,
1197 _depth: fidl::encoding::Depth,
1198 ) -> fidl::Result<()> {
1199 encoder.debug_check_bounds::<AdvertisingDataDeprecated>(offset);
1200 fidl::encoding::Encode::<AdvertisingDataDeprecated, D>::encode(
1202 (
1203 <fidl::encoding::Optional<fidl::encoding::BoundedString<248>> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
1204 <fidl::encoding::Boxed<fidl_fuchsia_bluetooth::Int8> as fidl::encoding::ValueTypeMarker>::borrow(&self.tx_power_level),
1205 <fidl::encoding::Boxed<fidl_fuchsia_bluetooth::UInt16> as fidl::encoding::ValueTypeMarker>::borrow(&self.appearance),
1206 <fidl::encoding::Optional<fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<36>>> as fidl::encoding::ValueTypeMarker>::borrow(&self.service_uuids),
1207 <fidl::encoding::Optional<fidl::encoding::UnboundedVector<ServiceDataEntry>> as fidl::encoding::ValueTypeMarker>::borrow(&self.service_data),
1208 <fidl::encoding::Optional<fidl::encoding::UnboundedVector<ManufacturerSpecificDataEntry>> as fidl::encoding::ValueTypeMarker>::borrow(&self.manufacturer_specific_data),
1209 <fidl::encoding::Optional<fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<36>>> as fidl::encoding::ValueTypeMarker>::borrow(&self.solicited_service_uuids),
1210 <fidl::encoding::Optional<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>> as fidl::encoding::ValueTypeMarker>::borrow(&self.uris),
1211 ),
1212 encoder, offset, _depth
1213 )
1214 }
1215 }
1216 unsafe impl<
1217 D: fidl::encoding::ResourceDialect,
1218 T0: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<248>>, D>,
1219 T1: fidl::encoding::Encode<fidl::encoding::Boxed<fidl_fuchsia_bluetooth::Int8>, D>,
1220 T2: fidl::encoding::Encode<fidl::encoding::Boxed<fidl_fuchsia_bluetooth::UInt16>, D>,
1221 T3: fidl::encoding::Encode<
1222 fidl::encoding::Optional<
1223 fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<36>>,
1224 >,
1225 D,
1226 >,
1227 T4: fidl::encoding::Encode<
1228 fidl::encoding::Optional<fidl::encoding::UnboundedVector<ServiceDataEntry>>,
1229 D,
1230 >,
1231 T5: fidl::encoding::Encode<
1232 fidl::encoding::Optional<
1233 fidl::encoding::UnboundedVector<ManufacturerSpecificDataEntry>,
1234 >,
1235 D,
1236 >,
1237 T6: fidl::encoding::Encode<
1238 fidl::encoding::Optional<
1239 fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<36>>,
1240 >,
1241 D,
1242 >,
1243 T7: fidl::encoding::Encode<
1244 fidl::encoding::Optional<
1245 fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
1246 >,
1247 D,
1248 >,
1249 > fidl::encoding::Encode<AdvertisingDataDeprecated, D>
1250 for (T0, T1, T2, T3, T4, T5, T6, T7)
1251 {
1252 #[inline]
1253 unsafe fn encode(
1254 self,
1255 encoder: &mut fidl::encoding::Encoder<'_, D>,
1256 offset: usize,
1257 depth: fidl::encoding::Depth,
1258 ) -> fidl::Result<()> {
1259 encoder.debug_check_bounds::<AdvertisingDataDeprecated>(offset);
1260 self.0.encode(encoder, offset + 0, depth)?;
1264 self.1.encode(encoder, offset + 16, depth)?;
1265 self.2.encode(encoder, offset + 24, depth)?;
1266 self.3.encode(encoder, offset + 32, depth)?;
1267 self.4.encode(encoder, offset + 48, depth)?;
1268 self.5.encode(encoder, offset + 64, depth)?;
1269 self.6.encode(encoder, offset + 80, depth)?;
1270 self.7.encode(encoder, offset + 96, depth)?;
1271 Ok(())
1272 }
1273 }
1274
1275 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1276 for AdvertisingDataDeprecated
1277 {
1278 #[inline(always)]
1279 fn new_empty() -> Self {
1280 Self {
1281 name: fidl::new_empty!(
1282 fidl::encoding::Optional<fidl::encoding::BoundedString<248>>,
1283 D
1284 ),
1285 tx_power_level: fidl::new_empty!(
1286 fidl::encoding::Boxed<fidl_fuchsia_bluetooth::Int8>,
1287 D
1288 ),
1289 appearance: fidl::new_empty!(
1290 fidl::encoding::Boxed<fidl_fuchsia_bluetooth::UInt16>,
1291 D
1292 ),
1293 service_uuids: fidl::new_empty!(
1294 fidl::encoding::Optional<
1295 fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<36>>,
1296 >,
1297 D
1298 ),
1299 service_data: fidl::new_empty!(
1300 fidl::encoding::Optional<fidl::encoding::UnboundedVector<ServiceDataEntry>>,
1301 D
1302 ),
1303 manufacturer_specific_data: fidl::new_empty!(
1304 fidl::encoding::Optional<
1305 fidl::encoding::UnboundedVector<ManufacturerSpecificDataEntry>,
1306 >,
1307 D
1308 ),
1309 solicited_service_uuids: fidl::new_empty!(
1310 fidl::encoding::Optional<
1311 fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<36>>,
1312 >,
1313 D
1314 ),
1315 uris: fidl::new_empty!(
1316 fidl::encoding::Optional<
1317 fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
1318 >,
1319 D
1320 ),
1321 }
1322 }
1323
1324 #[inline]
1325 unsafe fn decode(
1326 &mut self,
1327 decoder: &mut fidl::encoding::Decoder<'_, D>,
1328 offset: usize,
1329 _depth: fidl::encoding::Depth,
1330 ) -> fidl::Result<()> {
1331 decoder.debug_check_bounds::<Self>(offset);
1332 fidl::decode!(
1334 fidl::encoding::Optional<fidl::encoding::BoundedString<248>>,
1335 D,
1336 &mut self.name,
1337 decoder,
1338 offset + 0,
1339 _depth
1340 )?;
1341 fidl::decode!(
1342 fidl::encoding::Boxed<fidl_fuchsia_bluetooth::Int8>,
1343 D,
1344 &mut self.tx_power_level,
1345 decoder,
1346 offset + 16,
1347 _depth
1348 )?;
1349 fidl::decode!(
1350 fidl::encoding::Boxed<fidl_fuchsia_bluetooth::UInt16>,
1351 D,
1352 &mut self.appearance,
1353 decoder,
1354 offset + 24,
1355 _depth
1356 )?;
1357 fidl::decode!(
1358 fidl::encoding::Optional<
1359 fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<36>>,
1360 >,
1361 D,
1362 &mut self.service_uuids,
1363 decoder,
1364 offset + 32,
1365 _depth
1366 )?;
1367 fidl::decode!(
1368 fidl::encoding::Optional<fidl::encoding::UnboundedVector<ServiceDataEntry>>,
1369 D,
1370 &mut self.service_data,
1371 decoder,
1372 offset + 48,
1373 _depth
1374 )?;
1375 fidl::decode!(
1376 fidl::encoding::Optional<
1377 fidl::encoding::UnboundedVector<ManufacturerSpecificDataEntry>,
1378 >,
1379 D,
1380 &mut self.manufacturer_specific_data,
1381 decoder,
1382 offset + 64,
1383 _depth
1384 )?;
1385 fidl::decode!(
1386 fidl::encoding::Optional<
1387 fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<36>>,
1388 >,
1389 D,
1390 &mut self.solicited_service_uuids,
1391 decoder,
1392 offset + 80,
1393 _depth
1394 )?;
1395 fidl::decode!(
1396 fidl::encoding::Optional<
1397 fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
1398 >,
1399 D,
1400 &mut self.uris,
1401 decoder,
1402 offset + 96,
1403 _depth
1404 )?;
1405 Ok(())
1406 }
1407 }
1408
1409 impl fidl::encoding::ValueTypeMarker for CentralConnectPeripheralResponse {
1410 type Borrowed<'a> = &'a Self;
1411 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1412 value
1413 }
1414 }
1415
1416 unsafe impl fidl::encoding::TypeMarker for CentralConnectPeripheralResponse {
1417 type Owned = Self;
1418
1419 #[inline(always)]
1420 fn inline_align(_context: fidl::encoding::Context) -> usize {
1421 8
1422 }
1423
1424 #[inline(always)]
1425 fn inline_size(_context: fidl::encoding::Context) -> usize {
1426 8
1427 }
1428 }
1429
1430 unsafe impl<D: fidl::encoding::ResourceDialect>
1431 fidl::encoding::Encode<CentralConnectPeripheralResponse, D>
1432 for &CentralConnectPeripheralResponse
1433 {
1434 #[inline]
1435 unsafe fn encode(
1436 self,
1437 encoder: &mut fidl::encoding::Encoder<'_, D>,
1438 offset: usize,
1439 _depth: fidl::encoding::Depth,
1440 ) -> fidl::Result<()> {
1441 encoder.debug_check_bounds::<CentralConnectPeripheralResponse>(offset);
1442 fidl::encoding::Encode::<CentralConnectPeripheralResponse, D>::encode(
1444 (<fidl_fuchsia_bluetooth::Status as fidl::encoding::ValueTypeMarker>::borrow(
1445 &self.status,
1446 ),),
1447 encoder,
1448 offset,
1449 _depth,
1450 )
1451 }
1452 }
1453 unsafe impl<
1454 D: fidl::encoding::ResourceDialect,
1455 T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::Status, D>,
1456 > fidl::encoding::Encode<CentralConnectPeripheralResponse, D> for (T0,)
1457 {
1458 #[inline]
1459 unsafe fn encode(
1460 self,
1461 encoder: &mut fidl::encoding::Encoder<'_, D>,
1462 offset: usize,
1463 depth: fidl::encoding::Depth,
1464 ) -> fidl::Result<()> {
1465 encoder.debug_check_bounds::<CentralConnectPeripheralResponse>(offset);
1466 self.0.encode(encoder, offset + 0, depth)?;
1470 Ok(())
1471 }
1472 }
1473
1474 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1475 for CentralConnectPeripheralResponse
1476 {
1477 #[inline(always)]
1478 fn new_empty() -> Self {
1479 Self { status: fidl::new_empty!(fidl_fuchsia_bluetooth::Status, D) }
1480 }
1481
1482 #[inline]
1483 unsafe fn decode(
1484 &mut self,
1485 decoder: &mut fidl::encoding::Decoder<'_, D>,
1486 offset: usize,
1487 _depth: fidl::encoding::Depth,
1488 ) -> fidl::Result<()> {
1489 decoder.debug_check_bounds::<Self>(offset);
1490 fidl::decode!(
1492 fidl_fuchsia_bluetooth::Status,
1493 D,
1494 &mut self.status,
1495 decoder,
1496 offset + 0,
1497 _depth
1498 )?;
1499 Ok(())
1500 }
1501 }
1502
1503 impl fidl::encoding::ValueTypeMarker for CentralDisconnectPeripheralRequest {
1504 type Borrowed<'a> = &'a Self;
1505 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1506 value
1507 }
1508 }
1509
1510 unsafe impl fidl::encoding::TypeMarker for CentralDisconnectPeripheralRequest {
1511 type Owned = Self;
1512
1513 #[inline(always)]
1514 fn inline_align(_context: fidl::encoding::Context) -> usize {
1515 8
1516 }
1517
1518 #[inline(always)]
1519 fn inline_size(_context: fidl::encoding::Context) -> usize {
1520 16
1521 }
1522 }
1523
1524 unsafe impl<D: fidl::encoding::ResourceDialect>
1525 fidl::encoding::Encode<CentralDisconnectPeripheralRequest, D>
1526 for &CentralDisconnectPeripheralRequest
1527 {
1528 #[inline]
1529 unsafe fn encode(
1530 self,
1531 encoder: &mut fidl::encoding::Encoder<'_, D>,
1532 offset: usize,
1533 _depth: fidl::encoding::Depth,
1534 ) -> fidl::Result<()> {
1535 encoder.debug_check_bounds::<CentralDisconnectPeripheralRequest>(offset);
1536 fidl::encoding::Encode::<CentralDisconnectPeripheralRequest, D>::encode(
1538 (<fidl::encoding::BoundedString<16> as fidl::encoding::ValueTypeMarker>::borrow(
1539 &self.identifier,
1540 ),),
1541 encoder,
1542 offset,
1543 _depth,
1544 )
1545 }
1546 }
1547 unsafe impl<
1548 D: fidl::encoding::ResourceDialect,
1549 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<16>, D>,
1550 > fidl::encoding::Encode<CentralDisconnectPeripheralRequest, D> for (T0,)
1551 {
1552 #[inline]
1553 unsafe fn encode(
1554 self,
1555 encoder: &mut fidl::encoding::Encoder<'_, D>,
1556 offset: usize,
1557 depth: fidl::encoding::Depth,
1558 ) -> fidl::Result<()> {
1559 encoder.debug_check_bounds::<CentralDisconnectPeripheralRequest>(offset);
1560 self.0.encode(encoder, offset + 0, depth)?;
1564 Ok(())
1565 }
1566 }
1567
1568 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1569 for CentralDisconnectPeripheralRequest
1570 {
1571 #[inline(always)]
1572 fn new_empty() -> Self {
1573 Self { identifier: fidl::new_empty!(fidl::encoding::BoundedString<16>, D) }
1574 }
1575
1576 #[inline]
1577 unsafe fn decode(
1578 &mut self,
1579 decoder: &mut fidl::encoding::Decoder<'_, D>,
1580 offset: usize,
1581 _depth: fidl::encoding::Depth,
1582 ) -> fidl::Result<()> {
1583 decoder.debug_check_bounds::<Self>(offset);
1584 fidl::decode!(
1586 fidl::encoding::BoundedString<16>,
1587 D,
1588 &mut self.identifier,
1589 decoder,
1590 offset + 0,
1591 _depth
1592 )?;
1593 Ok(())
1594 }
1595 }
1596
1597 impl fidl::encoding::ValueTypeMarker for CentralDisconnectPeripheralResponse {
1598 type Borrowed<'a> = &'a Self;
1599 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1600 value
1601 }
1602 }
1603
1604 unsafe impl fidl::encoding::TypeMarker for CentralDisconnectPeripheralResponse {
1605 type Owned = Self;
1606
1607 #[inline(always)]
1608 fn inline_align(_context: fidl::encoding::Context) -> usize {
1609 8
1610 }
1611
1612 #[inline(always)]
1613 fn inline_size(_context: fidl::encoding::Context) -> usize {
1614 8
1615 }
1616 }
1617
1618 unsafe impl<D: fidl::encoding::ResourceDialect>
1619 fidl::encoding::Encode<CentralDisconnectPeripheralResponse, D>
1620 for &CentralDisconnectPeripheralResponse
1621 {
1622 #[inline]
1623 unsafe fn encode(
1624 self,
1625 encoder: &mut fidl::encoding::Encoder<'_, D>,
1626 offset: usize,
1627 _depth: fidl::encoding::Depth,
1628 ) -> fidl::Result<()> {
1629 encoder.debug_check_bounds::<CentralDisconnectPeripheralResponse>(offset);
1630 fidl::encoding::Encode::<CentralDisconnectPeripheralResponse, D>::encode(
1632 (<fidl_fuchsia_bluetooth::Status as fidl::encoding::ValueTypeMarker>::borrow(
1633 &self.status,
1634 ),),
1635 encoder,
1636 offset,
1637 _depth,
1638 )
1639 }
1640 }
1641 unsafe impl<
1642 D: fidl::encoding::ResourceDialect,
1643 T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::Status, D>,
1644 > fidl::encoding::Encode<CentralDisconnectPeripheralResponse, D> for (T0,)
1645 {
1646 #[inline]
1647 unsafe fn encode(
1648 self,
1649 encoder: &mut fidl::encoding::Encoder<'_, D>,
1650 offset: usize,
1651 depth: fidl::encoding::Depth,
1652 ) -> fidl::Result<()> {
1653 encoder.debug_check_bounds::<CentralDisconnectPeripheralResponse>(offset);
1654 self.0.encode(encoder, offset + 0, depth)?;
1658 Ok(())
1659 }
1660 }
1661
1662 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1663 for CentralDisconnectPeripheralResponse
1664 {
1665 #[inline(always)]
1666 fn new_empty() -> Self {
1667 Self { status: fidl::new_empty!(fidl_fuchsia_bluetooth::Status, D) }
1668 }
1669
1670 #[inline]
1671 unsafe fn decode(
1672 &mut self,
1673 decoder: &mut fidl::encoding::Decoder<'_, D>,
1674 offset: usize,
1675 _depth: fidl::encoding::Depth,
1676 ) -> fidl::Result<()> {
1677 decoder.debug_check_bounds::<Self>(offset);
1678 fidl::decode!(
1680 fidl_fuchsia_bluetooth::Status,
1681 D,
1682 &mut self.status,
1683 decoder,
1684 offset + 0,
1685 _depth
1686 )?;
1687 Ok(())
1688 }
1689 }
1690
1691 impl fidl::encoding::ValueTypeMarker for CentralGetPeripheralRequest {
1692 type Borrowed<'a> = &'a Self;
1693 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1694 value
1695 }
1696 }
1697
1698 unsafe impl fidl::encoding::TypeMarker for CentralGetPeripheralRequest {
1699 type Owned = Self;
1700
1701 #[inline(always)]
1702 fn inline_align(_context: fidl::encoding::Context) -> usize {
1703 8
1704 }
1705
1706 #[inline(always)]
1707 fn inline_size(_context: fidl::encoding::Context) -> usize {
1708 16
1709 }
1710 }
1711
1712 unsafe impl<D: fidl::encoding::ResourceDialect>
1713 fidl::encoding::Encode<CentralGetPeripheralRequest, D> for &CentralGetPeripheralRequest
1714 {
1715 #[inline]
1716 unsafe fn encode(
1717 self,
1718 encoder: &mut fidl::encoding::Encoder<'_, D>,
1719 offset: usize,
1720 _depth: fidl::encoding::Depth,
1721 ) -> fidl::Result<()> {
1722 encoder.debug_check_bounds::<CentralGetPeripheralRequest>(offset);
1723 fidl::encoding::Encode::<CentralGetPeripheralRequest, D>::encode(
1725 (<fidl::encoding::BoundedString<16> as fidl::encoding::ValueTypeMarker>::borrow(
1726 &self.identifier,
1727 ),),
1728 encoder,
1729 offset,
1730 _depth,
1731 )
1732 }
1733 }
1734 unsafe impl<
1735 D: fidl::encoding::ResourceDialect,
1736 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<16>, D>,
1737 > fidl::encoding::Encode<CentralGetPeripheralRequest, D> for (T0,)
1738 {
1739 #[inline]
1740 unsafe fn encode(
1741 self,
1742 encoder: &mut fidl::encoding::Encoder<'_, D>,
1743 offset: usize,
1744 depth: fidl::encoding::Depth,
1745 ) -> fidl::Result<()> {
1746 encoder.debug_check_bounds::<CentralGetPeripheralRequest>(offset);
1747 self.0.encode(encoder, offset + 0, depth)?;
1751 Ok(())
1752 }
1753 }
1754
1755 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1756 for CentralGetPeripheralRequest
1757 {
1758 #[inline(always)]
1759 fn new_empty() -> Self {
1760 Self { identifier: fidl::new_empty!(fidl::encoding::BoundedString<16>, D) }
1761 }
1762
1763 #[inline]
1764 unsafe fn decode(
1765 &mut self,
1766 decoder: &mut fidl::encoding::Decoder<'_, D>,
1767 offset: usize,
1768 _depth: fidl::encoding::Depth,
1769 ) -> fidl::Result<()> {
1770 decoder.debug_check_bounds::<Self>(offset);
1771 fidl::decode!(
1773 fidl::encoding::BoundedString<16>,
1774 D,
1775 &mut self.identifier,
1776 decoder,
1777 offset + 0,
1778 _depth
1779 )?;
1780 Ok(())
1781 }
1782 }
1783
1784 impl fidl::encoding::ValueTypeMarker for CentralGetPeripheralResponse {
1785 type Borrowed<'a> = &'a Self;
1786 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1787 value
1788 }
1789 }
1790
1791 unsafe impl fidl::encoding::TypeMarker for CentralGetPeripheralResponse {
1792 type Owned = Self;
1793
1794 #[inline(always)]
1795 fn inline_align(_context: fidl::encoding::Context) -> usize {
1796 8
1797 }
1798
1799 #[inline(always)]
1800 fn inline_size(_context: fidl::encoding::Context) -> usize {
1801 8
1802 }
1803 }
1804
1805 unsafe impl<D: fidl::encoding::ResourceDialect>
1806 fidl::encoding::Encode<CentralGetPeripheralResponse, D> for &CentralGetPeripheralResponse
1807 {
1808 #[inline]
1809 unsafe fn encode(
1810 self,
1811 encoder: &mut fidl::encoding::Encoder<'_, D>,
1812 offset: usize,
1813 _depth: fidl::encoding::Depth,
1814 ) -> fidl::Result<()> {
1815 encoder.debug_check_bounds::<CentralGetPeripheralResponse>(offset);
1816 fidl::encoding::Encode::<CentralGetPeripheralResponse, D>::encode(
1818 (<fidl::encoding::Boxed<RemoteDevice> as fidl::encoding::ValueTypeMarker>::borrow(
1819 &self.peripheral,
1820 ),),
1821 encoder,
1822 offset,
1823 _depth,
1824 )
1825 }
1826 }
1827 unsafe impl<
1828 D: fidl::encoding::ResourceDialect,
1829 T0: fidl::encoding::Encode<fidl::encoding::Boxed<RemoteDevice>, D>,
1830 > fidl::encoding::Encode<CentralGetPeripheralResponse, D> for (T0,)
1831 {
1832 #[inline]
1833 unsafe fn encode(
1834 self,
1835 encoder: &mut fidl::encoding::Encoder<'_, D>,
1836 offset: usize,
1837 depth: fidl::encoding::Depth,
1838 ) -> fidl::Result<()> {
1839 encoder.debug_check_bounds::<CentralGetPeripheralResponse>(offset);
1840 self.0.encode(encoder, offset + 0, depth)?;
1844 Ok(())
1845 }
1846 }
1847
1848 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1849 for CentralGetPeripheralResponse
1850 {
1851 #[inline(always)]
1852 fn new_empty() -> Self {
1853 Self { peripheral: fidl::new_empty!(fidl::encoding::Boxed<RemoteDevice>, D) }
1854 }
1855
1856 #[inline]
1857 unsafe fn decode(
1858 &mut self,
1859 decoder: &mut fidl::encoding::Decoder<'_, D>,
1860 offset: usize,
1861 _depth: fidl::encoding::Depth,
1862 ) -> fidl::Result<()> {
1863 decoder.debug_check_bounds::<Self>(offset);
1864 fidl::decode!(
1866 fidl::encoding::Boxed<RemoteDevice>,
1867 D,
1868 &mut self.peripheral,
1869 decoder,
1870 offset + 0,
1871 _depth
1872 )?;
1873 Ok(())
1874 }
1875 }
1876
1877 impl fidl::encoding::ValueTypeMarker for CentralGetPeripheralsRequest {
1878 type Borrowed<'a> = &'a Self;
1879 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1880 value
1881 }
1882 }
1883
1884 unsafe impl fidl::encoding::TypeMarker for CentralGetPeripheralsRequest {
1885 type Owned = Self;
1886
1887 #[inline(always)]
1888 fn inline_align(_context: fidl::encoding::Context) -> usize {
1889 8
1890 }
1891
1892 #[inline(always)]
1893 fn inline_size(_context: fidl::encoding::Context) -> usize {
1894 16
1895 }
1896 }
1897
1898 unsafe impl<D: fidl::encoding::ResourceDialect>
1899 fidl::encoding::Encode<CentralGetPeripheralsRequest, D> for &CentralGetPeripheralsRequest
1900 {
1901 #[inline]
1902 unsafe fn encode(
1903 self,
1904 encoder: &mut fidl::encoding::Encoder<'_, D>,
1905 offset: usize,
1906 _depth: fidl::encoding::Depth,
1907 ) -> fidl::Result<()> {
1908 encoder.debug_check_bounds::<CentralGetPeripheralsRequest>(offset);
1909 fidl::encoding::Encode::<CentralGetPeripheralsRequest, D>::encode(
1911 (<fidl::encoding::Optional<
1912 fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<36>>,
1913 > as fidl::encoding::ValueTypeMarker>::borrow(&self.service_uuids),),
1914 encoder,
1915 offset,
1916 _depth,
1917 )
1918 }
1919 }
1920 unsafe impl<
1921 D: fidl::encoding::ResourceDialect,
1922 T0: fidl::encoding::Encode<
1923 fidl::encoding::Optional<
1924 fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<36>>,
1925 >,
1926 D,
1927 >,
1928 > fidl::encoding::Encode<CentralGetPeripheralsRequest, D> for (T0,)
1929 {
1930 #[inline]
1931 unsafe fn encode(
1932 self,
1933 encoder: &mut fidl::encoding::Encoder<'_, D>,
1934 offset: usize,
1935 depth: fidl::encoding::Depth,
1936 ) -> fidl::Result<()> {
1937 encoder.debug_check_bounds::<CentralGetPeripheralsRequest>(offset);
1938 self.0.encode(encoder, offset + 0, depth)?;
1942 Ok(())
1943 }
1944 }
1945
1946 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1947 for CentralGetPeripheralsRequest
1948 {
1949 #[inline(always)]
1950 fn new_empty() -> Self {
1951 Self {
1952 service_uuids: fidl::new_empty!(
1953 fidl::encoding::Optional<
1954 fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<36>>,
1955 >,
1956 D
1957 ),
1958 }
1959 }
1960
1961 #[inline]
1962 unsafe fn decode(
1963 &mut self,
1964 decoder: &mut fidl::encoding::Decoder<'_, D>,
1965 offset: usize,
1966 _depth: fidl::encoding::Depth,
1967 ) -> fidl::Result<()> {
1968 decoder.debug_check_bounds::<Self>(offset);
1969 fidl::decode!(
1971 fidl::encoding::Optional<
1972 fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<36>>,
1973 >,
1974 D,
1975 &mut self.service_uuids,
1976 decoder,
1977 offset + 0,
1978 _depth
1979 )?;
1980 Ok(())
1981 }
1982 }
1983
1984 impl fidl::encoding::ValueTypeMarker for CentralGetPeripheralsResponse {
1985 type Borrowed<'a> = &'a Self;
1986 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1987 value
1988 }
1989 }
1990
1991 unsafe impl fidl::encoding::TypeMarker for CentralGetPeripheralsResponse {
1992 type Owned = Self;
1993
1994 #[inline(always)]
1995 fn inline_align(_context: fidl::encoding::Context) -> usize {
1996 8
1997 }
1998
1999 #[inline(always)]
2000 fn inline_size(_context: fidl::encoding::Context) -> usize {
2001 16
2002 }
2003 }
2004
2005 unsafe impl<D: fidl::encoding::ResourceDialect>
2006 fidl::encoding::Encode<CentralGetPeripheralsResponse, D>
2007 for &CentralGetPeripheralsResponse
2008 {
2009 #[inline]
2010 unsafe fn encode(
2011 self,
2012 encoder: &mut fidl::encoding::Encoder<'_, D>,
2013 offset: usize,
2014 _depth: fidl::encoding::Depth,
2015 ) -> fidl::Result<()> {
2016 encoder.debug_check_bounds::<CentralGetPeripheralsResponse>(offset);
2017 fidl::encoding::Encode::<CentralGetPeripheralsResponse, D>::encode(
2019 (
2020 <fidl::encoding::UnboundedVector<RemoteDevice> as fidl::encoding::ValueTypeMarker>::borrow(&self.peripherals),
2021 ),
2022 encoder, offset, _depth
2023 )
2024 }
2025 }
2026 unsafe impl<
2027 D: fidl::encoding::ResourceDialect,
2028 T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<RemoteDevice>, D>,
2029 > fidl::encoding::Encode<CentralGetPeripheralsResponse, D> for (T0,)
2030 {
2031 #[inline]
2032 unsafe fn encode(
2033 self,
2034 encoder: &mut fidl::encoding::Encoder<'_, D>,
2035 offset: usize,
2036 depth: fidl::encoding::Depth,
2037 ) -> fidl::Result<()> {
2038 encoder.debug_check_bounds::<CentralGetPeripheralsResponse>(offset);
2039 self.0.encode(encoder, offset + 0, depth)?;
2043 Ok(())
2044 }
2045 }
2046
2047 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2048 for CentralGetPeripheralsResponse
2049 {
2050 #[inline(always)]
2051 fn new_empty() -> Self {
2052 Self { peripherals: fidl::new_empty!(fidl::encoding::UnboundedVector<RemoteDevice>, D) }
2053 }
2054
2055 #[inline]
2056 unsafe fn decode(
2057 &mut self,
2058 decoder: &mut fidl::encoding::Decoder<'_, D>,
2059 offset: usize,
2060 _depth: fidl::encoding::Depth,
2061 ) -> fidl::Result<()> {
2062 decoder.debug_check_bounds::<Self>(offset);
2063 fidl::decode!(
2065 fidl::encoding::UnboundedVector<RemoteDevice>,
2066 D,
2067 &mut self.peripherals,
2068 decoder,
2069 offset + 0,
2070 _depth
2071 )?;
2072 Ok(())
2073 }
2074 }
2075
2076 impl fidl::encoding::ValueTypeMarker for CentralOnDeviceDiscoveredRequest {
2077 type Borrowed<'a> = &'a Self;
2078 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2079 value
2080 }
2081 }
2082
2083 unsafe impl fidl::encoding::TypeMarker for CentralOnDeviceDiscoveredRequest {
2084 type Owned = Self;
2085
2086 #[inline(always)]
2087 fn inline_align(_context: fidl::encoding::Context) -> usize {
2088 8
2089 }
2090
2091 #[inline(always)]
2092 fn inline_size(_context: fidl::encoding::Context) -> usize {
2093 40
2094 }
2095 }
2096
2097 unsafe impl<D: fidl::encoding::ResourceDialect>
2098 fidl::encoding::Encode<CentralOnDeviceDiscoveredRequest, D>
2099 for &CentralOnDeviceDiscoveredRequest
2100 {
2101 #[inline]
2102 unsafe fn encode(
2103 self,
2104 encoder: &mut fidl::encoding::Encoder<'_, D>,
2105 offset: usize,
2106 _depth: fidl::encoding::Depth,
2107 ) -> fidl::Result<()> {
2108 encoder.debug_check_bounds::<CentralOnDeviceDiscoveredRequest>(offset);
2109 fidl::encoding::Encode::<CentralOnDeviceDiscoveredRequest, D>::encode(
2111 (<RemoteDevice as fidl::encoding::ValueTypeMarker>::borrow(&self.device),),
2112 encoder,
2113 offset,
2114 _depth,
2115 )
2116 }
2117 }
2118 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<RemoteDevice, D>>
2119 fidl::encoding::Encode<CentralOnDeviceDiscoveredRequest, D> for (T0,)
2120 {
2121 #[inline]
2122 unsafe fn encode(
2123 self,
2124 encoder: &mut fidl::encoding::Encoder<'_, D>,
2125 offset: usize,
2126 depth: fidl::encoding::Depth,
2127 ) -> fidl::Result<()> {
2128 encoder.debug_check_bounds::<CentralOnDeviceDiscoveredRequest>(offset);
2129 self.0.encode(encoder, offset + 0, depth)?;
2133 Ok(())
2134 }
2135 }
2136
2137 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2138 for CentralOnDeviceDiscoveredRequest
2139 {
2140 #[inline(always)]
2141 fn new_empty() -> Self {
2142 Self { device: fidl::new_empty!(RemoteDevice, D) }
2143 }
2144
2145 #[inline]
2146 unsafe fn decode(
2147 &mut self,
2148 decoder: &mut fidl::encoding::Decoder<'_, D>,
2149 offset: usize,
2150 _depth: fidl::encoding::Depth,
2151 ) -> fidl::Result<()> {
2152 decoder.debug_check_bounds::<Self>(offset);
2153 fidl::decode!(RemoteDevice, D, &mut self.device, decoder, offset + 0, _depth)?;
2155 Ok(())
2156 }
2157 }
2158
2159 impl fidl::encoding::ValueTypeMarker for CentralOnPeripheralDisconnectedRequest {
2160 type Borrowed<'a> = &'a Self;
2161 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2162 value
2163 }
2164 }
2165
2166 unsafe impl fidl::encoding::TypeMarker for CentralOnPeripheralDisconnectedRequest {
2167 type Owned = Self;
2168
2169 #[inline(always)]
2170 fn inline_align(_context: fidl::encoding::Context) -> usize {
2171 8
2172 }
2173
2174 #[inline(always)]
2175 fn inline_size(_context: fidl::encoding::Context) -> usize {
2176 16
2177 }
2178 }
2179
2180 unsafe impl<D: fidl::encoding::ResourceDialect>
2181 fidl::encoding::Encode<CentralOnPeripheralDisconnectedRequest, D>
2182 for &CentralOnPeripheralDisconnectedRequest
2183 {
2184 #[inline]
2185 unsafe fn encode(
2186 self,
2187 encoder: &mut fidl::encoding::Encoder<'_, D>,
2188 offset: usize,
2189 _depth: fidl::encoding::Depth,
2190 ) -> fidl::Result<()> {
2191 encoder.debug_check_bounds::<CentralOnPeripheralDisconnectedRequest>(offset);
2192 fidl::encoding::Encode::<CentralOnPeripheralDisconnectedRequest, D>::encode(
2194 (<fidl::encoding::BoundedString<16> as fidl::encoding::ValueTypeMarker>::borrow(
2195 &self.identifier,
2196 ),),
2197 encoder,
2198 offset,
2199 _depth,
2200 )
2201 }
2202 }
2203 unsafe impl<
2204 D: fidl::encoding::ResourceDialect,
2205 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<16>, D>,
2206 > fidl::encoding::Encode<CentralOnPeripheralDisconnectedRequest, D> for (T0,)
2207 {
2208 #[inline]
2209 unsafe fn encode(
2210 self,
2211 encoder: &mut fidl::encoding::Encoder<'_, D>,
2212 offset: usize,
2213 depth: fidl::encoding::Depth,
2214 ) -> fidl::Result<()> {
2215 encoder.debug_check_bounds::<CentralOnPeripheralDisconnectedRequest>(offset);
2216 self.0.encode(encoder, offset + 0, depth)?;
2220 Ok(())
2221 }
2222 }
2223
2224 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2225 for CentralOnPeripheralDisconnectedRequest
2226 {
2227 #[inline(always)]
2228 fn new_empty() -> Self {
2229 Self { identifier: fidl::new_empty!(fidl::encoding::BoundedString<16>, D) }
2230 }
2231
2232 #[inline]
2233 unsafe fn decode(
2234 &mut self,
2235 decoder: &mut fidl::encoding::Decoder<'_, D>,
2236 offset: usize,
2237 _depth: fidl::encoding::Depth,
2238 ) -> fidl::Result<()> {
2239 decoder.debug_check_bounds::<Self>(offset);
2240 fidl::decode!(
2242 fidl::encoding::BoundedString<16>,
2243 D,
2244 &mut self.identifier,
2245 decoder,
2246 offset + 0,
2247 _depth
2248 )?;
2249 Ok(())
2250 }
2251 }
2252
2253 impl fidl::encoding::ValueTypeMarker for CentralOnScanStateChangedRequest {
2254 type Borrowed<'a> = &'a Self;
2255 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2256 value
2257 }
2258 }
2259
2260 unsafe impl fidl::encoding::TypeMarker for CentralOnScanStateChangedRequest {
2261 type Owned = Self;
2262
2263 #[inline(always)]
2264 fn inline_align(_context: fidl::encoding::Context) -> usize {
2265 1
2266 }
2267
2268 #[inline(always)]
2269 fn inline_size(_context: fidl::encoding::Context) -> usize {
2270 1
2271 }
2272 }
2273
2274 unsafe impl<D: fidl::encoding::ResourceDialect>
2275 fidl::encoding::Encode<CentralOnScanStateChangedRequest, D>
2276 for &CentralOnScanStateChangedRequest
2277 {
2278 #[inline]
2279 unsafe fn encode(
2280 self,
2281 encoder: &mut fidl::encoding::Encoder<'_, D>,
2282 offset: usize,
2283 _depth: fidl::encoding::Depth,
2284 ) -> fidl::Result<()> {
2285 encoder.debug_check_bounds::<CentralOnScanStateChangedRequest>(offset);
2286 fidl::encoding::Encode::<CentralOnScanStateChangedRequest, D>::encode(
2288 (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.scanning),),
2289 encoder,
2290 offset,
2291 _depth,
2292 )
2293 }
2294 }
2295 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
2296 fidl::encoding::Encode<CentralOnScanStateChangedRequest, D> for (T0,)
2297 {
2298 #[inline]
2299 unsafe fn encode(
2300 self,
2301 encoder: &mut fidl::encoding::Encoder<'_, D>,
2302 offset: usize,
2303 depth: fidl::encoding::Depth,
2304 ) -> fidl::Result<()> {
2305 encoder.debug_check_bounds::<CentralOnScanStateChangedRequest>(offset);
2306 self.0.encode(encoder, offset + 0, depth)?;
2310 Ok(())
2311 }
2312 }
2313
2314 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2315 for CentralOnScanStateChangedRequest
2316 {
2317 #[inline(always)]
2318 fn new_empty() -> Self {
2319 Self { scanning: fidl::new_empty!(bool, D) }
2320 }
2321
2322 #[inline]
2323 unsafe fn decode(
2324 &mut self,
2325 decoder: &mut fidl::encoding::Decoder<'_, D>,
2326 offset: usize,
2327 _depth: fidl::encoding::Depth,
2328 ) -> fidl::Result<()> {
2329 decoder.debug_check_bounds::<Self>(offset);
2330 fidl::decode!(bool, D, &mut self.scanning, decoder, offset + 0, _depth)?;
2332 Ok(())
2333 }
2334 }
2335
2336 impl fidl::encoding::ValueTypeMarker for CentralStartScanRequest {
2337 type Borrowed<'a> = &'a Self;
2338 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2339 value
2340 }
2341 }
2342
2343 unsafe impl fidl::encoding::TypeMarker for CentralStartScanRequest {
2344 type Owned = Self;
2345
2346 #[inline(always)]
2347 fn inline_align(_context: fidl::encoding::Context) -> usize {
2348 8
2349 }
2350
2351 #[inline(always)]
2352 fn inline_size(_context: fidl::encoding::Context) -> usize {
2353 8
2354 }
2355 }
2356
2357 unsafe impl<D: fidl::encoding::ResourceDialect>
2358 fidl::encoding::Encode<CentralStartScanRequest, D> for &CentralStartScanRequest
2359 {
2360 #[inline]
2361 unsafe fn encode(
2362 self,
2363 encoder: &mut fidl::encoding::Encoder<'_, D>,
2364 offset: usize,
2365 _depth: fidl::encoding::Depth,
2366 ) -> fidl::Result<()> {
2367 encoder.debug_check_bounds::<CentralStartScanRequest>(offset);
2368 fidl::encoding::Encode::<CentralStartScanRequest, D>::encode(
2370 (<fidl::encoding::Boxed<ScanFilter> as fidl::encoding::ValueTypeMarker>::borrow(
2371 &self.filter,
2372 ),),
2373 encoder,
2374 offset,
2375 _depth,
2376 )
2377 }
2378 }
2379 unsafe impl<
2380 D: fidl::encoding::ResourceDialect,
2381 T0: fidl::encoding::Encode<fidl::encoding::Boxed<ScanFilter>, D>,
2382 > fidl::encoding::Encode<CentralStartScanRequest, D> for (T0,)
2383 {
2384 #[inline]
2385 unsafe fn encode(
2386 self,
2387 encoder: &mut fidl::encoding::Encoder<'_, D>,
2388 offset: usize,
2389 depth: fidl::encoding::Depth,
2390 ) -> fidl::Result<()> {
2391 encoder.debug_check_bounds::<CentralStartScanRequest>(offset);
2392 self.0.encode(encoder, offset + 0, depth)?;
2396 Ok(())
2397 }
2398 }
2399
2400 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2401 for CentralStartScanRequest
2402 {
2403 #[inline(always)]
2404 fn new_empty() -> Self {
2405 Self { filter: fidl::new_empty!(fidl::encoding::Boxed<ScanFilter>, D) }
2406 }
2407
2408 #[inline]
2409 unsafe fn decode(
2410 &mut self,
2411 decoder: &mut fidl::encoding::Decoder<'_, D>,
2412 offset: usize,
2413 _depth: fidl::encoding::Depth,
2414 ) -> fidl::Result<()> {
2415 decoder.debug_check_bounds::<Self>(offset);
2416 fidl::decode!(
2418 fidl::encoding::Boxed<ScanFilter>,
2419 D,
2420 &mut self.filter,
2421 decoder,
2422 offset + 0,
2423 _depth
2424 )?;
2425 Ok(())
2426 }
2427 }
2428
2429 impl fidl::encoding::ValueTypeMarker for CentralStartScanResponse {
2430 type Borrowed<'a> = &'a Self;
2431 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2432 value
2433 }
2434 }
2435
2436 unsafe impl fidl::encoding::TypeMarker for CentralStartScanResponse {
2437 type Owned = Self;
2438
2439 #[inline(always)]
2440 fn inline_align(_context: fidl::encoding::Context) -> usize {
2441 8
2442 }
2443
2444 #[inline(always)]
2445 fn inline_size(_context: fidl::encoding::Context) -> usize {
2446 8
2447 }
2448 }
2449
2450 unsafe impl<D: fidl::encoding::ResourceDialect>
2451 fidl::encoding::Encode<CentralStartScanResponse, D> for &CentralStartScanResponse
2452 {
2453 #[inline]
2454 unsafe fn encode(
2455 self,
2456 encoder: &mut fidl::encoding::Encoder<'_, D>,
2457 offset: usize,
2458 _depth: fidl::encoding::Depth,
2459 ) -> fidl::Result<()> {
2460 encoder.debug_check_bounds::<CentralStartScanResponse>(offset);
2461 fidl::encoding::Encode::<CentralStartScanResponse, D>::encode(
2463 (<fidl_fuchsia_bluetooth::Status as fidl::encoding::ValueTypeMarker>::borrow(
2464 &self.status,
2465 ),),
2466 encoder,
2467 offset,
2468 _depth,
2469 )
2470 }
2471 }
2472 unsafe impl<
2473 D: fidl::encoding::ResourceDialect,
2474 T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::Status, D>,
2475 > fidl::encoding::Encode<CentralStartScanResponse, D> for (T0,)
2476 {
2477 #[inline]
2478 unsafe fn encode(
2479 self,
2480 encoder: &mut fidl::encoding::Encoder<'_, D>,
2481 offset: usize,
2482 depth: fidl::encoding::Depth,
2483 ) -> fidl::Result<()> {
2484 encoder.debug_check_bounds::<CentralStartScanResponse>(offset);
2485 self.0.encode(encoder, offset + 0, depth)?;
2489 Ok(())
2490 }
2491 }
2492
2493 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2494 for CentralStartScanResponse
2495 {
2496 #[inline(always)]
2497 fn new_empty() -> Self {
2498 Self { status: fidl::new_empty!(fidl_fuchsia_bluetooth::Status, D) }
2499 }
2500
2501 #[inline]
2502 unsafe fn decode(
2503 &mut self,
2504 decoder: &mut fidl::encoding::Decoder<'_, D>,
2505 offset: usize,
2506 _depth: fidl::encoding::Depth,
2507 ) -> fidl::Result<()> {
2508 decoder.debug_check_bounds::<Self>(offset);
2509 fidl::decode!(
2511 fidl_fuchsia_bluetooth::Status,
2512 D,
2513 &mut self.status,
2514 decoder,
2515 offset + 0,
2516 _depth
2517 )?;
2518 Ok(())
2519 }
2520 }
2521
2522 impl fidl::encoding::ValueTypeMarker for ManufacturerData {
2523 type Borrowed<'a> = &'a Self;
2524 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2525 value
2526 }
2527 }
2528
2529 unsafe impl fidl::encoding::TypeMarker for ManufacturerData {
2530 type Owned = Self;
2531
2532 #[inline(always)]
2533 fn inline_align(_context: fidl::encoding::Context) -> usize {
2534 8
2535 }
2536
2537 #[inline(always)]
2538 fn inline_size(_context: fidl::encoding::Context) -> usize {
2539 24
2540 }
2541 }
2542
2543 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ManufacturerData, D>
2544 for &ManufacturerData
2545 {
2546 #[inline]
2547 unsafe fn encode(
2548 self,
2549 encoder: &mut fidl::encoding::Encoder<'_, D>,
2550 offset: usize,
2551 _depth: fidl::encoding::Depth,
2552 ) -> fidl::Result<()> {
2553 encoder.debug_check_bounds::<ManufacturerData>(offset);
2554 fidl::encoding::Encode::<ManufacturerData, D>::encode(
2556 (
2557 <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.company_id),
2558 <fidl::encoding::Vector<u8, 252> as fidl::encoding::ValueTypeMarker>::borrow(
2559 &self.data,
2560 ),
2561 ),
2562 encoder,
2563 offset,
2564 _depth,
2565 )
2566 }
2567 }
2568 unsafe impl<
2569 D: fidl::encoding::ResourceDialect,
2570 T0: fidl::encoding::Encode<u16, D>,
2571 T1: fidl::encoding::Encode<fidl::encoding::Vector<u8, 252>, D>,
2572 > fidl::encoding::Encode<ManufacturerData, D> for (T0, T1)
2573 {
2574 #[inline]
2575 unsafe fn encode(
2576 self,
2577 encoder: &mut fidl::encoding::Encoder<'_, D>,
2578 offset: usize,
2579 depth: fidl::encoding::Depth,
2580 ) -> fidl::Result<()> {
2581 encoder.debug_check_bounds::<ManufacturerData>(offset);
2582 unsafe {
2585 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2586 (ptr as *mut u64).write_unaligned(0);
2587 }
2588 self.0.encode(encoder, offset + 0, depth)?;
2590 self.1.encode(encoder, offset + 8, depth)?;
2591 Ok(())
2592 }
2593 }
2594
2595 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ManufacturerData {
2596 #[inline(always)]
2597 fn new_empty() -> Self {
2598 Self {
2599 company_id: fidl::new_empty!(u16, D),
2600 data: fidl::new_empty!(fidl::encoding::Vector<u8, 252>, D),
2601 }
2602 }
2603
2604 #[inline]
2605 unsafe fn decode(
2606 &mut self,
2607 decoder: &mut fidl::encoding::Decoder<'_, D>,
2608 offset: usize,
2609 _depth: fidl::encoding::Depth,
2610 ) -> fidl::Result<()> {
2611 decoder.debug_check_bounds::<Self>(offset);
2612 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2614 let padval = unsafe { (ptr as *const u64).read_unaligned() };
2615 let mask = 0xffffffffffff0000u64;
2616 let maskedval = padval & mask;
2617 if maskedval != 0 {
2618 return Err(fidl::Error::NonZeroPadding {
2619 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2620 });
2621 }
2622 fidl::decode!(u16, D, &mut self.company_id, decoder, offset + 0, _depth)?;
2623 fidl::decode!(fidl::encoding::Vector<u8, 252>, D, &mut self.data, decoder, offset + 8, _depth)?;
2624 Ok(())
2625 }
2626 }
2627
2628 impl fidl::encoding::ValueTypeMarker for ManufacturerSpecificDataEntry {
2629 type Borrowed<'a> = &'a Self;
2630 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2631 value
2632 }
2633 }
2634
2635 unsafe impl fidl::encoding::TypeMarker for ManufacturerSpecificDataEntry {
2636 type Owned = Self;
2637
2638 #[inline(always)]
2639 fn inline_align(_context: fidl::encoding::Context) -> usize {
2640 8
2641 }
2642
2643 #[inline(always)]
2644 fn inline_size(_context: fidl::encoding::Context) -> usize {
2645 24
2646 }
2647 }
2648
2649 unsafe impl<D: fidl::encoding::ResourceDialect>
2650 fidl::encoding::Encode<ManufacturerSpecificDataEntry, D>
2651 for &ManufacturerSpecificDataEntry
2652 {
2653 #[inline]
2654 unsafe fn encode(
2655 self,
2656 encoder: &mut fidl::encoding::Encoder<'_, D>,
2657 offset: usize,
2658 _depth: fidl::encoding::Depth,
2659 ) -> fidl::Result<()> {
2660 encoder.debug_check_bounds::<ManufacturerSpecificDataEntry>(offset);
2661 fidl::encoding::Encode::<ManufacturerSpecificDataEntry, D>::encode(
2663 (
2664 <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.company_id),
2665 <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.data),
2666 ),
2667 encoder, offset, _depth
2668 )
2669 }
2670 }
2671 unsafe impl<
2672 D: fidl::encoding::ResourceDialect,
2673 T0: fidl::encoding::Encode<u16, D>,
2674 T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
2675 > fidl::encoding::Encode<ManufacturerSpecificDataEntry, D> for (T0, T1)
2676 {
2677 #[inline]
2678 unsafe fn encode(
2679 self,
2680 encoder: &mut fidl::encoding::Encoder<'_, D>,
2681 offset: usize,
2682 depth: fidl::encoding::Depth,
2683 ) -> fidl::Result<()> {
2684 encoder.debug_check_bounds::<ManufacturerSpecificDataEntry>(offset);
2685 unsafe {
2688 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2689 (ptr as *mut u64).write_unaligned(0);
2690 }
2691 self.0.encode(encoder, offset + 0, depth)?;
2693 self.1.encode(encoder, offset + 8, depth)?;
2694 Ok(())
2695 }
2696 }
2697
2698 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2699 for ManufacturerSpecificDataEntry
2700 {
2701 #[inline(always)]
2702 fn new_empty() -> Self {
2703 Self {
2704 company_id: fidl::new_empty!(u16, D),
2705 data: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
2706 }
2707 }
2708
2709 #[inline]
2710 unsafe fn decode(
2711 &mut self,
2712 decoder: &mut fidl::encoding::Decoder<'_, D>,
2713 offset: usize,
2714 _depth: fidl::encoding::Depth,
2715 ) -> fidl::Result<()> {
2716 decoder.debug_check_bounds::<Self>(offset);
2717 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2719 let padval = unsafe { (ptr as *const u64).read_unaligned() };
2720 let mask = 0xffffffffffff0000u64;
2721 let maskedval = padval & mask;
2722 if maskedval != 0 {
2723 return Err(fidl::Error::NonZeroPadding {
2724 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2725 });
2726 }
2727 fidl::decode!(u16, D, &mut self.company_id, decoder, offset + 0, _depth)?;
2728 fidl::decode!(
2729 fidl::encoding::UnboundedVector<u8>,
2730 D,
2731 &mut self.data,
2732 decoder,
2733 offset + 8,
2734 _depth
2735 )?;
2736 Ok(())
2737 }
2738 }
2739
2740 impl fidl::encoding::ValueTypeMarker for RemoteDevice {
2741 type Borrowed<'a> = &'a Self;
2742 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2743 value
2744 }
2745 }
2746
2747 unsafe impl fidl::encoding::TypeMarker for RemoteDevice {
2748 type Owned = Self;
2749
2750 #[inline(always)]
2751 fn inline_align(_context: fidl::encoding::Context) -> usize {
2752 8
2753 }
2754
2755 #[inline(always)]
2756 fn inline_size(_context: fidl::encoding::Context) -> usize {
2757 40
2758 }
2759 }
2760
2761 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RemoteDevice, D>
2762 for &RemoteDevice
2763 {
2764 #[inline]
2765 unsafe fn encode(
2766 self,
2767 encoder: &mut fidl::encoding::Encoder<'_, D>,
2768 offset: usize,
2769 _depth: fidl::encoding::Depth,
2770 ) -> fidl::Result<()> {
2771 encoder.debug_check_bounds::<RemoteDevice>(offset);
2772 fidl::encoding::Encode::<RemoteDevice, D>::encode(
2774 (
2775 <fidl::encoding::BoundedString<16> as fidl::encoding::ValueTypeMarker>::borrow(&self.identifier),
2776 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.connectable),
2777 <fidl::encoding::Boxed<fidl_fuchsia_bluetooth::Int8> as fidl::encoding::ValueTypeMarker>::borrow(&self.rssi),
2778 <fidl::encoding::Boxed<AdvertisingDataDeprecated> as fidl::encoding::ValueTypeMarker>::borrow(&self.advertising_data),
2779 ),
2780 encoder, offset, _depth
2781 )
2782 }
2783 }
2784 unsafe impl<
2785 D: fidl::encoding::ResourceDialect,
2786 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<16>, D>,
2787 T1: fidl::encoding::Encode<bool, D>,
2788 T2: fidl::encoding::Encode<fidl::encoding::Boxed<fidl_fuchsia_bluetooth::Int8>, D>,
2789 T3: fidl::encoding::Encode<fidl::encoding::Boxed<AdvertisingDataDeprecated>, D>,
2790 > fidl::encoding::Encode<RemoteDevice, D> for (T0, T1, T2, T3)
2791 {
2792 #[inline]
2793 unsafe fn encode(
2794 self,
2795 encoder: &mut fidl::encoding::Encoder<'_, D>,
2796 offset: usize,
2797 depth: fidl::encoding::Depth,
2798 ) -> fidl::Result<()> {
2799 encoder.debug_check_bounds::<RemoteDevice>(offset);
2800 unsafe {
2803 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2804 (ptr as *mut u64).write_unaligned(0);
2805 }
2806 self.0.encode(encoder, offset + 0, depth)?;
2808 self.1.encode(encoder, offset + 16, depth)?;
2809 self.2.encode(encoder, offset + 24, depth)?;
2810 self.3.encode(encoder, offset + 32, depth)?;
2811 Ok(())
2812 }
2813 }
2814
2815 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RemoteDevice {
2816 #[inline(always)]
2817 fn new_empty() -> Self {
2818 Self {
2819 identifier: fidl::new_empty!(fidl::encoding::BoundedString<16>, D),
2820 connectable: fidl::new_empty!(bool, D),
2821 rssi: fidl::new_empty!(fidl::encoding::Boxed<fidl_fuchsia_bluetooth::Int8>, D),
2822 advertising_data: fidl::new_empty!(
2823 fidl::encoding::Boxed<AdvertisingDataDeprecated>,
2824 D
2825 ),
2826 }
2827 }
2828
2829 #[inline]
2830 unsafe fn decode(
2831 &mut self,
2832 decoder: &mut fidl::encoding::Decoder<'_, D>,
2833 offset: usize,
2834 _depth: fidl::encoding::Depth,
2835 ) -> fidl::Result<()> {
2836 decoder.debug_check_bounds::<Self>(offset);
2837 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2839 let padval = unsafe { (ptr as *const u64).read_unaligned() };
2840 let mask = 0xffffffffffffff00u64;
2841 let maskedval = padval & mask;
2842 if maskedval != 0 {
2843 return Err(fidl::Error::NonZeroPadding {
2844 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2845 });
2846 }
2847 fidl::decode!(
2848 fidl::encoding::BoundedString<16>,
2849 D,
2850 &mut self.identifier,
2851 decoder,
2852 offset + 0,
2853 _depth
2854 )?;
2855 fidl::decode!(bool, D, &mut self.connectable, decoder, offset + 16, _depth)?;
2856 fidl::decode!(
2857 fidl::encoding::Boxed<fidl_fuchsia_bluetooth::Int8>,
2858 D,
2859 &mut self.rssi,
2860 decoder,
2861 offset + 24,
2862 _depth
2863 )?;
2864 fidl::decode!(
2865 fidl::encoding::Boxed<AdvertisingDataDeprecated>,
2866 D,
2867 &mut self.advertising_data,
2868 decoder,
2869 offset + 32,
2870 _depth
2871 )?;
2872 Ok(())
2873 }
2874 }
2875
2876 impl fidl::encoding::ValueTypeMarker for ScanFilter {
2877 type Borrowed<'a> = &'a Self;
2878 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2879 value
2880 }
2881 }
2882
2883 unsafe impl fidl::encoding::TypeMarker for ScanFilter {
2884 type Owned = Self;
2885
2886 #[inline(always)]
2887 fn inline_align(_context: fidl::encoding::Context) -> usize {
2888 8
2889 }
2890
2891 #[inline(always)]
2892 fn inline_size(_context: fidl::encoding::Context) -> usize {
2893 72
2894 }
2895 }
2896
2897 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ScanFilter, D>
2898 for &ScanFilter
2899 {
2900 #[inline]
2901 unsafe fn encode(
2902 self,
2903 encoder: &mut fidl::encoding::Encoder<'_, D>,
2904 offset: usize,
2905 _depth: fidl::encoding::Depth,
2906 ) -> fidl::Result<()> {
2907 encoder.debug_check_bounds::<ScanFilter>(offset);
2908 fidl::encoding::Encode::<ScanFilter, D>::encode(
2910 (
2911 <fidl::encoding::Optional<fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<36>>> as fidl::encoding::ValueTypeMarker>::borrow(&self.service_uuids),
2912 <fidl::encoding::Optional<fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<36>>> as fidl::encoding::ValueTypeMarker>::borrow(&self.service_data_uuids),
2913 <fidl::encoding::Boxed<fidl_fuchsia_bluetooth::UInt16> as fidl::encoding::ValueTypeMarker>::borrow(&self.manufacturer_identifier),
2914 <fidl::encoding::Boxed<fidl_fuchsia_bluetooth::Bool> as fidl::encoding::ValueTypeMarker>::borrow(&self.connectable),
2915 <fidl::encoding::Optional<fidl::encoding::BoundedString<248>> as fidl::encoding::ValueTypeMarker>::borrow(&self.name_substring),
2916 <fidl::encoding::Boxed<fidl_fuchsia_bluetooth::Int8> as fidl::encoding::ValueTypeMarker>::borrow(&self.max_path_loss),
2917 ),
2918 encoder, offset, _depth
2919 )
2920 }
2921 }
2922 unsafe impl<
2923 D: fidl::encoding::ResourceDialect,
2924 T0: fidl::encoding::Encode<
2925 fidl::encoding::Optional<
2926 fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<36>>,
2927 >,
2928 D,
2929 >,
2930 T1: fidl::encoding::Encode<
2931 fidl::encoding::Optional<
2932 fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<36>>,
2933 >,
2934 D,
2935 >,
2936 T2: fidl::encoding::Encode<fidl::encoding::Boxed<fidl_fuchsia_bluetooth::UInt16>, D>,
2937 T3: fidl::encoding::Encode<fidl::encoding::Boxed<fidl_fuchsia_bluetooth::Bool>, D>,
2938 T4: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<248>>, D>,
2939 T5: fidl::encoding::Encode<fidl::encoding::Boxed<fidl_fuchsia_bluetooth::Int8>, D>,
2940 > fidl::encoding::Encode<ScanFilter, D> for (T0, T1, T2, T3, T4, T5)
2941 {
2942 #[inline]
2943 unsafe fn encode(
2944 self,
2945 encoder: &mut fidl::encoding::Encoder<'_, D>,
2946 offset: usize,
2947 depth: fidl::encoding::Depth,
2948 ) -> fidl::Result<()> {
2949 encoder.debug_check_bounds::<ScanFilter>(offset);
2950 self.0.encode(encoder, offset + 0, depth)?;
2954 self.1.encode(encoder, offset + 16, depth)?;
2955 self.2.encode(encoder, offset + 32, depth)?;
2956 self.3.encode(encoder, offset + 40, depth)?;
2957 self.4.encode(encoder, offset + 48, depth)?;
2958 self.5.encode(encoder, offset + 64, depth)?;
2959 Ok(())
2960 }
2961 }
2962
2963 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ScanFilter {
2964 #[inline(always)]
2965 fn new_empty() -> Self {
2966 Self {
2967 service_uuids: fidl::new_empty!(
2968 fidl::encoding::Optional<
2969 fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<36>>,
2970 >,
2971 D
2972 ),
2973 service_data_uuids: fidl::new_empty!(
2974 fidl::encoding::Optional<
2975 fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<36>>,
2976 >,
2977 D
2978 ),
2979 manufacturer_identifier: fidl::new_empty!(
2980 fidl::encoding::Boxed<fidl_fuchsia_bluetooth::UInt16>,
2981 D
2982 ),
2983 connectable: fidl::new_empty!(
2984 fidl::encoding::Boxed<fidl_fuchsia_bluetooth::Bool>,
2985 D
2986 ),
2987 name_substring: fidl::new_empty!(
2988 fidl::encoding::Optional<fidl::encoding::BoundedString<248>>,
2989 D
2990 ),
2991 max_path_loss: fidl::new_empty!(
2992 fidl::encoding::Boxed<fidl_fuchsia_bluetooth::Int8>,
2993 D
2994 ),
2995 }
2996 }
2997
2998 #[inline]
2999 unsafe fn decode(
3000 &mut self,
3001 decoder: &mut fidl::encoding::Decoder<'_, D>,
3002 offset: usize,
3003 _depth: fidl::encoding::Depth,
3004 ) -> fidl::Result<()> {
3005 decoder.debug_check_bounds::<Self>(offset);
3006 fidl::decode!(
3008 fidl::encoding::Optional<
3009 fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<36>>,
3010 >,
3011 D,
3012 &mut self.service_uuids,
3013 decoder,
3014 offset + 0,
3015 _depth
3016 )?;
3017 fidl::decode!(
3018 fidl::encoding::Optional<
3019 fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<36>>,
3020 >,
3021 D,
3022 &mut self.service_data_uuids,
3023 decoder,
3024 offset + 16,
3025 _depth
3026 )?;
3027 fidl::decode!(
3028 fidl::encoding::Boxed<fidl_fuchsia_bluetooth::UInt16>,
3029 D,
3030 &mut self.manufacturer_identifier,
3031 decoder,
3032 offset + 32,
3033 _depth
3034 )?;
3035 fidl::decode!(
3036 fidl::encoding::Boxed<fidl_fuchsia_bluetooth::Bool>,
3037 D,
3038 &mut self.connectable,
3039 decoder,
3040 offset + 40,
3041 _depth
3042 )?;
3043 fidl::decode!(
3044 fidl::encoding::Optional<fidl::encoding::BoundedString<248>>,
3045 D,
3046 &mut self.name_substring,
3047 decoder,
3048 offset + 48,
3049 _depth
3050 )?;
3051 fidl::decode!(
3052 fidl::encoding::Boxed<fidl_fuchsia_bluetooth::Int8>,
3053 D,
3054 &mut self.max_path_loss,
3055 decoder,
3056 offset + 64,
3057 _depth
3058 )?;
3059 Ok(())
3060 }
3061 }
3062
3063 impl fidl::encoding::ValueTypeMarker for ScanResultWatcherWatchResponse {
3064 type Borrowed<'a> = &'a Self;
3065 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3066 value
3067 }
3068 }
3069
3070 unsafe impl fidl::encoding::TypeMarker for ScanResultWatcherWatchResponse {
3071 type Owned = Self;
3072
3073 #[inline(always)]
3074 fn inline_align(_context: fidl::encoding::Context) -> usize {
3075 8
3076 }
3077
3078 #[inline(always)]
3079 fn inline_size(_context: fidl::encoding::Context) -> usize {
3080 16
3081 }
3082 }
3083
3084 unsafe impl<D: fidl::encoding::ResourceDialect>
3085 fidl::encoding::Encode<ScanResultWatcherWatchResponse, D>
3086 for &ScanResultWatcherWatchResponse
3087 {
3088 #[inline]
3089 unsafe fn encode(
3090 self,
3091 encoder: &mut fidl::encoding::Encoder<'_, D>,
3092 offset: usize,
3093 _depth: fidl::encoding::Depth,
3094 ) -> fidl::Result<()> {
3095 encoder.debug_check_bounds::<ScanResultWatcherWatchResponse>(offset);
3096 fidl::encoding::Encode::<ScanResultWatcherWatchResponse, D>::encode(
3098 (
3099 <fidl::encoding::UnboundedVector<Peer> as fidl::encoding::ValueTypeMarker>::borrow(&self.updated),
3100 ),
3101 encoder, offset, _depth
3102 )
3103 }
3104 }
3105 unsafe impl<
3106 D: fidl::encoding::ResourceDialect,
3107 T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Peer>, D>,
3108 > fidl::encoding::Encode<ScanResultWatcherWatchResponse, D> for (T0,)
3109 {
3110 #[inline]
3111 unsafe fn encode(
3112 self,
3113 encoder: &mut fidl::encoding::Encoder<'_, D>,
3114 offset: usize,
3115 depth: fidl::encoding::Depth,
3116 ) -> fidl::Result<()> {
3117 encoder.debug_check_bounds::<ScanResultWatcherWatchResponse>(offset);
3118 self.0.encode(encoder, offset + 0, depth)?;
3122 Ok(())
3123 }
3124 }
3125
3126 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3127 for ScanResultWatcherWatchResponse
3128 {
3129 #[inline(always)]
3130 fn new_empty() -> Self {
3131 Self { updated: fidl::new_empty!(fidl::encoding::UnboundedVector<Peer>, D) }
3132 }
3133
3134 #[inline]
3135 unsafe fn decode(
3136 &mut self,
3137 decoder: &mut fidl::encoding::Decoder<'_, D>,
3138 offset: usize,
3139 _depth: fidl::encoding::Depth,
3140 ) -> fidl::Result<()> {
3141 decoder.debug_check_bounds::<Self>(offset);
3142 fidl::decode!(
3144 fidl::encoding::UnboundedVector<Peer>,
3145 D,
3146 &mut self.updated,
3147 decoder,
3148 offset + 0,
3149 _depth
3150 )?;
3151 Ok(())
3152 }
3153 }
3154
3155 impl fidl::encoding::ValueTypeMarker for ServiceData {
3156 type Borrowed<'a> = &'a Self;
3157 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3158 value
3159 }
3160 }
3161
3162 unsafe impl fidl::encoding::TypeMarker for ServiceData {
3163 type Owned = Self;
3164
3165 #[inline(always)]
3166 fn inline_align(_context: fidl::encoding::Context) -> usize {
3167 8
3168 }
3169
3170 #[inline(always)]
3171 fn inline_size(_context: fidl::encoding::Context) -> usize {
3172 32
3173 }
3174 }
3175
3176 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ServiceData, D>
3177 for &ServiceData
3178 {
3179 #[inline]
3180 unsafe fn encode(
3181 self,
3182 encoder: &mut fidl::encoding::Encoder<'_, D>,
3183 offset: usize,
3184 _depth: fidl::encoding::Depth,
3185 ) -> fidl::Result<()> {
3186 encoder.debug_check_bounds::<ServiceData>(offset);
3187 fidl::encoding::Encode::<ServiceData, D>::encode(
3189 (
3190 <fidl_fuchsia_bluetooth::Uuid as fidl::encoding::ValueTypeMarker>::borrow(
3191 &self.uuid,
3192 ),
3193 <fidl::encoding::Vector<u8, 252> as fidl::encoding::ValueTypeMarker>::borrow(
3194 &self.data,
3195 ),
3196 ),
3197 encoder,
3198 offset,
3199 _depth,
3200 )
3201 }
3202 }
3203 unsafe impl<
3204 D: fidl::encoding::ResourceDialect,
3205 T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::Uuid, D>,
3206 T1: fidl::encoding::Encode<fidl::encoding::Vector<u8, 252>, D>,
3207 > fidl::encoding::Encode<ServiceData, D> for (T0, T1)
3208 {
3209 #[inline]
3210 unsafe fn encode(
3211 self,
3212 encoder: &mut fidl::encoding::Encoder<'_, D>,
3213 offset: usize,
3214 depth: fidl::encoding::Depth,
3215 ) -> fidl::Result<()> {
3216 encoder.debug_check_bounds::<ServiceData>(offset);
3217 self.0.encode(encoder, offset + 0, depth)?;
3221 self.1.encode(encoder, offset + 16, depth)?;
3222 Ok(())
3223 }
3224 }
3225
3226 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ServiceData {
3227 #[inline(always)]
3228 fn new_empty() -> Self {
3229 Self {
3230 uuid: fidl::new_empty!(fidl_fuchsia_bluetooth::Uuid, D),
3231 data: fidl::new_empty!(fidl::encoding::Vector<u8, 252>, D),
3232 }
3233 }
3234
3235 #[inline]
3236 unsafe fn decode(
3237 &mut self,
3238 decoder: &mut fidl::encoding::Decoder<'_, D>,
3239 offset: usize,
3240 _depth: fidl::encoding::Depth,
3241 ) -> fidl::Result<()> {
3242 decoder.debug_check_bounds::<Self>(offset);
3243 fidl::decode!(
3245 fidl_fuchsia_bluetooth::Uuid,
3246 D,
3247 &mut self.uuid,
3248 decoder,
3249 offset + 0,
3250 _depth
3251 )?;
3252 fidl::decode!(fidl::encoding::Vector<u8, 252>, D, &mut self.data, decoder, offset + 16, _depth)?;
3253 Ok(())
3254 }
3255 }
3256
3257 impl fidl::encoding::ValueTypeMarker for ServiceDataEntry {
3258 type Borrowed<'a> = &'a Self;
3259 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3260 value
3261 }
3262 }
3263
3264 unsafe impl fidl::encoding::TypeMarker for ServiceDataEntry {
3265 type Owned = Self;
3266
3267 #[inline(always)]
3268 fn inline_align(_context: fidl::encoding::Context) -> usize {
3269 8
3270 }
3271
3272 #[inline(always)]
3273 fn inline_size(_context: fidl::encoding::Context) -> usize {
3274 32
3275 }
3276 }
3277
3278 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ServiceDataEntry, D>
3279 for &ServiceDataEntry
3280 {
3281 #[inline]
3282 unsafe fn encode(
3283 self,
3284 encoder: &mut fidl::encoding::Encoder<'_, D>,
3285 offset: usize,
3286 _depth: fidl::encoding::Depth,
3287 ) -> fidl::Result<()> {
3288 encoder.debug_check_bounds::<ServiceDataEntry>(offset);
3289 fidl::encoding::Encode::<ServiceDataEntry, D>::encode(
3291 (
3292 <fidl::encoding::BoundedString<36> as fidl::encoding::ValueTypeMarker>::borrow(&self.uuid),
3293 <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.data),
3294 ),
3295 encoder, offset, _depth
3296 )
3297 }
3298 }
3299 unsafe impl<
3300 D: fidl::encoding::ResourceDialect,
3301 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<36>, D>,
3302 T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
3303 > fidl::encoding::Encode<ServiceDataEntry, D> for (T0, T1)
3304 {
3305 #[inline]
3306 unsafe fn encode(
3307 self,
3308 encoder: &mut fidl::encoding::Encoder<'_, D>,
3309 offset: usize,
3310 depth: fidl::encoding::Depth,
3311 ) -> fidl::Result<()> {
3312 encoder.debug_check_bounds::<ServiceDataEntry>(offset);
3313 self.0.encode(encoder, offset + 0, depth)?;
3317 self.1.encode(encoder, offset + 16, depth)?;
3318 Ok(())
3319 }
3320 }
3321
3322 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ServiceDataEntry {
3323 #[inline(always)]
3324 fn new_empty() -> Self {
3325 Self {
3326 uuid: fidl::new_empty!(fidl::encoding::BoundedString<36>, D),
3327 data: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
3328 }
3329 }
3330
3331 #[inline]
3332 unsafe fn decode(
3333 &mut self,
3334 decoder: &mut fidl::encoding::Decoder<'_, D>,
3335 offset: usize,
3336 _depth: fidl::encoding::Depth,
3337 ) -> fidl::Result<()> {
3338 decoder.debug_check_bounds::<Self>(offset);
3339 fidl::decode!(
3341 fidl::encoding::BoundedString<36>,
3342 D,
3343 &mut self.uuid,
3344 decoder,
3345 offset + 0,
3346 _depth
3347 )?;
3348 fidl::decode!(
3349 fidl::encoding::UnboundedVector<u8>,
3350 D,
3351 &mut self.data,
3352 decoder,
3353 offset + 16,
3354 _depth
3355 )?;
3356 Ok(())
3357 }
3358 }
3359
3360 impl AcceptedChannelParameters {
3361 #[inline(always)]
3362 fn max_ordinal_present(&self) -> u64 {
3363 if let Some(_) = self.max_packet_size {
3364 return 2;
3365 }
3366 if let Some(_) = self.accepted_channel_modes {
3367 return 1;
3368 }
3369 0
3370 }
3371 }
3372
3373 impl fidl::encoding::ValueTypeMarker for AcceptedChannelParameters {
3374 type Borrowed<'a> = &'a Self;
3375 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3376 value
3377 }
3378 }
3379
3380 unsafe impl fidl::encoding::TypeMarker for AcceptedChannelParameters {
3381 type Owned = Self;
3382
3383 #[inline(always)]
3384 fn inline_align(_context: fidl::encoding::Context) -> usize {
3385 8
3386 }
3387
3388 #[inline(always)]
3389 fn inline_size(_context: fidl::encoding::Context) -> usize {
3390 16
3391 }
3392 }
3393
3394 unsafe impl<D: fidl::encoding::ResourceDialect>
3395 fidl::encoding::Encode<AcceptedChannelParameters, D> for &AcceptedChannelParameters
3396 {
3397 unsafe fn encode(
3398 self,
3399 encoder: &mut fidl::encoding::Encoder<'_, D>,
3400 offset: usize,
3401 mut depth: fidl::encoding::Depth,
3402 ) -> fidl::Result<()> {
3403 encoder.debug_check_bounds::<AcceptedChannelParameters>(offset);
3404 let max_ordinal: u64 = self.max_ordinal_present();
3406 encoder.write_num(max_ordinal, offset);
3407 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3408 if max_ordinal == 0 {
3410 return Ok(());
3411 }
3412 depth.increment()?;
3413 let envelope_size = 8;
3414 let bytes_len = max_ordinal as usize * envelope_size;
3415 #[allow(unused_variables)]
3416 let offset = encoder.out_of_line_offset(bytes_len);
3417 let mut _prev_end_offset: usize = 0;
3418 if 1 > max_ordinal {
3419 return Ok(());
3420 }
3421
3422 let cur_offset: usize = (1 - 1) * envelope_size;
3425
3426 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3428
3429 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::ChannelMode>, D>(
3434 self.accepted_channel_modes.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::ChannelMode> as fidl::encoding::ValueTypeMarker>::borrow),
3435 encoder, offset + cur_offset, depth
3436 )?;
3437
3438 _prev_end_offset = cur_offset + envelope_size;
3439 if 2 > max_ordinal {
3440 return Ok(());
3441 }
3442
3443 let cur_offset: usize = (2 - 1) * envelope_size;
3446
3447 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3449
3450 fidl::encoding::encode_in_envelope_optional::<u16, D>(
3455 self.max_packet_size.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
3456 encoder,
3457 offset + cur_offset,
3458 depth,
3459 )?;
3460
3461 _prev_end_offset = cur_offset + envelope_size;
3462
3463 Ok(())
3464 }
3465 }
3466
3467 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3468 for AcceptedChannelParameters
3469 {
3470 #[inline(always)]
3471 fn new_empty() -> Self {
3472 Self::default()
3473 }
3474
3475 unsafe fn decode(
3476 &mut self,
3477 decoder: &mut fidl::encoding::Decoder<'_, D>,
3478 offset: usize,
3479 mut depth: fidl::encoding::Depth,
3480 ) -> fidl::Result<()> {
3481 decoder.debug_check_bounds::<Self>(offset);
3482 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3483 None => return Err(fidl::Error::NotNullable),
3484 Some(len) => len,
3485 };
3486 if len == 0 {
3488 return Ok(());
3489 };
3490 depth.increment()?;
3491 let envelope_size = 8;
3492 let bytes_len = len * envelope_size;
3493 let offset = decoder.out_of_line_offset(bytes_len)?;
3494 let mut _next_ordinal_to_read = 0;
3496 let mut next_offset = offset;
3497 let end_offset = offset + bytes_len;
3498 _next_ordinal_to_read += 1;
3499 if next_offset >= end_offset {
3500 return Ok(());
3501 }
3502
3503 while _next_ordinal_to_read < 1 {
3505 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3506 _next_ordinal_to_read += 1;
3507 next_offset += envelope_size;
3508 }
3509
3510 let next_out_of_line = decoder.next_out_of_line();
3511 let handles_before = decoder.remaining_handles();
3512 if let Some((inlined, num_bytes, num_handles)) =
3513 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3514 {
3515 let member_inline_size = <fidl::encoding::UnboundedVector<
3516 fidl_fuchsia_bluetooth::ChannelMode,
3517 > as fidl::encoding::TypeMarker>::inline_size(
3518 decoder.context
3519 );
3520 if inlined != (member_inline_size <= 4) {
3521 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3522 }
3523 let inner_offset;
3524 let mut inner_depth = depth.clone();
3525 if inlined {
3526 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3527 inner_offset = next_offset;
3528 } else {
3529 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3530 inner_depth.increment()?;
3531 }
3532 let val_ref = self.accepted_channel_modes.get_or_insert_with(|| {
3533 fidl::new_empty!(
3534 fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::ChannelMode>,
3535 D
3536 )
3537 });
3538 fidl::decode!(
3539 fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::ChannelMode>,
3540 D,
3541 val_ref,
3542 decoder,
3543 inner_offset,
3544 inner_depth
3545 )?;
3546 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3547 {
3548 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3549 }
3550 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3551 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3552 }
3553 }
3554
3555 next_offset += envelope_size;
3556 _next_ordinal_to_read += 1;
3557 if next_offset >= end_offset {
3558 return Ok(());
3559 }
3560
3561 while _next_ordinal_to_read < 2 {
3563 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3564 _next_ordinal_to_read += 1;
3565 next_offset += envelope_size;
3566 }
3567
3568 let next_out_of_line = decoder.next_out_of_line();
3569 let handles_before = decoder.remaining_handles();
3570 if let Some((inlined, num_bytes, num_handles)) =
3571 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3572 {
3573 let member_inline_size =
3574 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3575 if inlined != (member_inline_size <= 4) {
3576 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3577 }
3578 let inner_offset;
3579 let mut inner_depth = depth.clone();
3580 if inlined {
3581 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3582 inner_offset = next_offset;
3583 } else {
3584 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3585 inner_depth.increment()?;
3586 }
3587 let val_ref = self.max_packet_size.get_or_insert_with(|| fidl::new_empty!(u16, D));
3588 fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
3589 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3590 {
3591 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3592 }
3593 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3594 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3595 }
3596 }
3597
3598 next_offset += envelope_size;
3599
3600 while next_offset < end_offset {
3602 _next_ordinal_to_read += 1;
3603 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3604 next_offset += envelope_size;
3605 }
3606
3607 Ok(())
3608 }
3609 }
3610
3611 impl AdvertisingData {
3612 #[inline(always)]
3613 fn max_ordinal_present(&self) -> u64 {
3614 if let Some(_) = self.broadcast_name {
3615 return 10;
3616 }
3617 if let Some(_) = self.resolvable_set_identifier {
3618 return 9;
3619 }
3620 if let Some(_) = self.include_tx_power_level {
3621 return 8;
3622 }
3623 if let Some(_) = self.uris {
3624 return 7;
3625 }
3626 if let Some(_) = self.manufacturer_data {
3627 return 6;
3628 }
3629 if let Some(_) = self.service_data {
3630 return 5;
3631 }
3632 if let Some(_) = self.service_uuids {
3633 return 4;
3634 }
3635 if let Some(_) = self.tx_power_level {
3636 return 3;
3637 }
3638 if let Some(_) = self.appearance {
3639 return 2;
3640 }
3641 if let Some(_) = self.name {
3642 return 1;
3643 }
3644 0
3645 }
3646 }
3647
3648 impl fidl::encoding::ValueTypeMarker for AdvertisingData {
3649 type Borrowed<'a> = &'a Self;
3650 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3651 value
3652 }
3653 }
3654
3655 unsafe impl fidl::encoding::TypeMarker for AdvertisingData {
3656 type Owned = Self;
3657
3658 #[inline(always)]
3659 fn inline_align(_context: fidl::encoding::Context) -> usize {
3660 8
3661 }
3662
3663 #[inline(always)]
3664 fn inline_size(_context: fidl::encoding::Context) -> usize {
3665 16
3666 }
3667 }
3668
3669 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AdvertisingData, D>
3670 for &AdvertisingData
3671 {
3672 unsafe fn encode(
3673 self,
3674 encoder: &mut fidl::encoding::Encoder<'_, D>,
3675 offset: usize,
3676 mut depth: fidl::encoding::Depth,
3677 ) -> fidl::Result<()> {
3678 encoder.debug_check_bounds::<AdvertisingData>(offset);
3679 let max_ordinal: u64 = self.max_ordinal_present();
3681 encoder.write_num(max_ordinal, offset);
3682 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3683 if max_ordinal == 0 {
3685 return Ok(());
3686 }
3687 depth.increment()?;
3688 let envelope_size = 8;
3689 let bytes_len = max_ordinal as usize * envelope_size;
3690 #[allow(unused_variables)]
3691 let offset = encoder.out_of_line_offset(bytes_len);
3692 let mut _prev_end_offset: usize = 0;
3693 if 1 > max_ordinal {
3694 return Ok(());
3695 }
3696
3697 let cur_offset: usize = (1 - 1) * envelope_size;
3700
3701 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3703
3704 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<248>, D>(
3709 self.name.as_ref().map(
3710 <fidl::encoding::BoundedString<248> as fidl::encoding::ValueTypeMarker>::borrow,
3711 ),
3712 encoder,
3713 offset + cur_offset,
3714 depth,
3715 )?;
3716
3717 _prev_end_offset = cur_offset + envelope_size;
3718 if 2 > max_ordinal {
3719 return Ok(());
3720 }
3721
3722 let cur_offset: usize = (2 - 1) * envelope_size;
3725
3726 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3728
3729 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::Appearance, D>(
3734 self.appearance.as_ref().map(
3735 <fidl_fuchsia_bluetooth::Appearance as fidl::encoding::ValueTypeMarker>::borrow,
3736 ),
3737 encoder,
3738 offset + cur_offset,
3739 depth,
3740 )?;
3741
3742 _prev_end_offset = cur_offset + envelope_size;
3743 if 3 > max_ordinal {
3744 return Ok(());
3745 }
3746
3747 let cur_offset: usize = (3 - 1) * envelope_size;
3750
3751 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3753
3754 fidl::encoding::encode_in_envelope_optional::<i8, D>(
3759 self.tx_power_level.as_ref().map(<i8 as fidl::encoding::ValueTypeMarker>::borrow),
3760 encoder,
3761 offset + cur_offset,
3762 depth,
3763 )?;
3764
3765 _prev_end_offset = cur_offset + envelope_size;
3766 if 4 > max_ordinal {
3767 return Ok(());
3768 }
3769
3770 let cur_offset: usize = (4 - 1) * envelope_size;
3773
3774 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3776
3777 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::Uuid>, D>(
3782 self.service_uuids.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::Uuid> as fidl::encoding::ValueTypeMarker>::borrow),
3783 encoder, offset + cur_offset, depth
3784 )?;
3785
3786 _prev_end_offset = cur_offset + envelope_size;
3787 if 5 > max_ordinal {
3788 return Ok(());
3789 }
3790
3791 let cur_offset: usize = (5 - 1) * envelope_size;
3794
3795 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3797
3798 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<ServiceData>, D>(
3803 self.service_data.as_ref().map(<fidl::encoding::UnboundedVector<ServiceData> as fidl::encoding::ValueTypeMarker>::borrow),
3804 encoder, offset + cur_offset, depth
3805 )?;
3806
3807 _prev_end_offset = cur_offset + envelope_size;
3808 if 6 > max_ordinal {
3809 return Ok(());
3810 }
3811
3812 let cur_offset: usize = (6 - 1) * envelope_size;
3815
3816 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3818
3819 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<ManufacturerData>, D>(
3824 self.manufacturer_data.as_ref().map(<fidl::encoding::UnboundedVector<ManufacturerData> as fidl::encoding::ValueTypeMarker>::borrow),
3825 encoder, offset + cur_offset, depth
3826 )?;
3827
3828 _prev_end_offset = cur_offset + envelope_size;
3829 if 7 > max_ordinal {
3830 return Ok(());
3831 }
3832
3833 let cur_offset: usize = (7 - 1) * envelope_size;
3836
3837 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3839
3840 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<278>>, D>(
3845 self.uris.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<278>> as fidl::encoding::ValueTypeMarker>::borrow),
3846 encoder, offset + cur_offset, depth
3847 )?;
3848
3849 _prev_end_offset = cur_offset + envelope_size;
3850 if 8 > max_ordinal {
3851 return Ok(());
3852 }
3853
3854 let cur_offset: usize = (8 - 1) * envelope_size;
3857
3858 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3860
3861 fidl::encoding::encode_in_envelope_optional::<bool, D>(
3866 self.include_tx_power_level
3867 .as_ref()
3868 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
3869 encoder,
3870 offset + cur_offset,
3871 depth,
3872 )?;
3873
3874 _prev_end_offset = cur_offset + envelope_size;
3875 if 9 > max_ordinal {
3876 return Ok(());
3877 }
3878
3879 let cur_offset: usize = (9 - 1) * envelope_size;
3882
3883 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3885
3886 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<u8, 6>, D>(
3891 self.resolvable_set_identifier
3892 .as_ref()
3893 .map(<fidl::encoding::Array<u8, 6> as fidl::encoding::ValueTypeMarker>::borrow),
3894 encoder,
3895 offset + cur_offset,
3896 depth,
3897 )?;
3898
3899 _prev_end_offset = cur_offset + envelope_size;
3900 if 10 > max_ordinal {
3901 return Ok(());
3902 }
3903
3904 let cur_offset: usize = (10 - 1) * envelope_size;
3907
3908 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3910
3911 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<128>, D>(
3916 self.broadcast_name.as_ref().map(
3917 <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow,
3918 ),
3919 encoder,
3920 offset + cur_offset,
3921 depth,
3922 )?;
3923
3924 _prev_end_offset = cur_offset + envelope_size;
3925
3926 Ok(())
3927 }
3928 }
3929
3930 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AdvertisingData {
3931 #[inline(always)]
3932 fn new_empty() -> Self {
3933 Self::default()
3934 }
3935
3936 unsafe fn decode(
3937 &mut self,
3938 decoder: &mut fidl::encoding::Decoder<'_, D>,
3939 offset: usize,
3940 mut depth: fidl::encoding::Depth,
3941 ) -> fidl::Result<()> {
3942 decoder.debug_check_bounds::<Self>(offset);
3943 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3944 None => return Err(fidl::Error::NotNullable),
3945 Some(len) => len,
3946 };
3947 if len == 0 {
3949 return Ok(());
3950 };
3951 depth.increment()?;
3952 let envelope_size = 8;
3953 let bytes_len = len * envelope_size;
3954 let offset = decoder.out_of_line_offset(bytes_len)?;
3955 let mut _next_ordinal_to_read = 0;
3957 let mut next_offset = offset;
3958 let end_offset = offset + bytes_len;
3959 _next_ordinal_to_read += 1;
3960 if next_offset >= end_offset {
3961 return Ok(());
3962 }
3963
3964 while _next_ordinal_to_read < 1 {
3966 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3967 _next_ordinal_to_read += 1;
3968 next_offset += envelope_size;
3969 }
3970
3971 let next_out_of_line = decoder.next_out_of_line();
3972 let handles_before = decoder.remaining_handles();
3973 if let Some((inlined, num_bytes, num_handles)) =
3974 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3975 {
3976 let member_inline_size =
3977 <fidl::encoding::BoundedString<248> as fidl::encoding::TypeMarker>::inline_size(
3978 decoder.context,
3979 );
3980 if inlined != (member_inline_size <= 4) {
3981 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3982 }
3983 let inner_offset;
3984 let mut inner_depth = depth.clone();
3985 if inlined {
3986 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3987 inner_offset = next_offset;
3988 } else {
3989 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3990 inner_depth.increment()?;
3991 }
3992 let val_ref = self
3993 .name
3994 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<248>, D));
3995 fidl::decode!(
3996 fidl::encoding::BoundedString<248>,
3997 D,
3998 val_ref,
3999 decoder,
4000 inner_offset,
4001 inner_depth
4002 )?;
4003 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4004 {
4005 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4006 }
4007 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4008 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4009 }
4010 }
4011
4012 next_offset += envelope_size;
4013 _next_ordinal_to_read += 1;
4014 if next_offset >= end_offset {
4015 return Ok(());
4016 }
4017
4018 while _next_ordinal_to_read < 2 {
4020 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4021 _next_ordinal_to_read += 1;
4022 next_offset += envelope_size;
4023 }
4024
4025 let next_out_of_line = decoder.next_out_of_line();
4026 let handles_before = decoder.remaining_handles();
4027 if let Some((inlined, num_bytes, num_handles)) =
4028 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4029 {
4030 let member_inline_size =
4031 <fidl_fuchsia_bluetooth::Appearance as fidl::encoding::TypeMarker>::inline_size(
4032 decoder.context,
4033 );
4034 if inlined != (member_inline_size <= 4) {
4035 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4036 }
4037 let inner_offset;
4038 let mut inner_depth = depth.clone();
4039 if inlined {
4040 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4041 inner_offset = next_offset;
4042 } else {
4043 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4044 inner_depth.increment()?;
4045 }
4046 let val_ref = self
4047 .appearance
4048 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_bluetooth::Appearance, D));
4049 fidl::decode!(
4050 fidl_fuchsia_bluetooth::Appearance,
4051 D,
4052 val_ref,
4053 decoder,
4054 inner_offset,
4055 inner_depth
4056 )?;
4057 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4058 {
4059 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4060 }
4061 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4062 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4063 }
4064 }
4065
4066 next_offset += envelope_size;
4067 _next_ordinal_to_read += 1;
4068 if next_offset >= end_offset {
4069 return Ok(());
4070 }
4071
4072 while _next_ordinal_to_read < 3 {
4074 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4075 _next_ordinal_to_read += 1;
4076 next_offset += envelope_size;
4077 }
4078
4079 let next_out_of_line = decoder.next_out_of_line();
4080 let handles_before = decoder.remaining_handles();
4081 if let Some((inlined, num_bytes, num_handles)) =
4082 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4083 {
4084 let member_inline_size =
4085 <i8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4086 if inlined != (member_inline_size <= 4) {
4087 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4088 }
4089 let inner_offset;
4090 let mut inner_depth = depth.clone();
4091 if inlined {
4092 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4093 inner_offset = next_offset;
4094 } else {
4095 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4096 inner_depth.increment()?;
4097 }
4098 let val_ref = self.tx_power_level.get_or_insert_with(|| fidl::new_empty!(i8, D));
4099 fidl::decode!(i8, D, val_ref, decoder, inner_offset, inner_depth)?;
4100 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4101 {
4102 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4103 }
4104 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4105 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4106 }
4107 }
4108
4109 next_offset += envelope_size;
4110 _next_ordinal_to_read += 1;
4111 if next_offset >= end_offset {
4112 return Ok(());
4113 }
4114
4115 while _next_ordinal_to_read < 4 {
4117 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4118 _next_ordinal_to_read += 1;
4119 next_offset += envelope_size;
4120 }
4121
4122 let next_out_of_line = decoder.next_out_of_line();
4123 let handles_before = decoder.remaining_handles();
4124 if let Some((inlined, num_bytes, num_handles)) =
4125 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4126 {
4127 let member_inline_size = <fidl::encoding::UnboundedVector<
4128 fidl_fuchsia_bluetooth::Uuid,
4129 > as fidl::encoding::TypeMarker>::inline_size(
4130 decoder.context
4131 );
4132 if inlined != (member_inline_size <= 4) {
4133 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4134 }
4135 let inner_offset;
4136 let mut inner_depth = depth.clone();
4137 if inlined {
4138 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4139 inner_offset = next_offset;
4140 } else {
4141 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4142 inner_depth.increment()?;
4143 }
4144 let val_ref = self.service_uuids.get_or_insert_with(|| {
4145 fidl::new_empty!(
4146 fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::Uuid>,
4147 D
4148 )
4149 });
4150 fidl::decode!(
4151 fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::Uuid>,
4152 D,
4153 val_ref,
4154 decoder,
4155 inner_offset,
4156 inner_depth
4157 )?;
4158 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4159 {
4160 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4161 }
4162 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4163 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4164 }
4165 }
4166
4167 next_offset += envelope_size;
4168 _next_ordinal_to_read += 1;
4169 if next_offset >= end_offset {
4170 return Ok(());
4171 }
4172
4173 while _next_ordinal_to_read < 5 {
4175 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4176 _next_ordinal_to_read += 1;
4177 next_offset += envelope_size;
4178 }
4179
4180 let next_out_of_line = decoder.next_out_of_line();
4181 let handles_before = decoder.remaining_handles();
4182 if let Some((inlined, num_bytes, num_handles)) =
4183 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4184 {
4185 let member_inline_size = <fidl::encoding::UnboundedVector<ServiceData> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4186 if inlined != (member_inline_size <= 4) {
4187 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4188 }
4189 let inner_offset;
4190 let mut inner_depth = depth.clone();
4191 if inlined {
4192 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4193 inner_offset = next_offset;
4194 } else {
4195 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4196 inner_depth.increment()?;
4197 }
4198 let val_ref = self.service_data.get_or_insert_with(|| {
4199 fidl::new_empty!(fidl::encoding::UnboundedVector<ServiceData>, D)
4200 });
4201 fidl::decode!(
4202 fidl::encoding::UnboundedVector<ServiceData>,
4203 D,
4204 val_ref,
4205 decoder,
4206 inner_offset,
4207 inner_depth
4208 )?;
4209 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4210 {
4211 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4212 }
4213 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4214 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4215 }
4216 }
4217
4218 next_offset += envelope_size;
4219 _next_ordinal_to_read += 1;
4220 if next_offset >= end_offset {
4221 return Ok(());
4222 }
4223
4224 while _next_ordinal_to_read < 6 {
4226 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4227 _next_ordinal_to_read += 1;
4228 next_offset += envelope_size;
4229 }
4230
4231 let next_out_of_line = decoder.next_out_of_line();
4232 let handles_before = decoder.remaining_handles();
4233 if let Some((inlined, num_bytes, num_handles)) =
4234 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4235 {
4236 let member_inline_size = <fidl::encoding::UnboundedVector<ManufacturerData> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4237 if inlined != (member_inline_size <= 4) {
4238 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4239 }
4240 let inner_offset;
4241 let mut inner_depth = depth.clone();
4242 if inlined {
4243 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4244 inner_offset = next_offset;
4245 } else {
4246 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4247 inner_depth.increment()?;
4248 }
4249 let val_ref = self.manufacturer_data.get_or_insert_with(|| {
4250 fidl::new_empty!(fidl::encoding::UnboundedVector<ManufacturerData>, D)
4251 });
4252 fidl::decode!(
4253 fidl::encoding::UnboundedVector<ManufacturerData>,
4254 D,
4255 val_ref,
4256 decoder,
4257 inner_offset,
4258 inner_depth
4259 )?;
4260 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4261 {
4262 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4263 }
4264 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4265 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4266 }
4267 }
4268
4269 next_offset += envelope_size;
4270 _next_ordinal_to_read += 1;
4271 if next_offset >= end_offset {
4272 return Ok(());
4273 }
4274
4275 while _next_ordinal_to_read < 7 {
4277 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4278 _next_ordinal_to_read += 1;
4279 next_offset += envelope_size;
4280 }
4281
4282 let next_out_of_line = decoder.next_out_of_line();
4283 let handles_before = decoder.remaining_handles();
4284 if let Some((inlined, num_bytes, num_handles)) =
4285 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4286 {
4287 let member_inline_size = <fidl::encoding::UnboundedVector<
4288 fidl::encoding::BoundedString<278>,
4289 > as fidl::encoding::TypeMarker>::inline_size(
4290 decoder.context
4291 );
4292 if inlined != (member_inline_size <= 4) {
4293 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4294 }
4295 let inner_offset;
4296 let mut inner_depth = depth.clone();
4297 if inlined {
4298 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4299 inner_offset = next_offset;
4300 } else {
4301 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4302 inner_depth.increment()?;
4303 }
4304 let val_ref = self.uris.get_or_insert_with(|| {
4305 fidl::new_empty!(
4306 fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<278>>,
4307 D
4308 )
4309 });
4310 fidl::decode!(
4311 fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<278>>,
4312 D,
4313 val_ref,
4314 decoder,
4315 inner_offset,
4316 inner_depth
4317 )?;
4318 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4319 {
4320 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4321 }
4322 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4323 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4324 }
4325 }
4326
4327 next_offset += envelope_size;
4328 _next_ordinal_to_read += 1;
4329 if next_offset >= end_offset {
4330 return Ok(());
4331 }
4332
4333 while _next_ordinal_to_read < 8 {
4335 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4336 _next_ordinal_to_read += 1;
4337 next_offset += envelope_size;
4338 }
4339
4340 let next_out_of_line = decoder.next_out_of_line();
4341 let handles_before = decoder.remaining_handles();
4342 if let Some((inlined, num_bytes, num_handles)) =
4343 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4344 {
4345 let member_inline_size =
4346 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4347 if inlined != (member_inline_size <= 4) {
4348 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4349 }
4350 let inner_offset;
4351 let mut inner_depth = depth.clone();
4352 if inlined {
4353 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4354 inner_offset = next_offset;
4355 } else {
4356 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4357 inner_depth.increment()?;
4358 }
4359 let val_ref =
4360 self.include_tx_power_level.get_or_insert_with(|| fidl::new_empty!(bool, D));
4361 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
4362 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4363 {
4364 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4365 }
4366 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4367 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4368 }
4369 }
4370
4371 next_offset += envelope_size;
4372 _next_ordinal_to_read += 1;
4373 if next_offset >= end_offset {
4374 return Ok(());
4375 }
4376
4377 while _next_ordinal_to_read < 9 {
4379 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4380 _next_ordinal_to_read += 1;
4381 next_offset += envelope_size;
4382 }
4383
4384 let next_out_of_line = decoder.next_out_of_line();
4385 let handles_before = decoder.remaining_handles();
4386 if let Some((inlined, num_bytes, num_handles)) =
4387 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4388 {
4389 let member_inline_size =
4390 <fidl::encoding::Array<u8, 6> as fidl::encoding::TypeMarker>::inline_size(
4391 decoder.context,
4392 );
4393 if inlined != (member_inline_size <= 4) {
4394 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4395 }
4396 let inner_offset;
4397 let mut inner_depth = depth.clone();
4398 if inlined {
4399 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4400 inner_offset = next_offset;
4401 } else {
4402 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4403 inner_depth.increment()?;
4404 }
4405 let val_ref = self
4406 .resolvable_set_identifier
4407 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<u8, 6>, D));
4408 fidl::decode!(fidl::encoding::Array<u8, 6>, D, val_ref, decoder, inner_offset, inner_depth)?;
4409 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4410 {
4411 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4412 }
4413 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4414 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4415 }
4416 }
4417
4418 next_offset += envelope_size;
4419 _next_ordinal_to_read += 1;
4420 if next_offset >= end_offset {
4421 return Ok(());
4422 }
4423
4424 while _next_ordinal_to_read < 10 {
4426 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4427 _next_ordinal_to_read += 1;
4428 next_offset += envelope_size;
4429 }
4430
4431 let next_out_of_line = decoder.next_out_of_line();
4432 let handles_before = decoder.remaining_handles();
4433 if let Some((inlined, num_bytes, num_handles)) =
4434 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4435 {
4436 let member_inline_size =
4437 <fidl::encoding::BoundedString<128> as fidl::encoding::TypeMarker>::inline_size(
4438 decoder.context,
4439 );
4440 if inlined != (member_inline_size <= 4) {
4441 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4442 }
4443 let inner_offset;
4444 let mut inner_depth = depth.clone();
4445 if inlined {
4446 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4447 inner_offset = next_offset;
4448 } else {
4449 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4450 inner_depth.increment()?;
4451 }
4452 let val_ref = self
4453 .broadcast_name
4454 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<128>, D));
4455 fidl::decode!(
4456 fidl::encoding::BoundedString<128>,
4457 D,
4458 val_ref,
4459 decoder,
4460 inner_offset,
4461 inner_depth
4462 )?;
4463 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4464 {
4465 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4466 }
4467 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4468 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4469 }
4470 }
4471
4472 next_offset += envelope_size;
4473
4474 while next_offset < end_offset {
4476 _next_ordinal_to_read += 1;
4477 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4478 next_offset += envelope_size;
4479 }
4480
4481 Ok(())
4482 }
4483 }
4484
4485 impl AdvertisingParameters {
4486 #[inline(always)]
4487 fn max_ordinal_present(&self) -> u64 {
4488 if let Some(_) = self.address_type {
4489 return 7;
4490 }
4491 if let Some(_) = self.advertising_procedure {
4492 return 6;
4493 }
4494 if let Some(_) = self.connection_options {
4495 return 5;
4496 }
4497 if let Some(_) = self.connectable {
4498 return 4;
4499 }
4500 if let Some(_) = self.mode_hint {
4501 return 3;
4502 }
4503 if let Some(_) = self.scan_response {
4504 return 2;
4505 }
4506 if let Some(_) = self.data {
4507 return 1;
4508 }
4509 0
4510 }
4511 }
4512
4513 impl fidl::encoding::ValueTypeMarker for AdvertisingParameters {
4514 type Borrowed<'a> = &'a Self;
4515 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4516 value
4517 }
4518 }
4519
4520 unsafe impl fidl::encoding::TypeMarker for AdvertisingParameters {
4521 type Owned = Self;
4522
4523 #[inline(always)]
4524 fn inline_align(_context: fidl::encoding::Context) -> usize {
4525 8
4526 }
4527
4528 #[inline(always)]
4529 fn inline_size(_context: fidl::encoding::Context) -> usize {
4530 16
4531 }
4532 }
4533
4534 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AdvertisingParameters, D>
4535 for &AdvertisingParameters
4536 {
4537 unsafe fn encode(
4538 self,
4539 encoder: &mut fidl::encoding::Encoder<'_, D>,
4540 offset: usize,
4541 mut depth: fidl::encoding::Depth,
4542 ) -> fidl::Result<()> {
4543 encoder.debug_check_bounds::<AdvertisingParameters>(offset);
4544 let max_ordinal: u64 = self.max_ordinal_present();
4546 encoder.write_num(max_ordinal, offset);
4547 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4548 if max_ordinal == 0 {
4550 return Ok(());
4551 }
4552 depth.increment()?;
4553 let envelope_size = 8;
4554 let bytes_len = max_ordinal as usize * envelope_size;
4555 #[allow(unused_variables)]
4556 let offset = encoder.out_of_line_offset(bytes_len);
4557 let mut _prev_end_offset: usize = 0;
4558 if 1 > max_ordinal {
4559 return Ok(());
4560 }
4561
4562 let cur_offset: usize = (1 - 1) * envelope_size;
4565
4566 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4568
4569 fidl::encoding::encode_in_envelope_optional::<AdvertisingData, D>(
4574 self.data
4575 .as_ref()
4576 .map(<AdvertisingData as fidl::encoding::ValueTypeMarker>::borrow),
4577 encoder,
4578 offset + cur_offset,
4579 depth,
4580 )?;
4581
4582 _prev_end_offset = cur_offset + envelope_size;
4583 if 2 > max_ordinal {
4584 return Ok(());
4585 }
4586
4587 let cur_offset: usize = (2 - 1) * envelope_size;
4590
4591 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4593
4594 fidl::encoding::encode_in_envelope_optional::<AdvertisingData, D>(
4599 self.scan_response
4600 .as_ref()
4601 .map(<AdvertisingData as fidl::encoding::ValueTypeMarker>::borrow),
4602 encoder,
4603 offset + cur_offset,
4604 depth,
4605 )?;
4606
4607 _prev_end_offset = cur_offset + envelope_size;
4608 if 3 > max_ordinal {
4609 return Ok(());
4610 }
4611
4612 let cur_offset: usize = (3 - 1) * envelope_size;
4615
4616 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4618
4619 fidl::encoding::encode_in_envelope_optional::<AdvertisingModeHint, D>(
4624 self.mode_hint
4625 .as_ref()
4626 .map(<AdvertisingModeHint as fidl::encoding::ValueTypeMarker>::borrow),
4627 encoder,
4628 offset + cur_offset,
4629 depth,
4630 )?;
4631
4632 _prev_end_offset = cur_offset + envelope_size;
4633 if 4 > max_ordinal {
4634 return Ok(());
4635 }
4636
4637 let cur_offset: usize = (4 - 1) * envelope_size;
4640
4641 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4643
4644 fidl::encoding::encode_in_envelope_optional::<bool, D>(
4649 self.connectable.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
4650 encoder,
4651 offset + cur_offset,
4652 depth,
4653 )?;
4654
4655 _prev_end_offset = cur_offset + envelope_size;
4656 if 5 > max_ordinal {
4657 return Ok(());
4658 }
4659
4660 let cur_offset: usize = (5 - 1) * envelope_size;
4663
4664 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4666
4667 fidl::encoding::encode_in_envelope_optional::<ConnectionOptions, D>(
4672 self.connection_options
4673 .as_ref()
4674 .map(<ConnectionOptions as fidl::encoding::ValueTypeMarker>::borrow),
4675 encoder,
4676 offset + cur_offset,
4677 depth,
4678 )?;
4679
4680 _prev_end_offset = cur_offset + envelope_size;
4681 if 6 > max_ordinal {
4682 return Ok(());
4683 }
4684
4685 let cur_offset: usize = (6 - 1) * envelope_size;
4688
4689 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4691
4692 fidl::encoding::encode_in_envelope_optional::<AdvertisingProcedure, D>(
4697 self.advertising_procedure
4698 .as_ref()
4699 .map(<AdvertisingProcedure as fidl::encoding::ValueTypeMarker>::borrow),
4700 encoder,
4701 offset + cur_offset,
4702 depth,
4703 )?;
4704
4705 _prev_end_offset = cur_offset + envelope_size;
4706 if 7 > max_ordinal {
4707 return Ok(());
4708 }
4709
4710 let cur_offset: usize = (7 - 1) * envelope_size;
4713
4714 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4716
4717 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::AddressType, D>(
4722 self.address_type.as_ref().map(<fidl_fuchsia_bluetooth::AddressType as fidl::encoding::ValueTypeMarker>::borrow),
4723 encoder, offset + cur_offset, depth
4724 )?;
4725
4726 _prev_end_offset = cur_offset + envelope_size;
4727
4728 Ok(())
4729 }
4730 }
4731
4732 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AdvertisingParameters {
4733 #[inline(always)]
4734 fn new_empty() -> Self {
4735 Self::default()
4736 }
4737
4738 unsafe fn decode(
4739 &mut self,
4740 decoder: &mut fidl::encoding::Decoder<'_, D>,
4741 offset: usize,
4742 mut depth: fidl::encoding::Depth,
4743 ) -> fidl::Result<()> {
4744 decoder.debug_check_bounds::<Self>(offset);
4745 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4746 None => return Err(fidl::Error::NotNullable),
4747 Some(len) => len,
4748 };
4749 if len == 0 {
4751 return Ok(());
4752 };
4753 depth.increment()?;
4754 let envelope_size = 8;
4755 let bytes_len = len * envelope_size;
4756 let offset = decoder.out_of_line_offset(bytes_len)?;
4757 let mut _next_ordinal_to_read = 0;
4759 let mut next_offset = offset;
4760 let end_offset = offset + bytes_len;
4761 _next_ordinal_to_read += 1;
4762 if next_offset >= end_offset {
4763 return Ok(());
4764 }
4765
4766 while _next_ordinal_to_read < 1 {
4768 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4769 _next_ordinal_to_read += 1;
4770 next_offset += envelope_size;
4771 }
4772
4773 let next_out_of_line = decoder.next_out_of_line();
4774 let handles_before = decoder.remaining_handles();
4775 if let Some((inlined, num_bytes, num_handles)) =
4776 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4777 {
4778 let member_inline_size =
4779 <AdvertisingData as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4780 if inlined != (member_inline_size <= 4) {
4781 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4782 }
4783 let inner_offset;
4784 let mut inner_depth = depth.clone();
4785 if inlined {
4786 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4787 inner_offset = next_offset;
4788 } else {
4789 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4790 inner_depth.increment()?;
4791 }
4792 let val_ref = self.data.get_or_insert_with(|| fidl::new_empty!(AdvertisingData, D));
4793 fidl::decode!(AdvertisingData, D, val_ref, decoder, inner_offset, inner_depth)?;
4794 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4795 {
4796 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4797 }
4798 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4799 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4800 }
4801 }
4802
4803 next_offset += envelope_size;
4804 _next_ordinal_to_read += 1;
4805 if next_offset >= end_offset {
4806 return Ok(());
4807 }
4808
4809 while _next_ordinal_to_read < 2 {
4811 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4812 _next_ordinal_to_read += 1;
4813 next_offset += envelope_size;
4814 }
4815
4816 let next_out_of_line = decoder.next_out_of_line();
4817 let handles_before = decoder.remaining_handles();
4818 if let Some((inlined, num_bytes, num_handles)) =
4819 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4820 {
4821 let member_inline_size =
4822 <AdvertisingData as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4823 if inlined != (member_inline_size <= 4) {
4824 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4825 }
4826 let inner_offset;
4827 let mut inner_depth = depth.clone();
4828 if inlined {
4829 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4830 inner_offset = next_offset;
4831 } else {
4832 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4833 inner_depth.increment()?;
4834 }
4835 let val_ref =
4836 self.scan_response.get_or_insert_with(|| fidl::new_empty!(AdvertisingData, D));
4837 fidl::decode!(AdvertisingData, D, val_ref, decoder, inner_offset, inner_depth)?;
4838 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4839 {
4840 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4841 }
4842 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4843 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4844 }
4845 }
4846
4847 next_offset += envelope_size;
4848 _next_ordinal_to_read += 1;
4849 if next_offset >= end_offset {
4850 return Ok(());
4851 }
4852
4853 while _next_ordinal_to_read < 3 {
4855 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4856 _next_ordinal_to_read += 1;
4857 next_offset += envelope_size;
4858 }
4859
4860 let next_out_of_line = decoder.next_out_of_line();
4861 let handles_before = decoder.remaining_handles();
4862 if let Some((inlined, num_bytes, num_handles)) =
4863 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4864 {
4865 let member_inline_size =
4866 <AdvertisingModeHint as fidl::encoding::TypeMarker>::inline_size(
4867 decoder.context,
4868 );
4869 if inlined != (member_inline_size <= 4) {
4870 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4871 }
4872 let inner_offset;
4873 let mut inner_depth = depth.clone();
4874 if inlined {
4875 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4876 inner_offset = next_offset;
4877 } else {
4878 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4879 inner_depth.increment()?;
4880 }
4881 let val_ref =
4882 self.mode_hint.get_or_insert_with(|| fidl::new_empty!(AdvertisingModeHint, D));
4883 fidl::decode!(AdvertisingModeHint, D, val_ref, decoder, inner_offset, inner_depth)?;
4884 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4885 {
4886 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4887 }
4888 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4889 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4890 }
4891 }
4892
4893 next_offset += envelope_size;
4894 _next_ordinal_to_read += 1;
4895 if next_offset >= end_offset {
4896 return Ok(());
4897 }
4898
4899 while _next_ordinal_to_read < 4 {
4901 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4902 _next_ordinal_to_read += 1;
4903 next_offset += envelope_size;
4904 }
4905
4906 let next_out_of_line = decoder.next_out_of_line();
4907 let handles_before = decoder.remaining_handles();
4908 if let Some((inlined, num_bytes, num_handles)) =
4909 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4910 {
4911 let member_inline_size =
4912 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4913 if inlined != (member_inline_size <= 4) {
4914 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4915 }
4916 let inner_offset;
4917 let mut inner_depth = depth.clone();
4918 if inlined {
4919 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4920 inner_offset = next_offset;
4921 } else {
4922 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4923 inner_depth.increment()?;
4924 }
4925 let val_ref = self.connectable.get_or_insert_with(|| fidl::new_empty!(bool, D));
4926 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
4927 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4928 {
4929 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4930 }
4931 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4932 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4933 }
4934 }
4935
4936 next_offset += envelope_size;
4937 _next_ordinal_to_read += 1;
4938 if next_offset >= end_offset {
4939 return Ok(());
4940 }
4941
4942 while _next_ordinal_to_read < 5 {
4944 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4945 _next_ordinal_to_read += 1;
4946 next_offset += envelope_size;
4947 }
4948
4949 let next_out_of_line = decoder.next_out_of_line();
4950 let handles_before = decoder.remaining_handles();
4951 if let Some((inlined, num_bytes, num_handles)) =
4952 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4953 {
4954 let member_inline_size =
4955 <ConnectionOptions as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4956 if inlined != (member_inline_size <= 4) {
4957 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4958 }
4959 let inner_offset;
4960 let mut inner_depth = depth.clone();
4961 if inlined {
4962 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4963 inner_offset = next_offset;
4964 } else {
4965 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4966 inner_depth.increment()?;
4967 }
4968 let val_ref = self
4969 .connection_options
4970 .get_or_insert_with(|| fidl::new_empty!(ConnectionOptions, D));
4971 fidl::decode!(ConnectionOptions, D, val_ref, decoder, inner_offset, inner_depth)?;
4972 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4973 {
4974 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4975 }
4976 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4977 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4978 }
4979 }
4980
4981 next_offset += envelope_size;
4982 _next_ordinal_to_read += 1;
4983 if next_offset >= end_offset {
4984 return Ok(());
4985 }
4986
4987 while _next_ordinal_to_read < 6 {
4989 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4990 _next_ordinal_to_read += 1;
4991 next_offset += envelope_size;
4992 }
4993
4994 let next_out_of_line = decoder.next_out_of_line();
4995 let handles_before = decoder.remaining_handles();
4996 if let Some((inlined, num_bytes, num_handles)) =
4997 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4998 {
4999 let member_inline_size =
5000 <AdvertisingProcedure as fidl::encoding::TypeMarker>::inline_size(
5001 decoder.context,
5002 );
5003 if inlined != (member_inline_size <= 4) {
5004 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5005 }
5006 let inner_offset;
5007 let mut inner_depth = depth.clone();
5008 if inlined {
5009 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5010 inner_offset = next_offset;
5011 } else {
5012 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5013 inner_depth.increment()?;
5014 }
5015 let val_ref = self
5016 .advertising_procedure
5017 .get_or_insert_with(|| fidl::new_empty!(AdvertisingProcedure, D));
5018 fidl::decode!(
5019 AdvertisingProcedure,
5020 D,
5021 val_ref,
5022 decoder,
5023 inner_offset,
5024 inner_depth
5025 )?;
5026 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5027 {
5028 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5029 }
5030 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5031 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5032 }
5033 }
5034
5035 next_offset += envelope_size;
5036 _next_ordinal_to_read += 1;
5037 if next_offset >= end_offset {
5038 return Ok(());
5039 }
5040
5041 while _next_ordinal_to_read < 7 {
5043 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5044 _next_ordinal_to_read += 1;
5045 next_offset += envelope_size;
5046 }
5047
5048 let next_out_of_line = decoder.next_out_of_line();
5049 let handles_before = decoder.remaining_handles();
5050 if let Some((inlined, num_bytes, num_handles)) =
5051 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5052 {
5053 let member_inline_size = <fidl_fuchsia_bluetooth::AddressType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5054 if inlined != (member_inline_size <= 4) {
5055 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5056 }
5057 let inner_offset;
5058 let mut inner_depth = depth.clone();
5059 if inlined {
5060 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5061 inner_offset = next_offset;
5062 } else {
5063 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5064 inner_depth.increment()?;
5065 }
5066 let val_ref = self.address_type.get_or_insert_with(|| {
5067 fidl::new_empty!(fidl_fuchsia_bluetooth::AddressType, D)
5068 });
5069 fidl::decode!(
5070 fidl_fuchsia_bluetooth::AddressType,
5071 D,
5072 val_ref,
5073 decoder,
5074 inner_offset,
5075 inner_depth
5076 )?;
5077 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5078 {
5079 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5080 }
5081 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5082 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5083 }
5084 }
5085
5086 next_offset += envelope_size;
5087
5088 while next_offset < end_offset {
5090 _next_ordinal_to_read += 1;
5091 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5092 next_offset += envelope_size;
5093 }
5094
5095 Ok(())
5096 }
5097 }
5098
5099 impl ChannelListenerRegistryListenL2capResponse {
5100 #[inline(always)]
5101 fn max_ordinal_present(&self) -> u64 {
5102 if let Some(_) = self.psm {
5103 return 1;
5104 }
5105 0
5106 }
5107 }
5108
5109 impl fidl::encoding::ValueTypeMarker for ChannelListenerRegistryListenL2capResponse {
5110 type Borrowed<'a> = &'a Self;
5111 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5112 value
5113 }
5114 }
5115
5116 unsafe impl fidl::encoding::TypeMarker for ChannelListenerRegistryListenL2capResponse {
5117 type Owned = Self;
5118
5119 #[inline(always)]
5120 fn inline_align(_context: fidl::encoding::Context) -> usize {
5121 8
5122 }
5123
5124 #[inline(always)]
5125 fn inline_size(_context: fidl::encoding::Context) -> usize {
5126 16
5127 }
5128 }
5129
5130 unsafe impl<D: fidl::encoding::ResourceDialect>
5131 fidl::encoding::Encode<ChannelListenerRegistryListenL2capResponse, D>
5132 for &ChannelListenerRegistryListenL2capResponse
5133 {
5134 unsafe fn encode(
5135 self,
5136 encoder: &mut fidl::encoding::Encoder<'_, D>,
5137 offset: usize,
5138 mut depth: fidl::encoding::Depth,
5139 ) -> fidl::Result<()> {
5140 encoder.debug_check_bounds::<ChannelListenerRegistryListenL2capResponse>(offset);
5141 let max_ordinal: u64 = self.max_ordinal_present();
5143 encoder.write_num(max_ordinal, offset);
5144 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5145 if max_ordinal == 0 {
5147 return Ok(());
5148 }
5149 depth.increment()?;
5150 let envelope_size = 8;
5151 let bytes_len = max_ordinal as usize * envelope_size;
5152 #[allow(unused_variables)]
5153 let offset = encoder.out_of_line_offset(bytes_len);
5154 let mut _prev_end_offset: usize = 0;
5155 if 1 > max_ordinal {
5156 return Ok(());
5157 }
5158
5159 let cur_offset: usize = (1 - 1) * envelope_size;
5162
5163 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5165
5166 fidl::encoding::encode_in_envelope_optional::<u16, D>(
5171 self.psm.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
5172 encoder,
5173 offset + cur_offset,
5174 depth,
5175 )?;
5176
5177 _prev_end_offset = cur_offset + envelope_size;
5178
5179 Ok(())
5180 }
5181 }
5182
5183 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
5184 for ChannelListenerRegistryListenL2capResponse
5185 {
5186 #[inline(always)]
5187 fn new_empty() -> Self {
5188 Self::default()
5189 }
5190
5191 unsafe fn decode(
5192 &mut self,
5193 decoder: &mut fidl::encoding::Decoder<'_, D>,
5194 offset: usize,
5195 mut depth: fidl::encoding::Depth,
5196 ) -> fidl::Result<()> {
5197 decoder.debug_check_bounds::<Self>(offset);
5198 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5199 None => return Err(fidl::Error::NotNullable),
5200 Some(len) => len,
5201 };
5202 if len == 0 {
5204 return Ok(());
5205 };
5206 depth.increment()?;
5207 let envelope_size = 8;
5208 let bytes_len = len * envelope_size;
5209 let offset = decoder.out_of_line_offset(bytes_len)?;
5210 let mut _next_ordinal_to_read = 0;
5212 let mut next_offset = offset;
5213 let end_offset = offset + bytes_len;
5214 _next_ordinal_to_read += 1;
5215 if next_offset >= end_offset {
5216 return Ok(());
5217 }
5218
5219 while _next_ordinal_to_read < 1 {
5221 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5222 _next_ordinal_to_read += 1;
5223 next_offset += envelope_size;
5224 }
5225
5226 let next_out_of_line = decoder.next_out_of_line();
5227 let handles_before = decoder.remaining_handles();
5228 if let Some((inlined, num_bytes, num_handles)) =
5229 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5230 {
5231 let member_inline_size =
5232 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5233 if inlined != (member_inline_size <= 4) {
5234 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5235 }
5236 let inner_offset;
5237 let mut inner_depth = depth.clone();
5238 if inlined {
5239 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5240 inner_offset = next_offset;
5241 } else {
5242 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5243 inner_depth.increment()?;
5244 }
5245 let val_ref = self.psm.get_or_insert_with(|| fidl::new_empty!(u16, D));
5246 fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
5247 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5248 {
5249 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5250 }
5251 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5252 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5253 }
5254 }
5255
5256 next_offset += envelope_size;
5257
5258 while next_offset < end_offset {
5260 _next_ordinal_to_read += 1;
5261 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5262 next_offset += envelope_size;
5263 }
5264
5265 Ok(())
5266 }
5267 }
5268
5269 impl CisEstablishedParameters {
5270 #[inline(always)]
5271 fn max_ordinal_present(&self) -> u64 {
5272 if let Some(_) = self.peripheral_to_central_params {
5273 return 6;
5274 }
5275 if let Some(_) = self.central_to_peripheral_params {
5276 return 5;
5277 }
5278 if let Some(_) = self.iso_interval {
5279 return 4;
5280 }
5281 if let Some(_) = self.max_subevents {
5282 return 3;
5283 }
5284 if let Some(_) = self.cis_sync_delay {
5285 return 2;
5286 }
5287 if let Some(_) = self.cig_sync_delay {
5288 return 1;
5289 }
5290 0
5291 }
5292 }
5293
5294 impl fidl::encoding::ValueTypeMarker for CisEstablishedParameters {
5295 type Borrowed<'a> = &'a Self;
5296 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5297 value
5298 }
5299 }
5300
5301 unsafe impl fidl::encoding::TypeMarker for CisEstablishedParameters {
5302 type Owned = Self;
5303
5304 #[inline(always)]
5305 fn inline_align(_context: fidl::encoding::Context) -> usize {
5306 8
5307 }
5308
5309 #[inline(always)]
5310 fn inline_size(_context: fidl::encoding::Context) -> usize {
5311 16
5312 }
5313 }
5314
5315 unsafe impl<D: fidl::encoding::ResourceDialect>
5316 fidl::encoding::Encode<CisEstablishedParameters, D> for &CisEstablishedParameters
5317 {
5318 unsafe fn encode(
5319 self,
5320 encoder: &mut fidl::encoding::Encoder<'_, D>,
5321 offset: usize,
5322 mut depth: fidl::encoding::Depth,
5323 ) -> fidl::Result<()> {
5324 encoder.debug_check_bounds::<CisEstablishedParameters>(offset);
5325 let max_ordinal: u64 = self.max_ordinal_present();
5327 encoder.write_num(max_ordinal, offset);
5328 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5329 if max_ordinal == 0 {
5331 return Ok(());
5332 }
5333 depth.increment()?;
5334 let envelope_size = 8;
5335 let bytes_len = max_ordinal as usize * envelope_size;
5336 #[allow(unused_variables)]
5337 let offset = encoder.out_of_line_offset(bytes_len);
5338 let mut _prev_end_offset: usize = 0;
5339 if 1 > max_ordinal {
5340 return Ok(());
5341 }
5342
5343 let cur_offset: usize = (1 - 1) * envelope_size;
5346
5347 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5349
5350 fidl::encoding::encode_in_envelope_optional::<i64, D>(
5355 self.cig_sync_delay.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
5356 encoder,
5357 offset + cur_offset,
5358 depth,
5359 )?;
5360
5361 _prev_end_offset = cur_offset + envelope_size;
5362 if 2 > max_ordinal {
5363 return Ok(());
5364 }
5365
5366 let cur_offset: usize = (2 - 1) * envelope_size;
5369
5370 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5372
5373 fidl::encoding::encode_in_envelope_optional::<i64, D>(
5378 self.cis_sync_delay.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
5379 encoder,
5380 offset + cur_offset,
5381 depth,
5382 )?;
5383
5384 _prev_end_offset = cur_offset + envelope_size;
5385 if 3 > max_ordinal {
5386 return Ok(());
5387 }
5388
5389 let cur_offset: usize = (3 - 1) * envelope_size;
5392
5393 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5395
5396 fidl::encoding::encode_in_envelope_optional::<u8, D>(
5401 self.max_subevents.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
5402 encoder,
5403 offset + cur_offset,
5404 depth,
5405 )?;
5406
5407 _prev_end_offset = cur_offset + envelope_size;
5408 if 4 > max_ordinal {
5409 return Ok(());
5410 }
5411
5412 let cur_offset: usize = (4 - 1) * envelope_size;
5415
5416 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5418
5419 fidl::encoding::encode_in_envelope_optional::<i64, D>(
5424 self.iso_interval.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
5425 encoder,
5426 offset + cur_offset,
5427 depth,
5428 )?;
5429
5430 _prev_end_offset = cur_offset + envelope_size;
5431 if 5 > max_ordinal {
5432 return Ok(());
5433 }
5434
5435 let cur_offset: usize = (5 - 1) * envelope_size;
5438
5439 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5441
5442 fidl::encoding::encode_in_envelope_optional::<CisUnidirectionalParams, D>(
5447 self.central_to_peripheral_params
5448 .as_ref()
5449 .map(<CisUnidirectionalParams as fidl::encoding::ValueTypeMarker>::borrow),
5450 encoder,
5451 offset + cur_offset,
5452 depth,
5453 )?;
5454
5455 _prev_end_offset = cur_offset + envelope_size;
5456 if 6 > max_ordinal {
5457 return Ok(());
5458 }
5459
5460 let cur_offset: usize = (6 - 1) * envelope_size;
5463
5464 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5466
5467 fidl::encoding::encode_in_envelope_optional::<CisUnidirectionalParams, D>(
5472 self.peripheral_to_central_params
5473 .as_ref()
5474 .map(<CisUnidirectionalParams as fidl::encoding::ValueTypeMarker>::borrow),
5475 encoder,
5476 offset + cur_offset,
5477 depth,
5478 )?;
5479
5480 _prev_end_offset = cur_offset + envelope_size;
5481
5482 Ok(())
5483 }
5484 }
5485
5486 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
5487 for CisEstablishedParameters
5488 {
5489 #[inline(always)]
5490 fn new_empty() -> Self {
5491 Self::default()
5492 }
5493
5494 unsafe fn decode(
5495 &mut self,
5496 decoder: &mut fidl::encoding::Decoder<'_, D>,
5497 offset: usize,
5498 mut depth: fidl::encoding::Depth,
5499 ) -> fidl::Result<()> {
5500 decoder.debug_check_bounds::<Self>(offset);
5501 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5502 None => return Err(fidl::Error::NotNullable),
5503 Some(len) => len,
5504 };
5505 if len == 0 {
5507 return Ok(());
5508 };
5509 depth.increment()?;
5510 let envelope_size = 8;
5511 let bytes_len = len * envelope_size;
5512 let offset = decoder.out_of_line_offset(bytes_len)?;
5513 let mut _next_ordinal_to_read = 0;
5515 let mut next_offset = offset;
5516 let end_offset = offset + bytes_len;
5517 _next_ordinal_to_read += 1;
5518 if next_offset >= end_offset {
5519 return Ok(());
5520 }
5521
5522 while _next_ordinal_to_read < 1 {
5524 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5525 _next_ordinal_to_read += 1;
5526 next_offset += envelope_size;
5527 }
5528
5529 let next_out_of_line = decoder.next_out_of_line();
5530 let handles_before = decoder.remaining_handles();
5531 if let Some((inlined, num_bytes, num_handles)) =
5532 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5533 {
5534 let member_inline_size =
5535 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5536 if inlined != (member_inline_size <= 4) {
5537 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5538 }
5539 let inner_offset;
5540 let mut inner_depth = depth.clone();
5541 if inlined {
5542 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5543 inner_offset = next_offset;
5544 } else {
5545 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5546 inner_depth.increment()?;
5547 }
5548 let val_ref = self.cig_sync_delay.get_or_insert_with(|| fidl::new_empty!(i64, D));
5549 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
5550 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5551 {
5552 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5553 }
5554 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5555 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5556 }
5557 }
5558
5559 next_offset += envelope_size;
5560 _next_ordinal_to_read += 1;
5561 if next_offset >= end_offset {
5562 return Ok(());
5563 }
5564
5565 while _next_ordinal_to_read < 2 {
5567 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5568 _next_ordinal_to_read += 1;
5569 next_offset += envelope_size;
5570 }
5571
5572 let next_out_of_line = decoder.next_out_of_line();
5573 let handles_before = decoder.remaining_handles();
5574 if let Some((inlined, num_bytes, num_handles)) =
5575 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5576 {
5577 let member_inline_size =
5578 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5579 if inlined != (member_inline_size <= 4) {
5580 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5581 }
5582 let inner_offset;
5583 let mut inner_depth = depth.clone();
5584 if inlined {
5585 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5586 inner_offset = next_offset;
5587 } else {
5588 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5589 inner_depth.increment()?;
5590 }
5591 let val_ref = self.cis_sync_delay.get_or_insert_with(|| fidl::new_empty!(i64, D));
5592 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
5593 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5594 {
5595 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5596 }
5597 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5598 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5599 }
5600 }
5601
5602 next_offset += envelope_size;
5603 _next_ordinal_to_read += 1;
5604 if next_offset >= end_offset {
5605 return Ok(());
5606 }
5607
5608 while _next_ordinal_to_read < 3 {
5610 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5611 _next_ordinal_to_read += 1;
5612 next_offset += envelope_size;
5613 }
5614
5615 let next_out_of_line = decoder.next_out_of_line();
5616 let handles_before = decoder.remaining_handles();
5617 if let Some((inlined, num_bytes, num_handles)) =
5618 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5619 {
5620 let member_inline_size =
5621 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5622 if inlined != (member_inline_size <= 4) {
5623 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5624 }
5625 let inner_offset;
5626 let mut inner_depth = depth.clone();
5627 if inlined {
5628 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5629 inner_offset = next_offset;
5630 } else {
5631 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5632 inner_depth.increment()?;
5633 }
5634 let val_ref = self.max_subevents.get_or_insert_with(|| fidl::new_empty!(u8, D));
5635 fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
5636 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5637 {
5638 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5639 }
5640 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5641 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5642 }
5643 }
5644
5645 next_offset += envelope_size;
5646 _next_ordinal_to_read += 1;
5647 if next_offset >= end_offset {
5648 return Ok(());
5649 }
5650
5651 while _next_ordinal_to_read < 4 {
5653 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5654 _next_ordinal_to_read += 1;
5655 next_offset += envelope_size;
5656 }
5657
5658 let next_out_of_line = decoder.next_out_of_line();
5659 let handles_before = decoder.remaining_handles();
5660 if let Some((inlined, num_bytes, num_handles)) =
5661 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5662 {
5663 let member_inline_size =
5664 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5665 if inlined != (member_inline_size <= 4) {
5666 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5667 }
5668 let inner_offset;
5669 let mut inner_depth = depth.clone();
5670 if inlined {
5671 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5672 inner_offset = next_offset;
5673 } else {
5674 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5675 inner_depth.increment()?;
5676 }
5677 let val_ref = self.iso_interval.get_or_insert_with(|| fidl::new_empty!(i64, D));
5678 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
5679 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5680 {
5681 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5682 }
5683 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5684 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5685 }
5686 }
5687
5688 next_offset += envelope_size;
5689 _next_ordinal_to_read += 1;
5690 if next_offset >= end_offset {
5691 return Ok(());
5692 }
5693
5694 while _next_ordinal_to_read < 5 {
5696 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5697 _next_ordinal_to_read += 1;
5698 next_offset += envelope_size;
5699 }
5700
5701 let next_out_of_line = decoder.next_out_of_line();
5702 let handles_before = decoder.remaining_handles();
5703 if let Some((inlined, num_bytes, num_handles)) =
5704 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5705 {
5706 let member_inline_size =
5707 <CisUnidirectionalParams as fidl::encoding::TypeMarker>::inline_size(
5708 decoder.context,
5709 );
5710 if inlined != (member_inline_size <= 4) {
5711 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5712 }
5713 let inner_offset;
5714 let mut inner_depth = depth.clone();
5715 if inlined {
5716 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5717 inner_offset = next_offset;
5718 } else {
5719 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5720 inner_depth.increment()?;
5721 }
5722 let val_ref = self
5723 .central_to_peripheral_params
5724 .get_or_insert_with(|| fidl::new_empty!(CisUnidirectionalParams, D));
5725 fidl::decode!(
5726 CisUnidirectionalParams,
5727 D,
5728 val_ref,
5729 decoder,
5730 inner_offset,
5731 inner_depth
5732 )?;
5733 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5734 {
5735 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5736 }
5737 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5738 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5739 }
5740 }
5741
5742 next_offset += envelope_size;
5743 _next_ordinal_to_read += 1;
5744 if next_offset >= end_offset {
5745 return Ok(());
5746 }
5747
5748 while _next_ordinal_to_read < 6 {
5750 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5751 _next_ordinal_to_read += 1;
5752 next_offset += envelope_size;
5753 }
5754
5755 let next_out_of_line = decoder.next_out_of_line();
5756 let handles_before = decoder.remaining_handles();
5757 if let Some((inlined, num_bytes, num_handles)) =
5758 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5759 {
5760 let member_inline_size =
5761 <CisUnidirectionalParams as fidl::encoding::TypeMarker>::inline_size(
5762 decoder.context,
5763 );
5764 if inlined != (member_inline_size <= 4) {
5765 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5766 }
5767 let inner_offset;
5768 let mut inner_depth = depth.clone();
5769 if inlined {
5770 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5771 inner_offset = next_offset;
5772 } else {
5773 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5774 inner_depth.increment()?;
5775 }
5776 let val_ref = self
5777 .peripheral_to_central_params
5778 .get_or_insert_with(|| fidl::new_empty!(CisUnidirectionalParams, D));
5779 fidl::decode!(
5780 CisUnidirectionalParams,
5781 D,
5782 val_ref,
5783 decoder,
5784 inner_offset,
5785 inner_depth
5786 )?;
5787 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5788 {
5789 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5790 }
5791 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5792 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5793 }
5794 }
5795
5796 next_offset += envelope_size;
5797
5798 while next_offset < end_offset {
5800 _next_ordinal_to_read += 1;
5801 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5802 next_offset += envelope_size;
5803 }
5804
5805 Ok(())
5806 }
5807 }
5808
5809 impl CisUnidirectionalParams {
5810 #[inline(always)]
5811 fn max_ordinal_present(&self) -> u64 {
5812 if let Some(_) = self.flush_timeout {
5813 return 3;
5814 }
5815 if let Some(_) = self.burst_number {
5816 return 2;
5817 }
5818 if let Some(_) = self.transport_latency {
5819 return 1;
5820 }
5821 0
5822 }
5823 }
5824
5825 impl fidl::encoding::ValueTypeMarker for CisUnidirectionalParams {
5826 type Borrowed<'a> = &'a Self;
5827 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5828 value
5829 }
5830 }
5831
5832 unsafe impl fidl::encoding::TypeMarker for CisUnidirectionalParams {
5833 type Owned = Self;
5834
5835 #[inline(always)]
5836 fn inline_align(_context: fidl::encoding::Context) -> usize {
5837 8
5838 }
5839
5840 #[inline(always)]
5841 fn inline_size(_context: fidl::encoding::Context) -> usize {
5842 16
5843 }
5844 }
5845
5846 unsafe impl<D: fidl::encoding::ResourceDialect>
5847 fidl::encoding::Encode<CisUnidirectionalParams, D> for &CisUnidirectionalParams
5848 {
5849 unsafe fn encode(
5850 self,
5851 encoder: &mut fidl::encoding::Encoder<'_, D>,
5852 offset: usize,
5853 mut depth: fidl::encoding::Depth,
5854 ) -> fidl::Result<()> {
5855 encoder.debug_check_bounds::<CisUnidirectionalParams>(offset);
5856 let max_ordinal: u64 = self.max_ordinal_present();
5858 encoder.write_num(max_ordinal, offset);
5859 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5860 if max_ordinal == 0 {
5862 return Ok(());
5863 }
5864 depth.increment()?;
5865 let envelope_size = 8;
5866 let bytes_len = max_ordinal as usize * envelope_size;
5867 #[allow(unused_variables)]
5868 let offset = encoder.out_of_line_offset(bytes_len);
5869 let mut _prev_end_offset: usize = 0;
5870 if 1 > max_ordinal {
5871 return Ok(());
5872 }
5873
5874 let cur_offset: usize = (1 - 1) * envelope_size;
5877
5878 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5880
5881 fidl::encoding::encode_in_envelope_optional::<i64, D>(
5886 self.transport_latency
5887 .as_ref()
5888 .map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
5889 encoder,
5890 offset + cur_offset,
5891 depth,
5892 )?;
5893
5894 _prev_end_offset = cur_offset + envelope_size;
5895 if 2 > max_ordinal {
5896 return Ok(());
5897 }
5898
5899 let cur_offset: usize = (2 - 1) * envelope_size;
5902
5903 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5905
5906 fidl::encoding::encode_in_envelope_optional::<u8, D>(
5911 self.burst_number.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
5912 encoder,
5913 offset + cur_offset,
5914 depth,
5915 )?;
5916
5917 _prev_end_offset = cur_offset + envelope_size;
5918 if 3 > max_ordinal {
5919 return Ok(());
5920 }
5921
5922 let cur_offset: usize = (3 - 1) * envelope_size;
5925
5926 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5928
5929 fidl::encoding::encode_in_envelope_optional::<u8, D>(
5934 self.flush_timeout.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
5935 encoder,
5936 offset + cur_offset,
5937 depth,
5938 )?;
5939
5940 _prev_end_offset = cur_offset + envelope_size;
5941
5942 Ok(())
5943 }
5944 }
5945
5946 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
5947 for CisUnidirectionalParams
5948 {
5949 #[inline(always)]
5950 fn new_empty() -> Self {
5951 Self::default()
5952 }
5953
5954 unsafe fn decode(
5955 &mut self,
5956 decoder: &mut fidl::encoding::Decoder<'_, D>,
5957 offset: usize,
5958 mut depth: fidl::encoding::Depth,
5959 ) -> fidl::Result<()> {
5960 decoder.debug_check_bounds::<Self>(offset);
5961 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5962 None => return Err(fidl::Error::NotNullable),
5963 Some(len) => len,
5964 };
5965 if len == 0 {
5967 return Ok(());
5968 };
5969 depth.increment()?;
5970 let envelope_size = 8;
5971 let bytes_len = len * envelope_size;
5972 let offset = decoder.out_of_line_offset(bytes_len)?;
5973 let mut _next_ordinal_to_read = 0;
5975 let mut next_offset = offset;
5976 let end_offset = offset + bytes_len;
5977 _next_ordinal_to_read += 1;
5978 if next_offset >= end_offset {
5979 return Ok(());
5980 }
5981
5982 while _next_ordinal_to_read < 1 {
5984 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5985 _next_ordinal_to_read += 1;
5986 next_offset += envelope_size;
5987 }
5988
5989 let next_out_of_line = decoder.next_out_of_line();
5990 let handles_before = decoder.remaining_handles();
5991 if let Some((inlined, num_bytes, num_handles)) =
5992 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5993 {
5994 let member_inline_size =
5995 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5996 if inlined != (member_inline_size <= 4) {
5997 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5998 }
5999 let inner_offset;
6000 let mut inner_depth = depth.clone();
6001 if inlined {
6002 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6003 inner_offset = next_offset;
6004 } else {
6005 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6006 inner_depth.increment()?;
6007 }
6008 let val_ref =
6009 self.transport_latency.get_or_insert_with(|| fidl::new_empty!(i64, D));
6010 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
6011 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6012 {
6013 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6014 }
6015 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6016 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6017 }
6018 }
6019
6020 next_offset += envelope_size;
6021 _next_ordinal_to_read += 1;
6022 if next_offset >= end_offset {
6023 return Ok(());
6024 }
6025
6026 while _next_ordinal_to_read < 2 {
6028 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6029 _next_ordinal_to_read += 1;
6030 next_offset += envelope_size;
6031 }
6032
6033 let next_out_of_line = decoder.next_out_of_line();
6034 let handles_before = decoder.remaining_handles();
6035 if let Some((inlined, num_bytes, num_handles)) =
6036 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6037 {
6038 let member_inline_size =
6039 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6040 if inlined != (member_inline_size <= 4) {
6041 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6042 }
6043 let inner_offset;
6044 let mut inner_depth = depth.clone();
6045 if inlined {
6046 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6047 inner_offset = next_offset;
6048 } else {
6049 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6050 inner_depth.increment()?;
6051 }
6052 let val_ref = self.burst_number.get_or_insert_with(|| fidl::new_empty!(u8, D));
6053 fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
6054 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6055 {
6056 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6057 }
6058 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6059 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6060 }
6061 }
6062
6063 next_offset += envelope_size;
6064 _next_ordinal_to_read += 1;
6065 if next_offset >= end_offset {
6066 return Ok(());
6067 }
6068
6069 while _next_ordinal_to_read < 3 {
6071 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6072 _next_ordinal_to_read += 1;
6073 next_offset += envelope_size;
6074 }
6075
6076 let next_out_of_line = decoder.next_out_of_line();
6077 let handles_before = decoder.remaining_handles();
6078 if let Some((inlined, num_bytes, num_handles)) =
6079 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6080 {
6081 let member_inline_size =
6082 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6083 if inlined != (member_inline_size <= 4) {
6084 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6085 }
6086 let inner_offset;
6087 let mut inner_depth = depth.clone();
6088 if inlined {
6089 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6090 inner_offset = next_offset;
6091 } else {
6092 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6093 inner_depth.increment()?;
6094 }
6095 let val_ref = self.flush_timeout.get_or_insert_with(|| fidl::new_empty!(u8, D));
6096 fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
6097 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6098 {
6099 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6100 }
6101 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6102 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6103 }
6104 }
6105
6106 next_offset += envelope_size;
6107
6108 while next_offset < end_offset {
6110 _next_ordinal_to_read += 1;
6111 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6112 next_offset += envelope_size;
6113 }
6114
6115 Ok(())
6116 }
6117 }
6118
6119 impl CodecDelayGetCodecLocalDelayRangeRequest {
6120 #[inline(always)]
6121 fn max_ordinal_present(&self) -> u64 {
6122 if let Some(_) = self.codec_attributes {
6123 return 3;
6124 }
6125 if let Some(_) = self.data_direction {
6126 return 2;
6127 }
6128 if let Some(_) = self.logical_transport_type {
6129 return 1;
6130 }
6131 0
6132 }
6133 }
6134
6135 impl fidl::encoding::ValueTypeMarker for CodecDelayGetCodecLocalDelayRangeRequest {
6136 type Borrowed<'a> = &'a Self;
6137 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6138 value
6139 }
6140 }
6141
6142 unsafe impl fidl::encoding::TypeMarker for CodecDelayGetCodecLocalDelayRangeRequest {
6143 type Owned = Self;
6144
6145 #[inline(always)]
6146 fn inline_align(_context: fidl::encoding::Context) -> usize {
6147 8
6148 }
6149
6150 #[inline(always)]
6151 fn inline_size(_context: fidl::encoding::Context) -> usize {
6152 16
6153 }
6154 }
6155
6156 unsafe impl<D: fidl::encoding::ResourceDialect>
6157 fidl::encoding::Encode<CodecDelayGetCodecLocalDelayRangeRequest, D>
6158 for &CodecDelayGetCodecLocalDelayRangeRequest
6159 {
6160 unsafe fn encode(
6161 self,
6162 encoder: &mut fidl::encoding::Encoder<'_, D>,
6163 offset: usize,
6164 mut depth: fidl::encoding::Depth,
6165 ) -> fidl::Result<()> {
6166 encoder.debug_check_bounds::<CodecDelayGetCodecLocalDelayRangeRequest>(offset);
6167 let max_ordinal: u64 = self.max_ordinal_present();
6169 encoder.write_num(max_ordinal, offset);
6170 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6171 if max_ordinal == 0 {
6173 return Ok(());
6174 }
6175 depth.increment()?;
6176 let envelope_size = 8;
6177 let bytes_len = max_ordinal as usize * envelope_size;
6178 #[allow(unused_variables)]
6179 let offset = encoder.out_of_line_offset(bytes_len);
6180 let mut _prev_end_offset: usize = 0;
6181 if 1 > max_ordinal {
6182 return Ok(());
6183 }
6184
6185 let cur_offset: usize = (1 - 1) * envelope_size;
6188
6189 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6191
6192 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::LogicalTransportType, D>(
6197 self.logical_transport_type.as_ref().map(<fidl_fuchsia_bluetooth::LogicalTransportType as fidl::encoding::ValueTypeMarker>::borrow),
6198 encoder, offset + cur_offset, depth
6199 )?;
6200
6201 _prev_end_offset = cur_offset + envelope_size;
6202 if 2 > max_ordinal {
6203 return Ok(());
6204 }
6205
6206 let cur_offset: usize = (2 - 1) * envelope_size;
6209
6210 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6212
6213 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::DataDirection, D>(
6218 self.data_direction.as_ref().map(<fidl_fuchsia_bluetooth::DataDirection as fidl::encoding::ValueTypeMarker>::borrow),
6219 encoder, offset + cur_offset, depth
6220 )?;
6221
6222 _prev_end_offset = cur_offset + envelope_size;
6223 if 3 > max_ordinal {
6224 return Ok(());
6225 }
6226
6227 let cur_offset: usize = (3 - 1) * envelope_size;
6230
6231 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6233
6234 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::CodecAttributes, D>(
6239 self.codec_attributes.as_ref().map(<fidl_fuchsia_bluetooth::CodecAttributes as fidl::encoding::ValueTypeMarker>::borrow),
6240 encoder, offset + cur_offset, depth
6241 )?;
6242
6243 _prev_end_offset = cur_offset + envelope_size;
6244
6245 Ok(())
6246 }
6247 }
6248
6249 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
6250 for CodecDelayGetCodecLocalDelayRangeRequest
6251 {
6252 #[inline(always)]
6253 fn new_empty() -> Self {
6254 Self::default()
6255 }
6256
6257 unsafe fn decode(
6258 &mut self,
6259 decoder: &mut fidl::encoding::Decoder<'_, D>,
6260 offset: usize,
6261 mut depth: fidl::encoding::Depth,
6262 ) -> fidl::Result<()> {
6263 decoder.debug_check_bounds::<Self>(offset);
6264 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6265 None => return Err(fidl::Error::NotNullable),
6266 Some(len) => len,
6267 };
6268 if len == 0 {
6270 return Ok(());
6271 };
6272 depth.increment()?;
6273 let envelope_size = 8;
6274 let bytes_len = len * envelope_size;
6275 let offset = decoder.out_of_line_offset(bytes_len)?;
6276 let mut _next_ordinal_to_read = 0;
6278 let mut next_offset = offset;
6279 let end_offset = offset + bytes_len;
6280 _next_ordinal_to_read += 1;
6281 if next_offset >= end_offset {
6282 return Ok(());
6283 }
6284
6285 while _next_ordinal_to_read < 1 {
6287 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6288 _next_ordinal_to_read += 1;
6289 next_offset += envelope_size;
6290 }
6291
6292 let next_out_of_line = decoder.next_out_of_line();
6293 let handles_before = decoder.remaining_handles();
6294 if let Some((inlined, num_bytes, num_handles)) =
6295 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6296 {
6297 let member_inline_size = <fidl_fuchsia_bluetooth::LogicalTransportType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6298 if inlined != (member_inline_size <= 4) {
6299 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6300 }
6301 let inner_offset;
6302 let mut inner_depth = depth.clone();
6303 if inlined {
6304 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6305 inner_offset = next_offset;
6306 } else {
6307 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6308 inner_depth.increment()?;
6309 }
6310 let val_ref = self.logical_transport_type.get_or_insert_with(|| {
6311 fidl::new_empty!(fidl_fuchsia_bluetooth::LogicalTransportType, D)
6312 });
6313 fidl::decode!(
6314 fidl_fuchsia_bluetooth::LogicalTransportType,
6315 D,
6316 val_ref,
6317 decoder,
6318 inner_offset,
6319 inner_depth
6320 )?;
6321 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6322 {
6323 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6324 }
6325 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6326 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6327 }
6328 }
6329
6330 next_offset += envelope_size;
6331 _next_ordinal_to_read += 1;
6332 if next_offset >= end_offset {
6333 return Ok(());
6334 }
6335
6336 while _next_ordinal_to_read < 2 {
6338 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6339 _next_ordinal_to_read += 1;
6340 next_offset += envelope_size;
6341 }
6342
6343 let next_out_of_line = decoder.next_out_of_line();
6344 let handles_before = decoder.remaining_handles();
6345 if let Some((inlined, num_bytes, num_handles)) =
6346 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6347 {
6348 let member_inline_size = <fidl_fuchsia_bluetooth::DataDirection as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6349 if inlined != (member_inline_size <= 4) {
6350 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6351 }
6352 let inner_offset;
6353 let mut inner_depth = depth.clone();
6354 if inlined {
6355 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6356 inner_offset = next_offset;
6357 } else {
6358 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6359 inner_depth.increment()?;
6360 }
6361 let val_ref = self.data_direction.get_or_insert_with(|| {
6362 fidl::new_empty!(fidl_fuchsia_bluetooth::DataDirection, D)
6363 });
6364 fidl::decode!(
6365 fidl_fuchsia_bluetooth::DataDirection,
6366 D,
6367 val_ref,
6368 decoder,
6369 inner_offset,
6370 inner_depth
6371 )?;
6372 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6373 {
6374 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6375 }
6376 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6377 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6378 }
6379 }
6380
6381 next_offset += envelope_size;
6382 _next_ordinal_to_read += 1;
6383 if next_offset >= end_offset {
6384 return Ok(());
6385 }
6386
6387 while _next_ordinal_to_read < 3 {
6389 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6390 _next_ordinal_to_read += 1;
6391 next_offset += envelope_size;
6392 }
6393
6394 let next_out_of_line = decoder.next_out_of_line();
6395 let handles_before = decoder.remaining_handles();
6396 if let Some((inlined, num_bytes, num_handles)) =
6397 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6398 {
6399 let member_inline_size = <fidl_fuchsia_bluetooth::CodecAttributes as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6400 if inlined != (member_inline_size <= 4) {
6401 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6402 }
6403 let inner_offset;
6404 let mut inner_depth = depth.clone();
6405 if inlined {
6406 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6407 inner_offset = next_offset;
6408 } else {
6409 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6410 inner_depth.increment()?;
6411 }
6412 let val_ref = self.codec_attributes.get_or_insert_with(|| {
6413 fidl::new_empty!(fidl_fuchsia_bluetooth::CodecAttributes, D)
6414 });
6415 fidl::decode!(
6416 fidl_fuchsia_bluetooth::CodecAttributes,
6417 D,
6418 val_ref,
6419 decoder,
6420 inner_offset,
6421 inner_depth
6422 )?;
6423 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6424 {
6425 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6426 }
6427 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6428 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6429 }
6430 }
6431
6432 next_offset += envelope_size;
6433
6434 while next_offset < end_offset {
6436 _next_ordinal_to_read += 1;
6437 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6438 next_offset += envelope_size;
6439 }
6440
6441 Ok(())
6442 }
6443 }
6444
6445 impl CodecDelayGetCodecLocalDelayRangeResponse {
6446 #[inline(always)]
6447 fn max_ordinal_present(&self) -> u64 {
6448 if let Some(_) = self.max_controller_delay {
6449 return 2;
6450 }
6451 if let Some(_) = self.min_controller_delay {
6452 return 1;
6453 }
6454 0
6455 }
6456 }
6457
6458 impl fidl::encoding::ValueTypeMarker for CodecDelayGetCodecLocalDelayRangeResponse {
6459 type Borrowed<'a> = &'a Self;
6460 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6461 value
6462 }
6463 }
6464
6465 unsafe impl fidl::encoding::TypeMarker for CodecDelayGetCodecLocalDelayRangeResponse {
6466 type Owned = Self;
6467
6468 #[inline(always)]
6469 fn inline_align(_context: fidl::encoding::Context) -> usize {
6470 8
6471 }
6472
6473 #[inline(always)]
6474 fn inline_size(_context: fidl::encoding::Context) -> usize {
6475 16
6476 }
6477 }
6478
6479 unsafe impl<D: fidl::encoding::ResourceDialect>
6480 fidl::encoding::Encode<CodecDelayGetCodecLocalDelayRangeResponse, D>
6481 for &CodecDelayGetCodecLocalDelayRangeResponse
6482 {
6483 unsafe fn encode(
6484 self,
6485 encoder: &mut fidl::encoding::Encoder<'_, D>,
6486 offset: usize,
6487 mut depth: fidl::encoding::Depth,
6488 ) -> fidl::Result<()> {
6489 encoder.debug_check_bounds::<CodecDelayGetCodecLocalDelayRangeResponse>(offset);
6490 let max_ordinal: u64 = self.max_ordinal_present();
6492 encoder.write_num(max_ordinal, offset);
6493 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6494 if max_ordinal == 0 {
6496 return Ok(());
6497 }
6498 depth.increment()?;
6499 let envelope_size = 8;
6500 let bytes_len = max_ordinal as usize * envelope_size;
6501 #[allow(unused_variables)]
6502 let offset = encoder.out_of_line_offset(bytes_len);
6503 let mut _prev_end_offset: usize = 0;
6504 if 1 > max_ordinal {
6505 return Ok(());
6506 }
6507
6508 let cur_offset: usize = (1 - 1) * envelope_size;
6511
6512 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6514
6515 fidl::encoding::encode_in_envelope_optional::<i64, D>(
6520 self.min_controller_delay
6521 .as_ref()
6522 .map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
6523 encoder,
6524 offset + cur_offset,
6525 depth,
6526 )?;
6527
6528 _prev_end_offset = cur_offset + envelope_size;
6529 if 2 > max_ordinal {
6530 return Ok(());
6531 }
6532
6533 let cur_offset: usize = (2 - 1) * envelope_size;
6536
6537 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6539
6540 fidl::encoding::encode_in_envelope_optional::<i64, D>(
6545 self.max_controller_delay
6546 .as_ref()
6547 .map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
6548 encoder,
6549 offset + cur_offset,
6550 depth,
6551 )?;
6552
6553 _prev_end_offset = cur_offset + envelope_size;
6554
6555 Ok(())
6556 }
6557 }
6558
6559 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
6560 for CodecDelayGetCodecLocalDelayRangeResponse
6561 {
6562 #[inline(always)]
6563 fn new_empty() -> Self {
6564 Self::default()
6565 }
6566
6567 unsafe fn decode(
6568 &mut self,
6569 decoder: &mut fidl::encoding::Decoder<'_, D>,
6570 offset: usize,
6571 mut depth: fidl::encoding::Depth,
6572 ) -> fidl::Result<()> {
6573 decoder.debug_check_bounds::<Self>(offset);
6574 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6575 None => return Err(fidl::Error::NotNullable),
6576 Some(len) => len,
6577 };
6578 if len == 0 {
6580 return Ok(());
6581 };
6582 depth.increment()?;
6583 let envelope_size = 8;
6584 let bytes_len = len * envelope_size;
6585 let offset = decoder.out_of_line_offset(bytes_len)?;
6586 let mut _next_ordinal_to_read = 0;
6588 let mut next_offset = offset;
6589 let end_offset = offset + bytes_len;
6590 _next_ordinal_to_read += 1;
6591 if next_offset >= end_offset {
6592 return Ok(());
6593 }
6594
6595 while _next_ordinal_to_read < 1 {
6597 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6598 _next_ordinal_to_read += 1;
6599 next_offset += envelope_size;
6600 }
6601
6602 let next_out_of_line = decoder.next_out_of_line();
6603 let handles_before = decoder.remaining_handles();
6604 if let Some((inlined, num_bytes, num_handles)) =
6605 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6606 {
6607 let member_inline_size =
6608 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6609 if inlined != (member_inline_size <= 4) {
6610 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6611 }
6612 let inner_offset;
6613 let mut inner_depth = depth.clone();
6614 if inlined {
6615 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6616 inner_offset = next_offset;
6617 } else {
6618 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6619 inner_depth.increment()?;
6620 }
6621 let val_ref =
6622 self.min_controller_delay.get_or_insert_with(|| fidl::new_empty!(i64, D));
6623 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
6624 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6625 {
6626 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6627 }
6628 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6629 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6630 }
6631 }
6632
6633 next_offset += envelope_size;
6634 _next_ordinal_to_read += 1;
6635 if next_offset >= end_offset {
6636 return Ok(());
6637 }
6638
6639 while _next_ordinal_to_read < 2 {
6641 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6642 _next_ordinal_to_read += 1;
6643 next_offset += envelope_size;
6644 }
6645
6646 let next_out_of_line = decoder.next_out_of_line();
6647 let handles_before = decoder.remaining_handles();
6648 if let Some((inlined, num_bytes, num_handles)) =
6649 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6650 {
6651 let member_inline_size =
6652 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6653 if inlined != (member_inline_size <= 4) {
6654 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6655 }
6656 let inner_offset;
6657 let mut inner_depth = depth.clone();
6658 if inlined {
6659 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6660 inner_offset = next_offset;
6661 } else {
6662 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6663 inner_depth.increment()?;
6664 }
6665 let val_ref =
6666 self.max_controller_delay.get_or_insert_with(|| fidl::new_empty!(i64, D));
6667 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
6668 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6669 {
6670 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6671 }
6672 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6673 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6674 }
6675 }
6676
6677 next_offset += envelope_size;
6678
6679 while next_offset < end_offset {
6681 _next_ordinal_to_read += 1;
6682 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6683 next_offset += envelope_size;
6684 }
6685
6686 Ok(())
6687 }
6688 }
6689
6690 impl ConnectionOptions {
6691 #[inline(always)]
6692 fn max_ordinal_present(&self) -> u64 {
6693 if let Some(_) = self.service_filter {
6694 return 2;
6695 }
6696 if let Some(_) = self.bondable_mode {
6697 return 1;
6698 }
6699 0
6700 }
6701 }
6702
6703 impl fidl::encoding::ValueTypeMarker for ConnectionOptions {
6704 type Borrowed<'a> = &'a Self;
6705 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6706 value
6707 }
6708 }
6709
6710 unsafe impl fidl::encoding::TypeMarker for ConnectionOptions {
6711 type Owned = Self;
6712
6713 #[inline(always)]
6714 fn inline_align(_context: fidl::encoding::Context) -> usize {
6715 8
6716 }
6717
6718 #[inline(always)]
6719 fn inline_size(_context: fidl::encoding::Context) -> usize {
6720 16
6721 }
6722 }
6723
6724 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ConnectionOptions, D>
6725 for &ConnectionOptions
6726 {
6727 unsafe fn encode(
6728 self,
6729 encoder: &mut fidl::encoding::Encoder<'_, D>,
6730 offset: usize,
6731 mut depth: fidl::encoding::Depth,
6732 ) -> fidl::Result<()> {
6733 encoder.debug_check_bounds::<ConnectionOptions>(offset);
6734 let max_ordinal: u64 = self.max_ordinal_present();
6736 encoder.write_num(max_ordinal, offset);
6737 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6738 if max_ordinal == 0 {
6740 return Ok(());
6741 }
6742 depth.increment()?;
6743 let envelope_size = 8;
6744 let bytes_len = max_ordinal as usize * envelope_size;
6745 #[allow(unused_variables)]
6746 let offset = encoder.out_of_line_offset(bytes_len);
6747 let mut _prev_end_offset: usize = 0;
6748 if 1 > max_ordinal {
6749 return Ok(());
6750 }
6751
6752 let cur_offset: usize = (1 - 1) * envelope_size;
6755
6756 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6758
6759 fidl::encoding::encode_in_envelope_optional::<bool, D>(
6764 self.bondable_mode.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
6765 encoder,
6766 offset + cur_offset,
6767 depth,
6768 )?;
6769
6770 _prev_end_offset = cur_offset + envelope_size;
6771 if 2 > max_ordinal {
6772 return Ok(());
6773 }
6774
6775 let cur_offset: usize = (2 - 1) * envelope_size;
6778
6779 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6781
6782 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::Uuid, D>(
6787 self.service_filter
6788 .as_ref()
6789 .map(<fidl_fuchsia_bluetooth::Uuid as fidl::encoding::ValueTypeMarker>::borrow),
6790 encoder,
6791 offset + cur_offset,
6792 depth,
6793 )?;
6794
6795 _prev_end_offset = cur_offset + envelope_size;
6796
6797 Ok(())
6798 }
6799 }
6800
6801 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ConnectionOptions {
6802 #[inline(always)]
6803 fn new_empty() -> Self {
6804 Self::default()
6805 }
6806
6807 unsafe fn decode(
6808 &mut self,
6809 decoder: &mut fidl::encoding::Decoder<'_, D>,
6810 offset: usize,
6811 mut depth: fidl::encoding::Depth,
6812 ) -> fidl::Result<()> {
6813 decoder.debug_check_bounds::<Self>(offset);
6814 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6815 None => return Err(fidl::Error::NotNullable),
6816 Some(len) => len,
6817 };
6818 if len == 0 {
6820 return Ok(());
6821 };
6822 depth.increment()?;
6823 let envelope_size = 8;
6824 let bytes_len = len * envelope_size;
6825 let offset = decoder.out_of_line_offset(bytes_len)?;
6826 let mut _next_ordinal_to_read = 0;
6828 let mut next_offset = offset;
6829 let end_offset = offset + bytes_len;
6830 _next_ordinal_to_read += 1;
6831 if next_offset >= end_offset {
6832 return Ok(());
6833 }
6834
6835 while _next_ordinal_to_read < 1 {
6837 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6838 _next_ordinal_to_read += 1;
6839 next_offset += envelope_size;
6840 }
6841
6842 let next_out_of_line = decoder.next_out_of_line();
6843 let handles_before = decoder.remaining_handles();
6844 if let Some((inlined, num_bytes, num_handles)) =
6845 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6846 {
6847 let member_inline_size =
6848 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6849 if inlined != (member_inline_size <= 4) {
6850 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6851 }
6852 let inner_offset;
6853 let mut inner_depth = depth.clone();
6854 if inlined {
6855 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6856 inner_offset = next_offset;
6857 } else {
6858 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6859 inner_depth.increment()?;
6860 }
6861 let val_ref = self.bondable_mode.get_or_insert_with(|| fidl::new_empty!(bool, D));
6862 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
6863 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6864 {
6865 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6866 }
6867 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6868 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6869 }
6870 }
6871
6872 next_offset += envelope_size;
6873 _next_ordinal_to_read += 1;
6874 if next_offset >= end_offset {
6875 return Ok(());
6876 }
6877
6878 while _next_ordinal_to_read < 2 {
6880 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6881 _next_ordinal_to_read += 1;
6882 next_offset += envelope_size;
6883 }
6884
6885 let next_out_of_line = decoder.next_out_of_line();
6886 let handles_before = decoder.remaining_handles();
6887 if let Some((inlined, num_bytes, num_handles)) =
6888 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6889 {
6890 let member_inline_size =
6891 <fidl_fuchsia_bluetooth::Uuid as fidl::encoding::TypeMarker>::inline_size(
6892 decoder.context,
6893 );
6894 if inlined != (member_inline_size <= 4) {
6895 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6896 }
6897 let inner_offset;
6898 let mut inner_depth = depth.clone();
6899 if inlined {
6900 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6901 inner_offset = next_offset;
6902 } else {
6903 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6904 inner_depth.increment()?;
6905 }
6906 let val_ref = self
6907 .service_filter
6908 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_bluetooth::Uuid, D));
6909 fidl::decode!(
6910 fidl_fuchsia_bluetooth::Uuid,
6911 D,
6912 val_ref,
6913 decoder,
6914 inner_offset,
6915 inner_depth
6916 )?;
6917 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6918 {
6919 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6920 }
6921 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6922 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6923 }
6924 }
6925
6926 next_offset += envelope_size;
6927
6928 while next_offset < end_offset {
6930 _next_ordinal_to_read += 1;
6931 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6932 next_offset += envelope_size;
6933 }
6934
6935 Ok(())
6936 }
6937 }
6938
6939 impl Extended {
6940 #[inline(always)]
6941 fn max_ordinal_present(&self) -> u64 {
6942 0
6943 }
6944 }
6945
6946 impl fidl::encoding::ValueTypeMarker for Extended {
6947 type Borrowed<'a> = &'a Self;
6948 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6949 value
6950 }
6951 }
6952
6953 unsafe impl fidl::encoding::TypeMarker for Extended {
6954 type Owned = Self;
6955
6956 #[inline(always)]
6957 fn inline_align(_context: fidl::encoding::Context) -> usize {
6958 8
6959 }
6960
6961 #[inline(always)]
6962 fn inline_size(_context: fidl::encoding::Context) -> usize {
6963 16
6964 }
6965 }
6966
6967 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Extended, D> for &Extended {
6968 unsafe fn encode(
6969 self,
6970 encoder: &mut fidl::encoding::Encoder<'_, D>,
6971 offset: usize,
6972 mut depth: fidl::encoding::Depth,
6973 ) -> fidl::Result<()> {
6974 encoder.debug_check_bounds::<Extended>(offset);
6975 let max_ordinal: u64 = self.max_ordinal_present();
6977 encoder.write_num(max_ordinal, offset);
6978 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6979 if max_ordinal == 0 {
6981 return Ok(());
6982 }
6983 depth.increment()?;
6984 let envelope_size = 8;
6985 let bytes_len = max_ordinal as usize * envelope_size;
6986 #[allow(unused_variables)]
6987 let offset = encoder.out_of_line_offset(bytes_len);
6988 let mut _prev_end_offset: usize = 0;
6989
6990 Ok(())
6991 }
6992 }
6993
6994 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Extended {
6995 #[inline(always)]
6996 fn new_empty() -> Self {
6997 Self::default()
6998 }
6999
7000 unsafe fn decode(
7001 &mut self,
7002 decoder: &mut fidl::encoding::Decoder<'_, D>,
7003 offset: usize,
7004 mut depth: fidl::encoding::Depth,
7005 ) -> fidl::Result<()> {
7006 decoder.debug_check_bounds::<Self>(offset);
7007 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7008 None => return Err(fidl::Error::NotNullable),
7009 Some(len) => len,
7010 };
7011 if len == 0 {
7013 return Ok(());
7014 };
7015 depth.increment()?;
7016 let envelope_size = 8;
7017 let bytes_len = len * envelope_size;
7018 let offset = decoder.out_of_line_offset(bytes_len)?;
7019 let mut _next_ordinal_to_read = 0;
7021 let mut next_offset = offset;
7022 let end_offset = offset + bytes_len;
7023
7024 while next_offset < end_offset {
7026 _next_ordinal_to_read += 1;
7027 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7028 next_offset += envelope_size;
7029 }
7030
7031 Ok(())
7032 }
7033 }
7034
7035 impl Filter {
7036 #[inline(always)]
7037 fn max_ordinal_present(&self) -> u64 {
7038 if let Some(_) = self.solicitation_uuid {
7039 return 7;
7040 }
7041 if let Some(_) = self.max_path_loss {
7042 return 6;
7043 }
7044 if let Some(_) = self.name {
7045 return 5;
7046 }
7047 if let Some(_) = self.connectable {
7048 return 4;
7049 }
7050 if let Some(_) = self.manufacturer_id {
7051 return 3;
7052 }
7053 if let Some(_) = self.service_data_uuid {
7054 return 2;
7055 }
7056 if let Some(_) = self.service_uuid {
7057 return 1;
7058 }
7059 0
7060 }
7061 }
7062
7063 impl fidl::encoding::ValueTypeMarker for Filter {
7064 type Borrowed<'a> = &'a Self;
7065 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7066 value
7067 }
7068 }
7069
7070 unsafe impl fidl::encoding::TypeMarker for Filter {
7071 type Owned = Self;
7072
7073 #[inline(always)]
7074 fn inline_align(_context: fidl::encoding::Context) -> usize {
7075 8
7076 }
7077
7078 #[inline(always)]
7079 fn inline_size(_context: fidl::encoding::Context) -> usize {
7080 16
7081 }
7082 }
7083
7084 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Filter, D> for &Filter {
7085 unsafe fn encode(
7086 self,
7087 encoder: &mut fidl::encoding::Encoder<'_, D>,
7088 offset: usize,
7089 mut depth: fidl::encoding::Depth,
7090 ) -> fidl::Result<()> {
7091 encoder.debug_check_bounds::<Filter>(offset);
7092 let max_ordinal: u64 = self.max_ordinal_present();
7094 encoder.write_num(max_ordinal, offset);
7095 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7096 if max_ordinal == 0 {
7098 return Ok(());
7099 }
7100 depth.increment()?;
7101 let envelope_size = 8;
7102 let bytes_len = max_ordinal as usize * envelope_size;
7103 #[allow(unused_variables)]
7104 let offset = encoder.out_of_line_offset(bytes_len);
7105 let mut _prev_end_offset: usize = 0;
7106 if 1 > max_ordinal {
7107 return Ok(());
7108 }
7109
7110 let cur_offset: usize = (1 - 1) * envelope_size;
7113
7114 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7116
7117 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::Uuid, D>(
7122 self.service_uuid
7123 .as_ref()
7124 .map(<fidl_fuchsia_bluetooth::Uuid as fidl::encoding::ValueTypeMarker>::borrow),
7125 encoder,
7126 offset + cur_offset,
7127 depth,
7128 )?;
7129
7130 _prev_end_offset = cur_offset + envelope_size;
7131 if 2 > max_ordinal {
7132 return Ok(());
7133 }
7134
7135 let cur_offset: usize = (2 - 1) * envelope_size;
7138
7139 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7141
7142 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::Uuid, D>(
7147 self.service_data_uuid
7148 .as_ref()
7149 .map(<fidl_fuchsia_bluetooth::Uuid as fidl::encoding::ValueTypeMarker>::borrow),
7150 encoder,
7151 offset + cur_offset,
7152 depth,
7153 )?;
7154
7155 _prev_end_offset = cur_offset + envelope_size;
7156 if 3 > max_ordinal {
7157 return Ok(());
7158 }
7159
7160 let cur_offset: usize = (3 - 1) * envelope_size;
7163
7164 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7166
7167 fidl::encoding::encode_in_envelope_optional::<u16, D>(
7172 self.manufacturer_id.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
7173 encoder,
7174 offset + cur_offset,
7175 depth,
7176 )?;
7177
7178 _prev_end_offset = cur_offset + envelope_size;
7179 if 4 > max_ordinal {
7180 return Ok(());
7181 }
7182
7183 let cur_offset: usize = (4 - 1) * envelope_size;
7186
7187 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7189
7190 fidl::encoding::encode_in_envelope_optional::<bool, D>(
7195 self.connectable.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
7196 encoder,
7197 offset + cur_offset,
7198 depth,
7199 )?;
7200
7201 _prev_end_offset = cur_offset + envelope_size;
7202 if 5 > max_ordinal {
7203 return Ok(());
7204 }
7205
7206 let cur_offset: usize = (5 - 1) * envelope_size;
7209
7210 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7212
7213 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<248>, D>(
7218 self.name.as_ref().map(
7219 <fidl::encoding::BoundedString<248> as fidl::encoding::ValueTypeMarker>::borrow,
7220 ),
7221 encoder,
7222 offset + cur_offset,
7223 depth,
7224 )?;
7225
7226 _prev_end_offset = cur_offset + envelope_size;
7227 if 6 > max_ordinal {
7228 return Ok(());
7229 }
7230
7231 let cur_offset: usize = (6 - 1) * envelope_size;
7234
7235 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7237
7238 fidl::encoding::encode_in_envelope_optional::<i8, D>(
7243 self.max_path_loss.as_ref().map(<i8 as fidl::encoding::ValueTypeMarker>::borrow),
7244 encoder,
7245 offset + cur_offset,
7246 depth,
7247 )?;
7248
7249 _prev_end_offset = cur_offset + envelope_size;
7250 if 7 > max_ordinal {
7251 return Ok(());
7252 }
7253
7254 let cur_offset: usize = (7 - 1) * envelope_size;
7257
7258 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7260
7261 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::Uuid, D>(
7266 self.solicitation_uuid
7267 .as_ref()
7268 .map(<fidl_fuchsia_bluetooth::Uuid as fidl::encoding::ValueTypeMarker>::borrow),
7269 encoder,
7270 offset + cur_offset,
7271 depth,
7272 )?;
7273
7274 _prev_end_offset = cur_offset + envelope_size;
7275
7276 Ok(())
7277 }
7278 }
7279
7280 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Filter {
7281 #[inline(always)]
7282 fn new_empty() -> Self {
7283 Self::default()
7284 }
7285
7286 unsafe fn decode(
7287 &mut self,
7288 decoder: &mut fidl::encoding::Decoder<'_, D>,
7289 offset: usize,
7290 mut depth: fidl::encoding::Depth,
7291 ) -> fidl::Result<()> {
7292 decoder.debug_check_bounds::<Self>(offset);
7293 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7294 None => return Err(fidl::Error::NotNullable),
7295 Some(len) => len,
7296 };
7297 if len == 0 {
7299 return Ok(());
7300 };
7301 depth.increment()?;
7302 let envelope_size = 8;
7303 let bytes_len = len * envelope_size;
7304 let offset = decoder.out_of_line_offset(bytes_len)?;
7305 let mut _next_ordinal_to_read = 0;
7307 let mut next_offset = offset;
7308 let end_offset = offset + bytes_len;
7309 _next_ordinal_to_read += 1;
7310 if next_offset >= end_offset {
7311 return Ok(());
7312 }
7313
7314 while _next_ordinal_to_read < 1 {
7316 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7317 _next_ordinal_to_read += 1;
7318 next_offset += envelope_size;
7319 }
7320
7321 let next_out_of_line = decoder.next_out_of_line();
7322 let handles_before = decoder.remaining_handles();
7323 if let Some((inlined, num_bytes, num_handles)) =
7324 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7325 {
7326 let member_inline_size =
7327 <fidl_fuchsia_bluetooth::Uuid as fidl::encoding::TypeMarker>::inline_size(
7328 decoder.context,
7329 );
7330 if inlined != (member_inline_size <= 4) {
7331 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7332 }
7333 let inner_offset;
7334 let mut inner_depth = depth.clone();
7335 if inlined {
7336 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7337 inner_offset = next_offset;
7338 } else {
7339 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7340 inner_depth.increment()?;
7341 }
7342 let val_ref = self
7343 .service_uuid
7344 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_bluetooth::Uuid, D));
7345 fidl::decode!(
7346 fidl_fuchsia_bluetooth::Uuid,
7347 D,
7348 val_ref,
7349 decoder,
7350 inner_offset,
7351 inner_depth
7352 )?;
7353 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7354 {
7355 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7356 }
7357 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7358 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7359 }
7360 }
7361
7362 next_offset += envelope_size;
7363 _next_ordinal_to_read += 1;
7364 if next_offset >= end_offset {
7365 return Ok(());
7366 }
7367
7368 while _next_ordinal_to_read < 2 {
7370 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7371 _next_ordinal_to_read += 1;
7372 next_offset += envelope_size;
7373 }
7374
7375 let next_out_of_line = decoder.next_out_of_line();
7376 let handles_before = decoder.remaining_handles();
7377 if let Some((inlined, num_bytes, num_handles)) =
7378 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7379 {
7380 let member_inline_size =
7381 <fidl_fuchsia_bluetooth::Uuid as fidl::encoding::TypeMarker>::inline_size(
7382 decoder.context,
7383 );
7384 if inlined != (member_inline_size <= 4) {
7385 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7386 }
7387 let inner_offset;
7388 let mut inner_depth = depth.clone();
7389 if inlined {
7390 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7391 inner_offset = next_offset;
7392 } else {
7393 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7394 inner_depth.increment()?;
7395 }
7396 let val_ref = self
7397 .service_data_uuid
7398 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_bluetooth::Uuid, D));
7399 fidl::decode!(
7400 fidl_fuchsia_bluetooth::Uuid,
7401 D,
7402 val_ref,
7403 decoder,
7404 inner_offset,
7405 inner_depth
7406 )?;
7407 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7408 {
7409 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7410 }
7411 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7412 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7413 }
7414 }
7415
7416 next_offset += envelope_size;
7417 _next_ordinal_to_read += 1;
7418 if next_offset >= end_offset {
7419 return Ok(());
7420 }
7421
7422 while _next_ordinal_to_read < 3 {
7424 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7425 _next_ordinal_to_read += 1;
7426 next_offset += envelope_size;
7427 }
7428
7429 let next_out_of_line = decoder.next_out_of_line();
7430 let handles_before = decoder.remaining_handles();
7431 if let Some((inlined, num_bytes, num_handles)) =
7432 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7433 {
7434 let member_inline_size =
7435 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7436 if inlined != (member_inline_size <= 4) {
7437 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7438 }
7439 let inner_offset;
7440 let mut inner_depth = depth.clone();
7441 if inlined {
7442 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7443 inner_offset = next_offset;
7444 } else {
7445 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7446 inner_depth.increment()?;
7447 }
7448 let val_ref = self.manufacturer_id.get_or_insert_with(|| fidl::new_empty!(u16, D));
7449 fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
7450 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7451 {
7452 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7453 }
7454 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7455 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7456 }
7457 }
7458
7459 next_offset += envelope_size;
7460 _next_ordinal_to_read += 1;
7461 if next_offset >= end_offset {
7462 return Ok(());
7463 }
7464
7465 while _next_ordinal_to_read < 4 {
7467 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7468 _next_ordinal_to_read += 1;
7469 next_offset += envelope_size;
7470 }
7471
7472 let next_out_of_line = decoder.next_out_of_line();
7473 let handles_before = decoder.remaining_handles();
7474 if let Some((inlined, num_bytes, num_handles)) =
7475 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7476 {
7477 let member_inline_size =
7478 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7479 if inlined != (member_inline_size <= 4) {
7480 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7481 }
7482 let inner_offset;
7483 let mut inner_depth = depth.clone();
7484 if inlined {
7485 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7486 inner_offset = next_offset;
7487 } else {
7488 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7489 inner_depth.increment()?;
7490 }
7491 let val_ref = self.connectable.get_or_insert_with(|| fidl::new_empty!(bool, D));
7492 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
7493 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7494 {
7495 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7496 }
7497 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7498 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7499 }
7500 }
7501
7502 next_offset += envelope_size;
7503 _next_ordinal_to_read += 1;
7504 if next_offset >= end_offset {
7505 return Ok(());
7506 }
7507
7508 while _next_ordinal_to_read < 5 {
7510 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7511 _next_ordinal_to_read += 1;
7512 next_offset += envelope_size;
7513 }
7514
7515 let next_out_of_line = decoder.next_out_of_line();
7516 let handles_before = decoder.remaining_handles();
7517 if let Some((inlined, num_bytes, num_handles)) =
7518 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7519 {
7520 let member_inline_size =
7521 <fidl::encoding::BoundedString<248> as fidl::encoding::TypeMarker>::inline_size(
7522 decoder.context,
7523 );
7524 if inlined != (member_inline_size <= 4) {
7525 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7526 }
7527 let inner_offset;
7528 let mut inner_depth = depth.clone();
7529 if inlined {
7530 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7531 inner_offset = next_offset;
7532 } else {
7533 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7534 inner_depth.increment()?;
7535 }
7536 let val_ref = self
7537 .name
7538 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<248>, D));
7539 fidl::decode!(
7540 fidl::encoding::BoundedString<248>,
7541 D,
7542 val_ref,
7543 decoder,
7544 inner_offset,
7545 inner_depth
7546 )?;
7547 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7548 {
7549 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7550 }
7551 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7552 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7553 }
7554 }
7555
7556 next_offset += envelope_size;
7557 _next_ordinal_to_read += 1;
7558 if next_offset >= end_offset {
7559 return Ok(());
7560 }
7561
7562 while _next_ordinal_to_read < 6 {
7564 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7565 _next_ordinal_to_read += 1;
7566 next_offset += envelope_size;
7567 }
7568
7569 let next_out_of_line = decoder.next_out_of_line();
7570 let handles_before = decoder.remaining_handles();
7571 if let Some((inlined, num_bytes, num_handles)) =
7572 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7573 {
7574 let member_inline_size =
7575 <i8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7576 if inlined != (member_inline_size <= 4) {
7577 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7578 }
7579 let inner_offset;
7580 let mut inner_depth = depth.clone();
7581 if inlined {
7582 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7583 inner_offset = next_offset;
7584 } else {
7585 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7586 inner_depth.increment()?;
7587 }
7588 let val_ref = self.max_path_loss.get_or_insert_with(|| fidl::new_empty!(i8, D));
7589 fidl::decode!(i8, D, val_ref, decoder, inner_offset, inner_depth)?;
7590 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7591 {
7592 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7593 }
7594 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7595 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7596 }
7597 }
7598
7599 next_offset += envelope_size;
7600 _next_ordinal_to_read += 1;
7601 if next_offset >= end_offset {
7602 return Ok(());
7603 }
7604
7605 while _next_ordinal_to_read < 7 {
7607 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7608 _next_ordinal_to_read += 1;
7609 next_offset += envelope_size;
7610 }
7611
7612 let next_out_of_line = decoder.next_out_of_line();
7613 let handles_before = decoder.remaining_handles();
7614 if let Some((inlined, num_bytes, num_handles)) =
7615 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7616 {
7617 let member_inline_size =
7618 <fidl_fuchsia_bluetooth::Uuid as fidl::encoding::TypeMarker>::inline_size(
7619 decoder.context,
7620 );
7621 if inlined != (member_inline_size <= 4) {
7622 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7623 }
7624 let inner_offset;
7625 let mut inner_depth = depth.clone();
7626 if inlined {
7627 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7628 inner_offset = next_offset;
7629 } else {
7630 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7631 inner_depth.increment()?;
7632 }
7633 let val_ref = self
7634 .solicitation_uuid
7635 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_bluetooth::Uuid, D));
7636 fidl::decode!(
7637 fidl_fuchsia_bluetooth::Uuid,
7638 D,
7639 val_ref,
7640 decoder,
7641 inner_offset,
7642 inner_depth
7643 )?;
7644 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7645 {
7646 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7647 }
7648 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7649 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7650 }
7651 }
7652
7653 next_offset += envelope_size;
7654
7655 while next_offset < end_offset {
7657 _next_ordinal_to_read += 1;
7658 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7659 next_offset += envelope_size;
7660 }
7661
7662 Ok(())
7663 }
7664 }
7665
7666 impl IsochronousStreamOnEstablishedRequest {
7667 #[inline(always)]
7668 fn max_ordinal_present(&self) -> u64 {
7669 if let Some(_) = self.established_params {
7670 return 2;
7671 }
7672 if let Some(_) = self.result {
7673 return 1;
7674 }
7675 0
7676 }
7677 }
7678
7679 impl fidl::encoding::ValueTypeMarker for IsochronousStreamOnEstablishedRequest {
7680 type Borrowed<'a> = &'a Self;
7681 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7682 value
7683 }
7684 }
7685
7686 unsafe impl fidl::encoding::TypeMarker for IsochronousStreamOnEstablishedRequest {
7687 type Owned = Self;
7688
7689 #[inline(always)]
7690 fn inline_align(_context: fidl::encoding::Context) -> usize {
7691 8
7692 }
7693
7694 #[inline(always)]
7695 fn inline_size(_context: fidl::encoding::Context) -> usize {
7696 16
7697 }
7698 }
7699
7700 unsafe impl<D: fidl::encoding::ResourceDialect>
7701 fidl::encoding::Encode<IsochronousStreamOnEstablishedRequest, D>
7702 for &IsochronousStreamOnEstablishedRequest
7703 {
7704 unsafe fn encode(
7705 self,
7706 encoder: &mut fidl::encoding::Encoder<'_, D>,
7707 offset: usize,
7708 mut depth: fidl::encoding::Depth,
7709 ) -> fidl::Result<()> {
7710 encoder.debug_check_bounds::<IsochronousStreamOnEstablishedRequest>(offset);
7711 let max_ordinal: u64 = self.max_ordinal_present();
7713 encoder.write_num(max_ordinal, offset);
7714 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7715 if max_ordinal == 0 {
7717 return Ok(());
7718 }
7719 depth.increment()?;
7720 let envelope_size = 8;
7721 let bytes_len = max_ordinal as usize * envelope_size;
7722 #[allow(unused_variables)]
7723 let offset = encoder.out_of_line_offset(bytes_len);
7724 let mut _prev_end_offset: usize = 0;
7725 if 1 > max_ordinal {
7726 return Ok(());
7727 }
7728
7729 let cur_offset: usize = (1 - 1) * envelope_size;
7732
7733 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7735
7736 fidl::encoding::encode_in_envelope_optional::<i32, D>(
7741 self.result.as_ref().map(<i32 as fidl::encoding::ValueTypeMarker>::borrow),
7742 encoder,
7743 offset + cur_offset,
7744 depth,
7745 )?;
7746
7747 _prev_end_offset = cur_offset + envelope_size;
7748 if 2 > max_ordinal {
7749 return Ok(());
7750 }
7751
7752 let cur_offset: usize = (2 - 1) * envelope_size;
7755
7756 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7758
7759 fidl::encoding::encode_in_envelope_optional::<CisEstablishedParameters, D>(
7764 self.established_params
7765 .as_ref()
7766 .map(<CisEstablishedParameters as fidl::encoding::ValueTypeMarker>::borrow),
7767 encoder,
7768 offset + cur_offset,
7769 depth,
7770 )?;
7771
7772 _prev_end_offset = cur_offset + envelope_size;
7773
7774 Ok(())
7775 }
7776 }
7777
7778 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7779 for IsochronousStreamOnEstablishedRequest
7780 {
7781 #[inline(always)]
7782 fn new_empty() -> Self {
7783 Self::default()
7784 }
7785
7786 unsafe fn decode(
7787 &mut self,
7788 decoder: &mut fidl::encoding::Decoder<'_, D>,
7789 offset: usize,
7790 mut depth: fidl::encoding::Depth,
7791 ) -> fidl::Result<()> {
7792 decoder.debug_check_bounds::<Self>(offset);
7793 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7794 None => return Err(fidl::Error::NotNullable),
7795 Some(len) => len,
7796 };
7797 if len == 0 {
7799 return Ok(());
7800 };
7801 depth.increment()?;
7802 let envelope_size = 8;
7803 let bytes_len = len * envelope_size;
7804 let offset = decoder.out_of_line_offset(bytes_len)?;
7805 let mut _next_ordinal_to_read = 0;
7807 let mut next_offset = offset;
7808 let end_offset = offset + bytes_len;
7809 _next_ordinal_to_read += 1;
7810 if next_offset >= end_offset {
7811 return Ok(());
7812 }
7813
7814 while _next_ordinal_to_read < 1 {
7816 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7817 _next_ordinal_to_read += 1;
7818 next_offset += envelope_size;
7819 }
7820
7821 let next_out_of_line = decoder.next_out_of_line();
7822 let handles_before = decoder.remaining_handles();
7823 if let Some((inlined, num_bytes, num_handles)) =
7824 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7825 {
7826 let member_inline_size =
7827 <i32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7828 if inlined != (member_inline_size <= 4) {
7829 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7830 }
7831 let inner_offset;
7832 let mut inner_depth = depth.clone();
7833 if inlined {
7834 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7835 inner_offset = next_offset;
7836 } else {
7837 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7838 inner_depth.increment()?;
7839 }
7840 let val_ref = self.result.get_or_insert_with(|| fidl::new_empty!(i32, D));
7841 fidl::decode!(i32, D, val_ref, decoder, inner_offset, inner_depth)?;
7842 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7843 {
7844 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7845 }
7846 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7847 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7848 }
7849 }
7850
7851 next_offset += envelope_size;
7852 _next_ordinal_to_read += 1;
7853 if next_offset >= end_offset {
7854 return Ok(());
7855 }
7856
7857 while _next_ordinal_to_read < 2 {
7859 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7860 _next_ordinal_to_read += 1;
7861 next_offset += envelope_size;
7862 }
7863
7864 let next_out_of_line = decoder.next_out_of_line();
7865 let handles_before = decoder.remaining_handles();
7866 if let Some((inlined, num_bytes, num_handles)) =
7867 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7868 {
7869 let member_inline_size =
7870 <CisEstablishedParameters as fidl::encoding::TypeMarker>::inline_size(
7871 decoder.context,
7872 );
7873 if inlined != (member_inline_size <= 4) {
7874 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7875 }
7876 let inner_offset;
7877 let mut inner_depth = depth.clone();
7878 if inlined {
7879 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7880 inner_offset = next_offset;
7881 } else {
7882 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7883 inner_depth.increment()?;
7884 }
7885 let val_ref = self
7886 .established_params
7887 .get_or_insert_with(|| fidl::new_empty!(CisEstablishedParameters, D));
7888 fidl::decode!(
7889 CisEstablishedParameters,
7890 D,
7891 val_ref,
7892 decoder,
7893 inner_offset,
7894 inner_depth
7895 )?;
7896 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7897 {
7898 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7899 }
7900 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7901 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7902 }
7903 }
7904
7905 next_offset += envelope_size;
7906
7907 while next_offset < end_offset {
7909 _next_ordinal_to_read += 1;
7910 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7911 next_offset += envelope_size;
7912 }
7913
7914 Ok(())
7915 }
7916 }
7917
7918 impl IsochronousStreamSetupDataPathRequest {
7919 #[inline(always)]
7920 fn max_ordinal_present(&self) -> u64 {
7921 if let Some(_) = self.controller_delay {
7922 return 3;
7923 }
7924 if let Some(_) = self.codec_attributes {
7925 return 2;
7926 }
7927 if let Some(_) = self.data_direction {
7928 return 1;
7929 }
7930 0
7931 }
7932 }
7933
7934 impl fidl::encoding::ValueTypeMarker for IsochronousStreamSetupDataPathRequest {
7935 type Borrowed<'a> = &'a Self;
7936 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7937 value
7938 }
7939 }
7940
7941 unsafe impl fidl::encoding::TypeMarker for IsochronousStreamSetupDataPathRequest {
7942 type Owned = Self;
7943
7944 #[inline(always)]
7945 fn inline_align(_context: fidl::encoding::Context) -> usize {
7946 8
7947 }
7948
7949 #[inline(always)]
7950 fn inline_size(_context: fidl::encoding::Context) -> usize {
7951 16
7952 }
7953 }
7954
7955 unsafe impl<D: fidl::encoding::ResourceDialect>
7956 fidl::encoding::Encode<IsochronousStreamSetupDataPathRequest, D>
7957 for &IsochronousStreamSetupDataPathRequest
7958 {
7959 unsafe fn encode(
7960 self,
7961 encoder: &mut fidl::encoding::Encoder<'_, D>,
7962 offset: usize,
7963 mut depth: fidl::encoding::Depth,
7964 ) -> fidl::Result<()> {
7965 encoder.debug_check_bounds::<IsochronousStreamSetupDataPathRequest>(offset);
7966 let max_ordinal: u64 = self.max_ordinal_present();
7968 encoder.write_num(max_ordinal, offset);
7969 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7970 if max_ordinal == 0 {
7972 return Ok(());
7973 }
7974 depth.increment()?;
7975 let envelope_size = 8;
7976 let bytes_len = max_ordinal as usize * envelope_size;
7977 #[allow(unused_variables)]
7978 let offset = encoder.out_of_line_offset(bytes_len);
7979 let mut _prev_end_offset: usize = 0;
7980 if 1 > max_ordinal {
7981 return Ok(());
7982 }
7983
7984 let cur_offset: usize = (1 - 1) * envelope_size;
7987
7988 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7990
7991 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::DataDirection, D>(
7996 self.data_direction.as_ref().map(<fidl_fuchsia_bluetooth::DataDirection as fidl::encoding::ValueTypeMarker>::borrow),
7997 encoder, offset + cur_offset, depth
7998 )?;
7999
8000 _prev_end_offset = cur_offset + envelope_size;
8001 if 2 > max_ordinal {
8002 return Ok(());
8003 }
8004
8005 let cur_offset: usize = (2 - 1) * envelope_size;
8008
8009 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8011
8012 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::CodecAttributes, D>(
8017 self.codec_attributes.as_ref().map(<fidl_fuchsia_bluetooth::CodecAttributes as fidl::encoding::ValueTypeMarker>::borrow),
8018 encoder, offset + cur_offset, depth
8019 )?;
8020
8021 _prev_end_offset = cur_offset + envelope_size;
8022 if 3 > max_ordinal {
8023 return Ok(());
8024 }
8025
8026 let cur_offset: usize = (3 - 1) * envelope_size;
8029
8030 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8032
8033 fidl::encoding::encode_in_envelope_optional::<i64, D>(
8038 self.controller_delay
8039 .as_ref()
8040 .map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
8041 encoder,
8042 offset + cur_offset,
8043 depth,
8044 )?;
8045
8046 _prev_end_offset = cur_offset + envelope_size;
8047
8048 Ok(())
8049 }
8050 }
8051
8052 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8053 for IsochronousStreamSetupDataPathRequest
8054 {
8055 #[inline(always)]
8056 fn new_empty() -> Self {
8057 Self::default()
8058 }
8059
8060 unsafe fn decode(
8061 &mut self,
8062 decoder: &mut fidl::encoding::Decoder<'_, D>,
8063 offset: usize,
8064 mut depth: fidl::encoding::Depth,
8065 ) -> fidl::Result<()> {
8066 decoder.debug_check_bounds::<Self>(offset);
8067 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8068 None => return Err(fidl::Error::NotNullable),
8069 Some(len) => len,
8070 };
8071 if len == 0 {
8073 return Ok(());
8074 };
8075 depth.increment()?;
8076 let envelope_size = 8;
8077 let bytes_len = len * envelope_size;
8078 let offset = decoder.out_of_line_offset(bytes_len)?;
8079 let mut _next_ordinal_to_read = 0;
8081 let mut next_offset = offset;
8082 let end_offset = offset + bytes_len;
8083 _next_ordinal_to_read += 1;
8084 if next_offset >= end_offset {
8085 return Ok(());
8086 }
8087
8088 while _next_ordinal_to_read < 1 {
8090 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8091 _next_ordinal_to_read += 1;
8092 next_offset += envelope_size;
8093 }
8094
8095 let next_out_of_line = decoder.next_out_of_line();
8096 let handles_before = decoder.remaining_handles();
8097 if let Some((inlined, num_bytes, num_handles)) =
8098 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8099 {
8100 let member_inline_size = <fidl_fuchsia_bluetooth::DataDirection as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8101 if inlined != (member_inline_size <= 4) {
8102 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8103 }
8104 let inner_offset;
8105 let mut inner_depth = depth.clone();
8106 if inlined {
8107 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8108 inner_offset = next_offset;
8109 } else {
8110 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8111 inner_depth.increment()?;
8112 }
8113 let val_ref = self.data_direction.get_or_insert_with(|| {
8114 fidl::new_empty!(fidl_fuchsia_bluetooth::DataDirection, D)
8115 });
8116 fidl::decode!(
8117 fidl_fuchsia_bluetooth::DataDirection,
8118 D,
8119 val_ref,
8120 decoder,
8121 inner_offset,
8122 inner_depth
8123 )?;
8124 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8125 {
8126 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8127 }
8128 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8129 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8130 }
8131 }
8132
8133 next_offset += envelope_size;
8134 _next_ordinal_to_read += 1;
8135 if next_offset >= end_offset {
8136 return Ok(());
8137 }
8138
8139 while _next_ordinal_to_read < 2 {
8141 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8142 _next_ordinal_to_read += 1;
8143 next_offset += envelope_size;
8144 }
8145
8146 let next_out_of_line = decoder.next_out_of_line();
8147 let handles_before = decoder.remaining_handles();
8148 if let Some((inlined, num_bytes, num_handles)) =
8149 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8150 {
8151 let member_inline_size = <fidl_fuchsia_bluetooth::CodecAttributes as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8152 if inlined != (member_inline_size <= 4) {
8153 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8154 }
8155 let inner_offset;
8156 let mut inner_depth = depth.clone();
8157 if inlined {
8158 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8159 inner_offset = next_offset;
8160 } else {
8161 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8162 inner_depth.increment()?;
8163 }
8164 let val_ref = self.codec_attributes.get_or_insert_with(|| {
8165 fidl::new_empty!(fidl_fuchsia_bluetooth::CodecAttributes, D)
8166 });
8167 fidl::decode!(
8168 fidl_fuchsia_bluetooth::CodecAttributes,
8169 D,
8170 val_ref,
8171 decoder,
8172 inner_offset,
8173 inner_depth
8174 )?;
8175 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8176 {
8177 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8178 }
8179 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8180 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8181 }
8182 }
8183
8184 next_offset += envelope_size;
8185 _next_ordinal_to_read += 1;
8186 if next_offset >= end_offset {
8187 return Ok(());
8188 }
8189
8190 while _next_ordinal_to_read < 3 {
8192 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8193 _next_ordinal_to_read += 1;
8194 next_offset += envelope_size;
8195 }
8196
8197 let next_out_of_line = decoder.next_out_of_line();
8198 let handles_before = decoder.remaining_handles();
8199 if let Some((inlined, num_bytes, num_handles)) =
8200 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8201 {
8202 let member_inline_size =
8203 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8204 if inlined != (member_inline_size <= 4) {
8205 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8206 }
8207 let inner_offset;
8208 let mut inner_depth = depth.clone();
8209 if inlined {
8210 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8211 inner_offset = next_offset;
8212 } else {
8213 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8214 inner_depth.increment()?;
8215 }
8216 let val_ref = self.controller_delay.get_or_insert_with(|| fidl::new_empty!(i64, D));
8217 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
8218 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8219 {
8220 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8221 }
8222 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8223 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8224 }
8225 }
8226
8227 next_offset += envelope_size;
8228
8229 while next_offset < end_offset {
8231 _next_ordinal_to_read += 1;
8232 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8233 next_offset += envelope_size;
8234 }
8235
8236 Ok(())
8237 }
8238 }
8239
8240 impl IsochronousStreamWriteRequest {
8241 #[inline(always)]
8242 fn max_ordinal_present(&self) -> u64 {
8243 if let Some(_) = self.data {
8244 return 1;
8245 }
8246 0
8247 }
8248 }
8249
8250 impl fidl::encoding::ValueTypeMarker for IsochronousStreamWriteRequest {
8251 type Borrowed<'a> = &'a Self;
8252 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8253 value
8254 }
8255 }
8256
8257 unsafe impl fidl::encoding::TypeMarker for IsochronousStreamWriteRequest {
8258 type Owned = Self;
8259
8260 #[inline(always)]
8261 fn inline_align(_context: fidl::encoding::Context) -> usize {
8262 8
8263 }
8264
8265 #[inline(always)]
8266 fn inline_size(_context: fidl::encoding::Context) -> usize {
8267 16
8268 }
8269 }
8270
8271 unsafe impl<D: fidl::encoding::ResourceDialect>
8272 fidl::encoding::Encode<IsochronousStreamWriteRequest, D>
8273 for &IsochronousStreamWriteRequest
8274 {
8275 unsafe fn encode(
8276 self,
8277 encoder: &mut fidl::encoding::Encoder<'_, D>,
8278 offset: usize,
8279 mut depth: fidl::encoding::Depth,
8280 ) -> fidl::Result<()> {
8281 encoder.debug_check_bounds::<IsochronousStreamWriteRequest>(offset);
8282 let max_ordinal: u64 = self.max_ordinal_present();
8284 encoder.write_num(max_ordinal, offset);
8285 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8286 if max_ordinal == 0 {
8288 return Ok(());
8289 }
8290 depth.increment()?;
8291 let envelope_size = 8;
8292 let bytes_len = max_ordinal as usize * envelope_size;
8293 #[allow(unused_variables)]
8294 let offset = encoder.out_of_line_offset(bytes_len);
8295 let mut _prev_end_offset: usize = 0;
8296 if 1 > max_ordinal {
8297 return Ok(());
8298 }
8299
8300 let cur_offset: usize = (1 - 1) * envelope_size;
8303
8304 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8306
8307 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 4095>, D>(
8312 self.data.as_ref().map(
8313 <fidl::encoding::Vector<u8, 4095> as fidl::encoding::ValueTypeMarker>::borrow,
8314 ),
8315 encoder,
8316 offset + cur_offset,
8317 depth,
8318 )?;
8319
8320 _prev_end_offset = cur_offset + envelope_size;
8321
8322 Ok(())
8323 }
8324 }
8325
8326 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8327 for IsochronousStreamWriteRequest
8328 {
8329 #[inline(always)]
8330 fn new_empty() -> Self {
8331 Self::default()
8332 }
8333
8334 unsafe fn decode(
8335 &mut self,
8336 decoder: &mut fidl::encoding::Decoder<'_, D>,
8337 offset: usize,
8338 mut depth: fidl::encoding::Depth,
8339 ) -> fidl::Result<()> {
8340 decoder.debug_check_bounds::<Self>(offset);
8341 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8342 None => return Err(fidl::Error::NotNullable),
8343 Some(len) => len,
8344 };
8345 if len == 0 {
8347 return Ok(());
8348 };
8349 depth.increment()?;
8350 let envelope_size = 8;
8351 let bytes_len = len * envelope_size;
8352 let offset = decoder.out_of_line_offset(bytes_len)?;
8353 let mut _next_ordinal_to_read = 0;
8355 let mut next_offset = offset;
8356 let end_offset = offset + bytes_len;
8357 _next_ordinal_to_read += 1;
8358 if next_offset >= end_offset {
8359 return Ok(());
8360 }
8361
8362 while _next_ordinal_to_read < 1 {
8364 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8365 _next_ordinal_to_read += 1;
8366 next_offset += envelope_size;
8367 }
8368
8369 let next_out_of_line = decoder.next_out_of_line();
8370 let handles_before = decoder.remaining_handles();
8371 if let Some((inlined, num_bytes, num_handles)) =
8372 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8373 {
8374 let member_inline_size =
8375 <fidl::encoding::Vector<u8, 4095> as fidl::encoding::TypeMarker>::inline_size(
8376 decoder.context,
8377 );
8378 if inlined != (member_inline_size <= 4) {
8379 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8380 }
8381 let inner_offset;
8382 let mut inner_depth = depth.clone();
8383 if inlined {
8384 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8385 inner_offset = next_offset;
8386 } else {
8387 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8388 inner_depth.increment()?;
8389 }
8390 let val_ref = self
8391 .data
8392 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 4095>, D));
8393 fidl::decode!(fidl::encoding::Vector<u8, 4095>, D, val_ref, decoder, inner_offset, inner_depth)?;
8394 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8395 {
8396 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8397 }
8398 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8399 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8400 }
8401 }
8402
8403 next_offset += envelope_size;
8404
8405 while next_offset < end_offset {
8407 _next_ordinal_to_read += 1;
8408 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8409 next_offset += envelope_size;
8410 }
8411
8412 Ok(())
8413 }
8414 }
8415
8416 impl IsochronousStreamReadResponse {
8417 #[inline(always)]
8418 fn max_ordinal_present(&self) -> u64 {
8419 if let Some(_) = self.timestamp {
8420 return 4;
8421 }
8422 if let Some(_) = self.status_flag {
8423 return 3;
8424 }
8425 if let Some(_) = self.sequence_number {
8426 return 2;
8427 }
8428 if let Some(_) = self.data {
8429 return 1;
8430 }
8431 0
8432 }
8433 }
8434
8435 impl fidl::encoding::ValueTypeMarker for IsochronousStreamReadResponse {
8436 type Borrowed<'a> = &'a Self;
8437 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8438 value
8439 }
8440 }
8441
8442 unsafe impl fidl::encoding::TypeMarker for IsochronousStreamReadResponse {
8443 type Owned = Self;
8444
8445 #[inline(always)]
8446 fn inline_align(_context: fidl::encoding::Context) -> usize {
8447 8
8448 }
8449
8450 #[inline(always)]
8451 fn inline_size(_context: fidl::encoding::Context) -> usize {
8452 16
8453 }
8454 }
8455
8456 unsafe impl<D: fidl::encoding::ResourceDialect>
8457 fidl::encoding::Encode<IsochronousStreamReadResponse, D>
8458 for &IsochronousStreamReadResponse
8459 {
8460 unsafe fn encode(
8461 self,
8462 encoder: &mut fidl::encoding::Encoder<'_, D>,
8463 offset: usize,
8464 mut depth: fidl::encoding::Depth,
8465 ) -> fidl::Result<()> {
8466 encoder.debug_check_bounds::<IsochronousStreamReadResponse>(offset);
8467 let max_ordinal: u64 = self.max_ordinal_present();
8469 encoder.write_num(max_ordinal, offset);
8470 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8471 if max_ordinal == 0 {
8473 return Ok(());
8474 }
8475 depth.increment()?;
8476 let envelope_size = 8;
8477 let bytes_len = max_ordinal as usize * envelope_size;
8478 #[allow(unused_variables)]
8479 let offset = encoder.out_of_line_offset(bytes_len);
8480 let mut _prev_end_offset: usize = 0;
8481 if 1 > max_ordinal {
8482 return Ok(());
8483 }
8484
8485 let cur_offset: usize = (1 - 1) * envelope_size;
8488
8489 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8491
8492 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<u8>, D>(
8497 self.data.as_ref().map(<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow),
8498 encoder, offset + cur_offset, depth
8499 )?;
8500
8501 _prev_end_offset = cur_offset + envelope_size;
8502 if 2 > max_ordinal {
8503 return Ok(());
8504 }
8505
8506 let cur_offset: usize = (2 - 1) * envelope_size;
8509
8510 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8512
8513 fidl::encoding::encode_in_envelope_optional::<u16, D>(
8518 self.sequence_number.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
8519 encoder,
8520 offset + cur_offset,
8521 depth,
8522 )?;
8523
8524 _prev_end_offset = cur_offset + envelope_size;
8525 if 3 > max_ordinal {
8526 return Ok(());
8527 }
8528
8529 let cur_offset: usize = (3 - 1) * envelope_size;
8532
8533 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8535
8536 fidl::encoding::encode_in_envelope_optional::<IsoPacketStatusFlag, D>(
8541 self.status_flag
8542 .as_ref()
8543 .map(<IsoPacketStatusFlag as fidl::encoding::ValueTypeMarker>::borrow),
8544 encoder,
8545 offset + cur_offset,
8546 depth,
8547 )?;
8548
8549 _prev_end_offset = cur_offset + envelope_size;
8550 if 4 > max_ordinal {
8551 return Ok(());
8552 }
8553
8554 let cur_offset: usize = (4 - 1) * envelope_size;
8557
8558 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8560
8561 fidl::encoding::encode_in_envelope_optional::<i64, D>(
8566 self.timestamp.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
8567 encoder,
8568 offset + cur_offset,
8569 depth,
8570 )?;
8571
8572 _prev_end_offset = cur_offset + envelope_size;
8573
8574 Ok(())
8575 }
8576 }
8577
8578 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8579 for IsochronousStreamReadResponse
8580 {
8581 #[inline(always)]
8582 fn new_empty() -> Self {
8583 Self::default()
8584 }
8585
8586 unsafe fn decode(
8587 &mut self,
8588 decoder: &mut fidl::encoding::Decoder<'_, D>,
8589 offset: usize,
8590 mut depth: fidl::encoding::Depth,
8591 ) -> fidl::Result<()> {
8592 decoder.debug_check_bounds::<Self>(offset);
8593 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8594 None => return Err(fidl::Error::NotNullable),
8595 Some(len) => len,
8596 };
8597 if len == 0 {
8599 return Ok(());
8600 };
8601 depth.increment()?;
8602 let envelope_size = 8;
8603 let bytes_len = len * envelope_size;
8604 let offset = decoder.out_of_line_offset(bytes_len)?;
8605 let mut _next_ordinal_to_read = 0;
8607 let mut next_offset = offset;
8608 let end_offset = offset + bytes_len;
8609 _next_ordinal_to_read += 1;
8610 if next_offset >= end_offset {
8611 return Ok(());
8612 }
8613
8614 while _next_ordinal_to_read < 1 {
8616 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8617 _next_ordinal_to_read += 1;
8618 next_offset += envelope_size;
8619 }
8620
8621 let next_out_of_line = decoder.next_out_of_line();
8622 let handles_before = decoder.remaining_handles();
8623 if let Some((inlined, num_bytes, num_handles)) =
8624 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8625 {
8626 let member_inline_size = <fidl::encoding::UnboundedVector<u8> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8627 if inlined != (member_inline_size <= 4) {
8628 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8629 }
8630 let inner_offset;
8631 let mut inner_depth = depth.clone();
8632 if inlined {
8633 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8634 inner_offset = next_offset;
8635 } else {
8636 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8637 inner_depth.increment()?;
8638 }
8639 let val_ref = self.data.get_or_insert_with(|| {
8640 fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D)
8641 });
8642 fidl::decode!(
8643 fidl::encoding::UnboundedVector<u8>,
8644 D,
8645 val_ref,
8646 decoder,
8647 inner_offset,
8648 inner_depth
8649 )?;
8650 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8651 {
8652 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8653 }
8654 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8655 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8656 }
8657 }
8658
8659 next_offset += envelope_size;
8660 _next_ordinal_to_read += 1;
8661 if next_offset >= end_offset {
8662 return Ok(());
8663 }
8664
8665 while _next_ordinal_to_read < 2 {
8667 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8668 _next_ordinal_to_read += 1;
8669 next_offset += envelope_size;
8670 }
8671
8672 let next_out_of_line = decoder.next_out_of_line();
8673 let handles_before = decoder.remaining_handles();
8674 if let Some((inlined, num_bytes, num_handles)) =
8675 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8676 {
8677 let member_inline_size =
8678 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8679 if inlined != (member_inline_size <= 4) {
8680 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8681 }
8682 let inner_offset;
8683 let mut inner_depth = depth.clone();
8684 if inlined {
8685 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8686 inner_offset = next_offset;
8687 } else {
8688 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8689 inner_depth.increment()?;
8690 }
8691 let val_ref = self.sequence_number.get_or_insert_with(|| fidl::new_empty!(u16, D));
8692 fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
8693 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8694 {
8695 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8696 }
8697 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8698 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8699 }
8700 }
8701
8702 next_offset += envelope_size;
8703 _next_ordinal_to_read += 1;
8704 if next_offset >= end_offset {
8705 return Ok(());
8706 }
8707
8708 while _next_ordinal_to_read < 3 {
8710 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8711 _next_ordinal_to_read += 1;
8712 next_offset += envelope_size;
8713 }
8714
8715 let next_out_of_line = decoder.next_out_of_line();
8716 let handles_before = decoder.remaining_handles();
8717 if let Some((inlined, num_bytes, num_handles)) =
8718 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8719 {
8720 let member_inline_size =
8721 <IsoPacketStatusFlag as fidl::encoding::TypeMarker>::inline_size(
8722 decoder.context,
8723 );
8724 if inlined != (member_inline_size <= 4) {
8725 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8726 }
8727 let inner_offset;
8728 let mut inner_depth = depth.clone();
8729 if inlined {
8730 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8731 inner_offset = next_offset;
8732 } else {
8733 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8734 inner_depth.increment()?;
8735 }
8736 let val_ref = self
8737 .status_flag
8738 .get_or_insert_with(|| fidl::new_empty!(IsoPacketStatusFlag, D));
8739 fidl::decode!(IsoPacketStatusFlag, D, val_ref, decoder, inner_offset, inner_depth)?;
8740 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8741 {
8742 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8743 }
8744 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8745 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8746 }
8747 }
8748
8749 next_offset += envelope_size;
8750 _next_ordinal_to_read += 1;
8751 if next_offset >= end_offset {
8752 return Ok(());
8753 }
8754
8755 while _next_ordinal_to_read < 4 {
8757 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8758 _next_ordinal_to_read += 1;
8759 next_offset += envelope_size;
8760 }
8761
8762 let next_out_of_line = decoder.next_out_of_line();
8763 let handles_before = decoder.remaining_handles();
8764 if let Some((inlined, num_bytes, num_handles)) =
8765 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8766 {
8767 let member_inline_size =
8768 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8769 if inlined != (member_inline_size <= 4) {
8770 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8771 }
8772 let inner_offset;
8773 let mut inner_depth = depth.clone();
8774 if inlined {
8775 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8776 inner_offset = next_offset;
8777 } else {
8778 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8779 inner_depth.increment()?;
8780 }
8781 let val_ref = self.timestamp.get_or_insert_with(|| fidl::new_empty!(i64, D));
8782 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
8783 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8784 {
8785 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8786 }
8787 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8788 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8789 }
8790 }
8791
8792 next_offset += envelope_size;
8793
8794 while next_offset < end_offset {
8796 _next_ordinal_to_read += 1;
8797 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8798 next_offset += envelope_size;
8799 }
8800
8801 Ok(())
8802 }
8803 }
8804
8805 impl Legacy {
8806 #[inline(always)]
8807 fn max_ordinal_present(&self) -> u64 {
8808 0
8809 }
8810 }
8811
8812 impl fidl::encoding::ValueTypeMarker for Legacy {
8813 type Borrowed<'a> = &'a Self;
8814 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8815 value
8816 }
8817 }
8818
8819 unsafe impl fidl::encoding::TypeMarker for Legacy {
8820 type Owned = Self;
8821
8822 #[inline(always)]
8823 fn inline_align(_context: fidl::encoding::Context) -> usize {
8824 8
8825 }
8826
8827 #[inline(always)]
8828 fn inline_size(_context: fidl::encoding::Context) -> usize {
8829 16
8830 }
8831 }
8832
8833 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Legacy, D> for &Legacy {
8834 unsafe fn encode(
8835 self,
8836 encoder: &mut fidl::encoding::Encoder<'_, D>,
8837 offset: usize,
8838 mut depth: fidl::encoding::Depth,
8839 ) -> fidl::Result<()> {
8840 encoder.debug_check_bounds::<Legacy>(offset);
8841 let max_ordinal: u64 = self.max_ordinal_present();
8843 encoder.write_num(max_ordinal, offset);
8844 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8845 if max_ordinal == 0 {
8847 return Ok(());
8848 }
8849 depth.increment()?;
8850 let envelope_size = 8;
8851 let bytes_len = max_ordinal as usize * envelope_size;
8852 #[allow(unused_variables)]
8853 let offset = encoder.out_of_line_offset(bytes_len);
8854 let mut _prev_end_offset: usize = 0;
8855
8856 Ok(())
8857 }
8858 }
8859
8860 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Legacy {
8861 #[inline(always)]
8862 fn new_empty() -> Self {
8863 Self::default()
8864 }
8865
8866 unsafe fn decode(
8867 &mut self,
8868 decoder: &mut fidl::encoding::Decoder<'_, D>,
8869 offset: usize,
8870 mut depth: fidl::encoding::Depth,
8871 ) -> fidl::Result<()> {
8872 decoder.debug_check_bounds::<Self>(offset);
8873 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8874 None => return Err(fidl::Error::NotNullable),
8875 Some(len) => len,
8876 };
8877 if len == 0 {
8879 return Ok(());
8880 };
8881 depth.increment()?;
8882 let envelope_size = 8;
8883 let bytes_len = len * envelope_size;
8884 let offset = decoder.out_of_line_offset(bytes_len)?;
8885 let mut _next_ordinal_to_read = 0;
8887 let mut next_offset = offset;
8888 let end_offset = offset + bytes_len;
8889
8890 while next_offset < end_offset {
8892 _next_ordinal_to_read += 1;
8893 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8894 next_offset += envelope_size;
8895 }
8896
8897 Ok(())
8898 }
8899 }
8900
8901 impl Peer {
8902 #[inline(always)]
8903 fn max_ordinal_present(&self) -> u64 {
8904 if let Some(_) = self.periodic_advertising_interval {
8905 return 10;
8906 }
8907 if let Some(_) = self.advertising_sid {
8908 return 9;
8909 }
8910 if let Some(_) = self.last_updated {
8911 return 8;
8912 }
8913 if let Some(_) = self.bonded {
8914 return 7;
8915 }
8916 if let Some(_) = self.data {
8917 return 6;
8918 }
8919 if let Some(_) = self.name {
8920 return 5;
8921 }
8922 if let Some(_) = self.advertising_data {
8923 return 4;
8924 }
8925 if let Some(_) = self.rssi {
8926 return 3;
8927 }
8928 if let Some(_) = self.connectable {
8929 return 2;
8930 }
8931 if let Some(_) = self.id {
8932 return 1;
8933 }
8934 0
8935 }
8936 }
8937
8938 impl fidl::encoding::ValueTypeMarker for Peer {
8939 type Borrowed<'a> = &'a Self;
8940 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8941 value
8942 }
8943 }
8944
8945 unsafe impl fidl::encoding::TypeMarker for Peer {
8946 type Owned = Self;
8947
8948 #[inline(always)]
8949 fn inline_align(_context: fidl::encoding::Context) -> usize {
8950 8
8951 }
8952
8953 #[inline(always)]
8954 fn inline_size(_context: fidl::encoding::Context) -> usize {
8955 16
8956 }
8957 }
8958
8959 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Peer, D> for &Peer {
8960 unsafe fn encode(
8961 self,
8962 encoder: &mut fidl::encoding::Encoder<'_, D>,
8963 offset: usize,
8964 mut depth: fidl::encoding::Depth,
8965 ) -> fidl::Result<()> {
8966 encoder.debug_check_bounds::<Peer>(offset);
8967 let max_ordinal: u64 = self.max_ordinal_present();
8969 encoder.write_num(max_ordinal, offset);
8970 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8971 if max_ordinal == 0 {
8973 return Ok(());
8974 }
8975 depth.increment()?;
8976 let envelope_size = 8;
8977 let bytes_len = max_ordinal as usize * envelope_size;
8978 #[allow(unused_variables)]
8979 let offset = encoder.out_of_line_offset(bytes_len);
8980 let mut _prev_end_offset: usize = 0;
8981 if 1 > max_ordinal {
8982 return Ok(());
8983 }
8984
8985 let cur_offset: usize = (1 - 1) * envelope_size;
8988
8989 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8991
8992 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::PeerId, D>(
8997 self.id.as_ref().map(
8998 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow,
8999 ),
9000 encoder,
9001 offset + cur_offset,
9002 depth,
9003 )?;
9004
9005 _prev_end_offset = cur_offset + envelope_size;
9006 if 2 > max_ordinal {
9007 return Ok(());
9008 }
9009
9010 let cur_offset: usize = (2 - 1) * envelope_size;
9013
9014 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9016
9017 fidl::encoding::encode_in_envelope_optional::<bool, D>(
9022 self.connectable.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
9023 encoder,
9024 offset + cur_offset,
9025 depth,
9026 )?;
9027
9028 _prev_end_offset = cur_offset + envelope_size;
9029 if 3 > max_ordinal {
9030 return Ok(());
9031 }
9032
9033 let cur_offset: usize = (3 - 1) * envelope_size;
9036
9037 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9039
9040 fidl::encoding::encode_in_envelope_optional::<i8, D>(
9045 self.rssi.as_ref().map(<i8 as fidl::encoding::ValueTypeMarker>::borrow),
9046 encoder,
9047 offset + cur_offset,
9048 depth,
9049 )?;
9050
9051 _prev_end_offset = cur_offset + envelope_size;
9052 if 4 > max_ordinal {
9053 return Ok(());
9054 }
9055
9056 let cur_offset: usize = (4 - 1) * envelope_size;
9059
9060 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9062
9063 fidl::encoding::encode_in_envelope_optional::<AdvertisingData, D>(
9068 self.advertising_data
9069 .as_ref()
9070 .map(<AdvertisingData as fidl::encoding::ValueTypeMarker>::borrow),
9071 encoder,
9072 offset + cur_offset,
9073 depth,
9074 )?;
9075
9076 _prev_end_offset = cur_offset + envelope_size;
9077 if 5 > max_ordinal {
9078 return Ok(());
9079 }
9080
9081 let cur_offset: usize = (5 - 1) * envelope_size;
9084
9085 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9087
9088 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<248>, D>(
9093 self.name.as_ref().map(
9094 <fidl::encoding::BoundedString<248> as fidl::encoding::ValueTypeMarker>::borrow,
9095 ),
9096 encoder,
9097 offset + cur_offset,
9098 depth,
9099 )?;
9100
9101 _prev_end_offset = cur_offset + envelope_size;
9102 if 6 > max_ordinal {
9103 return Ok(());
9104 }
9105
9106 let cur_offset: usize = (6 - 1) * envelope_size;
9109
9110 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9112
9113 fidl::encoding::encode_in_envelope_optional::<ScanData, D>(
9118 self.data.as_ref().map(<ScanData as fidl::encoding::ValueTypeMarker>::borrow),
9119 encoder,
9120 offset + cur_offset,
9121 depth,
9122 )?;
9123
9124 _prev_end_offset = cur_offset + envelope_size;
9125 if 7 > max_ordinal {
9126 return Ok(());
9127 }
9128
9129 let cur_offset: usize = (7 - 1) * envelope_size;
9132
9133 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9135
9136 fidl::encoding::encode_in_envelope_optional::<bool, D>(
9141 self.bonded.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
9142 encoder,
9143 offset + cur_offset,
9144 depth,
9145 )?;
9146
9147 _prev_end_offset = cur_offset + envelope_size;
9148 if 8 > max_ordinal {
9149 return Ok(());
9150 }
9151
9152 let cur_offset: usize = (8 - 1) * envelope_size;
9155
9156 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9158
9159 fidl::encoding::encode_in_envelope_optional::<i64, D>(
9164 self.last_updated.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
9165 encoder,
9166 offset + cur_offset,
9167 depth,
9168 )?;
9169
9170 _prev_end_offset = cur_offset + envelope_size;
9171 if 9 > max_ordinal {
9172 return Ok(());
9173 }
9174
9175 let cur_offset: usize = (9 - 1) * envelope_size;
9178
9179 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9181
9182 fidl::encoding::encode_in_envelope_optional::<u8, D>(
9187 self.advertising_sid.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
9188 encoder,
9189 offset + cur_offset,
9190 depth,
9191 )?;
9192
9193 _prev_end_offset = cur_offset + envelope_size;
9194 if 10 > max_ordinal {
9195 return Ok(());
9196 }
9197
9198 let cur_offset: usize = (10 - 1) * envelope_size;
9201
9202 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9204
9205 fidl::encoding::encode_in_envelope_optional::<u16, D>(
9210 self.periodic_advertising_interval
9211 .as_ref()
9212 .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
9213 encoder,
9214 offset + cur_offset,
9215 depth,
9216 )?;
9217
9218 _prev_end_offset = cur_offset + envelope_size;
9219
9220 Ok(())
9221 }
9222 }
9223
9224 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Peer {
9225 #[inline(always)]
9226 fn new_empty() -> Self {
9227 Self::default()
9228 }
9229
9230 unsafe fn decode(
9231 &mut self,
9232 decoder: &mut fidl::encoding::Decoder<'_, D>,
9233 offset: usize,
9234 mut depth: fidl::encoding::Depth,
9235 ) -> fidl::Result<()> {
9236 decoder.debug_check_bounds::<Self>(offset);
9237 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9238 None => return Err(fidl::Error::NotNullable),
9239 Some(len) => len,
9240 };
9241 if len == 0 {
9243 return Ok(());
9244 };
9245 depth.increment()?;
9246 let envelope_size = 8;
9247 let bytes_len = len * envelope_size;
9248 let offset = decoder.out_of_line_offset(bytes_len)?;
9249 let mut _next_ordinal_to_read = 0;
9251 let mut next_offset = offset;
9252 let end_offset = offset + bytes_len;
9253 _next_ordinal_to_read += 1;
9254 if next_offset >= end_offset {
9255 return Ok(());
9256 }
9257
9258 while _next_ordinal_to_read < 1 {
9260 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9261 _next_ordinal_to_read += 1;
9262 next_offset += envelope_size;
9263 }
9264
9265 let next_out_of_line = decoder.next_out_of_line();
9266 let handles_before = decoder.remaining_handles();
9267 if let Some((inlined, num_bytes, num_handles)) =
9268 fidl::encoding::decode_envelope_header(decoder, next_offset)?
9269 {
9270 let member_inline_size =
9271 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::TypeMarker>::inline_size(
9272 decoder.context,
9273 );
9274 if inlined != (member_inline_size <= 4) {
9275 return Err(fidl::Error::InvalidInlineBitInEnvelope);
9276 }
9277 let inner_offset;
9278 let mut inner_depth = depth.clone();
9279 if inlined {
9280 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9281 inner_offset = next_offset;
9282 } else {
9283 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9284 inner_depth.increment()?;
9285 }
9286 let val_ref = self
9287 .id
9288 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D));
9289 fidl::decode!(
9290 fidl_fuchsia_bluetooth::PeerId,
9291 D,
9292 val_ref,
9293 decoder,
9294 inner_offset,
9295 inner_depth
9296 )?;
9297 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9298 {
9299 return Err(fidl::Error::InvalidNumBytesInEnvelope);
9300 }
9301 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9302 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9303 }
9304 }
9305
9306 next_offset += envelope_size;
9307 _next_ordinal_to_read += 1;
9308 if next_offset >= end_offset {
9309 return Ok(());
9310 }
9311
9312 while _next_ordinal_to_read < 2 {
9314 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9315 _next_ordinal_to_read += 1;
9316 next_offset += envelope_size;
9317 }
9318
9319 let next_out_of_line = decoder.next_out_of_line();
9320 let handles_before = decoder.remaining_handles();
9321 if let Some((inlined, num_bytes, num_handles)) =
9322 fidl::encoding::decode_envelope_header(decoder, next_offset)?
9323 {
9324 let member_inline_size =
9325 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9326 if inlined != (member_inline_size <= 4) {
9327 return Err(fidl::Error::InvalidInlineBitInEnvelope);
9328 }
9329 let inner_offset;
9330 let mut inner_depth = depth.clone();
9331 if inlined {
9332 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9333 inner_offset = next_offset;
9334 } else {
9335 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9336 inner_depth.increment()?;
9337 }
9338 let val_ref = self.connectable.get_or_insert_with(|| fidl::new_empty!(bool, D));
9339 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
9340 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9341 {
9342 return Err(fidl::Error::InvalidNumBytesInEnvelope);
9343 }
9344 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9345 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9346 }
9347 }
9348
9349 next_offset += envelope_size;
9350 _next_ordinal_to_read += 1;
9351 if next_offset >= end_offset {
9352 return Ok(());
9353 }
9354
9355 while _next_ordinal_to_read < 3 {
9357 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9358 _next_ordinal_to_read += 1;
9359 next_offset += envelope_size;
9360 }
9361
9362 let next_out_of_line = decoder.next_out_of_line();
9363 let handles_before = decoder.remaining_handles();
9364 if let Some((inlined, num_bytes, num_handles)) =
9365 fidl::encoding::decode_envelope_header(decoder, next_offset)?
9366 {
9367 let member_inline_size =
9368 <i8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9369 if inlined != (member_inline_size <= 4) {
9370 return Err(fidl::Error::InvalidInlineBitInEnvelope);
9371 }
9372 let inner_offset;
9373 let mut inner_depth = depth.clone();
9374 if inlined {
9375 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9376 inner_offset = next_offset;
9377 } else {
9378 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9379 inner_depth.increment()?;
9380 }
9381 let val_ref = self.rssi.get_or_insert_with(|| fidl::new_empty!(i8, D));
9382 fidl::decode!(i8, D, val_ref, decoder, inner_offset, inner_depth)?;
9383 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9384 {
9385 return Err(fidl::Error::InvalidNumBytesInEnvelope);
9386 }
9387 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9388 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9389 }
9390 }
9391
9392 next_offset += envelope_size;
9393 _next_ordinal_to_read += 1;
9394 if next_offset >= end_offset {
9395 return Ok(());
9396 }
9397
9398 while _next_ordinal_to_read < 4 {
9400 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9401 _next_ordinal_to_read += 1;
9402 next_offset += envelope_size;
9403 }
9404
9405 let next_out_of_line = decoder.next_out_of_line();
9406 let handles_before = decoder.remaining_handles();
9407 if let Some((inlined, num_bytes, num_handles)) =
9408 fidl::encoding::decode_envelope_header(decoder, next_offset)?
9409 {
9410 let member_inline_size =
9411 <AdvertisingData as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9412 if inlined != (member_inline_size <= 4) {
9413 return Err(fidl::Error::InvalidInlineBitInEnvelope);
9414 }
9415 let inner_offset;
9416 let mut inner_depth = depth.clone();
9417 if inlined {
9418 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9419 inner_offset = next_offset;
9420 } else {
9421 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9422 inner_depth.increment()?;
9423 }
9424 let val_ref = self
9425 .advertising_data
9426 .get_or_insert_with(|| fidl::new_empty!(AdvertisingData, D));
9427 fidl::decode!(AdvertisingData, D, val_ref, decoder, inner_offset, inner_depth)?;
9428 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9429 {
9430 return Err(fidl::Error::InvalidNumBytesInEnvelope);
9431 }
9432 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9433 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9434 }
9435 }
9436
9437 next_offset += envelope_size;
9438 _next_ordinal_to_read += 1;
9439 if next_offset >= end_offset {
9440 return Ok(());
9441 }
9442
9443 while _next_ordinal_to_read < 5 {
9445 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9446 _next_ordinal_to_read += 1;
9447 next_offset += envelope_size;
9448 }
9449
9450 let next_out_of_line = decoder.next_out_of_line();
9451 let handles_before = decoder.remaining_handles();
9452 if let Some((inlined, num_bytes, num_handles)) =
9453 fidl::encoding::decode_envelope_header(decoder, next_offset)?
9454 {
9455 let member_inline_size =
9456 <fidl::encoding::BoundedString<248> as fidl::encoding::TypeMarker>::inline_size(
9457 decoder.context,
9458 );
9459 if inlined != (member_inline_size <= 4) {
9460 return Err(fidl::Error::InvalidInlineBitInEnvelope);
9461 }
9462 let inner_offset;
9463 let mut inner_depth = depth.clone();
9464 if inlined {
9465 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9466 inner_offset = next_offset;
9467 } else {
9468 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9469 inner_depth.increment()?;
9470 }
9471 let val_ref = self
9472 .name
9473 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<248>, D));
9474 fidl::decode!(
9475 fidl::encoding::BoundedString<248>,
9476 D,
9477 val_ref,
9478 decoder,
9479 inner_offset,
9480 inner_depth
9481 )?;
9482 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9483 {
9484 return Err(fidl::Error::InvalidNumBytesInEnvelope);
9485 }
9486 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9487 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9488 }
9489 }
9490
9491 next_offset += envelope_size;
9492 _next_ordinal_to_read += 1;
9493 if next_offset >= end_offset {
9494 return Ok(());
9495 }
9496
9497 while _next_ordinal_to_read < 6 {
9499 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9500 _next_ordinal_to_read += 1;
9501 next_offset += envelope_size;
9502 }
9503
9504 let next_out_of_line = decoder.next_out_of_line();
9505 let handles_before = decoder.remaining_handles();
9506 if let Some((inlined, num_bytes, num_handles)) =
9507 fidl::encoding::decode_envelope_header(decoder, next_offset)?
9508 {
9509 let member_inline_size =
9510 <ScanData as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9511 if inlined != (member_inline_size <= 4) {
9512 return Err(fidl::Error::InvalidInlineBitInEnvelope);
9513 }
9514 let inner_offset;
9515 let mut inner_depth = depth.clone();
9516 if inlined {
9517 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9518 inner_offset = next_offset;
9519 } else {
9520 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9521 inner_depth.increment()?;
9522 }
9523 let val_ref = self.data.get_or_insert_with(|| fidl::new_empty!(ScanData, D));
9524 fidl::decode!(ScanData, D, val_ref, decoder, inner_offset, inner_depth)?;
9525 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9526 {
9527 return Err(fidl::Error::InvalidNumBytesInEnvelope);
9528 }
9529 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9530 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9531 }
9532 }
9533
9534 next_offset += envelope_size;
9535 _next_ordinal_to_read += 1;
9536 if next_offset >= end_offset {
9537 return Ok(());
9538 }
9539
9540 while _next_ordinal_to_read < 7 {
9542 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9543 _next_ordinal_to_read += 1;
9544 next_offset += envelope_size;
9545 }
9546
9547 let next_out_of_line = decoder.next_out_of_line();
9548 let handles_before = decoder.remaining_handles();
9549 if let Some((inlined, num_bytes, num_handles)) =
9550 fidl::encoding::decode_envelope_header(decoder, next_offset)?
9551 {
9552 let member_inline_size =
9553 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9554 if inlined != (member_inline_size <= 4) {
9555 return Err(fidl::Error::InvalidInlineBitInEnvelope);
9556 }
9557 let inner_offset;
9558 let mut inner_depth = depth.clone();
9559 if inlined {
9560 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9561 inner_offset = next_offset;
9562 } else {
9563 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9564 inner_depth.increment()?;
9565 }
9566 let val_ref = self.bonded.get_or_insert_with(|| fidl::new_empty!(bool, D));
9567 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
9568 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9569 {
9570 return Err(fidl::Error::InvalidNumBytesInEnvelope);
9571 }
9572 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9573 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9574 }
9575 }
9576
9577 next_offset += envelope_size;
9578 _next_ordinal_to_read += 1;
9579 if next_offset >= end_offset {
9580 return Ok(());
9581 }
9582
9583 while _next_ordinal_to_read < 8 {
9585 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9586 _next_ordinal_to_read += 1;
9587 next_offset += envelope_size;
9588 }
9589
9590 let next_out_of_line = decoder.next_out_of_line();
9591 let handles_before = decoder.remaining_handles();
9592 if let Some((inlined, num_bytes, num_handles)) =
9593 fidl::encoding::decode_envelope_header(decoder, next_offset)?
9594 {
9595 let member_inline_size =
9596 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9597 if inlined != (member_inline_size <= 4) {
9598 return Err(fidl::Error::InvalidInlineBitInEnvelope);
9599 }
9600 let inner_offset;
9601 let mut inner_depth = depth.clone();
9602 if inlined {
9603 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9604 inner_offset = next_offset;
9605 } else {
9606 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9607 inner_depth.increment()?;
9608 }
9609 let val_ref = self.last_updated.get_or_insert_with(|| fidl::new_empty!(i64, D));
9610 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
9611 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9612 {
9613 return Err(fidl::Error::InvalidNumBytesInEnvelope);
9614 }
9615 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9616 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9617 }
9618 }
9619
9620 next_offset += envelope_size;
9621 _next_ordinal_to_read += 1;
9622 if next_offset >= end_offset {
9623 return Ok(());
9624 }
9625
9626 while _next_ordinal_to_read < 9 {
9628 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9629 _next_ordinal_to_read += 1;
9630 next_offset += envelope_size;
9631 }
9632
9633 let next_out_of_line = decoder.next_out_of_line();
9634 let handles_before = decoder.remaining_handles();
9635 if let Some((inlined, num_bytes, num_handles)) =
9636 fidl::encoding::decode_envelope_header(decoder, next_offset)?
9637 {
9638 let member_inline_size =
9639 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9640 if inlined != (member_inline_size <= 4) {
9641 return Err(fidl::Error::InvalidInlineBitInEnvelope);
9642 }
9643 let inner_offset;
9644 let mut inner_depth = depth.clone();
9645 if inlined {
9646 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9647 inner_offset = next_offset;
9648 } else {
9649 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9650 inner_depth.increment()?;
9651 }
9652 let val_ref = self.advertising_sid.get_or_insert_with(|| fidl::new_empty!(u8, D));
9653 fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
9654 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9655 {
9656 return Err(fidl::Error::InvalidNumBytesInEnvelope);
9657 }
9658 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9659 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9660 }
9661 }
9662
9663 next_offset += envelope_size;
9664 _next_ordinal_to_read += 1;
9665 if next_offset >= end_offset {
9666 return Ok(());
9667 }
9668
9669 while _next_ordinal_to_read < 10 {
9671 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9672 _next_ordinal_to_read += 1;
9673 next_offset += envelope_size;
9674 }
9675
9676 let next_out_of_line = decoder.next_out_of_line();
9677 let handles_before = decoder.remaining_handles();
9678 if let Some((inlined, num_bytes, num_handles)) =
9679 fidl::encoding::decode_envelope_header(decoder, next_offset)?
9680 {
9681 let member_inline_size =
9682 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9683 if inlined != (member_inline_size <= 4) {
9684 return Err(fidl::Error::InvalidInlineBitInEnvelope);
9685 }
9686 let inner_offset;
9687 let mut inner_depth = depth.clone();
9688 if inlined {
9689 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9690 inner_offset = next_offset;
9691 } else {
9692 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9693 inner_depth.increment()?;
9694 }
9695 let val_ref = self
9696 .periodic_advertising_interval
9697 .get_or_insert_with(|| fidl::new_empty!(u16, D));
9698 fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
9699 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9700 {
9701 return Err(fidl::Error::InvalidNumBytesInEnvelope);
9702 }
9703 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9704 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9705 }
9706 }
9707
9708 next_offset += envelope_size;
9709
9710 while next_offset < end_offset {
9712 _next_ordinal_to_read += 1;
9713 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9714 next_offset += envelope_size;
9715 }
9716
9717 Ok(())
9718 }
9719 }
9720
9721 impl ScanData {
9722 #[inline(always)]
9723 fn max_ordinal_present(&self) -> u64 {
9724 if let Some(_) = self.timestamp {
9725 return 7;
9726 }
9727 if let Some(_) = self.uris {
9728 return 6;
9729 }
9730 if let Some(_) = self.manufacturer_data {
9731 return 5;
9732 }
9733 if let Some(_) = self.service_data {
9734 return 4;
9735 }
9736 if let Some(_) = self.service_uuids {
9737 return 3;
9738 }
9739 if let Some(_) = self.appearance {
9740 return 2;
9741 }
9742 if let Some(_) = self.tx_power {
9743 return 1;
9744 }
9745 0
9746 }
9747 }
9748
9749 impl fidl::encoding::ValueTypeMarker for ScanData {
9750 type Borrowed<'a> = &'a Self;
9751 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9752 value
9753 }
9754 }
9755
9756 unsafe impl fidl::encoding::TypeMarker for ScanData {
9757 type Owned = Self;
9758
9759 #[inline(always)]
9760 fn inline_align(_context: fidl::encoding::Context) -> usize {
9761 8
9762 }
9763
9764 #[inline(always)]
9765 fn inline_size(_context: fidl::encoding::Context) -> usize {
9766 16
9767 }
9768 }
9769
9770 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ScanData, D> for &ScanData {
9771 unsafe fn encode(
9772 self,
9773 encoder: &mut fidl::encoding::Encoder<'_, D>,
9774 offset: usize,
9775 mut depth: fidl::encoding::Depth,
9776 ) -> fidl::Result<()> {
9777 encoder.debug_check_bounds::<ScanData>(offset);
9778 let max_ordinal: u64 = self.max_ordinal_present();
9780 encoder.write_num(max_ordinal, offset);
9781 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9782 if max_ordinal == 0 {
9784 return Ok(());
9785 }
9786 depth.increment()?;
9787 let envelope_size = 8;
9788 let bytes_len = max_ordinal as usize * envelope_size;
9789 #[allow(unused_variables)]
9790 let offset = encoder.out_of_line_offset(bytes_len);
9791 let mut _prev_end_offset: usize = 0;
9792 if 1 > max_ordinal {
9793 return Ok(());
9794 }
9795
9796 let cur_offset: usize = (1 - 1) * envelope_size;
9799
9800 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9802
9803 fidl::encoding::encode_in_envelope_optional::<i8, D>(
9808 self.tx_power.as_ref().map(<i8 as fidl::encoding::ValueTypeMarker>::borrow),
9809 encoder,
9810 offset + cur_offset,
9811 depth,
9812 )?;
9813
9814 _prev_end_offset = cur_offset + envelope_size;
9815 if 2 > max_ordinal {
9816 return Ok(());
9817 }
9818
9819 let cur_offset: usize = (2 - 1) * envelope_size;
9822
9823 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9825
9826 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::Appearance, D>(
9831 self.appearance.as_ref().map(
9832 <fidl_fuchsia_bluetooth::Appearance as fidl::encoding::ValueTypeMarker>::borrow,
9833 ),
9834 encoder,
9835 offset + cur_offset,
9836 depth,
9837 )?;
9838
9839 _prev_end_offset = cur_offset + envelope_size;
9840 if 3 > max_ordinal {
9841 return Ok(());
9842 }
9843
9844 let cur_offset: usize = (3 - 1) * envelope_size;
9847
9848 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9850
9851 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::Uuid>, D>(
9856 self.service_uuids.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::Uuid> as fidl::encoding::ValueTypeMarker>::borrow),
9857 encoder, offset + cur_offset, depth
9858 )?;
9859
9860 _prev_end_offset = cur_offset + envelope_size;
9861 if 4 > max_ordinal {
9862 return Ok(());
9863 }
9864
9865 let cur_offset: usize = (4 - 1) * envelope_size;
9868
9869 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9871
9872 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<ServiceData>, D>(
9877 self.service_data.as_ref().map(<fidl::encoding::UnboundedVector<ServiceData> as fidl::encoding::ValueTypeMarker>::borrow),
9878 encoder, offset + cur_offset, depth
9879 )?;
9880
9881 _prev_end_offset = cur_offset + envelope_size;
9882 if 5 > max_ordinal {
9883 return Ok(());
9884 }
9885
9886 let cur_offset: usize = (5 - 1) * envelope_size;
9889
9890 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9892
9893 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<ManufacturerData>, D>(
9898 self.manufacturer_data.as_ref().map(<fidl::encoding::UnboundedVector<ManufacturerData> as fidl::encoding::ValueTypeMarker>::borrow),
9899 encoder, offset + cur_offset, depth
9900 )?;
9901
9902 _prev_end_offset = cur_offset + envelope_size;
9903 if 6 > max_ordinal {
9904 return Ok(());
9905 }
9906
9907 let cur_offset: usize = (6 - 1) * envelope_size;
9910
9911 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9913
9914 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<278>>, D>(
9919 self.uris.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<278>> as fidl::encoding::ValueTypeMarker>::borrow),
9920 encoder, offset + cur_offset, depth
9921 )?;
9922
9923 _prev_end_offset = cur_offset + envelope_size;
9924 if 7 > max_ordinal {
9925 return Ok(());
9926 }
9927
9928 let cur_offset: usize = (7 - 1) * envelope_size;
9931
9932 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9934
9935 fidl::encoding::encode_in_envelope_optional::<i64, D>(
9940 self.timestamp.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
9941 encoder,
9942 offset + cur_offset,
9943 depth,
9944 )?;
9945
9946 _prev_end_offset = cur_offset + envelope_size;
9947
9948 Ok(())
9949 }
9950 }
9951
9952 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ScanData {
9953 #[inline(always)]
9954 fn new_empty() -> Self {
9955 Self::default()
9956 }
9957
9958 unsafe fn decode(
9959 &mut self,
9960 decoder: &mut fidl::encoding::Decoder<'_, D>,
9961 offset: usize,
9962 mut depth: fidl::encoding::Depth,
9963 ) -> fidl::Result<()> {
9964 decoder.debug_check_bounds::<Self>(offset);
9965 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9966 None => return Err(fidl::Error::NotNullable),
9967 Some(len) => len,
9968 };
9969 if len == 0 {
9971 return Ok(());
9972 };
9973 depth.increment()?;
9974 let envelope_size = 8;
9975 let bytes_len = len * envelope_size;
9976 let offset = decoder.out_of_line_offset(bytes_len)?;
9977 let mut _next_ordinal_to_read = 0;
9979 let mut next_offset = offset;
9980 let end_offset = offset + bytes_len;
9981 _next_ordinal_to_read += 1;
9982 if next_offset >= end_offset {
9983 return Ok(());
9984 }
9985
9986 while _next_ordinal_to_read < 1 {
9988 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9989 _next_ordinal_to_read += 1;
9990 next_offset += envelope_size;
9991 }
9992
9993 let next_out_of_line = decoder.next_out_of_line();
9994 let handles_before = decoder.remaining_handles();
9995 if let Some((inlined, num_bytes, num_handles)) =
9996 fidl::encoding::decode_envelope_header(decoder, next_offset)?
9997 {
9998 let member_inline_size =
9999 <i8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10000 if inlined != (member_inline_size <= 4) {
10001 return Err(fidl::Error::InvalidInlineBitInEnvelope);
10002 }
10003 let inner_offset;
10004 let mut inner_depth = depth.clone();
10005 if inlined {
10006 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10007 inner_offset = next_offset;
10008 } else {
10009 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10010 inner_depth.increment()?;
10011 }
10012 let val_ref = self.tx_power.get_or_insert_with(|| fidl::new_empty!(i8, D));
10013 fidl::decode!(i8, D, val_ref, decoder, inner_offset, inner_depth)?;
10014 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10015 {
10016 return Err(fidl::Error::InvalidNumBytesInEnvelope);
10017 }
10018 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10019 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10020 }
10021 }
10022
10023 next_offset += envelope_size;
10024 _next_ordinal_to_read += 1;
10025 if next_offset >= end_offset {
10026 return Ok(());
10027 }
10028
10029 while _next_ordinal_to_read < 2 {
10031 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10032 _next_ordinal_to_read += 1;
10033 next_offset += envelope_size;
10034 }
10035
10036 let next_out_of_line = decoder.next_out_of_line();
10037 let handles_before = decoder.remaining_handles();
10038 if let Some((inlined, num_bytes, num_handles)) =
10039 fidl::encoding::decode_envelope_header(decoder, next_offset)?
10040 {
10041 let member_inline_size =
10042 <fidl_fuchsia_bluetooth::Appearance as fidl::encoding::TypeMarker>::inline_size(
10043 decoder.context,
10044 );
10045 if inlined != (member_inline_size <= 4) {
10046 return Err(fidl::Error::InvalidInlineBitInEnvelope);
10047 }
10048 let inner_offset;
10049 let mut inner_depth = depth.clone();
10050 if inlined {
10051 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10052 inner_offset = next_offset;
10053 } else {
10054 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10055 inner_depth.increment()?;
10056 }
10057 let val_ref = self
10058 .appearance
10059 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_bluetooth::Appearance, D));
10060 fidl::decode!(
10061 fidl_fuchsia_bluetooth::Appearance,
10062 D,
10063 val_ref,
10064 decoder,
10065 inner_offset,
10066 inner_depth
10067 )?;
10068 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10069 {
10070 return Err(fidl::Error::InvalidNumBytesInEnvelope);
10071 }
10072 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10073 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10074 }
10075 }
10076
10077 next_offset += envelope_size;
10078 _next_ordinal_to_read += 1;
10079 if next_offset >= end_offset {
10080 return Ok(());
10081 }
10082
10083 while _next_ordinal_to_read < 3 {
10085 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10086 _next_ordinal_to_read += 1;
10087 next_offset += envelope_size;
10088 }
10089
10090 let next_out_of_line = decoder.next_out_of_line();
10091 let handles_before = decoder.remaining_handles();
10092 if let Some((inlined, num_bytes, num_handles)) =
10093 fidl::encoding::decode_envelope_header(decoder, next_offset)?
10094 {
10095 let member_inline_size = <fidl::encoding::UnboundedVector<
10096 fidl_fuchsia_bluetooth::Uuid,
10097 > as fidl::encoding::TypeMarker>::inline_size(
10098 decoder.context
10099 );
10100 if inlined != (member_inline_size <= 4) {
10101 return Err(fidl::Error::InvalidInlineBitInEnvelope);
10102 }
10103 let inner_offset;
10104 let mut inner_depth = depth.clone();
10105 if inlined {
10106 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10107 inner_offset = next_offset;
10108 } else {
10109 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10110 inner_depth.increment()?;
10111 }
10112 let val_ref = self.service_uuids.get_or_insert_with(|| {
10113 fidl::new_empty!(
10114 fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::Uuid>,
10115 D
10116 )
10117 });
10118 fidl::decode!(
10119 fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::Uuid>,
10120 D,
10121 val_ref,
10122 decoder,
10123 inner_offset,
10124 inner_depth
10125 )?;
10126 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10127 {
10128 return Err(fidl::Error::InvalidNumBytesInEnvelope);
10129 }
10130 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10131 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10132 }
10133 }
10134
10135 next_offset += envelope_size;
10136 _next_ordinal_to_read += 1;
10137 if next_offset >= end_offset {
10138 return Ok(());
10139 }
10140
10141 while _next_ordinal_to_read < 4 {
10143 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10144 _next_ordinal_to_read += 1;
10145 next_offset += envelope_size;
10146 }
10147
10148 let next_out_of_line = decoder.next_out_of_line();
10149 let handles_before = decoder.remaining_handles();
10150 if let Some((inlined, num_bytes, num_handles)) =
10151 fidl::encoding::decode_envelope_header(decoder, next_offset)?
10152 {
10153 let member_inline_size = <fidl::encoding::UnboundedVector<ServiceData> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10154 if inlined != (member_inline_size <= 4) {
10155 return Err(fidl::Error::InvalidInlineBitInEnvelope);
10156 }
10157 let inner_offset;
10158 let mut inner_depth = depth.clone();
10159 if inlined {
10160 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10161 inner_offset = next_offset;
10162 } else {
10163 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10164 inner_depth.increment()?;
10165 }
10166 let val_ref = self.service_data.get_or_insert_with(|| {
10167 fidl::new_empty!(fidl::encoding::UnboundedVector<ServiceData>, D)
10168 });
10169 fidl::decode!(
10170 fidl::encoding::UnboundedVector<ServiceData>,
10171 D,
10172 val_ref,
10173 decoder,
10174 inner_offset,
10175 inner_depth
10176 )?;
10177 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10178 {
10179 return Err(fidl::Error::InvalidNumBytesInEnvelope);
10180 }
10181 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10182 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10183 }
10184 }
10185
10186 next_offset += envelope_size;
10187 _next_ordinal_to_read += 1;
10188 if next_offset >= end_offset {
10189 return Ok(());
10190 }
10191
10192 while _next_ordinal_to_read < 5 {
10194 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10195 _next_ordinal_to_read += 1;
10196 next_offset += envelope_size;
10197 }
10198
10199 let next_out_of_line = decoder.next_out_of_line();
10200 let handles_before = decoder.remaining_handles();
10201 if let Some((inlined, num_bytes, num_handles)) =
10202 fidl::encoding::decode_envelope_header(decoder, next_offset)?
10203 {
10204 let member_inline_size = <fidl::encoding::UnboundedVector<ManufacturerData> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10205 if inlined != (member_inline_size <= 4) {
10206 return Err(fidl::Error::InvalidInlineBitInEnvelope);
10207 }
10208 let inner_offset;
10209 let mut inner_depth = depth.clone();
10210 if inlined {
10211 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10212 inner_offset = next_offset;
10213 } else {
10214 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10215 inner_depth.increment()?;
10216 }
10217 let val_ref = self.manufacturer_data.get_or_insert_with(|| {
10218 fidl::new_empty!(fidl::encoding::UnboundedVector<ManufacturerData>, D)
10219 });
10220 fidl::decode!(
10221 fidl::encoding::UnboundedVector<ManufacturerData>,
10222 D,
10223 val_ref,
10224 decoder,
10225 inner_offset,
10226 inner_depth
10227 )?;
10228 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10229 {
10230 return Err(fidl::Error::InvalidNumBytesInEnvelope);
10231 }
10232 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10233 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10234 }
10235 }
10236
10237 next_offset += envelope_size;
10238 _next_ordinal_to_read += 1;
10239 if next_offset >= end_offset {
10240 return Ok(());
10241 }
10242
10243 while _next_ordinal_to_read < 6 {
10245 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10246 _next_ordinal_to_read += 1;
10247 next_offset += envelope_size;
10248 }
10249
10250 let next_out_of_line = decoder.next_out_of_line();
10251 let handles_before = decoder.remaining_handles();
10252 if let Some((inlined, num_bytes, num_handles)) =
10253 fidl::encoding::decode_envelope_header(decoder, next_offset)?
10254 {
10255 let member_inline_size = <fidl::encoding::UnboundedVector<
10256 fidl::encoding::BoundedString<278>,
10257 > as fidl::encoding::TypeMarker>::inline_size(
10258 decoder.context
10259 );
10260 if inlined != (member_inline_size <= 4) {
10261 return Err(fidl::Error::InvalidInlineBitInEnvelope);
10262 }
10263 let inner_offset;
10264 let mut inner_depth = depth.clone();
10265 if inlined {
10266 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10267 inner_offset = next_offset;
10268 } else {
10269 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10270 inner_depth.increment()?;
10271 }
10272 let val_ref = self.uris.get_or_insert_with(|| {
10273 fidl::new_empty!(
10274 fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<278>>,
10275 D
10276 )
10277 });
10278 fidl::decode!(
10279 fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<278>>,
10280 D,
10281 val_ref,
10282 decoder,
10283 inner_offset,
10284 inner_depth
10285 )?;
10286 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10287 {
10288 return Err(fidl::Error::InvalidNumBytesInEnvelope);
10289 }
10290 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10291 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10292 }
10293 }
10294
10295 next_offset += envelope_size;
10296 _next_ordinal_to_read += 1;
10297 if next_offset >= end_offset {
10298 return Ok(());
10299 }
10300
10301 while _next_ordinal_to_read < 7 {
10303 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10304 _next_ordinal_to_read += 1;
10305 next_offset += envelope_size;
10306 }
10307
10308 let next_out_of_line = decoder.next_out_of_line();
10309 let handles_before = decoder.remaining_handles();
10310 if let Some((inlined, num_bytes, num_handles)) =
10311 fidl::encoding::decode_envelope_header(decoder, next_offset)?
10312 {
10313 let member_inline_size =
10314 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10315 if inlined != (member_inline_size <= 4) {
10316 return Err(fidl::Error::InvalidInlineBitInEnvelope);
10317 }
10318 let inner_offset;
10319 let mut inner_depth = depth.clone();
10320 if inlined {
10321 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10322 inner_offset = next_offset;
10323 } else {
10324 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10325 inner_depth.increment()?;
10326 }
10327 let val_ref = self.timestamp.get_or_insert_with(|| fidl::new_empty!(i64, D));
10328 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
10329 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10330 {
10331 return Err(fidl::Error::InvalidNumBytesInEnvelope);
10332 }
10333 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10334 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10335 }
10336 }
10337
10338 next_offset += envelope_size;
10339
10340 while next_offset < end_offset {
10342 _next_ordinal_to_read += 1;
10343 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10344 next_offset += envelope_size;
10345 }
10346
10347 Ok(())
10348 }
10349 }
10350
10351 impl ScanOptions {
10352 #[inline(always)]
10353 fn max_ordinal_present(&self) -> u64 {
10354 if let Some(_) = self.filters {
10355 return 1;
10356 }
10357 0
10358 }
10359 }
10360
10361 impl fidl::encoding::ValueTypeMarker for ScanOptions {
10362 type Borrowed<'a> = &'a Self;
10363 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10364 value
10365 }
10366 }
10367
10368 unsafe impl fidl::encoding::TypeMarker for ScanOptions {
10369 type Owned = Self;
10370
10371 #[inline(always)]
10372 fn inline_align(_context: fidl::encoding::Context) -> usize {
10373 8
10374 }
10375
10376 #[inline(always)]
10377 fn inline_size(_context: fidl::encoding::Context) -> usize {
10378 16
10379 }
10380 }
10381
10382 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ScanOptions, D>
10383 for &ScanOptions
10384 {
10385 unsafe fn encode(
10386 self,
10387 encoder: &mut fidl::encoding::Encoder<'_, D>,
10388 offset: usize,
10389 mut depth: fidl::encoding::Depth,
10390 ) -> fidl::Result<()> {
10391 encoder.debug_check_bounds::<ScanOptions>(offset);
10392 let max_ordinal: u64 = self.max_ordinal_present();
10394 encoder.write_num(max_ordinal, offset);
10395 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10396 if max_ordinal == 0 {
10398 return Ok(());
10399 }
10400 depth.increment()?;
10401 let envelope_size = 8;
10402 let bytes_len = max_ordinal as usize * envelope_size;
10403 #[allow(unused_variables)]
10404 let offset = encoder.out_of_line_offset(bytes_len);
10405 let mut _prev_end_offset: usize = 0;
10406 if 1 > max_ordinal {
10407 return Ok(());
10408 }
10409
10410 let cur_offset: usize = (1 - 1) * envelope_size;
10413
10414 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10416
10417 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<Filter>, D>(
10422 self.filters.as_ref().map(<fidl::encoding::UnboundedVector<Filter> as fidl::encoding::ValueTypeMarker>::borrow),
10423 encoder, offset + cur_offset, depth
10424 )?;
10425
10426 _prev_end_offset = cur_offset + envelope_size;
10427
10428 Ok(())
10429 }
10430 }
10431
10432 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ScanOptions {
10433 #[inline(always)]
10434 fn new_empty() -> Self {
10435 Self::default()
10436 }
10437
10438 unsafe fn decode(
10439 &mut self,
10440 decoder: &mut fidl::encoding::Decoder<'_, D>,
10441 offset: usize,
10442 mut depth: fidl::encoding::Depth,
10443 ) -> fidl::Result<()> {
10444 decoder.debug_check_bounds::<Self>(offset);
10445 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10446 None => return Err(fidl::Error::NotNullable),
10447 Some(len) => len,
10448 };
10449 if len == 0 {
10451 return Ok(());
10452 };
10453 depth.increment()?;
10454 let envelope_size = 8;
10455 let bytes_len = len * envelope_size;
10456 let offset = decoder.out_of_line_offset(bytes_len)?;
10457 let mut _next_ordinal_to_read = 0;
10459 let mut next_offset = offset;
10460 let end_offset = offset + bytes_len;
10461 _next_ordinal_to_read += 1;
10462 if next_offset >= end_offset {
10463 return Ok(());
10464 }
10465
10466 while _next_ordinal_to_read < 1 {
10468 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10469 _next_ordinal_to_read += 1;
10470 next_offset += envelope_size;
10471 }
10472
10473 let next_out_of_line = decoder.next_out_of_line();
10474 let handles_before = decoder.remaining_handles();
10475 if let Some((inlined, num_bytes, num_handles)) =
10476 fidl::encoding::decode_envelope_header(decoder, next_offset)?
10477 {
10478 let member_inline_size = <fidl::encoding::UnboundedVector<Filter> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10479 if inlined != (member_inline_size <= 4) {
10480 return Err(fidl::Error::InvalidInlineBitInEnvelope);
10481 }
10482 let inner_offset;
10483 let mut inner_depth = depth.clone();
10484 if inlined {
10485 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10486 inner_offset = next_offset;
10487 } else {
10488 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10489 inner_depth.increment()?;
10490 }
10491 let val_ref = self.filters.get_or_insert_with(|| {
10492 fidl::new_empty!(fidl::encoding::UnboundedVector<Filter>, D)
10493 });
10494 fidl::decode!(
10495 fidl::encoding::UnboundedVector<Filter>,
10496 D,
10497 val_ref,
10498 decoder,
10499 inner_offset,
10500 inner_depth
10501 )?;
10502 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10503 {
10504 return Err(fidl::Error::InvalidNumBytesInEnvelope);
10505 }
10506 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10507 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10508 }
10509 }
10510
10511 next_offset += envelope_size;
10512
10513 while next_offset < end_offset {
10515 _next_ordinal_to_read += 1;
10516 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10517 next_offset += envelope_size;
10518 }
10519
10520 Ok(())
10521 }
10522 }
10523
10524 impl fidl::encoding::ValueTypeMarker for AdvertisingProcedure {
10525 type Borrowed<'a> = &'a Self;
10526 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10527 value
10528 }
10529 }
10530
10531 unsafe impl fidl::encoding::TypeMarker for AdvertisingProcedure {
10532 type Owned = Self;
10533
10534 #[inline(always)]
10535 fn inline_align(_context: fidl::encoding::Context) -> usize {
10536 8
10537 }
10538
10539 #[inline(always)]
10540 fn inline_size(_context: fidl::encoding::Context) -> usize {
10541 16
10542 }
10543 }
10544
10545 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AdvertisingProcedure, D>
10546 for &AdvertisingProcedure
10547 {
10548 #[inline]
10549 unsafe fn encode(
10550 self,
10551 encoder: &mut fidl::encoding::Encoder<'_, D>,
10552 offset: usize,
10553 _depth: fidl::encoding::Depth,
10554 ) -> fidl::Result<()> {
10555 encoder.debug_check_bounds::<AdvertisingProcedure>(offset);
10556 encoder.write_num::<u64>(self.ordinal(), offset);
10557 match self {
10558 AdvertisingProcedure::Legacy(ref val) => {
10559 fidl::encoding::encode_in_envelope::<Legacy, D>(
10560 <Legacy as fidl::encoding::ValueTypeMarker>::borrow(val),
10561 encoder,
10562 offset + 8,
10563 _depth,
10564 )
10565 }
10566 AdvertisingProcedure::Extended(ref val) => {
10567 fidl::encoding::encode_in_envelope::<Extended, D>(
10568 <Extended as fidl::encoding::ValueTypeMarker>::borrow(val),
10569 encoder,
10570 offset + 8,
10571 _depth,
10572 )
10573 }
10574 AdvertisingProcedure::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
10575 }
10576 }
10577 }
10578
10579 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AdvertisingProcedure {
10580 #[inline(always)]
10581 fn new_empty() -> Self {
10582 Self::__SourceBreaking { unknown_ordinal: 0 }
10583 }
10584
10585 #[inline]
10586 unsafe fn decode(
10587 &mut self,
10588 decoder: &mut fidl::encoding::Decoder<'_, D>,
10589 offset: usize,
10590 mut depth: fidl::encoding::Depth,
10591 ) -> fidl::Result<()> {
10592 decoder.debug_check_bounds::<Self>(offset);
10593 #[allow(unused_variables)]
10594 let next_out_of_line = decoder.next_out_of_line();
10595 let handles_before = decoder.remaining_handles();
10596 let (ordinal, inlined, num_bytes, num_handles) =
10597 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
10598
10599 let member_inline_size = match ordinal {
10600 1 => <Legacy as fidl::encoding::TypeMarker>::inline_size(decoder.context),
10601 2 => <Extended as fidl::encoding::TypeMarker>::inline_size(decoder.context),
10602 0 => return Err(fidl::Error::UnknownUnionTag),
10603 _ => num_bytes as usize,
10604 };
10605
10606 if inlined != (member_inline_size <= 4) {
10607 return Err(fidl::Error::InvalidInlineBitInEnvelope);
10608 }
10609 let _inner_offset;
10610 if inlined {
10611 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
10612 _inner_offset = offset + 8;
10613 } else {
10614 depth.increment()?;
10615 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10616 }
10617 match ordinal {
10618 1 => {
10619 #[allow(irrefutable_let_patterns)]
10620 if let AdvertisingProcedure::Legacy(_) = self {
10621 } else {
10623 *self = AdvertisingProcedure::Legacy(fidl::new_empty!(Legacy, D));
10625 }
10626 #[allow(irrefutable_let_patterns)]
10627 if let AdvertisingProcedure::Legacy(ref mut val) = self {
10628 fidl::decode!(Legacy, D, val, decoder, _inner_offset, depth)?;
10629 } else {
10630 unreachable!()
10631 }
10632 }
10633 2 => {
10634 #[allow(irrefutable_let_patterns)]
10635 if let AdvertisingProcedure::Extended(_) = self {
10636 } else {
10638 *self = AdvertisingProcedure::Extended(fidl::new_empty!(Extended, D));
10640 }
10641 #[allow(irrefutable_let_patterns)]
10642 if let AdvertisingProcedure::Extended(ref mut val) = self {
10643 fidl::decode!(Extended, D, val, decoder, _inner_offset, depth)?;
10644 } else {
10645 unreachable!()
10646 }
10647 }
10648 #[allow(deprecated)]
10649 ordinal => {
10650 for _ in 0..num_handles {
10651 decoder.drop_next_handle()?;
10652 }
10653 *self = AdvertisingProcedure::__SourceBreaking { unknown_ordinal: ordinal };
10654 }
10655 }
10656 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
10657 return Err(fidl::Error::InvalidNumBytesInEnvelope);
10658 }
10659 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10660 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10661 }
10662 Ok(())
10663 }
10664 }
10665}