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 const INITIAL_VALUE_CHANGED_CREDITS: u32 = 10;
14
15pub const MAX_ATTRIBUTE_COUNT: u16 = 65535;
16
17pub const MAX_CHARACTERISTIC_COUNT: u16 = 32767;
18
19pub const MAX_DESCRIPTOR_COUNT: u16 = 65532;
20
21pub const MAX_SERVICE_COUNT: u16 = MAX_ATTRIBUTE_COUNT as u16;
22
23pub const MAX_VALUE_LENGTH: u16 = 512;
24
25bitflags! {
26 #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
29 pub struct CharacteristicPropertyBits: u16 {
30 const BROADCAST = 1;
31 const READ = 2;
32 const WRITE_WITHOUT_RESPONSE = 4;
33 const WRITE = 8;
34 const NOTIFY = 16;
35 const INDICATE = 32;
36 const AUTHENTICATED_SIGNED_WRITES = 64;
37 const RELIABLE_WRITE = 256;
38 const WRITABLE_AUXILIARIES = 512;
39 }
40}
41
42impl CharacteristicPropertyBits {
43 #[deprecated = "Strict bits should not use `has_unknown_bits`"]
44 #[inline(always)]
45 pub fn has_unknown_bits(&self) -> bool {
46 false
47 }
48
49 #[deprecated = "Strict bits should not use `get_unknown_bits`"]
50 #[inline(always)]
51 pub fn get_unknown_bits(&self) -> u16 {
52 0
53 }
54}
55
56#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
67#[repr(u32)]
68pub enum Error {
69 InvalidHandle = 1,
73 ReadNotPermitted = 2,
75 WriteNotPermitted = 3,
77 InvalidPdu = 4,
79 InsufficientAuthentication = 5,
81 InvalidOffset = 7,
86 InsufficientAuthorization = 8,
88 InsufficientEncryptionKeySize = 12,
90 InvalidAttributeValueLength = 13,
95 UnlikelyError = 14,
100 InsufficientEncryption = 15,
102 InsufficientResources = 17,
106 ValueNotAllowed = 19,
110 ApplicationError80 = 128,
115 ApplicationError81 = 129,
116 ApplicationError82 = 130,
117 ApplicationError83 = 131,
118 ApplicationError84 = 132,
119 ApplicationError85 = 133,
120 ApplicationError86 = 134,
121 ApplicationError87 = 135,
122 ApplicationError88 = 136,
123 ApplicationError89 = 137,
124 ApplicationError8A = 138,
125 ApplicationError8B = 139,
126 ApplicationError8C = 140,
127 ApplicationError8D = 141,
128 ApplicationError8E = 142,
129 ApplicationError8F = 143,
130 ApplicationError90 = 144,
131 ApplicationError91 = 145,
132 ApplicationError92 = 146,
133 ApplicationError93 = 147,
134 ApplicationError94 = 148,
135 ApplicationError95 = 149,
136 ApplicationError96 = 150,
137 ApplicationError97 = 151,
138 ApplicationError98 = 152,
139 ApplicationError99 = 153,
140 ApplicationError9A = 154,
141 ApplicationError9B = 155,
142 ApplicationError9C = 156,
143 ApplicationError9D = 157,
144 ApplicationError9E = 158,
145 ApplicationError9F = 159,
146 WriteRequestRejected = 252,
148 CccDescriptorImproperlyConfigured = 253,
151 ProcedureAlreadyInProgress = 254,
153 OutOfRange = 255,
155 InvalidParameters = 257,
158 TooManyResults = 258,
161}
162
163impl Error {
164 #[inline]
165 pub fn from_primitive(prim: u32) -> Option<Self> {
166 match prim {
167 1 => Some(Self::InvalidHandle),
168 2 => Some(Self::ReadNotPermitted),
169 3 => Some(Self::WriteNotPermitted),
170 4 => Some(Self::InvalidPdu),
171 5 => Some(Self::InsufficientAuthentication),
172 7 => Some(Self::InvalidOffset),
173 8 => Some(Self::InsufficientAuthorization),
174 12 => Some(Self::InsufficientEncryptionKeySize),
175 13 => Some(Self::InvalidAttributeValueLength),
176 14 => Some(Self::UnlikelyError),
177 15 => Some(Self::InsufficientEncryption),
178 17 => Some(Self::InsufficientResources),
179 19 => Some(Self::ValueNotAllowed),
180 128 => Some(Self::ApplicationError80),
181 129 => Some(Self::ApplicationError81),
182 130 => Some(Self::ApplicationError82),
183 131 => Some(Self::ApplicationError83),
184 132 => Some(Self::ApplicationError84),
185 133 => Some(Self::ApplicationError85),
186 134 => Some(Self::ApplicationError86),
187 135 => Some(Self::ApplicationError87),
188 136 => Some(Self::ApplicationError88),
189 137 => Some(Self::ApplicationError89),
190 138 => Some(Self::ApplicationError8A),
191 139 => Some(Self::ApplicationError8B),
192 140 => Some(Self::ApplicationError8C),
193 141 => Some(Self::ApplicationError8D),
194 142 => Some(Self::ApplicationError8E),
195 143 => Some(Self::ApplicationError8F),
196 144 => Some(Self::ApplicationError90),
197 145 => Some(Self::ApplicationError91),
198 146 => Some(Self::ApplicationError92),
199 147 => Some(Self::ApplicationError93),
200 148 => Some(Self::ApplicationError94),
201 149 => Some(Self::ApplicationError95),
202 150 => Some(Self::ApplicationError96),
203 151 => Some(Self::ApplicationError97),
204 152 => Some(Self::ApplicationError98),
205 153 => Some(Self::ApplicationError99),
206 154 => Some(Self::ApplicationError9A),
207 155 => Some(Self::ApplicationError9B),
208 156 => Some(Self::ApplicationError9C),
209 157 => Some(Self::ApplicationError9D),
210 158 => Some(Self::ApplicationError9E),
211 159 => Some(Self::ApplicationError9F),
212 252 => Some(Self::WriteRequestRejected),
213 253 => Some(Self::CccDescriptorImproperlyConfigured),
214 254 => Some(Self::ProcedureAlreadyInProgress),
215 255 => Some(Self::OutOfRange),
216 257 => Some(Self::InvalidParameters),
217 258 => Some(Self::TooManyResults),
218 _ => None,
219 }
220 }
221
222 #[inline]
223 pub const fn into_primitive(self) -> u32 {
224 self as u32
225 }
226
227 #[deprecated = "Strict enums should not use `is_unknown`"]
228 #[inline]
229 pub fn is_unknown(&self) -> bool {
230 false
231 }
232}
233
234#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
236pub enum PublishServiceError {
237 InvalidServiceHandle,
239 InvalidUuid,
241 InvalidCharacteristics,
244 UnlikelyError,
246 #[doc(hidden)]
247 __SourceBreaking { unknown_ordinal: u32 },
248}
249
250#[macro_export]
252macro_rules! PublishServiceErrorUnknown {
253 () => {
254 _
255 };
256}
257
258impl PublishServiceError {
259 #[inline]
260 pub fn from_primitive(prim: u32) -> Option<Self> {
261 match prim {
262 1 => Some(Self::InvalidServiceHandle),
263 2 => Some(Self::InvalidUuid),
264 3 => Some(Self::InvalidCharacteristics),
265 4 => Some(Self::UnlikelyError),
266 _ => None,
267 }
268 }
269
270 #[inline]
271 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
272 match prim {
273 1 => Self::InvalidServiceHandle,
274 2 => Self::InvalidUuid,
275 3 => Self::InvalidCharacteristics,
276 4 => Self::UnlikelyError,
277 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
278 }
279 }
280
281 #[inline]
282 pub fn unknown() -> Self {
283 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
284 }
285
286 #[inline]
287 pub const fn into_primitive(self) -> u32 {
288 match self {
289 Self::InvalidServiceHandle => 1,
290 Self::InvalidUuid => 2,
291 Self::InvalidCharacteristics => 3,
292 Self::UnlikelyError => 4,
293 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
294 }
295 }
296
297 #[inline]
298 pub fn is_unknown(&self) -> bool {
299 match self {
300 Self::__SourceBreaking { unknown_ordinal: _ } => true,
301 _ => false,
302 }
303 }
304}
305
306#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
308#[repr(u32)]
309pub enum ServiceKind {
310 Primary = 1,
312 Secondary = 2,
315}
316
317impl ServiceKind {
318 #[inline]
319 pub fn from_primitive(prim: u32) -> Option<Self> {
320 match prim {
321 1 => Some(Self::Primary),
322 2 => Some(Self::Secondary),
323 _ => None,
324 }
325 }
326
327 #[inline]
328 pub const fn into_primitive(self) -> u32 {
329 self as u32
330 }
331
332 #[deprecated = "Strict enums should not use `is_unknown`"]
333 #[inline]
334 pub fn is_unknown(&self) -> bool {
335 false
336 }
337}
338
339#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
342pub enum WriteMode {
343 Default,
347 Reliable,
352 WithoutResponse,
360 #[doc(hidden)]
361 __SourceBreaking { unknown_ordinal: u32 },
362}
363
364#[macro_export]
366macro_rules! WriteModeUnknown {
367 () => {
368 _
369 };
370}
371
372impl WriteMode {
373 #[inline]
374 pub fn from_primitive(prim: u32) -> Option<Self> {
375 match prim {
376 1 => Some(Self::Default),
377 2 => Some(Self::Reliable),
378 3 => Some(Self::WithoutResponse),
379 _ => None,
380 }
381 }
382
383 #[inline]
384 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
385 match prim {
386 1 => Self::Default,
387 2 => Self::Reliable,
388 3 => Self::WithoutResponse,
389 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
390 }
391 }
392
393 #[inline]
394 pub fn unknown() -> Self {
395 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
396 }
397
398 #[inline]
399 pub const fn into_primitive(self) -> u32 {
400 match self {
401 Self::Default => 1,
402 Self::Reliable => 2,
403 Self::WithoutResponse => 3,
404 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
405 }
406 }
407
408 #[inline]
409 pub fn is_unknown(&self) -> bool {
410 match self {
411 Self::__SourceBreaking { unknown_ordinal: _ } => true,
412 _ => false,
413 }
414 }
415}
416
417#[derive(Clone, Debug, PartialEq)]
418pub struct CharacteristicNotifierOnNotificationRequest {
419 pub value: ReadValue,
420}
421
422impl fidl::Persistable for CharacteristicNotifierOnNotificationRequest {}
423
424#[derive(Clone, Debug, PartialEq)]
425pub struct ClientWatchServicesRequest {
426 pub uuids: Vec<fidl_fuchsia_bluetooth::Uuid>,
427}
428
429impl fidl::Persistable for ClientWatchServicesRequest {}
430
431#[derive(Clone, Debug, PartialEq)]
432pub struct ClientWatchServicesResponse {
433 pub updated: Vec<ServiceInfo>,
434 pub removed: Vec<Handle>,
435}
436
437impl fidl::Persistable for ClientWatchServicesResponse {}
438
439#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
440#[repr(C)]
441pub struct Handle {
442 pub value: u64,
443}
444
445impl fidl::Persistable for Handle {}
446
447#[derive(Clone, Debug, PartialEq)]
448pub struct LocalServiceCharacteristicConfigurationRequest {
449 pub peer_id: fidl_fuchsia_bluetooth::PeerId,
450 pub handle: Handle,
451 pub notify: bool,
452 pub indicate: bool,
453}
454
455impl fidl::Persistable for LocalServiceCharacteristicConfigurationRequest {}
456
457#[derive(Clone, Debug, PartialEq)]
458pub struct LocalServiceReadValueRequest {
459 pub peer_id: fidl_fuchsia_bluetooth::PeerId,
460 pub handle: Handle,
461 pub offset: i32,
462}
463
464impl fidl::Persistable for LocalServiceReadValueRequest {}
465
466#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
467#[repr(C)]
468pub struct LocalServiceValueChangedCreditRequest {
469 pub additional_credit: u8,
470}
471
472impl fidl::Persistable for LocalServiceValueChangedCreditRequest {}
473
474#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
475pub struct LocalServiceReadValueResponse {
476 pub value: Vec<u8>,
477}
478
479impl fidl::Persistable for LocalServiceReadValueResponse {}
480
481#[derive(Clone, Debug, PartialEq)]
482pub struct RemoteServiceDiscoverCharacteristicsResponse {
483 pub characteristics: Vec<Characteristic>,
484}
485
486impl fidl::Persistable for RemoteServiceDiscoverCharacteristicsResponse {}
487
488#[derive(Clone, Debug, PartialEq)]
489pub struct RemoteServiceReadByTypeRequest {
490 pub uuid: fidl_fuchsia_bluetooth::Uuid,
491}
492
493impl fidl::Persistable for RemoteServiceReadByTypeRequest {}
494
495#[derive(Clone, Debug, PartialEq)]
496pub struct RemoteServiceReadCharacteristicRequest {
497 pub handle: Handle,
498 pub options: ReadOptions,
499}
500
501impl fidl::Persistable for RemoteServiceReadCharacteristicRequest {}
502
503#[derive(Clone, Debug, PartialEq)]
504pub struct RemoteServiceReadDescriptorRequest {
505 pub handle: Handle,
506 pub options: ReadOptions,
507}
508
509impl fidl::Persistable for RemoteServiceReadDescriptorRequest {}
510
511#[derive(Clone, Debug, PartialEq)]
512pub struct RemoteServiceWriteCharacteristicRequest {
513 pub handle: Handle,
514 pub value: Vec<u8>,
515 pub options: WriteOptions,
516}
517
518impl fidl::Persistable for RemoteServiceWriteCharacteristicRequest {}
519
520#[derive(Clone, Debug, PartialEq)]
521pub struct RemoteServiceWriteDescriptorRequest {
522 pub handle: Handle,
523 pub value: Vec<u8>,
524 pub options: WriteOptions,
525}
526
527impl fidl::Persistable for RemoteServiceWriteDescriptorRequest {}
528
529#[derive(Clone, Debug, PartialEq)]
530pub struct RemoteServiceReadByTypeResponse {
531 pub results: Vec<ReadByTypeResult>,
532}
533
534impl fidl::Persistable for RemoteServiceReadByTypeResponse {}
535
536#[derive(Clone, Debug, PartialEq)]
537pub struct RemoteServiceReadCharacteristicResponse {
538 pub value: ReadValue,
539}
540
541impl fidl::Persistable for RemoteServiceReadCharacteristicResponse {}
542
543#[derive(Clone, Debug, PartialEq)]
544pub struct RemoteServiceReadDescriptorResponse {
545 pub value: ReadValue,
546}
547
548impl fidl::Persistable for RemoteServiceReadDescriptorResponse {}
549
550#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
551#[repr(C)]
552pub struct ServiceHandle {
553 pub value: u64,
554}
555
556impl fidl::Persistable for ServiceHandle {}
557
558#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
563pub struct ShortReadOptions;
564
565impl fidl::Persistable for ShortReadOptions {}
566
567#[derive(Clone, Debug, Default, PartialEq)]
569pub struct AttributePermissions {
570 pub read: Option<SecurityRequirements>,
574 pub write: Option<SecurityRequirements>,
578 pub update: Option<SecurityRequirements>,
587 #[doc(hidden)]
588 pub __source_breaking: fidl::marker::SourceBreaking,
589}
590
591impl fidl::Persistable for AttributePermissions {}
592
593#[derive(Clone, Debug, Default, PartialEq)]
595pub struct Characteristic {
596 pub handle: Option<Handle>,
602 pub type_: Option<fidl_fuchsia_bluetooth::Uuid>,
605 pub properties: Option<CharacteristicPropertyBits>,
608 pub permissions: Option<AttributePermissions>,
614 pub descriptors: Option<Vec<Descriptor>>,
617 #[doc(hidden)]
618 pub __source_breaking: fidl::marker::SourceBreaking,
619}
620
621impl fidl::Persistable for Characteristic {}
622
623#[derive(Clone, Debug, Default, PartialEq)]
625pub struct Descriptor {
626 pub handle: Option<Handle>,
632 pub type_: Option<fidl_fuchsia_bluetooth::Uuid>,
635 pub permissions: Option<AttributePermissions>,
641 #[doc(hidden)]
642 pub __source_breaking: fidl::marker::SourceBreaking,
643}
644
645impl fidl::Persistable for Descriptor {}
646
647#[derive(Clone, Debug, Default, PartialEq)]
648pub struct LocalServicePeerUpdateRequest {
649 pub peer_id: Option<fidl_fuchsia_bluetooth::PeerId>,
650 pub mtu: Option<u16>,
651 #[doc(hidden)]
652 pub __source_breaking: fidl::marker::SourceBreaking,
653}
654
655impl fidl::Persistable for LocalServicePeerUpdateRequest {}
656
657#[derive(Clone, Debug, Default, PartialEq)]
658pub struct LocalServiceWriteValueRequest {
659 pub peer_id: Option<fidl_fuchsia_bluetooth::PeerId>,
660 pub handle: Option<Handle>,
661 pub offset: Option<u32>,
662 pub value: Option<Vec<u8>>,
663 #[doc(hidden)]
664 pub __source_breaking: fidl::marker::SourceBreaking,
665}
666
667impl fidl::Persistable for LocalServiceWriteValueRequest {}
668
669#[derive(Clone, Debug, Default, PartialEq)]
673pub struct LongReadOptions {
674 pub offset: Option<u16>,
678 pub max_bytes: Option<u16>,
682 #[doc(hidden)]
683 pub __source_breaking: fidl::marker::SourceBreaking,
684}
685
686impl fidl::Persistable for LongReadOptions {}
687
688#[derive(Clone, Debug, Default, PartialEq)]
690pub struct ReadByTypeResult {
691 pub handle: Option<Handle>,
693 pub value: Option<ReadValue>,
695 pub error: Option<Error>,
697 #[doc(hidden)]
698 pub __source_breaking: fidl::marker::SourceBreaking,
699}
700
701impl fidl::Persistable for ReadByTypeResult {}
702
703#[derive(Clone, Debug, Default, PartialEq)]
705pub struct ReadValue {
706 pub handle: Option<Handle>,
708 pub value: Option<Vec<u8>>,
710 pub maybe_truncated: Option<bool>,
715 #[doc(hidden)]
716 pub __source_breaking: fidl::marker::SourceBreaking,
717}
718
719impl fidl::Persistable for ReadValue {}
720
721#[derive(Clone, Debug, Default, PartialEq)]
724pub struct SecurityRequirements {
725 pub encryption_required: Option<bool>,
728 pub authentication_required: Option<bool>,
731 pub authorization_required: Option<bool>,
734 #[doc(hidden)]
735 pub __source_breaking: fidl::marker::SourceBreaking,
736}
737
738impl fidl::Persistable for SecurityRequirements {}
739
740#[derive(Clone, Debug, Default, PartialEq)]
742pub struct ServiceInfo {
743 pub handle: Option<ServiceHandle>,
750 pub kind: Option<ServiceKind>,
754 pub type_: Option<fidl_fuchsia_bluetooth::Uuid>,
758 pub characteristics: Option<Vec<Characteristic>>,
761 pub includes: Option<Vec<ServiceHandle>>,
765 #[doc(hidden)]
766 pub __source_breaking: fidl::marker::SourceBreaking,
767}
768
769impl fidl::Persistable for ServiceInfo {}
770
771#[derive(Clone, Debug, Default, PartialEq)]
773pub struct ValueChangedParameters {
774 pub handle: Option<Handle>,
777 pub value: Option<Vec<u8>>,
784 pub peer_ids: Option<Vec<fidl_fuchsia_bluetooth::PeerId>>,
790 #[doc(hidden)]
791 pub __source_breaking: fidl::marker::SourceBreaking,
792}
793
794impl fidl::Persistable for ValueChangedParameters {}
795
796#[derive(Clone, Debug, Default, PartialEq)]
799pub struct WriteOptions {
800 pub write_mode: Option<WriteMode>,
805 pub offset: Option<u16>,
810 #[doc(hidden)]
811 pub __source_breaking: fidl::marker::SourceBreaking,
812}
813
814impl fidl::Persistable for WriteOptions {}
815
816#[derive(Clone, Debug)]
819pub enum ReadOptions {
820 ShortRead(ShortReadOptions),
824 LongRead(LongReadOptions),
828 #[doc(hidden)]
829 __SourceBreaking { unknown_ordinal: u64 },
830}
831
832#[macro_export]
834macro_rules! ReadOptionsUnknown {
835 () => {
836 _
837 };
838}
839
840impl PartialEq for ReadOptions {
842 fn eq(&self, other: &Self) -> bool {
843 match (self, other) {
844 (Self::ShortRead(x), Self::ShortRead(y)) => *x == *y,
845 (Self::LongRead(x), Self::LongRead(y)) => *x == *y,
846 _ => false,
847 }
848 }
849}
850
851impl ReadOptions {
852 #[inline]
853 pub fn ordinal(&self) -> u64 {
854 match *self {
855 Self::ShortRead(_) => 1,
856 Self::LongRead(_) => 2,
857 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
858 }
859 }
860
861 #[inline]
862 pub fn unknown_variant_for_testing() -> Self {
863 Self::__SourceBreaking { unknown_ordinal: 0 }
864 }
865
866 #[inline]
867 pub fn is_unknown(&self) -> bool {
868 match self {
869 Self::__SourceBreaking { .. } => true,
870 _ => false,
871 }
872 }
873}
874
875impl fidl::Persistable for ReadOptions {}
876
877mod internal {
878 use super::*;
879 unsafe impl fidl::encoding::TypeMarker for CharacteristicPropertyBits {
880 type Owned = Self;
881
882 #[inline(always)]
883 fn inline_align(_context: fidl::encoding::Context) -> usize {
884 2
885 }
886
887 #[inline(always)]
888 fn inline_size(_context: fidl::encoding::Context) -> usize {
889 2
890 }
891 }
892
893 impl fidl::encoding::ValueTypeMarker for CharacteristicPropertyBits {
894 type Borrowed<'a> = Self;
895 #[inline(always)]
896 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
897 *value
898 }
899 }
900
901 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
902 for CharacteristicPropertyBits
903 {
904 #[inline]
905 unsafe fn encode(
906 self,
907 encoder: &mut fidl::encoding::Encoder<'_, D>,
908 offset: usize,
909 _depth: fidl::encoding::Depth,
910 ) -> fidl::Result<()> {
911 encoder.debug_check_bounds::<Self>(offset);
912 if self.bits() & Self::all().bits() != self.bits() {
913 return Err(fidl::Error::InvalidBitsValue);
914 }
915 encoder.write_num(self.bits(), offset);
916 Ok(())
917 }
918 }
919
920 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
921 for CharacteristicPropertyBits
922 {
923 #[inline(always)]
924 fn new_empty() -> Self {
925 Self::empty()
926 }
927
928 #[inline]
929 unsafe fn decode(
930 &mut self,
931 decoder: &mut fidl::encoding::Decoder<'_, D>,
932 offset: usize,
933 _depth: fidl::encoding::Depth,
934 ) -> fidl::Result<()> {
935 decoder.debug_check_bounds::<Self>(offset);
936 let prim = decoder.read_num::<u16>(offset);
937 *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
938 Ok(())
939 }
940 }
941 unsafe impl fidl::encoding::TypeMarker for Error {
942 type Owned = Self;
943
944 #[inline(always)]
945 fn inline_align(_context: fidl::encoding::Context) -> usize {
946 std::mem::align_of::<u32>()
947 }
948
949 #[inline(always)]
950 fn inline_size(_context: fidl::encoding::Context) -> usize {
951 std::mem::size_of::<u32>()
952 }
953
954 #[inline(always)]
955 fn encode_is_copy() -> bool {
956 true
957 }
958
959 #[inline(always)]
960 fn decode_is_copy() -> bool {
961 false
962 }
963 }
964
965 impl fidl::encoding::ValueTypeMarker for Error {
966 type Borrowed<'a> = Self;
967 #[inline(always)]
968 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
969 *value
970 }
971 }
972
973 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Error {
974 #[inline]
975 unsafe fn encode(
976 self,
977 encoder: &mut fidl::encoding::Encoder<'_, D>,
978 offset: usize,
979 _depth: fidl::encoding::Depth,
980 ) -> fidl::Result<()> {
981 encoder.debug_check_bounds::<Self>(offset);
982 encoder.write_num(self.into_primitive(), offset);
983 Ok(())
984 }
985 }
986
987 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Error {
988 #[inline(always)]
989 fn new_empty() -> Self {
990 Self::InvalidHandle
991 }
992
993 #[inline]
994 unsafe fn decode(
995 &mut self,
996 decoder: &mut fidl::encoding::Decoder<'_, D>,
997 offset: usize,
998 _depth: fidl::encoding::Depth,
999 ) -> fidl::Result<()> {
1000 decoder.debug_check_bounds::<Self>(offset);
1001 let prim = decoder.read_num::<u32>(offset);
1002
1003 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1004 Ok(())
1005 }
1006 }
1007 unsafe impl fidl::encoding::TypeMarker for PublishServiceError {
1008 type Owned = Self;
1009
1010 #[inline(always)]
1011 fn inline_align(_context: fidl::encoding::Context) -> usize {
1012 std::mem::align_of::<u32>()
1013 }
1014
1015 #[inline(always)]
1016 fn inline_size(_context: fidl::encoding::Context) -> usize {
1017 std::mem::size_of::<u32>()
1018 }
1019
1020 #[inline(always)]
1021 fn encode_is_copy() -> bool {
1022 false
1023 }
1024
1025 #[inline(always)]
1026 fn decode_is_copy() -> bool {
1027 false
1028 }
1029 }
1030
1031 impl fidl::encoding::ValueTypeMarker for PublishServiceError {
1032 type Borrowed<'a> = Self;
1033 #[inline(always)]
1034 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1035 *value
1036 }
1037 }
1038
1039 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1040 for PublishServiceError
1041 {
1042 #[inline]
1043 unsafe fn encode(
1044 self,
1045 encoder: &mut fidl::encoding::Encoder<'_, D>,
1046 offset: usize,
1047 _depth: fidl::encoding::Depth,
1048 ) -> fidl::Result<()> {
1049 encoder.debug_check_bounds::<Self>(offset);
1050 encoder.write_num(self.into_primitive(), offset);
1051 Ok(())
1052 }
1053 }
1054
1055 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PublishServiceError {
1056 #[inline(always)]
1057 fn new_empty() -> Self {
1058 Self::unknown()
1059 }
1060
1061 #[inline]
1062 unsafe fn decode(
1063 &mut self,
1064 decoder: &mut fidl::encoding::Decoder<'_, D>,
1065 offset: usize,
1066 _depth: fidl::encoding::Depth,
1067 ) -> fidl::Result<()> {
1068 decoder.debug_check_bounds::<Self>(offset);
1069 let prim = decoder.read_num::<u32>(offset);
1070
1071 *self = Self::from_primitive_allow_unknown(prim);
1072 Ok(())
1073 }
1074 }
1075 unsafe impl fidl::encoding::TypeMarker for ServiceKind {
1076 type Owned = Self;
1077
1078 #[inline(always)]
1079 fn inline_align(_context: fidl::encoding::Context) -> usize {
1080 std::mem::align_of::<u32>()
1081 }
1082
1083 #[inline(always)]
1084 fn inline_size(_context: fidl::encoding::Context) -> usize {
1085 std::mem::size_of::<u32>()
1086 }
1087
1088 #[inline(always)]
1089 fn encode_is_copy() -> bool {
1090 true
1091 }
1092
1093 #[inline(always)]
1094 fn decode_is_copy() -> bool {
1095 false
1096 }
1097 }
1098
1099 impl fidl::encoding::ValueTypeMarker for ServiceKind {
1100 type Borrowed<'a> = Self;
1101 #[inline(always)]
1102 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1103 *value
1104 }
1105 }
1106
1107 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ServiceKind {
1108 #[inline]
1109 unsafe fn encode(
1110 self,
1111 encoder: &mut fidl::encoding::Encoder<'_, D>,
1112 offset: usize,
1113 _depth: fidl::encoding::Depth,
1114 ) -> fidl::Result<()> {
1115 encoder.debug_check_bounds::<Self>(offset);
1116 encoder.write_num(self.into_primitive(), offset);
1117 Ok(())
1118 }
1119 }
1120
1121 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ServiceKind {
1122 #[inline(always)]
1123 fn new_empty() -> Self {
1124 Self::Primary
1125 }
1126
1127 #[inline]
1128 unsafe fn decode(
1129 &mut self,
1130 decoder: &mut fidl::encoding::Decoder<'_, D>,
1131 offset: usize,
1132 _depth: fidl::encoding::Depth,
1133 ) -> fidl::Result<()> {
1134 decoder.debug_check_bounds::<Self>(offset);
1135 let prim = decoder.read_num::<u32>(offset);
1136
1137 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1138 Ok(())
1139 }
1140 }
1141 unsafe impl fidl::encoding::TypeMarker for WriteMode {
1142 type Owned = Self;
1143
1144 #[inline(always)]
1145 fn inline_align(_context: fidl::encoding::Context) -> usize {
1146 std::mem::align_of::<u32>()
1147 }
1148
1149 #[inline(always)]
1150 fn inline_size(_context: fidl::encoding::Context) -> usize {
1151 std::mem::size_of::<u32>()
1152 }
1153
1154 #[inline(always)]
1155 fn encode_is_copy() -> bool {
1156 false
1157 }
1158
1159 #[inline(always)]
1160 fn decode_is_copy() -> bool {
1161 false
1162 }
1163 }
1164
1165 impl fidl::encoding::ValueTypeMarker for WriteMode {
1166 type Borrowed<'a> = Self;
1167 #[inline(always)]
1168 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1169 *value
1170 }
1171 }
1172
1173 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for WriteMode {
1174 #[inline]
1175 unsafe fn encode(
1176 self,
1177 encoder: &mut fidl::encoding::Encoder<'_, D>,
1178 offset: usize,
1179 _depth: fidl::encoding::Depth,
1180 ) -> fidl::Result<()> {
1181 encoder.debug_check_bounds::<Self>(offset);
1182 encoder.write_num(self.into_primitive(), offset);
1183 Ok(())
1184 }
1185 }
1186
1187 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WriteMode {
1188 #[inline(always)]
1189 fn new_empty() -> Self {
1190 Self::unknown()
1191 }
1192
1193 #[inline]
1194 unsafe fn decode(
1195 &mut self,
1196 decoder: &mut fidl::encoding::Decoder<'_, D>,
1197 offset: usize,
1198 _depth: fidl::encoding::Depth,
1199 ) -> fidl::Result<()> {
1200 decoder.debug_check_bounds::<Self>(offset);
1201 let prim = decoder.read_num::<u32>(offset);
1202
1203 *self = Self::from_primitive_allow_unknown(prim);
1204 Ok(())
1205 }
1206 }
1207
1208 impl fidl::encoding::ValueTypeMarker for CharacteristicNotifierOnNotificationRequest {
1209 type Borrowed<'a> = &'a Self;
1210 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1211 value
1212 }
1213 }
1214
1215 unsafe impl fidl::encoding::TypeMarker for CharacteristicNotifierOnNotificationRequest {
1216 type Owned = Self;
1217
1218 #[inline(always)]
1219 fn inline_align(_context: fidl::encoding::Context) -> usize {
1220 8
1221 }
1222
1223 #[inline(always)]
1224 fn inline_size(_context: fidl::encoding::Context) -> usize {
1225 16
1226 }
1227 }
1228
1229 unsafe impl<D: fidl::encoding::ResourceDialect>
1230 fidl::encoding::Encode<CharacteristicNotifierOnNotificationRequest, D>
1231 for &CharacteristicNotifierOnNotificationRequest
1232 {
1233 #[inline]
1234 unsafe fn encode(
1235 self,
1236 encoder: &mut fidl::encoding::Encoder<'_, D>,
1237 offset: usize,
1238 _depth: fidl::encoding::Depth,
1239 ) -> fidl::Result<()> {
1240 encoder.debug_check_bounds::<CharacteristicNotifierOnNotificationRequest>(offset);
1241 fidl::encoding::Encode::<CharacteristicNotifierOnNotificationRequest, D>::encode(
1243 (<ReadValue as fidl::encoding::ValueTypeMarker>::borrow(&self.value),),
1244 encoder,
1245 offset,
1246 _depth,
1247 )
1248 }
1249 }
1250 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<ReadValue, D>>
1251 fidl::encoding::Encode<CharacteristicNotifierOnNotificationRequest, D> for (T0,)
1252 {
1253 #[inline]
1254 unsafe fn encode(
1255 self,
1256 encoder: &mut fidl::encoding::Encoder<'_, D>,
1257 offset: usize,
1258 depth: fidl::encoding::Depth,
1259 ) -> fidl::Result<()> {
1260 encoder.debug_check_bounds::<CharacteristicNotifierOnNotificationRequest>(offset);
1261 self.0.encode(encoder, offset + 0, depth)?;
1265 Ok(())
1266 }
1267 }
1268
1269 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1270 for CharacteristicNotifierOnNotificationRequest
1271 {
1272 #[inline(always)]
1273 fn new_empty() -> Self {
1274 Self { value: fidl::new_empty!(ReadValue, D) }
1275 }
1276
1277 #[inline]
1278 unsafe fn decode(
1279 &mut self,
1280 decoder: &mut fidl::encoding::Decoder<'_, D>,
1281 offset: usize,
1282 _depth: fidl::encoding::Depth,
1283 ) -> fidl::Result<()> {
1284 decoder.debug_check_bounds::<Self>(offset);
1285 fidl::decode!(ReadValue, D, &mut self.value, decoder, offset + 0, _depth)?;
1287 Ok(())
1288 }
1289 }
1290
1291 impl fidl::encoding::ValueTypeMarker for ClientWatchServicesRequest {
1292 type Borrowed<'a> = &'a Self;
1293 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1294 value
1295 }
1296 }
1297
1298 unsafe impl fidl::encoding::TypeMarker for ClientWatchServicesRequest {
1299 type Owned = Self;
1300
1301 #[inline(always)]
1302 fn inline_align(_context: fidl::encoding::Context) -> usize {
1303 8
1304 }
1305
1306 #[inline(always)]
1307 fn inline_size(_context: fidl::encoding::Context) -> usize {
1308 16
1309 }
1310 }
1311
1312 unsafe impl<D: fidl::encoding::ResourceDialect>
1313 fidl::encoding::Encode<ClientWatchServicesRequest, D> for &ClientWatchServicesRequest
1314 {
1315 #[inline]
1316 unsafe fn encode(
1317 self,
1318 encoder: &mut fidl::encoding::Encoder<'_, D>,
1319 offset: usize,
1320 _depth: fidl::encoding::Depth,
1321 ) -> fidl::Result<()> {
1322 encoder.debug_check_bounds::<ClientWatchServicesRequest>(offset);
1323 fidl::encoding::Encode::<ClientWatchServicesRequest, D>::encode(
1325 (
1326 <fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::Uuid> as fidl::encoding::ValueTypeMarker>::borrow(&self.uuids),
1327 ),
1328 encoder, offset, _depth
1329 )
1330 }
1331 }
1332 unsafe impl<
1333 D: fidl::encoding::ResourceDialect,
1334 T0: fidl::encoding::Encode<
1335 fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::Uuid>,
1336 D,
1337 >,
1338 > fidl::encoding::Encode<ClientWatchServicesRequest, D> for (T0,)
1339 {
1340 #[inline]
1341 unsafe fn encode(
1342 self,
1343 encoder: &mut fidl::encoding::Encoder<'_, D>,
1344 offset: usize,
1345 depth: fidl::encoding::Depth,
1346 ) -> fidl::Result<()> {
1347 encoder.debug_check_bounds::<ClientWatchServicesRequest>(offset);
1348 self.0.encode(encoder, offset + 0, depth)?;
1352 Ok(())
1353 }
1354 }
1355
1356 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1357 for ClientWatchServicesRequest
1358 {
1359 #[inline(always)]
1360 fn new_empty() -> Self {
1361 Self {
1362 uuids: fidl::new_empty!(
1363 fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::Uuid>,
1364 D
1365 ),
1366 }
1367 }
1368
1369 #[inline]
1370 unsafe fn decode(
1371 &mut self,
1372 decoder: &mut fidl::encoding::Decoder<'_, D>,
1373 offset: usize,
1374 _depth: fidl::encoding::Depth,
1375 ) -> fidl::Result<()> {
1376 decoder.debug_check_bounds::<Self>(offset);
1377 fidl::decode!(
1379 fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::Uuid>,
1380 D,
1381 &mut self.uuids,
1382 decoder,
1383 offset + 0,
1384 _depth
1385 )?;
1386 Ok(())
1387 }
1388 }
1389
1390 impl fidl::encoding::ValueTypeMarker for ClientWatchServicesResponse {
1391 type Borrowed<'a> = &'a Self;
1392 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1393 value
1394 }
1395 }
1396
1397 unsafe impl fidl::encoding::TypeMarker for ClientWatchServicesResponse {
1398 type Owned = Self;
1399
1400 #[inline(always)]
1401 fn inline_align(_context: fidl::encoding::Context) -> usize {
1402 8
1403 }
1404
1405 #[inline(always)]
1406 fn inline_size(_context: fidl::encoding::Context) -> usize {
1407 32
1408 }
1409 }
1410
1411 unsafe impl<D: fidl::encoding::ResourceDialect>
1412 fidl::encoding::Encode<ClientWatchServicesResponse, D> for &ClientWatchServicesResponse
1413 {
1414 #[inline]
1415 unsafe fn encode(
1416 self,
1417 encoder: &mut fidl::encoding::Encoder<'_, D>,
1418 offset: usize,
1419 _depth: fidl::encoding::Depth,
1420 ) -> fidl::Result<()> {
1421 encoder.debug_check_bounds::<ClientWatchServicesResponse>(offset);
1422 fidl::encoding::Encode::<ClientWatchServicesResponse, D>::encode(
1424 (
1425 <fidl::encoding::Vector<ServiceInfo, 65535> as fidl::encoding::ValueTypeMarker>::borrow(&self.updated),
1426 <fidl::encoding::Vector<Handle, 65535> as fidl::encoding::ValueTypeMarker>::borrow(&self.removed),
1427 ),
1428 encoder, offset, _depth
1429 )
1430 }
1431 }
1432 unsafe impl<
1433 D: fidl::encoding::ResourceDialect,
1434 T0: fidl::encoding::Encode<fidl::encoding::Vector<ServiceInfo, 65535>, D>,
1435 T1: fidl::encoding::Encode<fidl::encoding::Vector<Handle, 65535>, D>,
1436 > fidl::encoding::Encode<ClientWatchServicesResponse, D> for (T0, T1)
1437 {
1438 #[inline]
1439 unsafe fn encode(
1440 self,
1441 encoder: &mut fidl::encoding::Encoder<'_, D>,
1442 offset: usize,
1443 depth: fidl::encoding::Depth,
1444 ) -> fidl::Result<()> {
1445 encoder.debug_check_bounds::<ClientWatchServicesResponse>(offset);
1446 self.0.encode(encoder, offset + 0, depth)?;
1450 self.1.encode(encoder, offset + 16, depth)?;
1451 Ok(())
1452 }
1453 }
1454
1455 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1456 for ClientWatchServicesResponse
1457 {
1458 #[inline(always)]
1459 fn new_empty() -> Self {
1460 Self {
1461 updated: fidl::new_empty!(fidl::encoding::Vector<ServiceInfo, 65535>, D),
1462 removed: fidl::new_empty!(fidl::encoding::Vector<Handle, 65535>, D),
1463 }
1464 }
1465
1466 #[inline]
1467 unsafe fn decode(
1468 &mut self,
1469 decoder: &mut fidl::encoding::Decoder<'_, D>,
1470 offset: usize,
1471 _depth: fidl::encoding::Depth,
1472 ) -> fidl::Result<()> {
1473 decoder.debug_check_bounds::<Self>(offset);
1474 fidl::decode!(fidl::encoding::Vector<ServiceInfo, 65535>, D, &mut self.updated, decoder, offset + 0, _depth)?;
1476 fidl::decode!(fidl::encoding::Vector<Handle, 65535>, D, &mut self.removed, decoder, offset + 16, _depth)?;
1477 Ok(())
1478 }
1479 }
1480
1481 impl fidl::encoding::ValueTypeMarker for Handle {
1482 type Borrowed<'a> = &'a Self;
1483 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1484 value
1485 }
1486 }
1487
1488 unsafe impl fidl::encoding::TypeMarker for Handle {
1489 type Owned = Self;
1490
1491 #[inline(always)]
1492 fn inline_align(_context: fidl::encoding::Context) -> usize {
1493 8
1494 }
1495
1496 #[inline(always)]
1497 fn inline_size(_context: fidl::encoding::Context) -> usize {
1498 8
1499 }
1500 #[inline(always)]
1501 fn encode_is_copy() -> bool {
1502 true
1503 }
1504
1505 #[inline(always)]
1506 fn decode_is_copy() -> bool {
1507 true
1508 }
1509 }
1510
1511 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Handle, D> for &Handle {
1512 #[inline]
1513 unsafe fn encode(
1514 self,
1515 encoder: &mut fidl::encoding::Encoder<'_, D>,
1516 offset: usize,
1517 _depth: fidl::encoding::Depth,
1518 ) -> fidl::Result<()> {
1519 encoder.debug_check_bounds::<Handle>(offset);
1520 unsafe {
1521 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1523 (buf_ptr as *mut Handle).write_unaligned((self as *const Handle).read());
1524 }
1527 Ok(())
1528 }
1529 }
1530 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
1531 fidl::encoding::Encode<Handle, D> for (T0,)
1532 {
1533 #[inline]
1534 unsafe fn encode(
1535 self,
1536 encoder: &mut fidl::encoding::Encoder<'_, D>,
1537 offset: usize,
1538 depth: fidl::encoding::Depth,
1539 ) -> fidl::Result<()> {
1540 encoder.debug_check_bounds::<Handle>(offset);
1541 self.0.encode(encoder, offset + 0, depth)?;
1545 Ok(())
1546 }
1547 }
1548
1549 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Handle {
1550 #[inline(always)]
1551 fn new_empty() -> Self {
1552 Self { value: fidl::new_empty!(u64, D) }
1553 }
1554
1555 #[inline]
1556 unsafe fn decode(
1557 &mut self,
1558 decoder: &mut fidl::encoding::Decoder<'_, D>,
1559 offset: usize,
1560 _depth: fidl::encoding::Depth,
1561 ) -> fidl::Result<()> {
1562 decoder.debug_check_bounds::<Self>(offset);
1563 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1564 unsafe {
1567 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1568 }
1569 Ok(())
1570 }
1571 }
1572
1573 impl fidl::encoding::ValueTypeMarker for LocalServiceCharacteristicConfigurationRequest {
1574 type Borrowed<'a> = &'a Self;
1575 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1576 value
1577 }
1578 }
1579
1580 unsafe impl fidl::encoding::TypeMarker for LocalServiceCharacteristicConfigurationRequest {
1581 type Owned = Self;
1582
1583 #[inline(always)]
1584 fn inline_align(_context: fidl::encoding::Context) -> usize {
1585 8
1586 }
1587
1588 #[inline(always)]
1589 fn inline_size(_context: fidl::encoding::Context) -> usize {
1590 24
1591 }
1592 }
1593
1594 unsafe impl<D: fidl::encoding::ResourceDialect>
1595 fidl::encoding::Encode<LocalServiceCharacteristicConfigurationRequest, D>
1596 for &LocalServiceCharacteristicConfigurationRequest
1597 {
1598 #[inline]
1599 unsafe fn encode(
1600 self,
1601 encoder: &mut fidl::encoding::Encoder<'_, D>,
1602 offset: usize,
1603 _depth: fidl::encoding::Depth,
1604 ) -> fidl::Result<()> {
1605 encoder.debug_check_bounds::<LocalServiceCharacteristicConfigurationRequest>(offset);
1606 fidl::encoding::Encode::<LocalServiceCharacteristicConfigurationRequest, D>::encode(
1608 (
1609 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(
1610 &self.peer_id,
1611 ),
1612 <Handle as fidl::encoding::ValueTypeMarker>::borrow(&self.handle),
1613 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.notify),
1614 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.indicate),
1615 ),
1616 encoder,
1617 offset,
1618 _depth,
1619 )
1620 }
1621 }
1622 unsafe impl<
1623 D: fidl::encoding::ResourceDialect,
1624 T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::PeerId, D>,
1625 T1: fidl::encoding::Encode<Handle, D>,
1626 T2: fidl::encoding::Encode<bool, D>,
1627 T3: fidl::encoding::Encode<bool, D>,
1628 > fidl::encoding::Encode<LocalServiceCharacteristicConfigurationRequest, D>
1629 for (T0, T1, T2, T3)
1630 {
1631 #[inline]
1632 unsafe fn encode(
1633 self,
1634 encoder: &mut fidl::encoding::Encoder<'_, D>,
1635 offset: usize,
1636 depth: fidl::encoding::Depth,
1637 ) -> fidl::Result<()> {
1638 encoder.debug_check_bounds::<LocalServiceCharacteristicConfigurationRequest>(offset);
1639 unsafe {
1642 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1643 (ptr as *mut u64).write_unaligned(0);
1644 }
1645 self.0.encode(encoder, offset + 0, depth)?;
1647 self.1.encode(encoder, offset + 8, depth)?;
1648 self.2.encode(encoder, offset + 16, depth)?;
1649 self.3.encode(encoder, offset + 17, depth)?;
1650 Ok(())
1651 }
1652 }
1653
1654 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1655 for LocalServiceCharacteristicConfigurationRequest
1656 {
1657 #[inline(always)]
1658 fn new_empty() -> Self {
1659 Self {
1660 peer_id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D),
1661 handle: fidl::new_empty!(Handle, D),
1662 notify: fidl::new_empty!(bool, D),
1663 indicate: fidl::new_empty!(bool, D),
1664 }
1665 }
1666
1667 #[inline]
1668 unsafe fn decode(
1669 &mut self,
1670 decoder: &mut fidl::encoding::Decoder<'_, D>,
1671 offset: usize,
1672 _depth: fidl::encoding::Depth,
1673 ) -> fidl::Result<()> {
1674 decoder.debug_check_bounds::<Self>(offset);
1675 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1677 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1678 let mask = 0xffffffffffff0000u64;
1679 let maskedval = padval & mask;
1680 if maskedval != 0 {
1681 return Err(fidl::Error::NonZeroPadding {
1682 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1683 });
1684 }
1685 fidl::decode!(
1686 fidl_fuchsia_bluetooth::PeerId,
1687 D,
1688 &mut self.peer_id,
1689 decoder,
1690 offset + 0,
1691 _depth
1692 )?;
1693 fidl::decode!(Handle, D, &mut self.handle, decoder, offset + 8, _depth)?;
1694 fidl::decode!(bool, D, &mut self.notify, decoder, offset + 16, _depth)?;
1695 fidl::decode!(bool, D, &mut self.indicate, decoder, offset + 17, _depth)?;
1696 Ok(())
1697 }
1698 }
1699
1700 impl fidl::encoding::ValueTypeMarker for LocalServiceReadValueRequest {
1701 type Borrowed<'a> = &'a Self;
1702 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1703 value
1704 }
1705 }
1706
1707 unsafe impl fidl::encoding::TypeMarker for LocalServiceReadValueRequest {
1708 type Owned = Self;
1709
1710 #[inline(always)]
1711 fn inline_align(_context: fidl::encoding::Context) -> usize {
1712 8
1713 }
1714
1715 #[inline(always)]
1716 fn inline_size(_context: fidl::encoding::Context) -> usize {
1717 24
1718 }
1719 }
1720
1721 unsafe impl<D: fidl::encoding::ResourceDialect>
1722 fidl::encoding::Encode<LocalServiceReadValueRequest, D> for &LocalServiceReadValueRequest
1723 {
1724 #[inline]
1725 unsafe fn encode(
1726 self,
1727 encoder: &mut fidl::encoding::Encoder<'_, D>,
1728 offset: usize,
1729 _depth: fidl::encoding::Depth,
1730 ) -> fidl::Result<()> {
1731 encoder.debug_check_bounds::<LocalServiceReadValueRequest>(offset);
1732 fidl::encoding::Encode::<LocalServiceReadValueRequest, D>::encode(
1734 (
1735 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(
1736 &self.peer_id,
1737 ),
1738 <Handle as fidl::encoding::ValueTypeMarker>::borrow(&self.handle),
1739 <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.offset),
1740 ),
1741 encoder,
1742 offset,
1743 _depth,
1744 )
1745 }
1746 }
1747 unsafe impl<
1748 D: fidl::encoding::ResourceDialect,
1749 T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::PeerId, D>,
1750 T1: fidl::encoding::Encode<Handle, D>,
1751 T2: fidl::encoding::Encode<i32, D>,
1752 > fidl::encoding::Encode<LocalServiceReadValueRequest, D> for (T0, T1, T2)
1753 {
1754 #[inline]
1755 unsafe fn encode(
1756 self,
1757 encoder: &mut fidl::encoding::Encoder<'_, D>,
1758 offset: usize,
1759 depth: fidl::encoding::Depth,
1760 ) -> fidl::Result<()> {
1761 encoder.debug_check_bounds::<LocalServiceReadValueRequest>(offset);
1762 unsafe {
1765 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1766 (ptr as *mut u64).write_unaligned(0);
1767 }
1768 self.0.encode(encoder, offset + 0, depth)?;
1770 self.1.encode(encoder, offset + 8, depth)?;
1771 self.2.encode(encoder, offset + 16, depth)?;
1772 Ok(())
1773 }
1774 }
1775
1776 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1777 for LocalServiceReadValueRequest
1778 {
1779 #[inline(always)]
1780 fn new_empty() -> Self {
1781 Self {
1782 peer_id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D),
1783 handle: fidl::new_empty!(Handle, D),
1784 offset: fidl::new_empty!(i32, D),
1785 }
1786 }
1787
1788 #[inline]
1789 unsafe fn decode(
1790 &mut self,
1791 decoder: &mut fidl::encoding::Decoder<'_, D>,
1792 offset: usize,
1793 _depth: fidl::encoding::Depth,
1794 ) -> fidl::Result<()> {
1795 decoder.debug_check_bounds::<Self>(offset);
1796 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1798 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1799 let mask = 0xffffffff00000000u64;
1800 let maskedval = padval & mask;
1801 if maskedval != 0 {
1802 return Err(fidl::Error::NonZeroPadding {
1803 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1804 });
1805 }
1806 fidl::decode!(
1807 fidl_fuchsia_bluetooth::PeerId,
1808 D,
1809 &mut self.peer_id,
1810 decoder,
1811 offset + 0,
1812 _depth
1813 )?;
1814 fidl::decode!(Handle, D, &mut self.handle, decoder, offset + 8, _depth)?;
1815 fidl::decode!(i32, D, &mut self.offset, decoder, offset + 16, _depth)?;
1816 Ok(())
1817 }
1818 }
1819
1820 impl fidl::encoding::ValueTypeMarker for LocalServiceValueChangedCreditRequest {
1821 type Borrowed<'a> = &'a Self;
1822 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1823 value
1824 }
1825 }
1826
1827 unsafe impl fidl::encoding::TypeMarker for LocalServiceValueChangedCreditRequest {
1828 type Owned = Self;
1829
1830 #[inline(always)]
1831 fn inline_align(_context: fidl::encoding::Context) -> usize {
1832 1
1833 }
1834
1835 #[inline(always)]
1836 fn inline_size(_context: fidl::encoding::Context) -> usize {
1837 1
1838 }
1839 #[inline(always)]
1840 fn encode_is_copy() -> bool {
1841 true
1842 }
1843
1844 #[inline(always)]
1845 fn decode_is_copy() -> bool {
1846 true
1847 }
1848 }
1849
1850 unsafe impl<D: fidl::encoding::ResourceDialect>
1851 fidl::encoding::Encode<LocalServiceValueChangedCreditRequest, D>
1852 for &LocalServiceValueChangedCreditRequest
1853 {
1854 #[inline]
1855 unsafe fn encode(
1856 self,
1857 encoder: &mut fidl::encoding::Encoder<'_, D>,
1858 offset: usize,
1859 _depth: fidl::encoding::Depth,
1860 ) -> fidl::Result<()> {
1861 encoder.debug_check_bounds::<LocalServiceValueChangedCreditRequest>(offset);
1862 unsafe {
1863 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1865 (buf_ptr as *mut LocalServiceValueChangedCreditRequest)
1866 .write_unaligned((self as *const LocalServiceValueChangedCreditRequest).read());
1867 }
1870 Ok(())
1871 }
1872 }
1873 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
1874 fidl::encoding::Encode<LocalServiceValueChangedCreditRequest, D> for (T0,)
1875 {
1876 #[inline]
1877 unsafe fn encode(
1878 self,
1879 encoder: &mut fidl::encoding::Encoder<'_, D>,
1880 offset: usize,
1881 depth: fidl::encoding::Depth,
1882 ) -> fidl::Result<()> {
1883 encoder.debug_check_bounds::<LocalServiceValueChangedCreditRequest>(offset);
1884 self.0.encode(encoder, offset + 0, depth)?;
1888 Ok(())
1889 }
1890 }
1891
1892 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1893 for LocalServiceValueChangedCreditRequest
1894 {
1895 #[inline(always)]
1896 fn new_empty() -> Self {
1897 Self { additional_credit: fidl::new_empty!(u8, D) }
1898 }
1899
1900 #[inline]
1901 unsafe fn decode(
1902 &mut self,
1903 decoder: &mut fidl::encoding::Decoder<'_, D>,
1904 offset: usize,
1905 _depth: fidl::encoding::Depth,
1906 ) -> fidl::Result<()> {
1907 decoder.debug_check_bounds::<Self>(offset);
1908 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1909 unsafe {
1912 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
1913 }
1914 Ok(())
1915 }
1916 }
1917
1918 impl fidl::encoding::ValueTypeMarker for LocalServiceReadValueResponse {
1919 type Borrowed<'a> = &'a Self;
1920 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1921 value
1922 }
1923 }
1924
1925 unsafe impl fidl::encoding::TypeMarker for LocalServiceReadValueResponse {
1926 type Owned = Self;
1927
1928 #[inline(always)]
1929 fn inline_align(_context: fidl::encoding::Context) -> usize {
1930 8
1931 }
1932
1933 #[inline(always)]
1934 fn inline_size(_context: fidl::encoding::Context) -> usize {
1935 16
1936 }
1937 }
1938
1939 unsafe impl<D: fidl::encoding::ResourceDialect>
1940 fidl::encoding::Encode<LocalServiceReadValueResponse, D>
1941 for &LocalServiceReadValueResponse
1942 {
1943 #[inline]
1944 unsafe fn encode(
1945 self,
1946 encoder: &mut fidl::encoding::Encoder<'_, D>,
1947 offset: usize,
1948 _depth: fidl::encoding::Depth,
1949 ) -> fidl::Result<()> {
1950 encoder.debug_check_bounds::<LocalServiceReadValueResponse>(offset);
1951 fidl::encoding::Encode::<LocalServiceReadValueResponse, D>::encode(
1953 (<fidl::encoding::Vector<u8, 512> as fidl::encoding::ValueTypeMarker>::borrow(
1954 &self.value,
1955 ),),
1956 encoder,
1957 offset,
1958 _depth,
1959 )
1960 }
1961 }
1962 unsafe impl<
1963 D: fidl::encoding::ResourceDialect,
1964 T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 512>, D>,
1965 > fidl::encoding::Encode<LocalServiceReadValueResponse, D> for (T0,)
1966 {
1967 #[inline]
1968 unsafe fn encode(
1969 self,
1970 encoder: &mut fidl::encoding::Encoder<'_, D>,
1971 offset: usize,
1972 depth: fidl::encoding::Depth,
1973 ) -> fidl::Result<()> {
1974 encoder.debug_check_bounds::<LocalServiceReadValueResponse>(offset);
1975 self.0.encode(encoder, offset + 0, depth)?;
1979 Ok(())
1980 }
1981 }
1982
1983 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1984 for LocalServiceReadValueResponse
1985 {
1986 #[inline(always)]
1987 fn new_empty() -> Self {
1988 Self { value: fidl::new_empty!(fidl::encoding::Vector<u8, 512>, D) }
1989 }
1990
1991 #[inline]
1992 unsafe fn decode(
1993 &mut self,
1994 decoder: &mut fidl::encoding::Decoder<'_, D>,
1995 offset: usize,
1996 _depth: fidl::encoding::Depth,
1997 ) -> fidl::Result<()> {
1998 decoder.debug_check_bounds::<Self>(offset);
1999 fidl::decode!(fidl::encoding::Vector<u8, 512>, D, &mut self.value, decoder, offset + 0, _depth)?;
2001 Ok(())
2002 }
2003 }
2004
2005 impl fidl::encoding::ValueTypeMarker for RemoteServiceDiscoverCharacteristicsResponse {
2006 type Borrowed<'a> = &'a Self;
2007 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2008 value
2009 }
2010 }
2011
2012 unsafe impl fidl::encoding::TypeMarker for RemoteServiceDiscoverCharacteristicsResponse {
2013 type Owned = Self;
2014
2015 #[inline(always)]
2016 fn inline_align(_context: fidl::encoding::Context) -> usize {
2017 8
2018 }
2019
2020 #[inline(always)]
2021 fn inline_size(_context: fidl::encoding::Context) -> usize {
2022 16
2023 }
2024 }
2025
2026 unsafe impl<D: fidl::encoding::ResourceDialect>
2027 fidl::encoding::Encode<RemoteServiceDiscoverCharacteristicsResponse, D>
2028 for &RemoteServiceDiscoverCharacteristicsResponse
2029 {
2030 #[inline]
2031 unsafe fn encode(
2032 self,
2033 encoder: &mut fidl::encoding::Encoder<'_, D>,
2034 offset: usize,
2035 _depth: fidl::encoding::Depth,
2036 ) -> fidl::Result<()> {
2037 encoder.debug_check_bounds::<RemoteServiceDiscoverCharacteristicsResponse>(offset);
2038 fidl::encoding::Encode::<RemoteServiceDiscoverCharacteristicsResponse, D>::encode(
2040 (
2041 <fidl::encoding::Vector<Characteristic, 32767> as fidl::encoding::ValueTypeMarker>::borrow(&self.characteristics),
2042 ),
2043 encoder, offset, _depth
2044 )
2045 }
2046 }
2047 unsafe impl<
2048 D: fidl::encoding::ResourceDialect,
2049 T0: fidl::encoding::Encode<fidl::encoding::Vector<Characteristic, 32767>, D>,
2050 > fidl::encoding::Encode<RemoteServiceDiscoverCharacteristicsResponse, D> for (T0,)
2051 {
2052 #[inline]
2053 unsafe fn encode(
2054 self,
2055 encoder: &mut fidl::encoding::Encoder<'_, D>,
2056 offset: usize,
2057 depth: fidl::encoding::Depth,
2058 ) -> fidl::Result<()> {
2059 encoder.debug_check_bounds::<RemoteServiceDiscoverCharacteristicsResponse>(offset);
2060 self.0.encode(encoder, offset + 0, depth)?;
2064 Ok(())
2065 }
2066 }
2067
2068 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2069 for RemoteServiceDiscoverCharacteristicsResponse
2070 {
2071 #[inline(always)]
2072 fn new_empty() -> Self {
2073 Self {
2074 characteristics: fidl::new_empty!(fidl::encoding::Vector<Characteristic, 32767>, D),
2075 }
2076 }
2077
2078 #[inline]
2079 unsafe fn decode(
2080 &mut self,
2081 decoder: &mut fidl::encoding::Decoder<'_, D>,
2082 offset: usize,
2083 _depth: fidl::encoding::Depth,
2084 ) -> fidl::Result<()> {
2085 decoder.debug_check_bounds::<Self>(offset);
2086 fidl::decode!(fidl::encoding::Vector<Characteristic, 32767>, D, &mut self.characteristics, decoder, offset + 0, _depth)?;
2088 Ok(())
2089 }
2090 }
2091
2092 impl fidl::encoding::ValueTypeMarker for RemoteServiceReadByTypeRequest {
2093 type Borrowed<'a> = &'a Self;
2094 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2095 value
2096 }
2097 }
2098
2099 unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadByTypeRequest {
2100 type Owned = Self;
2101
2102 #[inline(always)]
2103 fn inline_align(_context: fidl::encoding::Context) -> usize {
2104 1
2105 }
2106
2107 #[inline(always)]
2108 fn inline_size(_context: fidl::encoding::Context) -> usize {
2109 16
2110 }
2111 }
2112
2113 unsafe impl<D: fidl::encoding::ResourceDialect>
2114 fidl::encoding::Encode<RemoteServiceReadByTypeRequest, D>
2115 for &RemoteServiceReadByTypeRequest
2116 {
2117 #[inline]
2118 unsafe fn encode(
2119 self,
2120 encoder: &mut fidl::encoding::Encoder<'_, D>,
2121 offset: usize,
2122 _depth: fidl::encoding::Depth,
2123 ) -> fidl::Result<()> {
2124 encoder.debug_check_bounds::<RemoteServiceReadByTypeRequest>(offset);
2125 fidl::encoding::Encode::<RemoteServiceReadByTypeRequest, D>::encode(
2127 (<fidl_fuchsia_bluetooth::Uuid as fidl::encoding::ValueTypeMarker>::borrow(
2128 &self.uuid,
2129 ),),
2130 encoder,
2131 offset,
2132 _depth,
2133 )
2134 }
2135 }
2136 unsafe impl<
2137 D: fidl::encoding::ResourceDialect,
2138 T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::Uuid, D>,
2139 > fidl::encoding::Encode<RemoteServiceReadByTypeRequest, D> for (T0,)
2140 {
2141 #[inline]
2142 unsafe fn encode(
2143 self,
2144 encoder: &mut fidl::encoding::Encoder<'_, D>,
2145 offset: usize,
2146 depth: fidl::encoding::Depth,
2147 ) -> fidl::Result<()> {
2148 encoder.debug_check_bounds::<RemoteServiceReadByTypeRequest>(offset);
2149 self.0.encode(encoder, offset + 0, depth)?;
2153 Ok(())
2154 }
2155 }
2156
2157 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2158 for RemoteServiceReadByTypeRequest
2159 {
2160 #[inline(always)]
2161 fn new_empty() -> Self {
2162 Self { uuid: fidl::new_empty!(fidl_fuchsia_bluetooth::Uuid, D) }
2163 }
2164
2165 #[inline]
2166 unsafe fn decode(
2167 &mut self,
2168 decoder: &mut fidl::encoding::Decoder<'_, D>,
2169 offset: usize,
2170 _depth: fidl::encoding::Depth,
2171 ) -> fidl::Result<()> {
2172 decoder.debug_check_bounds::<Self>(offset);
2173 fidl::decode!(
2175 fidl_fuchsia_bluetooth::Uuid,
2176 D,
2177 &mut self.uuid,
2178 decoder,
2179 offset + 0,
2180 _depth
2181 )?;
2182 Ok(())
2183 }
2184 }
2185
2186 impl fidl::encoding::ValueTypeMarker for RemoteServiceReadCharacteristicRequest {
2187 type Borrowed<'a> = &'a Self;
2188 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2189 value
2190 }
2191 }
2192
2193 unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadCharacteristicRequest {
2194 type Owned = Self;
2195
2196 #[inline(always)]
2197 fn inline_align(_context: fidl::encoding::Context) -> usize {
2198 8
2199 }
2200
2201 #[inline(always)]
2202 fn inline_size(_context: fidl::encoding::Context) -> usize {
2203 24
2204 }
2205 }
2206
2207 unsafe impl<D: fidl::encoding::ResourceDialect>
2208 fidl::encoding::Encode<RemoteServiceReadCharacteristicRequest, D>
2209 for &RemoteServiceReadCharacteristicRequest
2210 {
2211 #[inline]
2212 unsafe fn encode(
2213 self,
2214 encoder: &mut fidl::encoding::Encoder<'_, D>,
2215 offset: usize,
2216 _depth: fidl::encoding::Depth,
2217 ) -> fidl::Result<()> {
2218 encoder.debug_check_bounds::<RemoteServiceReadCharacteristicRequest>(offset);
2219 fidl::encoding::Encode::<RemoteServiceReadCharacteristicRequest, D>::encode(
2221 (
2222 <Handle as fidl::encoding::ValueTypeMarker>::borrow(&self.handle),
2223 <ReadOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
2224 ),
2225 encoder,
2226 offset,
2227 _depth,
2228 )
2229 }
2230 }
2231 unsafe impl<
2232 D: fidl::encoding::ResourceDialect,
2233 T0: fidl::encoding::Encode<Handle, D>,
2234 T1: fidl::encoding::Encode<ReadOptions, D>,
2235 > fidl::encoding::Encode<RemoteServiceReadCharacteristicRequest, D> for (T0, T1)
2236 {
2237 #[inline]
2238 unsafe fn encode(
2239 self,
2240 encoder: &mut fidl::encoding::Encoder<'_, D>,
2241 offset: usize,
2242 depth: fidl::encoding::Depth,
2243 ) -> fidl::Result<()> {
2244 encoder.debug_check_bounds::<RemoteServiceReadCharacteristicRequest>(offset);
2245 self.0.encode(encoder, offset + 0, depth)?;
2249 self.1.encode(encoder, offset + 8, depth)?;
2250 Ok(())
2251 }
2252 }
2253
2254 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2255 for RemoteServiceReadCharacteristicRequest
2256 {
2257 #[inline(always)]
2258 fn new_empty() -> Self {
2259 Self { handle: fidl::new_empty!(Handle, D), options: fidl::new_empty!(ReadOptions, D) }
2260 }
2261
2262 #[inline]
2263 unsafe fn decode(
2264 &mut self,
2265 decoder: &mut fidl::encoding::Decoder<'_, D>,
2266 offset: usize,
2267 _depth: fidl::encoding::Depth,
2268 ) -> fidl::Result<()> {
2269 decoder.debug_check_bounds::<Self>(offset);
2270 fidl::decode!(Handle, D, &mut self.handle, decoder, offset + 0, _depth)?;
2272 fidl::decode!(ReadOptions, D, &mut self.options, decoder, offset + 8, _depth)?;
2273 Ok(())
2274 }
2275 }
2276
2277 impl fidl::encoding::ValueTypeMarker for RemoteServiceReadDescriptorRequest {
2278 type Borrowed<'a> = &'a Self;
2279 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2280 value
2281 }
2282 }
2283
2284 unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadDescriptorRequest {
2285 type Owned = Self;
2286
2287 #[inline(always)]
2288 fn inline_align(_context: fidl::encoding::Context) -> usize {
2289 8
2290 }
2291
2292 #[inline(always)]
2293 fn inline_size(_context: fidl::encoding::Context) -> usize {
2294 24
2295 }
2296 }
2297
2298 unsafe impl<D: fidl::encoding::ResourceDialect>
2299 fidl::encoding::Encode<RemoteServiceReadDescriptorRequest, D>
2300 for &RemoteServiceReadDescriptorRequest
2301 {
2302 #[inline]
2303 unsafe fn encode(
2304 self,
2305 encoder: &mut fidl::encoding::Encoder<'_, D>,
2306 offset: usize,
2307 _depth: fidl::encoding::Depth,
2308 ) -> fidl::Result<()> {
2309 encoder.debug_check_bounds::<RemoteServiceReadDescriptorRequest>(offset);
2310 fidl::encoding::Encode::<RemoteServiceReadDescriptorRequest, D>::encode(
2312 (
2313 <Handle as fidl::encoding::ValueTypeMarker>::borrow(&self.handle),
2314 <ReadOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
2315 ),
2316 encoder,
2317 offset,
2318 _depth,
2319 )
2320 }
2321 }
2322 unsafe impl<
2323 D: fidl::encoding::ResourceDialect,
2324 T0: fidl::encoding::Encode<Handle, D>,
2325 T1: fidl::encoding::Encode<ReadOptions, D>,
2326 > fidl::encoding::Encode<RemoteServiceReadDescriptorRequest, D> for (T0, T1)
2327 {
2328 #[inline]
2329 unsafe fn encode(
2330 self,
2331 encoder: &mut fidl::encoding::Encoder<'_, D>,
2332 offset: usize,
2333 depth: fidl::encoding::Depth,
2334 ) -> fidl::Result<()> {
2335 encoder.debug_check_bounds::<RemoteServiceReadDescriptorRequest>(offset);
2336 self.0.encode(encoder, offset + 0, depth)?;
2340 self.1.encode(encoder, offset + 8, depth)?;
2341 Ok(())
2342 }
2343 }
2344
2345 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2346 for RemoteServiceReadDescriptorRequest
2347 {
2348 #[inline(always)]
2349 fn new_empty() -> Self {
2350 Self { handle: fidl::new_empty!(Handle, D), options: fidl::new_empty!(ReadOptions, D) }
2351 }
2352
2353 #[inline]
2354 unsafe fn decode(
2355 &mut self,
2356 decoder: &mut fidl::encoding::Decoder<'_, D>,
2357 offset: usize,
2358 _depth: fidl::encoding::Depth,
2359 ) -> fidl::Result<()> {
2360 decoder.debug_check_bounds::<Self>(offset);
2361 fidl::decode!(Handle, D, &mut self.handle, decoder, offset + 0, _depth)?;
2363 fidl::decode!(ReadOptions, D, &mut self.options, decoder, offset + 8, _depth)?;
2364 Ok(())
2365 }
2366 }
2367
2368 impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteCharacteristicRequest {
2369 type Borrowed<'a> = &'a Self;
2370 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2371 value
2372 }
2373 }
2374
2375 unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteCharacteristicRequest {
2376 type Owned = Self;
2377
2378 #[inline(always)]
2379 fn inline_align(_context: fidl::encoding::Context) -> usize {
2380 8
2381 }
2382
2383 #[inline(always)]
2384 fn inline_size(_context: fidl::encoding::Context) -> usize {
2385 40
2386 }
2387 }
2388
2389 unsafe impl<D: fidl::encoding::ResourceDialect>
2390 fidl::encoding::Encode<RemoteServiceWriteCharacteristicRequest, D>
2391 for &RemoteServiceWriteCharacteristicRequest
2392 {
2393 #[inline]
2394 unsafe fn encode(
2395 self,
2396 encoder: &mut fidl::encoding::Encoder<'_, D>,
2397 offset: usize,
2398 _depth: fidl::encoding::Depth,
2399 ) -> fidl::Result<()> {
2400 encoder.debug_check_bounds::<RemoteServiceWriteCharacteristicRequest>(offset);
2401 fidl::encoding::Encode::<RemoteServiceWriteCharacteristicRequest, D>::encode(
2403 (
2404 <Handle as fidl::encoding::ValueTypeMarker>::borrow(&self.handle),
2405 <fidl::encoding::Vector<u8, 512> as fidl::encoding::ValueTypeMarker>::borrow(
2406 &self.value,
2407 ),
2408 <WriteOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
2409 ),
2410 encoder,
2411 offset,
2412 _depth,
2413 )
2414 }
2415 }
2416 unsafe impl<
2417 D: fidl::encoding::ResourceDialect,
2418 T0: fidl::encoding::Encode<Handle, D>,
2419 T1: fidl::encoding::Encode<fidl::encoding::Vector<u8, 512>, D>,
2420 T2: fidl::encoding::Encode<WriteOptions, D>,
2421 > fidl::encoding::Encode<RemoteServiceWriteCharacteristicRequest, D> for (T0, T1, T2)
2422 {
2423 #[inline]
2424 unsafe fn encode(
2425 self,
2426 encoder: &mut fidl::encoding::Encoder<'_, D>,
2427 offset: usize,
2428 depth: fidl::encoding::Depth,
2429 ) -> fidl::Result<()> {
2430 encoder.debug_check_bounds::<RemoteServiceWriteCharacteristicRequest>(offset);
2431 self.0.encode(encoder, offset + 0, depth)?;
2435 self.1.encode(encoder, offset + 8, depth)?;
2436 self.2.encode(encoder, offset + 24, depth)?;
2437 Ok(())
2438 }
2439 }
2440
2441 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2442 for RemoteServiceWriteCharacteristicRequest
2443 {
2444 #[inline(always)]
2445 fn new_empty() -> Self {
2446 Self {
2447 handle: fidl::new_empty!(Handle, D),
2448 value: fidl::new_empty!(fidl::encoding::Vector<u8, 512>, D),
2449 options: fidl::new_empty!(WriteOptions, D),
2450 }
2451 }
2452
2453 #[inline]
2454 unsafe fn decode(
2455 &mut self,
2456 decoder: &mut fidl::encoding::Decoder<'_, D>,
2457 offset: usize,
2458 _depth: fidl::encoding::Depth,
2459 ) -> fidl::Result<()> {
2460 decoder.debug_check_bounds::<Self>(offset);
2461 fidl::decode!(Handle, D, &mut self.handle, decoder, offset + 0, _depth)?;
2463 fidl::decode!(fidl::encoding::Vector<u8, 512>, D, &mut self.value, decoder, offset + 8, _depth)?;
2464 fidl::decode!(WriteOptions, D, &mut self.options, decoder, offset + 24, _depth)?;
2465 Ok(())
2466 }
2467 }
2468
2469 impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteDescriptorRequest {
2470 type Borrowed<'a> = &'a Self;
2471 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2472 value
2473 }
2474 }
2475
2476 unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteDescriptorRequest {
2477 type Owned = Self;
2478
2479 #[inline(always)]
2480 fn inline_align(_context: fidl::encoding::Context) -> usize {
2481 8
2482 }
2483
2484 #[inline(always)]
2485 fn inline_size(_context: fidl::encoding::Context) -> usize {
2486 40
2487 }
2488 }
2489
2490 unsafe impl<D: fidl::encoding::ResourceDialect>
2491 fidl::encoding::Encode<RemoteServiceWriteDescriptorRequest, D>
2492 for &RemoteServiceWriteDescriptorRequest
2493 {
2494 #[inline]
2495 unsafe fn encode(
2496 self,
2497 encoder: &mut fidl::encoding::Encoder<'_, D>,
2498 offset: usize,
2499 _depth: fidl::encoding::Depth,
2500 ) -> fidl::Result<()> {
2501 encoder.debug_check_bounds::<RemoteServiceWriteDescriptorRequest>(offset);
2502 fidl::encoding::Encode::<RemoteServiceWriteDescriptorRequest, D>::encode(
2504 (
2505 <Handle as fidl::encoding::ValueTypeMarker>::borrow(&self.handle),
2506 <fidl::encoding::Vector<u8, 512> as fidl::encoding::ValueTypeMarker>::borrow(
2507 &self.value,
2508 ),
2509 <WriteOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
2510 ),
2511 encoder,
2512 offset,
2513 _depth,
2514 )
2515 }
2516 }
2517 unsafe impl<
2518 D: fidl::encoding::ResourceDialect,
2519 T0: fidl::encoding::Encode<Handle, D>,
2520 T1: fidl::encoding::Encode<fidl::encoding::Vector<u8, 512>, D>,
2521 T2: fidl::encoding::Encode<WriteOptions, D>,
2522 > fidl::encoding::Encode<RemoteServiceWriteDescriptorRequest, D> for (T0, T1, T2)
2523 {
2524 #[inline]
2525 unsafe fn encode(
2526 self,
2527 encoder: &mut fidl::encoding::Encoder<'_, D>,
2528 offset: usize,
2529 depth: fidl::encoding::Depth,
2530 ) -> fidl::Result<()> {
2531 encoder.debug_check_bounds::<RemoteServiceWriteDescriptorRequest>(offset);
2532 self.0.encode(encoder, offset + 0, depth)?;
2536 self.1.encode(encoder, offset + 8, depth)?;
2537 self.2.encode(encoder, offset + 24, depth)?;
2538 Ok(())
2539 }
2540 }
2541
2542 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2543 for RemoteServiceWriteDescriptorRequest
2544 {
2545 #[inline(always)]
2546 fn new_empty() -> Self {
2547 Self {
2548 handle: fidl::new_empty!(Handle, D),
2549 value: fidl::new_empty!(fidl::encoding::Vector<u8, 512>, D),
2550 options: fidl::new_empty!(WriteOptions, D),
2551 }
2552 }
2553
2554 #[inline]
2555 unsafe fn decode(
2556 &mut self,
2557 decoder: &mut fidl::encoding::Decoder<'_, D>,
2558 offset: usize,
2559 _depth: fidl::encoding::Depth,
2560 ) -> fidl::Result<()> {
2561 decoder.debug_check_bounds::<Self>(offset);
2562 fidl::decode!(Handle, D, &mut self.handle, decoder, offset + 0, _depth)?;
2564 fidl::decode!(fidl::encoding::Vector<u8, 512>, D, &mut self.value, decoder, offset + 8, _depth)?;
2565 fidl::decode!(WriteOptions, D, &mut self.options, decoder, offset + 24, _depth)?;
2566 Ok(())
2567 }
2568 }
2569
2570 impl fidl::encoding::ValueTypeMarker for RemoteServiceReadByTypeResponse {
2571 type Borrowed<'a> = &'a Self;
2572 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2573 value
2574 }
2575 }
2576
2577 unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadByTypeResponse {
2578 type Owned = Self;
2579
2580 #[inline(always)]
2581 fn inline_align(_context: fidl::encoding::Context) -> usize {
2582 8
2583 }
2584
2585 #[inline(always)]
2586 fn inline_size(_context: fidl::encoding::Context) -> usize {
2587 16
2588 }
2589 }
2590
2591 unsafe impl<D: fidl::encoding::ResourceDialect>
2592 fidl::encoding::Encode<RemoteServiceReadByTypeResponse, D>
2593 for &RemoteServiceReadByTypeResponse
2594 {
2595 #[inline]
2596 unsafe fn encode(
2597 self,
2598 encoder: &mut fidl::encoding::Encoder<'_, D>,
2599 offset: usize,
2600 _depth: fidl::encoding::Depth,
2601 ) -> fidl::Result<()> {
2602 encoder.debug_check_bounds::<RemoteServiceReadByTypeResponse>(offset);
2603 fidl::encoding::Encode::<RemoteServiceReadByTypeResponse, D>::encode(
2605 (
2606 <fidl::encoding::Vector<ReadByTypeResult, 65535> as fidl::encoding::ValueTypeMarker>::borrow(&self.results),
2607 ),
2608 encoder, offset, _depth
2609 )
2610 }
2611 }
2612 unsafe impl<
2613 D: fidl::encoding::ResourceDialect,
2614 T0: fidl::encoding::Encode<fidl::encoding::Vector<ReadByTypeResult, 65535>, D>,
2615 > fidl::encoding::Encode<RemoteServiceReadByTypeResponse, D> for (T0,)
2616 {
2617 #[inline]
2618 unsafe fn encode(
2619 self,
2620 encoder: &mut fidl::encoding::Encoder<'_, D>,
2621 offset: usize,
2622 depth: fidl::encoding::Depth,
2623 ) -> fidl::Result<()> {
2624 encoder.debug_check_bounds::<RemoteServiceReadByTypeResponse>(offset);
2625 self.0.encode(encoder, offset + 0, depth)?;
2629 Ok(())
2630 }
2631 }
2632
2633 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2634 for RemoteServiceReadByTypeResponse
2635 {
2636 #[inline(always)]
2637 fn new_empty() -> Self {
2638 Self { results: fidl::new_empty!(fidl::encoding::Vector<ReadByTypeResult, 65535>, D) }
2639 }
2640
2641 #[inline]
2642 unsafe fn decode(
2643 &mut self,
2644 decoder: &mut fidl::encoding::Decoder<'_, D>,
2645 offset: usize,
2646 _depth: fidl::encoding::Depth,
2647 ) -> fidl::Result<()> {
2648 decoder.debug_check_bounds::<Self>(offset);
2649 fidl::decode!(fidl::encoding::Vector<ReadByTypeResult, 65535>, D, &mut self.results, decoder, offset + 0, _depth)?;
2651 Ok(())
2652 }
2653 }
2654
2655 impl fidl::encoding::ValueTypeMarker for RemoteServiceReadCharacteristicResponse {
2656 type Borrowed<'a> = &'a Self;
2657 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2658 value
2659 }
2660 }
2661
2662 unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadCharacteristicResponse {
2663 type Owned = Self;
2664
2665 #[inline(always)]
2666 fn inline_align(_context: fidl::encoding::Context) -> usize {
2667 8
2668 }
2669
2670 #[inline(always)]
2671 fn inline_size(_context: fidl::encoding::Context) -> usize {
2672 16
2673 }
2674 }
2675
2676 unsafe impl<D: fidl::encoding::ResourceDialect>
2677 fidl::encoding::Encode<RemoteServiceReadCharacteristicResponse, D>
2678 for &RemoteServiceReadCharacteristicResponse
2679 {
2680 #[inline]
2681 unsafe fn encode(
2682 self,
2683 encoder: &mut fidl::encoding::Encoder<'_, D>,
2684 offset: usize,
2685 _depth: fidl::encoding::Depth,
2686 ) -> fidl::Result<()> {
2687 encoder.debug_check_bounds::<RemoteServiceReadCharacteristicResponse>(offset);
2688 fidl::encoding::Encode::<RemoteServiceReadCharacteristicResponse, D>::encode(
2690 (<ReadValue as fidl::encoding::ValueTypeMarker>::borrow(&self.value),),
2691 encoder,
2692 offset,
2693 _depth,
2694 )
2695 }
2696 }
2697 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<ReadValue, D>>
2698 fidl::encoding::Encode<RemoteServiceReadCharacteristicResponse, D> for (T0,)
2699 {
2700 #[inline]
2701 unsafe fn encode(
2702 self,
2703 encoder: &mut fidl::encoding::Encoder<'_, D>,
2704 offset: usize,
2705 depth: fidl::encoding::Depth,
2706 ) -> fidl::Result<()> {
2707 encoder.debug_check_bounds::<RemoteServiceReadCharacteristicResponse>(offset);
2708 self.0.encode(encoder, offset + 0, depth)?;
2712 Ok(())
2713 }
2714 }
2715
2716 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2717 for RemoteServiceReadCharacteristicResponse
2718 {
2719 #[inline(always)]
2720 fn new_empty() -> Self {
2721 Self { value: fidl::new_empty!(ReadValue, D) }
2722 }
2723
2724 #[inline]
2725 unsafe fn decode(
2726 &mut self,
2727 decoder: &mut fidl::encoding::Decoder<'_, D>,
2728 offset: usize,
2729 _depth: fidl::encoding::Depth,
2730 ) -> fidl::Result<()> {
2731 decoder.debug_check_bounds::<Self>(offset);
2732 fidl::decode!(ReadValue, D, &mut self.value, decoder, offset + 0, _depth)?;
2734 Ok(())
2735 }
2736 }
2737
2738 impl fidl::encoding::ValueTypeMarker for RemoteServiceReadDescriptorResponse {
2739 type Borrowed<'a> = &'a Self;
2740 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2741 value
2742 }
2743 }
2744
2745 unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadDescriptorResponse {
2746 type Owned = Self;
2747
2748 #[inline(always)]
2749 fn inline_align(_context: fidl::encoding::Context) -> usize {
2750 8
2751 }
2752
2753 #[inline(always)]
2754 fn inline_size(_context: fidl::encoding::Context) -> usize {
2755 16
2756 }
2757 }
2758
2759 unsafe impl<D: fidl::encoding::ResourceDialect>
2760 fidl::encoding::Encode<RemoteServiceReadDescriptorResponse, D>
2761 for &RemoteServiceReadDescriptorResponse
2762 {
2763 #[inline]
2764 unsafe fn encode(
2765 self,
2766 encoder: &mut fidl::encoding::Encoder<'_, D>,
2767 offset: usize,
2768 _depth: fidl::encoding::Depth,
2769 ) -> fidl::Result<()> {
2770 encoder.debug_check_bounds::<RemoteServiceReadDescriptorResponse>(offset);
2771 fidl::encoding::Encode::<RemoteServiceReadDescriptorResponse, D>::encode(
2773 (<ReadValue as fidl::encoding::ValueTypeMarker>::borrow(&self.value),),
2774 encoder,
2775 offset,
2776 _depth,
2777 )
2778 }
2779 }
2780 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<ReadValue, D>>
2781 fidl::encoding::Encode<RemoteServiceReadDescriptorResponse, D> for (T0,)
2782 {
2783 #[inline]
2784 unsafe fn encode(
2785 self,
2786 encoder: &mut fidl::encoding::Encoder<'_, D>,
2787 offset: usize,
2788 depth: fidl::encoding::Depth,
2789 ) -> fidl::Result<()> {
2790 encoder.debug_check_bounds::<RemoteServiceReadDescriptorResponse>(offset);
2791 self.0.encode(encoder, offset + 0, depth)?;
2795 Ok(())
2796 }
2797 }
2798
2799 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2800 for RemoteServiceReadDescriptorResponse
2801 {
2802 #[inline(always)]
2803 fn new_empty() -> Self {
2804 Self { value: fidl::new_empty!(ReadValue, D) }
2805 }
2806
2807 #[inline]
2808 unsafe fn decode(
2809 &mut self,
2810 decoder: &mut fidl::encoding::Decoder<'_, D>,
2811 offset: usize,
2812 _depth: fidl::encoding::Depth,
2813 ) -> fidl::Result<()> {
2814 decoder.debug_check_bounds::<Self>(offset);
2815 fidl::decode!(ReadValue, D, &mut self.value, decoder, offset + 0, _depth)?;
2817 Ok(())
2818 }
2819 }
2820
2821 impl fidl::encoding::ValueTypeMarker for ServiceHandle {
2822 type Borrowed<'a> = &'a Self;
2823 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2824 value
2825 }
2826 }
2827
2828 unsafe impl fidl::encoding::TypeMarker for ServiceHandle {
2829 type Owned = Self;
2830
2831 #[inline(always)]
2832 fn inline_align(_context: fidl::encoding::Context) -> usize {
2833 8
2834 }
2835
2836 #[inline(always)]
2837 fn inline_size(_context: fidl::encoding::Context) -> usize {
2838 8
2839 }
2840 #[inline(always)]
2841 fn encode_is_copy() -> bool {
2842 true
2843 }
2844
2845 #[inline(always)]
2846 fn decode_is_copy() -> bool {
2847 true
2848 }
2849 }
2850
2851 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ServiceHandle, D>
2852 for &ServiceHandle
2853 {
2854 #[inline]
2855 unsafe fn encode(
2856 self,
2857 encoder: &mut fidl::encoding::Encoder<'_, D>,
2858 offset: usize,
2859 _depth: fidl::encoding::Depth,
2860 ) -> fidl::Result<()> {
2861 encoder.debug_check_bounds::<ServiceHandle>(offset);
2862 unsafe {
2863 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2865 (buf_ptr as *mut ServiceHandle)
2866 .write_unaligned((self as *const ServiceHandle).read());
2867 }
2870 Ok(())
2871 }
2872 }
2873 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
2874 fidl::encoding::Encode<ServiceHandle, D> for (T0,)
2875 {
2876 #[inline]
2877 unsafe fn encode(
2878 self,
2879 encoder: &mut fidl::encoding::Encoder<'_, D>,
2880 offset: usize,
2881 depth: fidl::encoding::Depth,
2882 ) -> fidl::Result<()> {
2883 encoder.debug_check_bounds::<ServiceHandle>(offset);
2884 self.0.encode(encoder, offset + 0, depth)?;
2888 Ok(())
2889 }
2890 }
2891
2892 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ServiceHandle {
2893 #[inline(always)]
2894 fn new_empty() -> Self {
2895 Self { value: fidl::new_empty!(u64, D) }
2896 }
2897
2898 #[inline]
2899 unsafe fn decode(
2900 &mut self,
2901 decoder: &mut fidl::encoding::Decoder<'_, D>,
2902 offset: usize,
2903 _depth: fidl::encoding::Depth,
2904 ) -> fidl::Result<()> {
2905 decoder.debug_check_bounds::<Self>(offset);
2906 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2907 unsafe {
2910 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
2911 }
2912 Ok(())
2913 }
2914 }
2915
2916 impl fidl::encoding::ValueTypeMarker for ShortReadOptions {
2917 type Borrowed<'a> = &'a Self;
2918 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2919 value
2920 }
2921 }
2922
2923 unsafe impl fidl::encoding::TypeMarker for ShortReadOptions {
2924 type Owned = Self;
2925
2926 #[inline(always)]
2927 fn inline_align(_context: fidl::encoding::Context) -> usize {
2928 1
2929 }
2930
2931 #[inline(always)]
2932 fn inline_size(_context: fidl::encoding::Context) -> usize {
2933 1
2934 }
2935 }
2936
2937 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ShortReadOptions, D>
2938 for &ShortReadOptions
2939 {
2940 #[inline]
2941 unsafe fn encode(
2942 self,
2943 encoder: &mut fidl::encoding::Encoder<'_, D>,
2944 offset: usize,
2945 _depth: fidl::encoding::Depth,
2946 ) -> fidl::Result<()> {
2947 encoder.debug_check_bounds::<ShortReadOptions>(offset);
2948 encoder.write_num(0u8, offset);
2949 Ok(())
2950 }
2951 }
2952
2953 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ShortReadOptions {
2954 #[inline(always)]
2955 fn new_empty() -> Self {
2956 Self
2957 }
2958
2959 #[inline]
2960 unsafe fn decode(
2961 &mut self,
2962 decoder: &mut fidl::encoding::Decoder<'_, D>,
2963 offset: usize,
2964 _depth: fidl::encoding::Depth,
2965 ) -> fidl::Result<()> {
2966 decoder.debug_check_bounds::<Self>(offset);
2967 match decoder.read_num::<u8>(offset) {
2968 0 => Ok(()),
2969 _ => Err(fidl::Error::Invalid),
2970 }
2971 }
2972 }
2973
2974 impl AttributePermissions {
2975 #[inline(always)]
2976 fn max_ordinal_present(&self) -> u64 {
2977 if let Some(_) = self.update {
2978 return 3;
2979 }
2980 if let Some(_) = self.write {
2981 return 2;
2982 }
2983 if let Some(_) = self.read {
2984 return 1;
2985 }
2986 0
2987 }
2988 }
2989
2990 impl fidl::encoding::ValueTypeMarker for AttributePermissions {
2991 type Borrowed<'a> = &'a Self;
2992 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2993 value
2994 }
2995 }
2996
2997 unsafe impl fidl::encoding::TypeMarker for AttributePermissions {
2998 type Owned = Self;
2999
3000 #[inline(always)]
3001 fn inline_align(_context: fidl::encoding::Context) -> usize {
3002 8
3003 }
3004
3005 #[inline(always)]
3006 fn inline_size(_context: fidl::encoding::Context) -> usize {
3007 16
3008 }
3009 }
3010
3011 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AttributePermissions, D>
3012 for &AttributePermissions
3013 {
3014 unsafe fn encode(
3015 self,
3016 encoder: &mut fidl::encoding::Encoder<'_, D>,
3017 offset: usize,
3018 mut depth: fidl::encoding::Depth,
3019 ) -> fidl::Result<()> {
3020 encoder.debug_check_bounds::<AttributePermissions>(offset);
3021 let max_ordinal: u64 = self.max_ordinal_present();
3023 encoder.write_num(max_ordinal, offset);
3024 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3025 if max_ordinal == 0 {
3027 return Ok(());
3028 }
3029 depth.increment()?;
3030 let envelope_size = 8;
3031 let bytes_len = max_ordinal as usize * envelope_size;
3032 #[allow(unused_variables)]
3033 let offset = encoder.out_of_line_offset(bytes_len);
3034 let mut _prev_end_offset: usize = 0;
3035 if 1 > max_ordinal {
3036 return Ok(());
3037 }
3038
3039 let cur_offset: usize = (1 - 1) * envelope_size;
3042
3043 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3045
3046 fidl::encoding::encode_in_envelope_optional::<SecurityRequirements, D>(
3051 self.read
3052 .as_ref()
3053 .map(<SecurityRequirements as fidl::encoding::ValueTypeMarker>::borrow),
3054 encoder,
3055 offset + cur_offset,
3056 depth,
3057 )?;
3058
3059 _prev_end_offset = cur_offset + envelope_size;
3060 if 2 > max_ordinal {
3061 return Ok(());
3062 }
3063
3064 let cur_offset: usize = (2 - 1) * envelope_size;
3067
3068 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3070
3071 fidl::encoding::encode_in_envelope_optional::<SecurityRequirements, D>(
3076 self.write
3077 .as_ref()
3078 .map(<SecurityRequirements as fidl::encoding::ValueTypeMarker>::borrow),
3079 encoder,
3080 offset + cur_offset,
3081 depth,
3082 )?;
3083
3084 _prev_end_offset = cur_offset + envelope_size;
3085 if 3 > max_ordinal {
3086 return Ok(());
3087 }
3088
3089 let cur_offset: usize = (3 - 1) * envelope_size;
3092
3093 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3095
3096 fidl::encoding::encode_in_envelope_optional::<SecurityRequirements, D>(
3101 self.update
3102 .as_ref()
3103 .map(<SecurityRequirements as fidl::encoding::ValueTypeMarker>::borrow),
3104 encoder,
3105 offset + cur_offset,
3106 depth,
3107 )?;
3108
3109 _prev_end_offset = cur_offset + envelope_size;
3110
3111 Ok(())
3112 }
3113 }
3114
3115 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AttributePermissions {
3116 #[inline(always)]
3117 fn new_empty() -> Self {
3118 Self::default()
3119 }
3120
3121 unsafe fn decode(
3122 &mut self,
3123 decoder: &mut fidl::encoding::Decoder<'_, D>,
3124 offset: usize,
3125 mut depth: fidl::encoding::Depth,
3126 ) -> fidl::Result<()> {
3127 decoder.debug_check_bounds::<Self>(offset);
3128 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3129 None => return Err(fidl::Error::NotNullable),
3130 Some(len) => len,
3131 };
3132 if len == 0 {
3134 return Ok(());
3135 };
3136 depth.increment()?;
3137 let envelope_size = 8;
3138 let bytes_len = len * envelope_size;
3139 let offset = decoder.out_of_line_offset(bytes_len)?;
3140 let mut _next_ordinal_to_read = 0;
3142 let mut next_offset = offset;
3143 let end_offset = offset + bytes_len;
3144 _next_ordinal_to_read += 1;
3145 if next_offset >= end_offset {
3146 return Ok(());
3147 }
3148
3149 while _next_ordinal_to_read < 1 {
3151 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3152 _next_ordinal_to_read += 1;
3153 next_offset += envelope_size;
3154 }
3155
3156 let next_out_of_line = decoder.next_out_of_line();
3157 let handles_before = decoder.remaining_handles();
3158 if let Some((inlined, num_bytes, num_handles)) =
3159 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3160 {
3161 let member_inline_size =
3162 <SecurityRequirements as fidl::encoding::TypeMarker>::inline_size(
3163 decoder.context,
3164 );
3165 if inlined != (member_inline_size <= 4) {
3166 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3167 }
3168 let inner_offset;
3169 let mut inner_depth = depth.clone();
3170 if inlined {
3171 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3172 inner_offset = next_offset;
3173 } else {
3174 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3175 inner_depth.increment()?;
3176 }
3177 let val_ref =
3178 self.read.get_or_insert_with(|| fidl::new_empty!(SecurityRequirements, D));
3179 fidl::decode!(
3180 SecurityRequirements,
3181 D,
3182 val_ref,
3183 decoder,
3184 inner_offset,
3185 inner_depth
3186 )?;
3187 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3188 {
3189 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3190 }
3191 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3192 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3193 }
3194 }
3195
3196 next_offset += envelope_size;
3197 _next_ordinal_to_read += 1;
3198 if next_offset >= end_offset {
3199 return Ok(());
3200 }
3201
3202 while _next_ordinal_to_read < 2 {
3204 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3205 _next_ordinal_to_read += 1;
3206 next_offset += envelope_size;
3207 }
3208
3209 let next_out_of_line = decoder.next_out_of_line();
3210 let handles_before = decoder.remaining_handles();
3211 if let Some((inlined, num_bytes, num_handles)) =
3212 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3213 {
3214 let member_inline_size =
3215 <SecurityRequirements as fidl::encoding::TypeMarker>::inline_size(
3216 decoder.context,
3217 );
3218 if inlined != (member_inline_size <= 4) {
3219 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3220 }
3221 let inner_offset;
3222 let mut inner_depth = depth.clone();
3223 if inlined {
3224 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3225 inner_offset = next_offset;
3226 } else {
3227 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3228 inner_depth.increment()?;
3229 }
3230 let val_ref =
3231 self.write.get_or_insert_with(|| fidl::new_empty!(SecurityRequirements, D));
3232 fidl::decode!(
3233 SecurityRequirements,
3234 D,
3235 val_ref,
3236 decoder,
3237 inner_offset,
3238 inner_depth
3239 )?;
3240 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3241 {
3242 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3243 }
3244 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3245 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3246 }
3247 }
3248
3249 next_offset += envelope_size;
3250 _next_ordinal_to_read += 1;
3251 if next_offset >= end_offset {
3252 return Ok(());
3253 }
3254
3255 while _next_ordinal_to_read < 3 {
3257 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3258 _next_ordinal_to_read += 1;
3259 next_offset += envelope_size;
3260 }
3261
3262 let next_out_of_line = decoder.next_out_of_line();
3263 let handles_before = decoder.remaining_handles();
3264 if let Some((inlined, num_bytes, num_handles)) =
3265 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3266 {
3267 let member_inline_size =
3268 <SecurityRequirements as fidl::encoding::TypeMarker>::inline_size(
3269 decoder.context,
3270 );
3271 if inlined != (member_inline_size <= 4) {
3272 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3273 }
3274 let inner_offset;
3275 let mut inner_depth = depth.clone();
3276 if inlined {
3277 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3278 inner_offset = next_offset;
3279 } else {
3280 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3281 inner_depth.increment()?;
3282 }
3283 let val_ref =
3284 self.update.get_or_insert_with(|| fidl::new_empty!(SecurityRequirements, D));
3285 fidl::decode!(
3286 SecurityRequirements,
3287 D,
3288 val_ref,
3289 decoder,
3290 inner_offset,
3291 inner_depth
3292 )?;
3293 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3294 {
3295 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3296 }
3297 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3298 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3299 }
3300 }
3301
3302 next_offset += envelope_size;
3303
3304 while next_offset < end_offset {
3306 _next_ordinal_to_read += 1;
3307 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3308 next_offset += envelope_size;
3309 }
3310
3311 Ok(())
3312 }
3313 }
3314
3315 impl Characteristic {
3316 #[inline(always)]
3317 fn max_ordinal_present(&self) -> u64 {
3318 if let Some(_) = self.descriptors {
3319 return 5;
3320 }
3321 if let Some(_) = self.permissions {
3322 return 4;
3323 }
3324 if let Some(_) = self.properties {
3325 return 3;
3326 }
3327 if let Some(_) = self.type_ {
3328 return 2;
3329 }
3330 if let Some(_) = self.handle {
3331 return 1;
3332 }
3333 0
3334 }
3335 }
3336
3337 impl fidl::encoding::ValueTypeMarker for Characteristic {
3338 type Borrowed<'a> = &'a Self;
3339 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3340 value
3341 }
3342 }
3343
3344 unsafe impl fidl::encoding::TypeMarker for Characteristic {
3345 type Owned = Self;
3346
3347 #[inline(always)]
3348 fn inline_align(_context: fidl::encoding::Context) -> usize {
3349 8
3350 }
3351
3352 #[inline(always)]
3353 fn inline_size(_context: fidl::encoding::Context) -> usize {
3354 16
3355 }
3356 }
3357
3358 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Characteristic, D>
3359 for &Characteristic
3360 {
3361 unsafe fn encode(
3362 self,
3363 encoder: &mut fidl::encoding::Encoder<'_, D>,
3364 offset: usize,
3365 mut depth: fidl::encoding::Depth,
3366 ) -> fidl::Result<()> {
3367 encoder.debug_check_bounds::<Characteristic>(offset);
3368 let max_ordinal: u64 = self.max_ordinal_present();
3370 encoder.write_num(max_ordinal, offset);
3371 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3372 if max_ordinal == 0 {
3374 return Ok(());
3375 }
3376 depth.increment()?;
3377 let envelope_size = 8;
3378 let bytes_len = max_ordinal as usize * envelope_size;
3379 #[allow(unused_variables)]
3380 let offset = encoder.out_of_line_offset(bytes_len);
3381 let mut _prev_end_offset: usize = 0;
3382 if 1 > max_ordinal {
3383 return Ok(());
3384 }
3385
3386 let cur_offset: usize = (1 - 1) * envelope_size;
3389
3390 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3392
3393 fidl::encoding::encode_in_envelope_optional::<Handle, D>(
3398 self.handle.as_ref().map(<Handle as fidl::encoding::ValueTypeMarker>::borrow),
3399 encoder,
3400 offset + cur_offset,
3401 depth,
3402 )?;
3403
3404 _prev_end_offset = cur_offset + envelope_size;
3405 if 2 > max_ordinal {
3406 return Ok(());
3407 }
3408
3409 let cur_offset: usize = (2 - 1) * envelope_size;
3412
3413 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3415
3416 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::Uuid, D>(
3421 self.type_
3422 .as_ref()
3423 .map(<fidl_fuchsia_bluetooth::Uuid as fidl::encoding::ValueTypeMarker>::borrow),
3424 encoder,
3425 offset + cur_offset,
3426 depth,
3427 )?;
3428
3429 _prev_end_offset = cur_offset + envelope_size;
3430 if 3 > max_ordinal {
3431 return Ok(());
3432 }
3433
3434 let cur_offset: usize = (3 - 1) * envelope_size;
3437
3438 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3440
3441 fidl::encoding::encode_in_envelope_optional::<CharacteristicPropertyBits, D>(
3446 self.properties
3447 .as_ref()
3448 .map(<CharacteristicPropertyBits as fidl::encoding::ValueTypeMarker>::borrow),
3449 encoder,
3450 offset + cur_offset,
3451 depth,
3452 )?;
3453
3454 _prev_end_offset = cur_offset + envelope_size;
3455 if 4 > max_ordinal {
3456 return Ok(());
3457 }
3458
3459 let cur_offset: usize = (4 - 1) * envelope_size;
3462
3463 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3465
3466 fidl::encoding::encode_in_envelope_optional::<AttributePermissions, D>(
3471 self.permissions
3472 .as_ref()
3473 .map(<AttributePermissions as fidl::encoding::ValueTypeMarker>::borrow),
3474 encoder,
3475 offset + cur_offset,
3476 depth,
3477 )?;
3478
3479 _prev_end_offset = cur_offset + envelope_size;
3480 if 5 > max_ordinal {
3481 return Ok(());
3482 }
3483
3484 let cur_offset: usize = (5 - 1) * envelope_size;
3487
3488 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3490
3491 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<Descriptor, 65532>, D>(
3496 self.descriptors.as_ref().map(<fidl::encoding::Vector<Descriptor, 65532> as fidl::encoding::ValueTypeMarker>::borrow),
3497 encoder, offset + cur_offset, depth
3498 )?;
3499
3500 _prev_end_offset = cur_offset + envelope_size;
3501
3502 Ok(())
3503 }
3504 }
3505
3506 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Characteristic {
3507 #[inline(always)]
3508 fn new_empty() -> Self {
3509 Self::default()
3510 }
3511
3512 unsafe fn decode(
3513 &mut self,
3514 decoder: &mut fidl::encoding::Decoder<'_, D>,
3515 offset: usize,
3516 mut depth: fidl::encoding::Depth,
3517 ) -> fidl::Result<()> {
3518 decoder.debug_check_bounds::<Self>(offset);
3519 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3520 None => return Err(fidl::Error::NotNullable),
3521 Some(len) => len,
3522 };
3523 if len == 0 {
3525 return Ok(());
3526 };
3527 depth.increment()?;
3528 let envelope_size = 8;
3529 let bytes_len = len * envelope_size;
3530 let offset = decoder.out_of_line_offset(bytes_len)?;
3531 let mut _next_ordinal_to_read = 0;
3533 let mut next_offset = offset;
3534 let end_offset = offset + bytes_len;
3535 _next_ordinal_to_read += 1;
3536 if next_offset >= end_offset {
3537 return Ok(());
3538 }
3539
3540 while _next_ordinal_to_read < 1 {
3542 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3543 _next_ordinal_to_read += 1;
3544 next_offset += envelope_size;
3545 }
3546
3547 let next_out_of_line = decoder.next_out_of_line();
3548 let handles_before = decoder.remaining_handles();
3549 if let Some((inlined, num_bytes, num_handles)) =
3550 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3551 {
3552 let member_inline_size =
3553 <Handle as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3554 if inlined != (member_inline_size <= 4) {
3555 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3556 }
3557 let inner_offset;
3558 let mut inner_depth = depth.clone();
3559 if inlined {
3560 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3561 inner_offset = next_offset;
3562 } else {
3563 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3564 inner_depth.increment()?;
3565 }
3566 let val_ref = self.handle.get_or_insert_with(|| fidl::new_empty!(Handle, D));
3567 fidl::decode!(Handle, D, val_ref, decoder, inner_offset, inner_depth)?;
3568 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3569 {
3570 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3571 }
3572 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3573 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3574 }
3575 }
3576
3577 next_offset += envelope_size;
3578 _next_ordinal_to_read += 1;
3579 if next_offset >= end_offset {
3580 return Ok(());
3581 }
3582
3583 while _next_ordinal_to_read < 2 {
3585 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3586 _next_ordinal_to_read += 1;
3587 next_offset += envelope_size;
3588 }
3589
3590 let next_out_of_line = decoder.next_out_of_line();
3591 let handles_before = decoder.remaining_handles();
3592 if let Some((inlined, num_bytes, num_handles)) =
3593 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3594 {
3595 let member_inline_size =
3596 <fidl_fuchsia_bluetooth::Uuid as fidl::encoding::TypeMarker>::inline_size(
3597 decoder.context,
3598 );
3599 if inlined != (member_inline_size <= 4) {
3600 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3601 }
3602 let inner_offset;
3603 let mut inner_depth = depth.clone();
3604 if inlined {
3605 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3606 inner_offset = next_offset;
3607 } else {
3608 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3609 inner_depth.increment()?;
3610 }
3611 let val_ref = self
3612 .type_
3613 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_bluetooth::Uuid, D));
3614 fidl::decode!(
3615 fidl_fuchsia_bluetooth::Uuid,
3616 D,
3617 val_ref,
3618 decoder,
3619 inner_offset,
3620 inner_depth
3621 )?;
3622 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3623 {
3624 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3625 }
3626 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3627 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3628 }
3629 }
3630
3631 next_offset += envelope_size;
3632 _next_ordinal_to_read += 1;
3633 if next_offset >= end_offset {
3634 return Ok(());
3635 }
3636
3637 while _next_ordinal_to_read < 3 {
3639 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3640 _next_ordinal_to_read += 1;
3641 next_offset += envelope_size;
3642 }
3643
3644 let next_out_of_line = decoder.next_out_of_line();
3645 let handles_before = decoder.remaining_handles();
3646 if let Some((inlined, num_bytes, num_handles)) =
3647 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3648 {
3649 let member_inline_size =
3650 <CharacteristicPropertyBits as fidl::encoding::TypeMarker>::inline_size(
3651 decoder.context,
3652 );
3653 if inlined != (member_inline_size <= 4) {
3654 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3655 }
3656 let inner_offset;
3657 let mut inner_depth = depth.clone();
3658 if inlined {
3659 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3660 inner_offset = next_offset;
3661 } else {
3662 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3663 inner_depth.increment()?;
3664 }
3665 let val_ref = self
3666 .properties
3667 .get_or_insert_with(|| fidl::new_empty!(CharacteristicPropertyBits, D));
3668 fidl::decode!(
3669 CharacteristicPropertyBits,
3670 D,
3671 val_ref,
3672 decoder,
3673 inner_offset,
3674 inner_depth
3675 )?;
3676 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3677 {
3678 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3679 }
3680 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3681 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3682 }
3683 }
3684
3685 next_offset += envelope_size;
3686 _next_ordinal_to_read += 1;
3687 if next_offset >= end_offset {
3688 return Ok(());
3689 }
3690
3691 while _next_ordinal_to_read < 4 {
3693 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3694 _next_ordinal_to_read += 1;
3695 next_offset += envelope_size;
3696 }
3697
3698 let next_out_of_line = decoder.next_out_of_line();
3699 let handles_before = decoder.remaining_handles();
3700 if let Some((inlined, num_bytes, num_handles)) =
3701 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3702 {
3703 let member_inline_size =
3704 <AttributePermissions as fidl::encoding::TypeMarker>::inline_size(
3705 decoder.context,
3706 );
3707 if inlined != (member_inline_size <= 4) {
3708 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3709 }
3710 let inner_offset;
3711 let mut inner_depth = depth.clone();
3712 if inlined {
3713 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3714 inner_offset = next_offset;
3715 } else {
3716 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3717 inner_depth.increment()?;
3718 }
3719 let val_ref = self
3720 .permissions
3721 .get_or_insert_with(|| fidl::new_empty!(AttributePermissions, D));
3722 fidl::decode!(
3723 AttributePermissions,
3724 D,
3725 val_ref,
3726 decoder,
3727 inner_offset,
3728 inner_depth
3729 )?;
3730 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3731 {
3732 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3733 }
3734 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3735 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3736 }
3737 }
3738
3739 next_offset += envelope_size;
3740 _next_ordinal_to_read += 1;
3741 if next_offset >= end_offset {
3742 return Ok(());
3743 }
3744
3745 while _next_ordinal_to_read < 5 {
3747 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3748 _next_ordinal_to_read += 1;
3749 next_offset += envelope_size;
3750 }
3751
3752 let next_out_of_line = decoder.next_out_of_line();
3753 let handles_before = decoder.remaining_handles();
3754 if let Some((inlined, num_bytes, num_handles)) =
3755 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3756 {
3757 let member_inline_size = <fidl::encoding::Vector<Descriptor, 65532> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3758 if inlined != (member_inline_size <= 4) {
3759 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3760 }
3761 let inner_offset;
3762 let mut inner_depth = depth.clone();
3763 if inlined {
3764 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3765 inner_offset = next_offset;
3766 } else {
3767 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3768 inner_depth.increment()?;
3769 }
3770 let val_ref = self.descriptors.get_or_insert_with(
3771 || fidl::new_empty!(fidl::encoding::Vector<Descriptor, 65532>, D),
3772 );
3773 fidl::decode!(fidl::encoding::Vector<Descriptor, 65532>, D, val_ref, decoder, inner_offset, inner_depth)?;
3774 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3775 {
3776 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3777 }
3778 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3779 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3780 }
3781 }
3782
3783 next_offset += envelope_size;
3784
3785 while next_offset < end_offset {
3787 _next_ordinal_to_read += 1;
3788 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3789 next_offset += envelope_size;
3790 }
3791
3792 Ok(())
3793 }
3794 }
3795
3796 impl Descriptor {
3797 #[inline(always)]
3798 fn max_ordinal_present(&self) -> u64 {
3799 if let Some(_) = self.permissions {
3800 return 3;
3801 }
3802 if let Some(_) = self.type_ {
3803 return 2;
3804 }
3805 if let Some(_) = self.handle {
3806 return 1;
3807 }
3808 0
3809 }
3810 }
3811
3812 impl fidl::encoding::ValueTypeMarker for Descriptor {
3813 type Borrowed<'a> = &'a Self;
3814 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3815 value
3816 }
3817 }
3818
3819 unsafe impl fidl::encoding::TypeMarker for Descriptor {
3820 type Owned = Self;
3821
3822 #[inline(always)]
3823 fn inline_align(_context: fidl::encoding::Context) -> usize {
3824 8
3825 }
3826
3827 #[inline(always)]
3828 fn inline_size(_context: fidl::encoding::Context) -> usize {
3829 16
3830 }
3831 }
3832
3833 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Descriptor, D>
3834 for &Descriptor
3835 {
3836 unsafe fn encode(
3837 self,
3838 encoder: &mut fidl::encoding::Encoder<'_, D>,
3839 offset: usize,
3840 mut depth: fidl::encoding::Depth,
3841 ) -> fidl::Result<()> {
3842 encoder.debug_check_bounds::<Descriptor>(offset);
3843 let max_ordinal: u64 = self.max_ordinal_present();
3845 encoder.write_num(max_ordinal, offset);
3846 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3847 if max_ordinal == 0 {
3849 return Ok(());
3850 }
3851 depth.increment()?;
3852 let envelope_size = 8;
3853 let bytes_len = max_ordinal as usize * envelope_size;
3854 #[allow(unused_variables)]
3855 let offset = encoder.out_of_line_offset(bytes_len);
3856 let mut _prev_end_offset: usize = 0;
3857 if 1 > max_ordinal {
3858 return Ok(());
3859 }
3860
3861 let cur_offset: usize = (1 - 1) * envelope_size;
3864
3865 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3867
3868 fidl::encoding::encode_in_envelope_optional::<Handle, D>(
3873 self.handle.as_ref().map(<Handle as fidl::encoding::ValueTypeMarker>::borrow),
3874 encoder,
3875 offset + cur_offset,
3876 depth,
3877 )?;
3878
3879 _prev_end_offset = cur_offset + envelope_size;
3880 if 2 > max_ordinal {
3881 return Ok(());
3882 }
3883
3884 let cur_offset: usize = (2 - 1) * envelope_size;
3887
3888 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3890
3891 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::Uuid, D>(
3896 self.type_
3897 .as_ref()
3898 .map(<fidl_fuchsia_bluetooth::Uuid as fidl::encoding::ValueTypeMarker>::borrow),
3899 encoder,
3900 offset + cur_offset,
3901 depth,
3902 )?;
3903
3904 _prev_end_offset = cur_offset + envelope_size;
3905 if 3 > max_ordinal {
3906 return Ok(());
3907 }
3908
3909 let cur_offset: usize = (3 - 1) * envelope_size;
3912
3913 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3915
3916 fidl::encoding::encode_in_envelope_optional::<AttributePermissions, D>(
3921 self.permissions
3922 .as_ref()
3923 .map(<AttributePermissions as fidl::encoding::ValueTypeMarker>::borrow),
3924 encoder,
3925 offset + cur_offset,
3926 depth,
3927 )?;
3928
3929 _prev_end_offset = cur_offset + envelope_size;
3930
3931 Ok(())
3932 }
3933 }
3934
3935 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Descriptor {
3936 #[inline(always)]
3937 fn new_empty() -> Self {
3938 Self::default()
3939 }
3940
3941 unsafe fn decode(
3942 &mut self,
3943 decoder: &mut fidl::encoding::Decoder<'_, D>,
3944 offset: usize,
3945 mut depth: fidl::encoding::Depth,
3946 ) -> fidl::Result<()> {
3947 decoder.debug_check_bounds::<Self>(offset);
3948 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3949 None => return Err(fidl::Error::NotNullable),
3950 Some(len) => len,
3951 };
3952 if len == 0 {
3954 return Ok(());
3955 };
3956 depth.increment()?;
3957 let envelope_size = 8;
3958 let bytes_len = len * envelope_size;
3959 let offset = decoder.out_of_line_offset(bytes_len)?;
3960 let mut _next_ordinal_to_read = 0;
3962 let mut next_offset = offset;
3963 let end_offset = offset + bytes_len;
3964 _next_ordinal_to_read += 1;
3965 if next_offset >= end_offset {
3966 return Ok(());
3967 }
3968
3969 while _next_ordinal_to_read < 1 {
3971 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3972 _next_ordinal_to_read += 1;
3973 next_offset += envelope_size;
3974 }
3975
3976 let next_out_of_line = decoder.next_out_of_line();
3977 let handles_before = decoder.remaining_handles();
3978 if let Some((inlined, num_bytes, num_handles)) =
3979 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3980 {
3981 let member_inline_size =
3982 <Handle as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3983 if inlined != (member_inline_size <= 4) {
3984 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3985 }
3986 let inner_offset;
3987 let mut inner_depth = depth.clone();
3988 if inlined {
3989 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3990 inner_offset = next_offset;
3991 } else {
3992 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3993 inner_depth.increment()?;
3994 }
3995 let val_ref = self.handle.get_or_insert_with(|| fidl::new_empty!(Handle, D));
3996 fidl::decode!(Handle, D, val_ref, decoder, inner_offset, inner_depth)?;
3997 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3998 {
3999 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4000 }
4001 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4002 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4003 }
4004 }
4005
4006 next_offset += envelope_size;
4007 _next_ordinal_to_read += 1;
4008 if next_offset >= end_offset {
4009 return Ok(());
4010 }
4011
4012 while _next_ordinal_to_read < 2 {
4014 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4015 _next_ordinal_to_read += 1;
4016 next_offset += envelope_size;
4017 }
4018
4019 let next_out_of_line = decoder.next_out_of_line();
4020 let handles_before = decoder.remaining_handles();
4021 if let Some((inlined, num_bytes, num_handles)) =
4022 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4023 {
4024 let member_inline_size =
4025 <fidl_fuchsia_bluetooth::Uuid as fidl::encoding::TypeMarker>::inline_size(
4026 decoder.context,
4027 );
4028 if inlined != (member_inline_size <= 4) {
4029 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4030 }
4031 let inner_offset;
4032 let mut inner_depth = depth.clone();
4033 if inlined {
4034 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4035 inner_offset = next_offset;
4036 } else {
4037 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4038 inner_depth.increment()?;
4039 }
4040 let val_ref = self
4041 .type_
4042 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_bluetooth::Uuid, D));
4043 fidl::decode!(
4044 fidl_fuchsia_bluetooth::Uuid,
4045 D,
4046 val_ref,
4047 decoder,
4048 inner_offset,
4049 inner_depth
4050 )?;
4051 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4052 {
4053 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4054 }
4055 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4056 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4057 }
4058 }
4059
4060 next_offset += envelope_size;
4061 _next_ordinal_to_read += 1;
4062 if next_offset >= end_offset {
4063 return Ok(());
4064 }
4065
4066 while _next_ordinal_to_read < 3 {
4068 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4069 _next_ordinal_to_read += 1;
4070 next_offset += envelope_size;
4071 }
4072
4073 let next_out_of_line = decoder.next_out_of_line();
4074 let handles_before = decoder.remaining_handles();
4075 if let Some((inlined, num_bytes, num_handles)) =
4076 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4077 {
4078 let member_inline_size =
4079 <AttributePermissions as fidl::encoding::TypeMarker>::inline_size(
4080 decoder.context,
4081 );
4082 if inlined != (member_inline_size <= 4) {
4083 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4084 }
4085 let inner_offset;
4086 let mut inner_depth = depth.clone();
4087 if inlined {
4088 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4089 inner_offset = next_offset;
4090 } else {
4091 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4092 inner_depth.increment()?;
4093 }
4094 let val_ref = self
4095 .permissions
4096 .get_or_insert_with(|| fidl::new_empty!(AttributePermissions, D));
4097 fidl::decode!(
4098 AttributePermissions,
4099 D,
4100 val_ref,
4101 decoder,
4102 inner_offset,
4103 inner_depth
4104 )?;
4105 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4106 {
4107 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4108 }
4109 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4110 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4111 }
4112 }
4113
4114 next_offset += envelope_size;
4115
4116 while next_offset < end_offset {
4118 _next_ordinal_to_read += 1;
4119 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4120 next_offset += envelope_size;
4121 }
4122
4123 Ok(())
4124 }
4125 }
4126
4127 impl LocalServicePeerUpdateRequest {
4128 #[inline(always)]
4129 fn max_ordinal_present(&self) -> u64 {
4130 if let Some(_) = self.mtu {
4131 return 2;
4132 }
4133 if let Some(_) = self.peer_id {
4134 return 1;
4135 }
4136 0
4137 }
4138 }
4139
4140 impl fidl::encoding::ValueTypeMarker for LocalServicePeerUpdateRequest {
4141 type Borrowed<'a> = &'a Self;
4142 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4143 value
4144 }
4145 }
4146
4147 unsafe impl fidl::encoding::TypeMarker for LocalServicePeerUpdateRequest {
4148 type Owned = Self;
4149
4150 #[inline(always)]
4151 fn inline_align(_context: fidl::encoding::Context) -> usize {
4152 8
4153 }
4154
4155 #[inline(always)]
4156 fn inline_size(_context: fidl::encoding::Context) -> usize {
4157 16
4158 }
4159 }
4160
4161 unsafe impl<D: fidl::encoding::ResourceDialect>
4162 fidl::encoding::Encode<LocalServicePeerUpdateRequest, D>
4163 for &LocalServicePeerUpdateRequest
4164 {
4165 unsafe fn encode(
4166 self,
4167 encoder: &mut fidl::encoding::Encoder<'_, D>,
4168 offset: usize,
4169 mut depth: fidl::encoding::Depth,
4170 ) -> fidl::Result<()> {
4171 encoder.debug_check_bounds::<LocalServicePeerUpdateRequest>(offset);
4172 let max_ordinal: u64 = self.max_ordinal_present();
4174 encoder.write_num(max_ordinal, offset);
4175 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4176 if max_ordinal == 0 {
4178 return Ok(());
4179 }
4180 depth.increment()?;
4181 let envelope_size = 8;
4182 let bytes_len = max_ordinal as usize * envelope_size;
4183 #[allow(unused_variables)]
4184 let offset = encoder.out_of_line_offset(bytes_len);
4185 let mut _prev_end_offset: usize = 0;
4186 if 1 > max_ordinal {
4187 return Ok(());
4188 }
4189
4190 let cur_offset: usize = (1 - 1) * envelope_size;
4193
4194 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4196
4197 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::PeerId, D>(
4202 self.peer_id.as_ref().map(
4203 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow,
4204 ),
4205 encoder,
4206 offset + cur_offset,
4207 depth,
4208 )?;
4209
4210 _prev_end_offset = cur_offset + envelope_size;
4211 if 2 > max_ordinal {
4212 return Ok(());
4213 }
4214
4215 let cur_offset: usize = (2 - 1) * envelope_size;
4218
4219 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4221
4222 fidl::encoding::encode_in_envelope_optional::<u16, D>(
4227 self.mtu.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
4228 encoder,
4229 offset + cur_offset,
4230 depth,
4231 )?;
4232
4233 _prev_end_offset = cur_offset + envelope_size;
4234
4235 Ok(())
4236 }
4237 }
4238
4239 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4240 for LocalServicePeerUpdateRequest
4241 {
4242 #[inline(always)]
4243 fn new_empty() -> Self {
4244 Self::default()
4245 }
4246
4247 unsafe fn decode(
4248 &mut self,
4249 decoder: &mut fidl::encoding::Decoder<'_, D>,
4250 offset: usize,
4251 mut depth: fidl::encoding::Depth,
4252 ) -> fidl::Result<()> {
4253 decoder.debug_check_bounds::<Self>(offset);
4254 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4255 None => return Err(fidl::Error::NotNullable),
4256 Some(len) => len,
4257 };
4258 if len == 0 {
4260 return Ok(());
4261 };
4262 depth.increment()?;
4263 let envelope_size = 8;
4264 let bytes_len = len * envelope_size;
4265 let offset = decoder.out_of_line_offset(bytes_len)?;
4266 let mut _next_ordinal_to_read = 0;
4268 let mut next_offset = offset;
4269 let end_offset = offset + bytes_len;
4270 _next_ordinal_to_read += 1;
4271 if next_offset >= end_offset {
4272 return Ok(());
4273 }
4274
4275 while _next_ordinal_to_read < 1 {
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 =
4288 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::TypeMarker>::inline_size(
4289 decoder.context,
4290 );
4291 if inlined != (member_inline_size <= 4) {
4292 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4293 }
4294 let inner_offset;
4295 let mut inner_depth = depth.clone();
4296 if inlined {
4297 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4298 inner_offset = next_offset;
4299 } else {
4300 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4301 inner_depth.increment()?;
4302 }
4303 let val_ref = self
4304 .peer_id
4305 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D));
4306 fidl::decode!(
4307 fidl_fuchsia_bluetooth::PeerId,
4308 D,
4309 val_ref,
4310 decoder,
4311 inner_offset,
4312 inner_depth
4313 )?;
4314 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4315 {
4316 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4317 }
4318 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4319 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4320 }
4321 }
4322
4323 next_offset += envelope_size;
4324 _next_ordinal_to_read += 1;
4325 if next_offset >= end_offset {
4326 return Ok(());
4327 }
4328
4329 while _next_ordinal_to_read < 2 {
4331 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4332 _next_ordinal_to_read += 1;
4333 next_offset += envelope_size;
4334 }
4335
4336 let next_out_of_line = decoder.next_out_of_line();
4337 let handles_before = decoder.remaining_handles();
4338 if let Some((inlined, num_bytes, num_handles)) =
4339 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4340 {
4341 let member_inline_size =
4342 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4343 if inlined != (member_inline_size <= 4) {
4344 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4345 }
4346 let inner_offset;
4347 let mut inner_depth = depth.clone();
4348 if inlined {
4349 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4350 inner_offset = next_offset;
4351 } else {
4352 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4353 inner_depth.increment()?;
4354 }
4355 let val_ref = self.mtu.get_or_insert_with(|| fidl::new_empty!(u16, D));
4356 fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
4357 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4358 {
4359 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4360 }
4361 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4362 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4363 }
4364 }
4365
4366 next_offset += envelope_size;
4367
4368 while next_offset < end_offset {
4370 _next_ordinal_to_read += 1;
4371 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4372 next_offset += envelope_size;
4373 }
4374
4375 Ok(())
4376 }
4377 }
4378
4379 impl LocalServiceWriteValueRequest {
4380 #[inline(always)]
4381 fn max_ordinal_present(&self) -> u64 {
4382 if let Some(_) = self.value {
4383 return 4;
4384 }
4385 if let Some(_) = self.offset {
4386 return 3;
4387 }
4388 if let Some(_) = self.handle {
4389 return 2;
4390 }
4391 if let Some(_) = self.peer_id {
4392 return 1;
4393 }
4394 0
4395 }
4396 }
4397
4398 impl fidl::encoding::ValueTypeMarker for LocalServiceWriteValueRequest {
4399 type Borrowed<'a> = &'a Self;
4400 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4401 value
4402 }
4403 }
4404
4405 unsafe impl fidl::encoding::TypeMarker for LocalServiceWriteValueRequest {
4406 type Owned = Self;
4407
4408 #[inline(always)]
4409 fn inline_align(_context: fidl::encoding::Context) -> usize {
4410 8
4411 }
4412
4413 #[inline(always)]
4414 fn inline_size(_context: fidl::encoding::Context) -> usize {
4415 16
4416 }
4417 }
4418
4419 unsafe impl<D: fidl::encoding::ResourceDialect>
4420 fidl::encoding::Encode<LocalServiceWriteValueRequest, D>
4421 for &LocalServiceWriteValueRequest
4422 {
4423 unsafe fn encode(
4424 self,
4425 encoder: &mut fidl::encoding::Encoder<'_, D>,
4426 offset: usize,
4427 mut depth: fidl::encoding::Depth,
4428 ) -> fidl::Result<()> {
4429 encoder.debug_check_bounds::<LocalServiceWriteValueRequest>(offset);
4430 let max_ordinal: u64 = self.max_ordinal_present();
4432 encoder.write_num(max_ordinal, offset);
4433 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4434 if max_ordinal == 0 {
4436 return Ok(());
4437 }
4438 depth.increment()?;
4439 let envelope_size = 8;
4440 let bytes_len = max_ordinal as usize * envelope_size;
4441 #[allow(unused_variables)]
4442 let offset = encoder.out_of_line_offset(bytes_len);
4443 let mut _prev_end_offset: usize = 0;
4444 if 1 > max_ordinal {
4445 return Ok(());
4446 }
4447
4448 let cur_offset: usize = (1 - 1) * envelope_size;
4451
4452 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4454
4455 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::PeerId, D>(
4460 self.peer_id.as_ref().map(
4461 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow,
4462 ),
4463 encoder,
4464 offset + cur_offset,
4465 depth,
4466 )?;
4467
4468 _prev_end_offset = cur_offset + envelope_size;
4469 if 2 > max_ordinal {
4470 return Ok(());
4471 }
4472
4473 let cur_offset: usize = (2 - 1) * envelope_size;
4476
4477 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4479
4480 fidl::encoding::encode_in_envelope_optional::<Handle, D>(
4485 self.handle.as_ref().map(<Handle as fidl::encoding::ValueTypeMarker>::borrow),
4486 encoder,
4487 offset + cur_offset,
4488 depth,
4489 )?;
4490
4491 _prev_end_offset = cur_offset + envelope_size;
4492 if 3 > max_ordinal {
4493 return Ok(());
4494 }
4495
4496 let cur_offset: usize = (3 - 1) * envelope_size;
4499
4500 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4502
4503 fidl::encoding::encode_in_envelope_optional::<u32, D>(
4508 self.offset.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4509 encoder,
4510 offset + cur_offset,
4511 depth,
4512 )?;
4513
4514 _prev_end_offset = cur_offset + envelope_size;
4515 if 4 > max_ordinal {
4516 return Ok(());
4517 }
4518
4519 let cur_offset: usize = (4 - 1) * envelope_size;
4522
4523 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4525
4526 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 512>, D>(
4531 self.value.as_ref().map(
4532 <fidl::encoding::Vector<u8, 512> as fidl::encoding::ValueTypeMarker>::borrow,
4533 ),
4534 encoder,
4535 offset + cur_offset,
4536 depth,
4537 )?;
4538
4539 _prev_end_offset = cur_offset + envelope_size;
4540
4541 Ok(())
4542 }
4543 }
4544
4545 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4546 for LocalServiceWriteValueRequest
4547 {
4548 #[inline(always)]
4549 fn new_empty() -> Self {
4550 Self::default()
4551 }
4552
4553 unsafe fn decode(
4554 &mut self,
4555 decoder: &mut fidl::encoding::Decoder<'_, D>,
4556 offset: usize,
4557 mut depth: fidl::encoding::Depth,
4558 ) -> fidl::Result<()> {
4559 decoder.debug_check_bounds::<Self>(offset);
4560 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4561 None => return Err(fidl::Error::NotNullable),
4562 Some(len) => len,
4563 };
4564 if len == 0 {
4566 return Ok(());
4567 };
4568 depth.increment()?;
4569 let envelope_size = 8;
4570 let bytes_len = len * envelope_size;
4571 let offset = decoder.out_of_line_offset(bytes_len)?;
4572 let mut _next_ordinal_to_read = 0;
4574 let mut next_offset = offset;
4575 let end_offset = offset + bytes_len;
4576 _next_ordinal_to_read += 1;
4577 if next_offset >= end_offset {
4578 return Ok(());
4579 }
4580
4581 while _next_ordinal_to_read < 1 {
4583 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4584 _next_ordinal_to_read += 1;
4585 next_offset += envelope_size;
4586 }
4587
4588 let next_out_of_line = decoder.next_out_of_line();
4589 let handles_before = decoder.remaining_handles();
4590 if let Some((inlined, num_bytes, num_handles)) =
4591 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4592 {
4593 let member_inline_size =
4594 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::TypeMarker>::inline_size(
4595 decoder.context,
4596 );
4597 if inlined != (member_inline_size <= 4) {
4598 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4599 }
4600 let inner_offset;
4601 let mut inner_depth = depth.clone();
4602 if inlined {
4603 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4604 inner_offset = next_offset;
4605 } else {
4606 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4607 inner_depth.increment()?;
4608 }
4609 let val_ref = self
4610 .peer_id
4611 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D));
4612 fidl::decode!(
4613 fidl_fuchsia_bluetooth::PeerId,
4614 D,
4615 val_ref,
4616 decoder,
4617 inner_offset,
4618 inner_depth
4619 )?;
4620 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4621 {
4622 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4623 }
4624 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4625 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4626 }
4627 }
4628
4629 next_offset += envelope_size;
4630 _next_ordinal_to_read += 1;
4631 if next_offset >= end_offset {
4632 return Ok(());
4633 }
4634
4635 while _next_ordinal_to_read < 2 {
4637 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4638 _next_ordinal_to_read += 1;
4639 next_offset += envelope_size;
4640 }
4641
4642 let next_out_of_line = decoder.next_out_of_line();
4643 let handles_before = decoder.remaining_handles();
4644 if let Some((inlined, num_bytes, num_handles)) =
4645 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4646 {
4647 let member_inline_size =
4648 <Handle as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4649 if inlined != (member_inline_size <= 4) {
4650 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4651 }
4652 let inner_offset;
4653 let mut inner_depth = depth.clone();
4654 if inlined {
4655 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4656 inner_offset = next_offset;
4657 } else {
4658 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4659 inner_depth.increment()?;
4660 }
4661 let val_ref = self.handle.get_or_insert_with(|| fidl::new_empty!(Handle, D));
4662 fidl::decode!(Handle, D, val_ref, decoder, inner_offset, inner_depth)?;
4663 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4664 {
4665 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4666 }
4667 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4668 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4669 }
4670 }
4671
4672 next_offset += envelope_size;
4673 _next_ordinal_to_read += 1;
4674 if next_offset >= end_offset {
4675 return Ok(());
4676 }
4677
4678 while _next_ordinal_to_read < 3 {
4680 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4681 _next_ordinal_to_read += 1;
4682 next_offset += envelope_size;
4683 }
4684
4685 let next_out_of_line = decoder.next_out_of_line();
4686 let handles_before = decoder.remaining_handles();
4687 if let Some((inlined, num_bytes, num_handles)) =
4688 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4689 {
4690 let member_inline_size =
4691 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4692 if inlined != (member_inline_size <= 4) {
4693 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4694 }
4695 let inner_offset;
4696 let mut inner_depth = depth.clone();
4697 if inlined {
4698 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4699 inner_offset = next_offset;
4700 } else {
4701 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4702 inner_depth.increment()?;
4703 }
4704 let val_ref = self.offset.get_or_insert_with(|| fidl::new_empty!(u32, D));
4705 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4706 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4707 {
4708 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4709 }
4710 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4711 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4712 }
4713 }
4714
4715 next_offset += envelope_size;
4716 _next_ordinal_to_read += 1;
4717 if next_offset >= end_offset {
4718 return Ok(());
4719 }
4720
4721 while _next_ordinal_to_read < 4 {
4723 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4724 _next_ordinal_to_read += 1;
4725 next_offset += envelope_size;
4726 }
4727
4728 let next_out_of_line = decoder.next_out_of_line();
4729 let handles_before = decoder.remaining_handles();
4730 if let Some((inlined, num_bytes, num_handles)) =
4731 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4732 {
4733 let member_inline_size =
4734 <fidl::encoding::Vector<u8, 512> as fidl::encoding::TypeMarker>::inline_size(
4735 decoder.context,
4736 );
4737 if inlined != (member_inline_size <= 4) {
4738 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4739 }
4740 let inner_offset;
4741 let mut inner_depth = depth.clone();
4742 if inlined {
4743 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4744 inner_offset = next_offset;
4745 } else {
4746 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4747 inner_depth.increment()?;
4748 }
4749 let val_ref = self
4750 .value
4751 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 512>, D));
4752 fidl::decode!(fidl::encoding::Vector<u8, 512>, D, val_ref, decoder, inner_offset, inner_depth)?;
4753 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4754 {
4755 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4756 }
4757 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4758 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4759 }
4760 }
4761
4762 next_offset += envelope_size;
4763
4764 while next_offset < end_offset {
4766 _next_ordinal_to_read += 1;
4767 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4768 next_offset += envelope_size;
4769 }
4770
4771 Ok(())
4772 }
4773 }
4774
4775 impl LongReadOptions {
4776 #[inline(always)]
4777 fn max_ordinal_present(&self) -> u64 {
4778 if let Some(_) = self.max_bytes {
4779 return 2;
4780 }
4781 if let Some(_) = self.offset {
4782 return 1;
4783 }
4784 0
4785 }
4786 }
4787
4788 impl fidl::encoding::ValueTypeMarker for LongReadOptions {
4789 type Borrowed<'a> = &'a Self;
4790 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4791 value
4792 }
4793 }
4794
4795 unsafe impl fidl::encoding::TypeMarker for LongReadOptions {
4796 type Owned = Self;
4797
4798 #[inline(always)]
4799 fn inline_align(_context: fidl::encoding::Context) -> usize {
4800 8
4801 }
4802
4803 #[inline(always)]
4804 fn inline_size(_context: fidl::encoding::Context) -> usize {
4805 16
4806 }
4807 }
4808
4809 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LongReadOptions, D>
4810 for &LongReadOptions
4811 {
4812 unsafe fn encode(
4813 self,
4814 encoder: &mut fidl::encoding::Encoder<'_, D>,
4815 offset: usize,
4816 mut depth: fidl::encoding::Depth,
4817 ) -> fidl::Result<()> {
4818 encoder.debug_check_bounds::<LongReadOptions>(offset);
4819 let max_ordinal: u64 = self.max_ordinal_present();
4821 encoder.write_num(max_ordinal, offset);
4822 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4823 if max_ordinal == 0 {
4825 return Ok(());
4826 }
4827 depth.increment()?;
4828 let envelope_size = 8;
4829 let bytes_len = max_ordinal as usize * envelope_size;
4830 #[allow(unused_variables)]
4831 let offset = encoder.out_of_line_offset(bytes_len);
4832 let mut _prev_end_offset: usize = 0;
4833 if 1 > max_ordinal {
4834 return Ok(());
4835 }
4836
4837 let cur_offset: usize = (1 - 1) * envelope_size;
4840
4841 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4843
4844 fidl::encoding::encode_in_envelope_optional::<u16, D>(
4849 self.offset.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
4850 encoder,
4851 offset + cur_offset,
4852 depth,
4853 )?;
4854
4855 _prev_end_offset = cur_offset + envelope_size;
4856 if 2 > max_ordinal {
4857 return Ok(());
4858 }
4859
4860 let cur_offset: usize = (2 - 1) * envelope_size;
4863
4864 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4866
4867 fidl::encoding::encode_in_envelope_optional::<u16, D>(
4872 self.max_bytes.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
4873 encoder,
4874 offset + cur_offset,
4875 depth,
4876 )?;
4877
4878 _prev_end_offset = cur_offset + envelope_size;
4879
4880 Ok(())
4881 }
4882 }
4883
4884 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LongReadOptions {
4885 #[inline(always)]
4886 fn new_empty() -> Self {
4887 Self::default()
4888 }
4889
4890 unsafe fn decode(
4891 &mut self,
4892 decoder: &mut fidl::encoding::Decoder<'_, D>,
4893 offset: usize,
4894 mut depth: fidl::encoding::Depth,
4895 ) -> fidl::Result<()> {
4896 decoder.debug_check_bounds::<Self>(offset);
4897 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4898 None => return Err(fidl::Error::NotNullable),
4899 Some(len) => len,
4900 };
4901 if len == 0 {
4903 return Ok(());
4904 };
4905 depth.increment()?;
4906 let envelope_size = 8;
4907 let bytes_len = len * envelope_size;
4908 let offset = decoder.out_of_line_offset(bytes_len)?;
4909 let mut _next_ordinal_to_read = 0;
4911 let mut next_offset = offset;
4912 let end_offset = offset + bytes_len;
4913 _next_ordinal_to_read += 1;
4914 if next_offset >= end_offset {
4915 return Ok(());
4916 }
4917
4918 while _next_ordinal_to_read < 1 {
4920 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4921 _next_ordinal_to_read += 1;
4922 next_offset += envelope_size;
4923 }
4924
4925 let next_out_of_line = decoder.next_out_of_line();
4926 let handles_before = decoder.remaining_handles();
4927 if let Some((inlined, num_bytes, num_handles)) =
4928 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4929 {
4930 let member_inline_size =
4931 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4932 if inlined != (member_inline_size <= 4) {
4933 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4934 }
4935 let inner_offset;
4936 let mut inner_depth = depth.clone();
4937 if inlined {
4938 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4939 inner_offset = next_offset;
4940 } else {
4941 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4942 inner_depth.increment()?;
4943 }
4944 let val_ref = self.offset.get_or_insert_with(|| fidl::new_empty!(u16, D));
4945 fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
4946 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4947 {
4948 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4949 }
4950 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4951 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4952 }
4953 }
4954
4955 next_offset += envelope_size;
4956 _next_ordinal_to_read += 1;
4957 if next_offset >= end_offset {
4958 return Ok(());
4959 }
4960
4961 while _next_ordinal_to_read < 2 {
4963 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4964 _next_ordinal_to_read += 1;
4965 next_offset += envelope_size;
4966 }
4967
4968 let next_out_of_line = decoder.next_out_of_line();
4969 let handles_before = decoder.remaining_handles();
4970 if let Some((inlined, num_bytes, num_handles)) =
4971 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4972 {
4973 let member_inline_size =
4974 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4975 if inlined != (member_inline_size <= 4) {
4976 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4977 }
4978 let inner_offset;
4979 let mut inner_depth = depth.clone();
4980 if inlined {
4981 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4982 inner_offset = next_offset;
4983 } else {
4984 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4985 inner_depth.increment()?;
4986 }
4987 let val_ref = self.max_bytes.get_or_insert_with(|| fidl::new_empty!(u16, D));
4988 fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
4989 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4990 {
4991 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4992 }
4993 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4994 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4995 }
4996 }
4997
4998 next_offset += envelope_size;
4999
5000 while next_offset < end_offset {
5002 _next_ordinal_to_read += 1;
5003 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5004 next_offset += envelope_size;
5005 }
5006
5007 Ok(())
5008 }
5009 }
5010
5011 impl ReadByTypeResult {
5012 #[inline(always)]
5013 fn max_ordinal_present(&self) -> u64 {
5014 if let Some(_) = self.error {
5015 return 3;
5016 }
5017 if let Some(_) = self.value {
5018 return 2;
5019 }
5020 if let Some(_) = self.handle {
5021 return 1;
5022 }
5023 0
5024 }
5025 }
5026
5027 impl fidl::encoding::ValueTypeMarker for ReadByTypeResult {
5028 type Borrowed<'a> = &'a Self;
5029 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5030 value
5031 }
5032 }
5033
5034 unsafe impl fidl::encoding::TypeMarker for ReadByTypeResult {
5035 type Owned = Self;
5036
5037 #[inline(always)]
5038 fn inline_align(_context: fidl::encoding::Context) -> usize {
5039 8
5040 }
5041
5042 #[inline(always)]
5043 fn inline_size(_context: fidl::encoding::Context) -> usize {
5044 16
5045 }
5046 }
5047
5048 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ReadByTypeResult, D>
5049 for &ReadByTypeResult
5050 {
5051 unsafe fn encode(
5052 self,
5053 encoder: &mut fidl::encoding::Encoder<'_, D>,
5054 offset: usize,
5055 mut depth: fidl::encoding::Depth,
5056 ) -> fidl::Result<()> {
5057 encoder.debug_check_bounds::<ReadByTypeResult>(offset);
5058 let max_ordinal: u64 = self.max_ordinal_present();
5060 encoder.write_num(max_ordinal, offset);
5061 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5062 if max_ordinal == 0 {
5064 return Ok(());
5065 }
5066 depth.increment()?;
5067 let envelope_size = 8;
5068 let bytes_len = max_ordinal as usize * envelope_size;
5069 #[allow(unused_variables)]
5070 let offset = encoder.out_of_line_offset(bytes_len);
5071 let mut _prev_end_offset: usize = 0;
5072 if 1 > max_ordinal {
5073 return Ok(());
5074 }
5075
5076 let cur_offset: usize = (1 - 1) * envelope_size;
5079
5080 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5082
5083 fidl::encoding::encode_in_envelope_optional::<Handle, D>(
5088 self.handle.as_ref().map(<Handle as fidl::encoding::ValueTypeMarker>::borrow),
5089 encoder,
5090 offset + cur_offset,
5091 depth,
5092 )?;
5093
5094 _prev_end_offset = cur_offset + envelope_size;
5095 if 2 > max_ordinal {
5096 return Ok(());
5097 }
5098
5099 let cur_offset: usize = (2 - 1) * envelope_size;
5102
5103 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5105
5106 fidl::encoding::encode_in_envelope_optional::<ReadValue, D>(
5111 self.value.as_ref().map(<ReadValue as fidl::encoding::ValueTypeMarker>::borrow),
5112 encoder,
5113 offset + cur_offset,
5114 depth,
5115 )?;
5116
5117 _prev_end_offset = cur_offset + envelope_size;
5118 if 3 > max_ordinal {
5119 return Ok(());
5120 }
5121
5122 let cur_offset: usize = (3 - 1) * envelope_size;
5125
5126 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5128
5129 fidl::encoding::encode_in_envelope_optional::<Error, D>(
5134 self.error.as_ref().map(<Error as fidl::encoding::ValueTypeMarker>::borrow),
5135 encoder,
5136 offset + cur_offset,
5137 depth,
5138 )?;
5139
5140 _prev_end_offset = cur_offset + envelope_size;
5141
5142 Ok(())
5143 }
5144 }
5145
5146 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ReadByTypeResult {
5147 #[inline(always)]
5148 fn new_empty() -> Self {
5149 Self::default()
5150 }
5151
5152 unsafe fn decode(
5153 &mut self,
5154 decoder: &mut fidl::encoding::Decoder<'_, D>,
5155 offset: usize,
5156 mut depth: fidl::encoding::Depth,
5157 ) -> fidl::Result<()> {
5158 decoder.debug_check_bounds::<Self>(offset);
5159 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5160 None => return Err(fidl::Error::NotNullable),
5161 Some(len) => len,
5162 };
5163 if len == 0 {
5165 return Ok(());
5166 };
5167 depth.increment()?;
5168 let envelope_size = 8;
5169 let bytes_len = len * envelope_size;
5170 let offset = decoder.out_of_line_offset(bytes_len)?;
5171 let mut _next_ordinal_to_read = 0;
5173 let mut next_offset = offset;
5174 let end_offset = offset + bytes_len;
5175 _next_ordinal_to_read += 1;
5176 if next_offset >= end_offset {
5177 return Ok(());
5178 }
5179
5180 while _next_ordinal_to_read < 1 {
5182 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5183 _next_ordinal_to_read += 1;
5184 next_offset += envelope_size;
5185 }
5186
5187 let next_out_of_line = decoder.next_out_of_line();
5188 let handles_before = decoder.remaining_handles();
5189 if let Some((inlined, num_bytes, num_handles)) =
5190 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5191 {
5192 let member_inline_size =
5193 <Handle as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5194 if inlined != (member_inline_size <= 4) {
5195 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5196 }
5197 let inner_offset;
5198 let mut inner_depth = depth.clone();
5199 if inlined {
5200 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5201 inner_offset = next_offset;
5202 } else {
5203 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5204 inner_depth.increment()?;
5205 }
5206 let val_ref = self.handle.get_or_insert_with(|| fidl::new_empty!(Handle, D));
5207 fidl::decode!(Handle, D, val_ref, decoder, inner_offset, inner_depth)?;
5208 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5209 {
5210 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5211 }
5212 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5213 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5214 }
5215 }
5216
5217 next_offset += envelope_size;
5218 _next_ordinal_to_read += 1;
5219 if next_offset >= end_offset {
5220 return Ok(());
5221 }
5222
5223 while _next_ordinal_to_read < 2 {
5225 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5226 _next_ordinal_to_read += 1;
5227 next_offset += envelope_size;
5228 }
5229
5230 let next_out_of_line = decoder.next_out_of_line();
5231 let handles_before = decoder.remaining_handles();
5232 if let Some((inlined, num_bytes, num_handles)) =
5233 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5234 {
5235 let member_inline_size =
5236 <ReadValue as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5237 if inlined != (member_inline_size <= 4) {
5238 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5239 }
5240 let inner_offset;
5241 let mut inner_depth = depth.clone();
5242 if inlined {
5243 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5244 inner_offset = next_offset;
5245 } else {
5246 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5247 inner_depth.increment()?;
5248 }
5249 let val_ref = self.value.get_or_insert_with(|| fidl::new_empty!(ReadValue, D));
5250 fidl::decode!(ReadValue, D, val_ref, decoder, inner_offset, inner_depth)?;
5251 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5252 {
5253 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5254 }
5255 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5256 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5257 }
5258 }
5259
5260 next_offset += envelope_size;
5261 _next_ordinal_to_read += 1;
5262 if next_offset >= end_offset {
5263 return Ok(());
5264 }
5265
5266 while _next_ordinal_to_read < 3 {
5268 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5269 _next_ordinal_to_read += 1;
5270 next_offset += envelope_size;
5271 }
5272
5273 let next_out_of_line = decoder.next_out_of_line();
5274 let handles_before = decoder.remaining_handles();
5275 if let Some((inlined, num_bytes, num_handles)) =
5276 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5277 {
5278 let member_inline_size =
5279 <Error as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5280 if inlined != (member_inline_size <= 4) {
5281 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5282 }
5283 let inner_offset;
5284 let mut inner_depth = depth.clone();
5285 if inlined {
5286 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5287 inner_offset = next_offset;
5288 } else {
5289 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5290 inner_depth.increment()?;
5291 }
5292 let val_ref = self.error.get_or_insert_with(|| fidl::new_empty!(Error, D));
5293 fidl::decode!(Error, D, val_ref, decoder, inner_offset, inner_depth)?;
5294 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5295 {
5296 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5297 }
5298 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5299 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5300 }
5301 }
5302
5303 next_offset += envelope_size;
5304
5305 while next_offset < end_offset {
5307 _next_ordinal_to_read += 1;
5308 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5309 next_offset += envelope_size;
5310 }
5311
5312 Ok(())
5313 }
5314 }
5315
5316 impl ReadValue {
5317 #[inline(always)]
5318 fn max_ordinal_present(&self) -> u64 {
5319 if let Some(_) = self.maybe_truncated {
5320 return 3;
5321 }
5322 if let Some(_) = self.value {
5323 return 2;
5324 }
5325 if let Some(_) = self.handle {
5326 return 1;
5327 }
5328 0
5329 }
5330 }
5331
5332 impl fidl::encoding::ValueTypeMarker for ReadValue {
5333 type Borrowed<'a> = &'a Self;
5334 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5335 value
5336 }
5337 }
5338
5339 unsafe impl fidl::encoding::TypeMarker for ReadValue {
5340 type Owned = Self;
5341
5342 #[inline(always)]
5343 fn inline_align(_context: fidl::encoding::Context) -> usize {
5344 8
5345 }
5346
5347 #[inline(always)]
5348 fn inline_size(_context: fidl::encoding::Context) -> usize {
5349 16
5350 }
5351 }
5352
5353 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ReadValue, D>
5354 for &ReadValue
5355 {
5356 unsafe fn encode(
5357 self,
5358 encoder: &mut fidl::encoding::Encoder<'_, D>,
5359 offset: usize,
5360 mut depth: fidl::encoding::Depth,
5361 ) -> fidl::Result<()> {
5362 encoder.debug_check_bounds::<ReadValue>(offset);
5363 let max_ordinal: u64 = self.max_ordinal_present();
5365 encoder.write_num(max_ordinal, offset);
5366 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5367 if max_ordinal == 0 {
5369 return Ok(());
5370 }
5371 depth.increment()?;
5372 let envelope_size = 8;
5373 let bytes_len = max_ordinal as usize * envelope_size;
5374 #[allow(unused_variables)]
5375 let offset = encoder.out_of_line_offset(bytes_len);
5376 let mut _prev_end_offset: usize = 0;
5377 if 1 > max_ordinal {
5378 return Ok(());
5379 }
5380
5381 let cur_offset: usize = (1 - 1) * envelope_size;
5384
5385 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5387
5388 fidl::encoding::encode_in_envelope_optional::<Handle, D>(
5393 self.handle.as_ref().map(<Handle as fidl::encoding::ValueTypeMarker>::borrow),
5394 encoder,
5395 offset + cur_offset,
5396 depth,
5397 )?;
5398
5399 _prev_end_offset = cur_offset + envelope_size;
5400 if 2 > max_ordinal {
5401 return Ok(());
5402 }
5403
5404 let cur_offset: usize = (2 - 1) * envelope_size;
5407
5408 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5410
5411 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 512>, D>(
5416 self.value.as_ref().map(
5417 <fidl::encoding::Vector<u8, 512> as fidl::encoding::ValueTypeMarker>::borrow,
5418 ),
5419 encoder,
5420 offset + cur_offset,
5421 depth,
5422 )?;
5423
5424 _prev_end_offset = cur_offset + envelope_size;
5425 if 3 > max_ordinal {
5426 return Ok(());
5427 }
5428
5429 let cur_offset: usize = (3 - 1) * envelope_size;
5432
5433 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5435
5436 fidl::encoding::encode_in_envelope_optional::<bool, D>(
5441 self.maybe_truncated
5442 .as_ref()
5443 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5444 encoder,
5445 offset + cur_offset,
5446 depth,
5447 )?;
5448
5449 _prev_end_offset = cur_offset + envelope_size;
5450
5451 Ok(())
5452 }
5453 }
5454
5455 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ReadValue {
5456 #[inline(always)]
5457 fn new_empty() -> Self {
5458 Self::default()
5459 }
5460
5461 unsafe fn decode(
5462 &mut self,
5463 decoder: &mut fidl::encoding::Decoder<'_, D>,
5464 offset: usize,
5465 mut depth: fidl::encoding::Depth,
5466 ) -> fidl::Result<()> {
5467 decoder.debug_check_bounds::<Self>(offset);
5468 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5469 None => return Err(fidl::Error::NotNullable),
5470 Some(len) => len,
5471 };
5472 if len == 0 {
5474 return Ok(());
5475 };
5476 depth.increment()?;
5477 let envelope_size = 8;
5478 let bytes_len = len * envelope_size;
5479 let offset = decoder.out_of_line_offset(bytes_len)?;
5480 let mut _next_ordinal_to_read = 0;
5482 let mut next_offset = offset;
5483 let end_offset = offset + bytes_len;
5484 _next_ordinal_to_read += 1;
5485 if next_offset >= end_offset {
5486 return Ok(());
5487 }
5488
5489 while _next_ordinal_to_read < 1 {
5491 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5492 _next_ordinal_to_read += 1;
5493 next_offset += envelope_size;
5494 }
5495
5496 let next_out_of_line = decoder.next_out_of_line();
5497 let handles_before = decoder.remaining_handles();
5498 if let Some((inlined, num_bytes, num_handles)) =
5499 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5500 {
5501 let member_inline_size =
5502 <Handle as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5503 if inlined != (member_inline_size <= 4) {
5504 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5505 }
5506 let inner_offset;
5507 let mut inner_depth = depth.clone();
5508 if inlined {
5509 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5510 inner_offset = next_offset;
5511 } else {
5512 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5513 inner_depth.increment()?;
5514 }
5515 let val_ref = self.handle.get_or_insert_with(|| fidl::new_empty!(Handle, D));
5516 fidl::decode!(Handle, D, val_ref, decoder, inner_offset, inner_depth)?;
5517 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5518 {
5519 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5520 }
5521 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5522 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5523 }
5524 }
5525
5526 next_offset += envelope_size;
5527 _next_ordinal_to_read += 1;
5528 if next_offset >= end_offset {
5529 return Ok(());
5530 }
5531
5532 while _next_ordinal_to_read < 2 {
5534 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5535 _next_ordinal_to_read += 1;
5536 next_offset += envelope_size;
5537 }
5538
5539 let next_out_of_line = decoder.next_out_of_line();
5540 let handles_before = decoder.remaining_handles();
5541 if let Some((inlined, num_bytes, num_handles)) =
5542 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5543 {
5544 let member_inline_size =
5545 <fidl::encoding::Vector<u8, 512> as fidl::encoding::TypeMarker>::inline_size(
5546 decoder.context,
5547 );
5548 if inlined != (member_inline_size <= 4) {
5549 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5550 }
5551 let inner_offset;
5552 let mut inner_depth = depth.clone();
5553 if inlined {
5554 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5555 inner_offset = next_offset;
5556 } else {
5557 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5558 inner_depth.increment()?;
5559 }
5560 let val_ref = self
5561 .value
5562 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 512>, D));
5563 fidl::decode!(fidl::encoding::Vector<u8, 512>, D, val_ref, decoder, inner_offset, inner_depth)?;
5564 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5565 {
5566 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5567 }
5568 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5569 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5570 }
5571 }
5572
5573 next_offset += envelope_size;
5574 _next_ordinal_to_read += 1;
5575 if next_offset >= end_offset {
5576 return Ok(());
5577 }
5578
5579 while _next_ordinal_to_read < 3 {
5581 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5582 _next_ordinal_to_read += 1;
5583 next_offset += envelope_size;
5584 }
5585
5586 let next_out_of_line = decoder.next_out_of_line();
5587 let handles_before = decoder.remaining_handles();
5588 if let Some((inlined, num_bytes, num_handles)) =
5589 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5590 {
5591 let member_inline_size =
5592 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5593 if inlined != (member_inline_size <= 4) {
5594 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5595 }
5596 let inner_offset;
5597 let mut inner_depth = depth.clone();
5598 if inlined {
5599 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5600 inner_offset = next_offset;
5601 } else {
5602 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5603 inner_depth.increment()?;
5604 }
5605 let val_ref = self.maybe_truncated.get_or_insert_with(|| fidl::new_empty!(bool, D));
5606 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
5607 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5608 {
5609 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5610 }
5611 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5612 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5613 }
5614 }
5615
5616 next_offset += envelope_size;
5617
5618 while next_offset < end_offset {
5620 _next_ordinal_to_read += 1;
5621 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5622 next_offset += envelope_size;
5623 }
5624
5625 Ok(())
5626 }
5627 }
5628
5629 impl SecurityRequirements {
5630 #[inline(always)]
5631 fn max_ordinal_present(&self) -> u64 {
5632 if let Some(_) = self.authorization_required {
5633 return 3;
5634 }
5635 if let Some(_) = self.authentication_required {
5636 return 2;
5637 }
5638 if let Some(_) = self.encryption_required {
5639 return 1;
5640 }
5641 0
5642 }
5643 }
5644
5645 impl fidl::encoding::ValueTypeMarker for SecurityRequirements {
5646 type Borrowed<'a> = &'a Self;
5647 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5648 value
5649 }
5650 }
5651
5652 unsafe impl fidl::encoding::TypeMarker for SecurityRequirements {
5653 type Owned = Self;
5654
5655 #[inline(always)]
5656 fn inline_align(_context: fidl::encoding::Context) -> usize {
5657 8
5658 }
5659
5660 #[inline(always)]
5661 fn inline_size(_context: fidl::encoding::Context) -> usize {
5662 16
5663 }
5664 }
5665
5666 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SecurityRequirements, D>
5667 for &SecurityRequirements
5668 {
5669 unsafe fn encode(
5670 self,
5671 encoder: &mut fidl::encoding::Encoder<'_, D>,
5672 offset: usize,
5673 mut depth: fidl::encoding::Depth,
5674 ) -> fidl::Result<()> {
5675 encoder.debug_check_bounds::<SecurityRequirements>(offset);
5676 let max_ordinal: u64 = self.max_ordinal_present();
5678 encoder.write_num(max_ordinal, offset);
5679 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5680 if max_ordinal == 0 {
5682 return Ok(());
5683 }
5684 depth.increment()?;
5685 let envelope_size = 8;
5686 let bytes_len = max_ordinal as usize * envelope_size;
5687 #[allow(unused_variables)]
5688 let offset = encoder.out_of_line_offset(bytes_len);
5689 let mut _prev_end_offset: usize = 0;
5690 if 1 > max_ordinal {
5691 return Ok(());
5692 }
5693
5694 let cur_offset: usize = (1 - 1) * envelope_size;
5697
5698 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5700
5701 fidl::encoding::encode_in_envelope_optional::<bool, D>(
5706 self.encryption_required
5707 .as_ref()
5708 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5709 encoder,
5710 offset + cur_offset,
5711 depth,
5712 )?;
5713
5714 _prev_end_offset = cur_offset + envelope_size;
5715 if 2 > max_ordinal {
5716 return Ok(());
5717 }
5718
5719 let cur_offset: usize = (2 - 1) * envelope_size;
5722
5723 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5725
5726 fidl::encoding::encode_in_envelope_optional::<bool, D>(
5731 self.authentication_required
5732 .as_ref()
5733 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5734 encoder,
5735 offset + cur_offset,
5736 depth,
5737 )?;
5738
5739 _prev_end_offset = cur_offset + envelope_size;
5740 if 3 > max_ordinal {
5741 return Ok(());
5742 }
5743
5744 let cur_offset: usize = (3 - 1) * envelope_size;
5747
5748 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5750
5751 fidl::encoding::encode_in_envelope_optional::<bool, D>(
5756 self.authorization_required
5757 .as_ref()
5758 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5759 encoder,
5760 offset + cur_offset,
5761 depth,
5762 )?;
5763
5764 _prev_end_offset = cur_offset + envelope_size;
5765
5766 Ok(())
5767 }
5768 }
5769
5770 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SecurityRequirements {
5771 #[inline(always)]
5772 fn new_empty() -> Self {
5773 Self::default()
5774 }
5775
5776 unsafe fn decode(
5777 &mut self,
5778 decoder: &mut fidl::encoding::Decoder<'_, D>,
5779 offset: usize,
5780 mut depth: fidl::encoding::Depth,
5781 ) -> fidl::Result<()> {
5782 decoder.debug_check_bounds::<Self>(offset);
5783 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5784 None => return Err(fidl::Error::NotNullable),
5785 Some(len) => len,
5786 };
5787 if len == 0 {
5789 return Ok(());
5790 };
5791 depth.increment()?;
5792 let envelope_size = 8;
5793 let bytes_len = len * envelope_size;
5794 let offset = decoder.out_of_line_offset(bytes_len)?;
5795 let mut _next_ordinal_to_read = 0;
5797 let mut next_offset = offset;
5798 let end_offset = offset + bytes_len;
5799 _next_ordinal_to_read += 1;
5800 if next_offset >= end_offset {
5801 return Ok(());
5802 }
5803
5804 while _next_ordinal_to_read < 1 {
5806 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5807 _next_ordinal_to_read += 1;
5808 next_offset += envelope_size;
5809 }
5810
5811 let next_out_of_line = decoder.next_out_of_line();
5812 let handles_before = decoder.remaining_handles();
5813 if let Some((inlined, num_bytes, num_handles)) =
5814 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5815 {
5816 let member_inline_size =
5817 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5818 if inlined != (member_inline_size <= 4) {
5819 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5820 }
5821 let inner_offset;
5822 let mut inner_depth = depth.clone();
5823 if inlined {
5824 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5825 inner_offset = next_offset;
5826 } else {
5827 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5828 inner_depth.increment()?;
5829 }
5830 let val_ref =
5831 self.encryption_required.get_or_insert_with(|| fidl::new_empty!(bool, D));
5832 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
5833 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5834 {
5835 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5836 }
5837 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5838 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5839 }
5840 }
5841
5842 next_offset += envelope_size;
5843 _next_ordinal_to_read += 1;
5844 if next_offset >= end_offset {
5845 return Ok(());
5846 }
5847
5848 while _next_ordinal_to_read < 2 {
5850 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5851 _next_ordinal_to_read += 1;
5852 next_offset += envelope_size;
5853 }
5854
5855 let next_out_of_line = decoder.next_out_of_line();
5856 let handles_before = decoder.remaining_handles();
5857 if let Some((inlined, num_bytes, num_handles)) =
5858 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5859 {
5860 let member_inline_size =
5861 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5862 if inlined != (member_inline_size <= 4) {
5863 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5864 }
5865 let inner_offset;
5866 let mut inner_depth = depth.clone();
5867 if inlined {
5868 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5869 inner_offset = next_offset;
5870 } else {
5871 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5872 inner_depth.increment()?;
5873 }
5874 let val_ref =
5875 self.authentication_required.get_or_insert_with(|| fidl::new_empty!(bool, D));
5876 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
5877 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5878 {
5879 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5880 }
5881 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5882 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5883 }
5884 }
5885
5886 next_offset += envelope_size;
5887 _next_ordinal_to_read += 1;
5888 if next_offset >= end_offset {
5889 return Ok(());
5890 }
5891
5892 while _next_ordinal_to_read < 3 {
5894 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5895 _next_ordinal_to_read += 1;
5896 next_offset += envelope_size;
5897 }
5898
5899 let next_out_of_line = decoder.next_out_of_line();
5900 let handles_before = decoder.remaining_handles();
5901 if let Some((inlined, num_bytes, num_handles)) =
5902 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5903 {
5904 let member_inline_size =
5905 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5906 if inlined != (member_inline_size <= 4) {
5907 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5908 }
5909 let inner_offset;
5910 let mut inner_depth = depth.clone();
5911 if inlined {
5912 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5913 inner_offset = next_offset;
5914 } else {
5915 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5916 inner_depth.increment()?;
5917 }
5918 let val_ref =
5919 self.authorization_required.get_or_insert_with(|| fidl::new_empty!(bool, D));
5920 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
5921 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5922 {
5923 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5924 }
5925 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5926 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5927 }
5928 }
5929
5930 next_offset += envelope_size;
5931
5932 while next_offset < end_offset {
5934 _next_ordinal_to_read += 1;
5935 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5936 next_offset += envelope_size;
5937 }
5938
5939 Ok(())
5940 }
5941 }
5942
5943 impl ServiceInfo {
5944 #[inline(always)]
5945 fn max_ordinal_present(&self) -> u64 {
5946 if let Some(_) = self.includes {
5947 return 5;
5948 }
5949 if let Some(_) = self.characteristics {
5950 return 4;
5951 }
5952 if let Some(_) = self.type_ {
5953 return 3;
5954 }
5955 if let Some(_) = self.kind {
5956 return 2;
5957 }
5958 if let Some(_) = self.handle {
5959 return 1;
5960 }
5961 0
5962 }
5963 }
5964
5965 impl fidl::encoding::ValueTypeMarker for ServiceInfo {
5966 type Borrowed<'a> = &'a Self;
5967 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5968 value
5969 }
5970 }
5971
5972 unsafe impl fidl::encoding::TypeMarker for ServiceInfo {
5973 type Owned = Self;
5974
5975 #[inline(always)]
5976 fn inline_align(_context: fidl::encoding::Context) -> usize {
5977 8
5978 }
5979
5980 #[inline(always)]
5981 fn inline_size(_context: fidl::encoding::Context) -> usize {
5982 16
5983 }
5984 }
5985
5986 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ServiceInfo, D>
5987 for &ServiceInfo
5988 {
5989 unsafe fn encode(
5990 self,
5991 encoder: &mut fidl::encoding::Encoder<'_, D>,
5992 offset: usize,
5993 mut depth: fidl::encoding::Depth,
5994 ) -> fidl::Result<()> {
5995 encoder.debug_check_bounds::<ServiceInfo>(offset);
5996 let max_ordinal: u64 = self.max_ordinal_present();
5998 encoder.write_num(max_ordinal, offset);
5999 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6000 if max_ordinal == 0 {
6002 return Ok(());
6003 }
6004 depth.increment()?;
6005 let envelope_size = 8;
6006 let bytes_len = max_ordinal as usize * envelope_size;
6007 #[allow(unused_variables)]
6008 let offset = encoder.out_of_line_offset(bytes_len);
6009 let mut _prev_end_offset: usize = 0;
6010 if 1 > max_ordinal {
6011 return Ok(());
6012 }
6013
6014 let cur_offset: usize = (1 - 1) * envelope_size;
6017
6018 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6020
6021 fidl::encoding::encode_in_envelope_optional::<ServiceHandle, D>(
6026 self.handle
6027 .as_ref()
6028 .map(<ServiceHandle as fidl::encoding::ValueTypeMarker>::borrow),
6029 encoder,
6030 offset + cur_offset,
6031 depth,
6032 )?;
6033
6034 _prev_end_offset = cur_offset + envelope_size;
6035 if 2 > max_ordinal {
6036 return Ok(());
6037 }
6038
6039 let cur_offset: usize = (2 - 1) * envelope_size;
6042
6043 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6045
6046 fidl::encoding::encode_in_envelope_optional::<ServiceKind, D>(
6051 self.kind.as_ref().map(<ServiceKind as fidl::encoding::ValueTypeMarker>::borrow),
6052 encoder,
6053 offset + cur_offset,
6054 depth,
6055 )?;
6056
6057 _prev_end_offset = cur_offset + envelope_size;
6058 if 3 > max_ordinal {
6059 return Ok(());
6060 }
6061
6062 let cur_offset: usize = (3 - 1) * envelope_size;
6065
6066 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6068
6069 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::Uuid, D>(
6074 self.type_
6075 .as_ref()
6076 .map(<fidl_fuchsia_bluetooth::Uuid as fidl::encoding::ValueTypeMarker>::borrow),
6077 encoder,
6078 offset + cur_offset,
6079 depth,
6080 )?;
6081
6082 _prev_end_offset = cur_offset + envelope_size;
6083 if 4 > max_ordinal {
6084 return Ok(());
6085 }
6086
6087 let cur_offset: usize = (4 - 1) * envelope_size;
6090
6091 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6093
6094 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<Characteristic, 32767>, D>(
6099 self.characteristics.as_ref().map(<fidl::encoding::Vector<Characteristic, 32767> as fidl::encoding::ValueTypeMarker>::borrow),
6100 encoder, offset + cur_offset, depth
6101 )?;
6102
6103 _prev_end_offset = cur_offset + envelope_size;
6104 if 5 > max_ordinal {
6105 return Ok(());
6106 }
6107
6108 let cur_offset: usize = (5 - 1) * envelope_size;
6111
6112 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6114
6115 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ServiceHandle, 65535>, D>(
6120 self.includes.as_ref().map(<fidl::encoding::Vector<ServiceHandle, 65535> as fidl::encoding::ValueTypeMarker>::borrow),
6121 encoder, offset + cur_offset, depth
6122 )?;
6123
6124 _prev_end_offset = cur_offset + envelope_size;
6125
6126 Ok(())
6127 }
6128 }
6129
6130 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ServiceInfo {
6131 #[inline(always)]
6132 fn new_empty() -> Self {
6133 Self::default()
6134 }
6135
6136 unsafe fn decode(
6137 &mut self,
6138 decoder: &mut fidl::encoding::Decoder<'_, D>,
6139 offset: usize,
6140 mut depth: fidl::encoding::Depth,
6141 ) -> fidl::Result<()> {
6142 decoder.debug_check_bounds::<Self>(offset);
6143 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6144 None => return Err(fidl::Error::NotNullable),
6145 Some(len) => len,
6146 };
6147 if len == 0 {
6149 return Ok(());
6150 };
6151 depth.increment()?;
6152 let envelope_size = 8;
6153 let bytes_len = len * envelope_size;
6154 let offset = decoder.out_of_line_offset(bytes_len)?;
6155 let mut _next_ordinal_to_read = 0;
6157 let mut next_offset = offset;
6158 let end_offset = offset + bytes_len;
6159 _next_ordinal_to_read += 1;
6160 if next_offset >= end_offset {
6161 return Ok(());
6162 }
6163
6164 while _next_ordinal_to_read < 1 {
6166 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6167 _next_ordinal_to_read += 1;
6168 next_offset += envelope_size;
6169 }
6170
6171 let next_out_of_line = decoder.next_out_of_line();
6172 let handles_before = decoder.remaining_handles();
6173 if let Some((inlined, num_bytes, num_handles)) =
6174 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6175 {
6176 let member_inline_size =
6177 <ServiceHandle as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6178 if inlined != (member_inline_size <= 4) {
6179 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6180 }
6181 let inner_offset;
6182 let mut inner_depth = depth.clone();
6183 if inlined {
6184 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6185 inner_offset = next_offset;
6186 } else {
6187 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6188 inner_depth.increment()?;
6189 }
6190 let val_ref = self.handle.get_or_insert_with(|| fidl::new_empty!(ServiceHandle, D));
6191 fidl::decode!(ServiceHandle, D, val_ref, decoder, inner_offset, inner_depth)?;
6192 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6193 {
6194 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6195 }
6196 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6197 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6198 }
6199 }
6200
6201 next_offset += envelope_size;
6202 _next_ordinal_to_read += 1;
6203 if next_offset >= end_offset {
6204 return Ok(());
6205 }
6206
6207 while _next_ordinal_to_read < 2 {
6209 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6210 _next_ordinal_to_read += 1;
6211 next_offset += envelope_size;
6212 }
6213
6214 let next_out_of_line = decoder.next_out_of_line();
6215 let handles_before = decoder.remaining_handles();
6216 if let Some((inlined, num_bytes, num_handles)) =
6217 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6218 {
6219 let member_inline_size =
6220 <ServiceKind as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6221 if inlined != (member_inline_size <= 4) {
6222 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6223 }
6224 let inner_offset;
6225 let mut inner_depth = depth.clone();
6226 if inlined {
6227 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6228 inner_offset = next_offset;
6229 } else {
6230 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6231 inner_depth.increment()?;
6232 }
6233 let val_ref = self.kind.get_or_insert_with(|| fidl::new_empty!(ServiceKind, D));
6234 fidl::decode!(ServiceKind, D, val_ref, decoder, inner_offset, inner_depth)?;
6235 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6236 {
6237 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6238 }
6239 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6240 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6241 }
6242 }
6243
6244 next_offset += envelope_size;
6245 _next_ordinal_to_read += 1;
6246 if next_offset >= end_offset {
6247 return Ok(());
6248 }
6249
6250 while _next_ordinal_to_read < 3 {
6252 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6253 _next_ordinal_to_read += 1;
6254 next_offset += envelope_size;
6255 }
6256
6257 let next_out_of_line = decoder.next_out_of_line();
6258 let handles_before = decoder.remaining_handles();
6259 if let Some((inlined, num_bytes, num_handles)) =
6260 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6261 {
6262 let member_inline_size =
6263 <fidl_fuchsia_bluetooth::Uuid as fidl::encoding::TypeMarker>::inline_size(
6264 decoder.context,
6265 );
6266 if inlined != (member_inline_size <= 4) {
6267 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6268 }
6269 let inner_offset;
6270 let mut inner_depth = depth.clone();
6271 if inlined {
6272 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6273 inner_offset = next_offset;
6274 } else {
6275 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6276 inner_depth.increment()?;
6277 }
6278 let val_ref = self
6279 .type_
6280 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_bluetooth::Uuid, D));
6281 fidl::decode!(
6282 fidl_fuchsia_bluetooth::Uuid,
6283 D,
6284 val_ref,
6285 decoder,
6286 inner_offset,
6287 inner_depth
6288 )?;
6289 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6290 {
6291 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6292 }
6293 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6294 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6295 }
6296 }
6297
6298 next_offset += envelope_size;
6299 _next_ordinal_to_read += 1;
6300 if next_offset >= end_offset {
6301 return Ok(());
6302 }
6303
6304 while _next_ordinal_to_read < 4 {
6306 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6307 _next_ordinal_to_read += 1;
6308 next_offset += envelope_size;
6309 }
6310
6311 let next_out_of_line = decoder.next_out_of_line();
6312 let handles_before = decoder.remaining_handles();
6313 if let Some((inlined, num_bytes, num_handles)) =
6314 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6315 {
6316 let member_inline_size = <fidl::encoding::Vector<Characteristic, 32767> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6317 if inlined != (member_inline_size <= 4) {
6318 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6319 }
6320 let inner_offset;
6321 let mut inner_depth = depth.clone();
6322 if inlined {
6323 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6324 inner_offset = next_offset;
6325 } else {
6326 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6327 inner_depth.increment()?;
6328 }
6329 let val_ref = self.characteristics.get_or_insert_with(
6330 || fidl::new_empty!(fidl::encoding::Vector<Characteristic, 32767>, D),
6331 );
6332 fidl::decode!(fidl::encoding::Vector<Characteristic, 32767>, D, val_ref, decoder, inner_offset, inner_depth)?;
6333 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6334 {
6335 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6336 }
6337 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6338 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6339 }
6340 }
6341
6342 next_offset += envelope_size;
6343 _next_ordinal_to_read += 1;
6344 if next_offset >= end_offset {
6345 return Ok(());
6346 }
6347
6348 while _next_ordinal_to_read < 5 {
6350 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6351 _next_ordinal_to_read += 1;
6352 next_offset += envelope_size;
6353 }
6354
6355 let next_out_of_line = decoder.next_out_of_line();
6356 let handles_before = decoder.remaining_handles();
6357 if let Some((inlined, num_bytes, num_handles)) =
6358 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6359 {
6360 let member_inline_size = <fidl::encoding::Vector<ServiceHandle, 65535> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6361 if inlined != (member_inline_size <= 4) {
6362 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6363 }
6364 let inner_offset;
6365 let mut inner_depth = depth.clone();
6366 if inlined {
6367 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6368 inner_offset = next_offset;
6369 } else {
6370 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6371 inner_depth.increment()?;
6372 }
6373 let val_ref = self.includes.get_or_insert_with(
6374 || fidl::new_empty!(fidl::encoding::Vector<ServiceHandle, 65535>, D),
6375 );
6376 fidl::decode!(fidl::encoding::Vector<ServiceHandle, 65535>, D, val_ref, decoder, inner_offset, inner_depth)?;
6377 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6378 {
6379 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6380 }
6381 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6382 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6383 }
6384 }
6385
6386 next_offset += envelope_size;
6387
6388 while next_offset < end_offset {
6390 _next_ordinal_to_read += 1;
6391 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6392 next_offset += envelope_size;
6393 }
6394
6395 Ok(())
6396 }
6397 }
6398
6399 impl ValueChangedParameters {
6400 #[inline(always)]
6401 fn max_ordinal_present(&self) -> u64 {
6402 if let Some(_) = self.peer_ids {
6403 return 3;
6404 }
6405 if let Some(_) = self.value {
6406 return 2;
6407 }
6408 if let Some(_) = self.handle {
6409 return 1;
6410 }
6411 0
6412 }
6413 }
6414
6415 impl fidl::encoding::ValueTypeMarker for ValueChangedParameters {
6416 type Borrowed<'a> = &'a Self;
6417 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6418 value
6419 }
6420 }
6421
6422 unsafe impl fidl::encoding::TypeMarker for ValueChangedParameters {
6423 type Owned = Self;
6424
6425 #[inline(always)]
6426 fn inline_align(_context: fidl::encoding::Context) -> usize {
6427 8
6428 }
6429
6430 #[inline(always)]
6431 fn inline_size(_context: fidl::encoding::Context) -> usize {
6432 16
6433 }
6434 }
6435
6436 unsafe impl<D: fidl::encoding::ResourceDialect>
6437 fidl::encoding::Encode<ValueChangedParameters, D> for &ValueChangedParameters
6438 {
6439 unsafe fn encode(
6440 self,
6441 encoder: &mut fidl::encoding::Encoder<'_, D>,
6442 offset: usize,
6443 mut depth: fidl::encoding::Depth,
6444 ) -> fidl::Result<()> {
6445 encoder.debug_check_bounds::<ValueChangedParameters>(offset);
6446 let max_ordinal: u64 = self.max_ordinal_present();
6448 encoder.write_num(max_ordinal, offset);
6449 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6450 if max_ordinal == 0 {
6452 return Ok(());
6453 }
6454 depth.increment()?;
6455 let envelope_size = 8;
6456 let bytes_len = max_ordinal as usize * envelope_size;
6457 #[allow(unused_variables)]
6458 let offset = encoder.out_of_line_offset(bytes_len);
6459 let mut _prev_end_offset: usize = 0;
6460 if 1 > max_ordinal {
6461 return Ok(());
6462 }
6463
6464 let cur_offset: usize = (1 - 1) * envelope_size;
6467
6468 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6470
6471 fidl::encoding::encode_in_envelope_optional::<Handle, D>(
6476 self.handle.as_ref().map(<Handle as fidl::encoding::ValueTypeMarker>::borrow),
6477 encoder,
6478 offset + cur_offset,
6479 depth,
6480 )?;
6481
6482 _prev_end_offset = cur_offset + envelope_size;
6483 if 2 > max_ordinal {
6484 return Ok(());
6485 }
6486
6487 let cur_offset: usize = (2 - 1) * envelope_size;
6490
6491 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6493
6494 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 512>, D>(
6499 self.value.as_ref().map(
6500 <fidl::encoding::Vector<u8, 512> as fidl::encoding::ValueTypeMarker>::borrow,
6501 ),
6502 encoder,
6503 offset + cur_offset,
6504 depth,
6505 )?;
6506
6507 _prev_end_offset = cur_offset + envelope_size;
6508 if 3 > max_ordinal {
6509 return Ok(());
6510 }
6511
6512 let cur_offset: usize = (3 - 1) * envelope_size;
6515
6516 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6518
6519 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::PeerId>, D>(
6524 self.peer_ids.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::PeerId> as fidl::encoding::ValueTypeMarker>::borrow),
6525 encoder, offset + cur_offset, depth
6526 )?;
6527
6528 _prev_end_offset = cur_offset + envelope_size;
6529
6530 Ok(())
6531 }
6532 }
6533
6534 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
6535 for ValueChangedParameters
6536 {
6537 #[inline(always)]
6538 fn new_empty() -> Self {
6539 Self::default()
6540 }
6541
6542 unsafe fn decode(
6543 &mut self,
6544 decoder: &mut fidl::encoding::Decoder<'_, D>,
6545 offset: usize,
6546 mut depth: fidl::encoding::Depth,
6547 ) -> fidl::Result<()> {
6548 decoder.debug_check_bounds::<Self>(offset);
6549 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6550 None => return Err(fidl::Error::NotNullable),
6551 Some(len) => len,
6552 };
6553 if len == 0 {
6555 return Ok(());
6556 };
6557 depth.increment()?;
6558 let envelope_size = 8;
6559 let bytes_len = len * envelope_size;
6560 let offset = decoder.out_of_line_offset(bytes_len)?;
6561 let mut _next_ordinal_to_read = 0;
6563 let mut next_offset = offset;
6564 let end_offset = offset + bytes_len;
6565 _next_ordinal_to_read += 1;
6566 if next_offset >= end_offset {
6567 return Ok(());
6568 }
6569
6570 while _next_ordinal_to_read < 1 {
6572 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6573 _next_ordinal_to_read += 1;
6574 next_offset += envelope_size;
6575 }
6576
6577 let next_out_of_line = decoder.next_out_of_line();
6578 let handles_before = decoder.remaining_handles();
6579 if let Some((inlined, num_bytes, num_handles)) =
6580 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6581 {
6582 let member_inline_size =
6583 <Handle as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6584 if inlined != (member_inline_size <= 4) {
6585 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6586 }
6587 let inner_offset;
6588 let mut inner_depth = depth.clone();
6589 if inlined {
6590 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6591 inner_offset = next_offset;
6592 } else {
6593 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6594 inner_depth.increment()?;
6595 }
6596 let val_ref = self.handle.get_or_insert_with(|| fidl::new_empty!(Handle, D));
6597 fidl::decode!(Handle, D, val_ref, decoder, inner_offset, inner_depth)?;
6598 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6599 {
6600 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6601 }
6602 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6603 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6604 }
6605 }
6606
6607 next_offset += envelope_size;
6608 _next_ordinal_to_read += 1;
6609 if next_offset >= end_offset {
6610 return Ok(());
6611 }
6612
6613 while _next_ordinal_to_read < 2 {
6615 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6616 _next_ordinal_to_read += 1;
6617 next_offset += envelope_size;
6618 }
6619
6620 let next_out_of_line = decoder.next_out_of_line();
6621 let handles_before = decoder.remaining_handles();
6622 if let Some((inlined, num_bytes, num_handles)) =
6623 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6624 {
6625 let member_inline_size =
6626 <fidl::encoding::Vector<u8, 512> as fidl::encoding::TypeMarker>::inline_size(
6627 decoder.context,
6628 );
6629 if inlined != (member_inline_size <= 4) {
6630 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6631 }
6632 let inner_offset;
6633 let mut inner_depth = depth.clone();
6634 if inlined {
6635 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6636 inner_offset = next_offset;
6637 } else {
6638 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6639 inner_depth.increment()?;
6640 }
6641 let val_ref = self
6642 .value
6643 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 512>, D));
6644 fidl::decode!(fidl::encoding::Vector<u8, 512>, D, val_ref, decoder, inner_offset, inner_depth)?;
6645 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6646 {
6647 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6648 }
6649 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6650 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6651 }
6652 }
6653
6654 next_offset += envelope_size;
6655 _next_ordinal_to_read += 1;
6656 if next_offset >= end_offset {
6657 return Ok(());
6658 }
6659
6660 while _next_ordinal_to_read < 3 {
6662 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6663 _next_ordinal_to_read += 1;
6664 next_offset += envelope_size;
6665 }
6666
6667 let next_out_of_line = decoder.next_out_of_line();
6668 let handles_before = decoder.remaining_handles();
6669 if let Some((inlined, num_bytes, num_handles)) =
6670 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6671 {
6672 let member_inline_size = <fidl::encoding::UnboundedVector<
6673 fidl_fuchsia_bluetooth::PeerId,
6674 > as fidl::encoding::TypeMarker>::inline_size(
6675 decoder.context
6676 );
6677 if inlined != (member_inline_size <= 4) {
6678 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6679 }
6680 let inner_offset;
6681 let mut inner_depth = depth.clone();
6682 if inlined {
6683 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6684 inner_offset = next_offset;
6685 } else {
6686 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6687 inner_depth.increment()?;
6688 }
6689 let val_ref = self.peer_ids.get_or_insert_with(|| {
6690 fidl::new_empty!(
6691 fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::PeerId>,
6692 D
6693 )
6694 });
6695 fidl::decode!(
6696 fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::PeerId>,
6697 D,
6698 val_ref,
6699 decoder,
6700 inner_offset,
6701 inner_depth
6702 )?;
6703 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6704 {
6705 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6706 }
6707 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6708 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6709 }
6710 }
6711
6712 next_offset += envelope_size;
6713
6714 while next_offset < end_offset {
6716 _next_ordinal_to_read += 1;
6717 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6718 next_offset += envelope_size;
6719 }
6720
6721 Ok(())
6722 }
6723 }
6724
6725 impl WriteOptions {
6726 #[inline(always)]
6727 fn max_ordinal_present(&self) -> u64 {
6728 if let Some(_) = self.offset {
6729 return 2;
6730 }
6731 if let Some(_) = self.write_mode {
6732 return 1;
6733 }
6734 0
6735 }
6736 }
6737
6738 impl fidl::encoding::ValueTypeMarker for WriteOptions {
6739 type Borrowed<'a> = &'a Self;
6740 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6741 value
6742 }
6743 }
6744
6745 unsafe impl fidl::encoding::TypeMarker for WriteOptions {
6746 type Owned = Self;
6747
6748 #[inline(always)]
6749 fn inline_align(_context: fidl::encoding::Context) -> usize {
6750 8
6751 }
6752
6753 #[inline(always)]
6754 fn inline_size(_context: fidl::encoding::Context) -> usize {
6755 16
6756 }
6757 }
6758
6759 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WriteOptions, D>
6760 for &WriteOptions
6761 {
6762 unsafe fn encode(
6763 self,
6764 encoder: &mut fidl::encoding::Encoder<'_, D>,
6765 offset: usize,
6766 mut depth: fidl::encoding::Depth,
6767 ) -> fidl::Result<()> {
6768 encoder.debug_check_bounds::<WriteOptions>(offset);
6769 let max_ordinal: u64 = self.max_ordinal_present();
6771 encoder.write_num(max_ordinal, offset);
6772 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6773 if max_ordinal == 0 {
6775 return Ok(());
6776 }
6777 depth.increment()?;
6778 let envelope_size = 8;
6779 let bytes_len = max_ordinal as usize * envelope_size;
6780 #[allow(unused_variables)]
6781 let offset = encoder.out_of_line_offset(bytes_len);
6782 let mut _prev_end_offset: usize = 0;
6783 if 1 > max_ordinal {
6784 return Ok(());
6785 }
6786
6787 let cur_offset: usize = (1 - 1) * envelope_size;
6790
6791 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6793
6794 fidl::encoding::encode_in_envelope_optional::<WriteMode, D>(
6799 self.write_mode
6800 .as_ref()
6801 .map(<WriteMode as fidl::encoding::ValueTypeMarker>::borrow),
6802 encoder,
6803 offset + cur_offset,
6804 depth,
6805 )?;
6806
6807 _prev_end_offset = cur_offset + envelope_size;
6808 if 2 > max_ordinal {
6809 return Ok(());
6810 }
6811
6812 let cur_offset: usize = (2 - 1) * envelope_size;
6815
6816 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6818
6819 fidl::encoding::encode_in_envelope_optional::<u16, D>(
6824 self.offset.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
6825 encoder,
6826 offset + cur_offset,
6827 depth,
6828 )?;
6829
6830 _prev_end_offset = cur_offset + envelope_size;
6831
6832 Ok(())
6833 }
6834 }
6835
6836 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WriteOptions {
6837 #[inline(always)]
6838 fn new_empty() -> Self {
6839 Self::default()
6840 }
6841
6842 unsafe fn decode(
6843 &mut self,
6844 decoder: &mut fidl::encoding::Decoder<'_, D>,
6845 offset: usize,
6846 mut depth: fidl::encoding::Depth,
6847 ) -> fidl::Result<()> {
6848 decoder.debug_check_bounds::<Self>(offset);
6849 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6850 None => return Err(fidl::Error::NotNullable),
6851 Some(len) => len,
6852 };
6853 if len == 0 {
6855 return Ok(());
6856 };
6857 depth.increment()?;
6858 let envelope_size = 8;
6859 let bytes_len = len * envelope_size;
6860 let offset = decoder.out_of_line_offset(bytes_len)?;
6861 let mut _next_ordinal_to_read = 0;
6863 let mut next_offset = offset;
6864 let end_offset = offset + bytes_len;
6865 _next_ordinal_to_read += 1;
6866 if next_offset >= end_offset {
6867 return Ok(());
6868 }
6869
6870 while _next_ordinal_to_read < 1 {
6872 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6873 _next_ordinal_to_read += 1;
6874 next_offset += envelope_size;
6875 }
6876
6877 let next_out_of_line = decoder.next_out_of_line();
6878 let handles_before = decoder.remaining_handles();
6879 if let Some((inlined, num_bytes, num_handles)) =
6880 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6881 {
6882 let member_inline_size =
6883 <WriteMode as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6884 if inlined != (member_inline_size <= 4) {
6885 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6886 }
6887 let inner_offset;
6888 let mut inner_depth = depth.clone();
6889 if inlined {
6890 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6891 inner_offset = next_offset;
6892 } else {
6893 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6894 inner_depth.increment()?;
6895 }
6896 let val_ref = self.write_mode.get_or_insert_with(|| fidl::new_empty!(WriteMode, D));
6897 fidl::decode!(WriteMode, D, val_ref, decoder, inner_offset, inner_depth)?;
6898 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6899 {
6900 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6901 }
6902 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6903 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6904 }
6905 }
6906
6907 next_offset += envelope_size;
6908 _next_ordinal_to_read += 1;
6909 if next_offset >= end_offset {
6910 return Ok(());
6911 }
6912
6913 while _next_ordinal_to_read < 2 {
6915 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6916 _next_ordinal_to_read += 1;
6917 next_offset += envelope_size;
6918 }
6919
6920 let next_out_of_line = decoder.next_out_of_line();
6921 let handles_before = decoder.remaining_handles();
6922 if let Some((inlined, num_bytes, num_handles)) =
6923 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6924 {
6925 let member_inline_size =
6926 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6927 if inlined != (member_inline_size <= 4) {
6928 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6929 }
6930 let inner_offset;
6931 let mut inner_depth = depth.clone();
6932 if inlined {
6933 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6934 inner_offset = next_offset;
6935 } else {
6936 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6937 inner_depth.increment()?;
6938 }
6939 let val_ref = self.offset.get_or_insert_with(|| fidl::new_empty!(u16, D));
6940 fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
6941 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6942 {
6943 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6944 }
6945 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6946 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6947 }
6948 }
6949
6950 next_offset += envelope_size;
6951
6952 while next_offset < end_offset {
6954 _next_ordinal_to_read += 1;
6955 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6956 next_offset += envelope_size;
6957 }
6958
6959 Ok(())
6960 }
6961 }
6962
6963 impl fidl::encoding::ValueTypeMarker for ReadOptions {
6964 type Borrowed<'a> = &'a Self;
6965 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6966 value
6967 }
6968 }
6969
6970 unsafe impl fidl::encoding::TypeMarker for ReadOptions {
6971 type Owned = Self;
6972
6973 #[inline(always)]
6974 fn inline_align(_context: fidl::encoding::Context) -> usize {
6975 8
6976 }
6977
6978 #[inline(always)]
6979 fn inline_size(_context: fidl::encoding::Context) -> usize {
6980 16
6981 }
6982 }
6983
6984 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ReadOptions, D>
6985 for &ReadOptions
6986 {
6987 #[inline]
6988 unsafe fn encode(
6989 self,
6990 encoder: &mut fidl::encoding::Encoder<'_, D>,
6991 offset: usize,
6992 _depth: fidl::encoding::Depth,
6993 ) -> fidl::Result<()> {
6994 encoder.debug_check_bounds::<ReadOptions>(offset);
6995 encoder.write_num::<u64>(self.ordinal(), offset);
6996 match self {
6997 ReadOptions::ShortRead(ref val) => {
6998 fidl::encoding::encode_in_envelope::<ShortReadOptions, D>(
6999 <ShortReadOptions as fidl::encoding::ValueTypeMarker>::borrow(val),
7000 encoder,
7001 offset + 8,
7002 _depth,
7003 )
7004 }
7005 ReadOptions::LongRead(ref val) => {
7006 fidl::encoding::encode_in_envelope::<LongReadOptions, D>(
7007 <LongReadOptions as fidl::encoding::ValueTypeMarker>::borrow(val),
7008 encoder,
7009 offset + 8,
7010 _depth,
7011 )
7012 }
7013 ReadOptions::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
7014 }
7015 }
7016 }
7017
7018 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ReadOptions {
7019 #[inline(always)]
7020 fn new_empty() -> Self {
7021 Self::__SourceBreaking { unknown_ordinal: 0 }
7022 }
7023
7024 #[inline]
7025 unsafe fn decode(
7026 &mut self,
7027 decoder: &mut fidl::encoding::Decoder<'_, D>,
7028 offset: usize,
7029 mut depth: fidl::encoding::Depth,
7030 ) -> fidl::Result<()> {
7031 decoder.debug_check_bounds::<Self>(offset);
7032 #[allow(unused_variables)]
7033 let next_out_of_line = decoder.next_out_of_line();
7034 let handles_before = decoder.remaining_handles();
7035 let (ordinal, inlined, num_bytes, num_handles) =
7036 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
7037
7038 let member_inline_size = match ordinal {
7039 1 => <ShortReadOptions as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7040 2 => <LongReadOptions as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7041 0 => return Err(fidl::Error::UnknownUnionTag),
7042 _ => num_bytes as usize,
7043 };
7044
7045 if inlined != (member_inline_size <= 4) {
7046 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7047 }
7048 let _inner_offset;
7049 if inlined {
7050 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
7051 _inner_offset = offset + 8;
7052 } else {
7053 depth.increment()?;
7054 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7055 }
7056 match ordinal {
7057 1 => {
7058 #[allow(irrefutable_let_patterns)]
7059 if let ReadOptions::ShortRead(_) = self {
7060 } else {
7062 *self = ReadOptions::ShortRead(fidl::new_empty!(ShortReadOptions, D));
7064 }
7065 #[allow(irrefutable_let_patterns)]
7066 if let ReadOptions::ShortRead(ref mut val) = self {
7067 fidl::decode!(ShortReadOptions, D, val, decoder, _inner_offset, depth)?;
7068 } else {
7069 unreachable!()
7070 }
7071 }
7072 2 => {
7073 #[allow(irrefutable_let_patterns)]
7074 if let ReadOptions::LongRead(_) = self {
7075 } else {
7077 *self = ReadOptions::LongRead(fidl::new_empty!(LongReadOptions, D));
7079 }
7080 #[allow(irrefutable_let_patterns)]
7081 if let ReadOptions::LongRead(ref mut val) = self {
7082 fidl::decode!(LongReadOptions, D, val, decoder, _inner_offset, depth)?;
7083 } else {
7084 unreachable!()
7085 }
7086 }
7087 #[allow(deprecated)]
7088 ordinal => {
7089 for _ in 0..num_handles {
7090 decoder.drop_next_handle()?;
7091 }
7092 *self = ReadOptions::__SourceBreaking { unknown_ordinal: ordinal };
7093 }
7094 }
7095 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
7096 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7097 }
7098 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7099 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7100 }
7101 Ok(())
7102 }
7103 }
7104}