fidl_fuchsia_bluetooth_gatt__common/
fidl_fuchsia_bluetooth_gatt__common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub const MAX_ATTRIBUTE_COUNT: u16 = 65535;
12
13pub const MAX_CHARACTERISTIC_COUNT: u16 = 32767;
14
15pub const MAX_DESCRIPTOR_COUNT: u16 = 65532;
16
17pub const MAX_READ_BY_TYPE_RESULTS: u16 = 189;
18
19pub const MAX_READ_BY_TYPE_VALUE_LENGTH: u16 = 253;
20
21pub const MAX_SERVICE_COUNT: u16 = MAX_ATTRIBUTE_COUNT as u16;
22
23pub const MAX_VALUE_LENGTH: u16 = 512;
24
25pub const PROPERTY_AUTHENTICATED_SIGNED_WRITES: u32 = 64;
26
27/// Possible values for the characteristic properties bitfield. These specify the
28/// GATT procedures that are allowed for a particular characteristic.
29pub const PROPERTY_BROADCAST: u32 = 1;
30
31pub const PROPERTY_INDICATE: u32 = 32;
32
33pub const PROPERTY_NOTIFY: u32 = 16;
34
35pub const PROPERTY_READ: u32 = 2;
36
37pub const PROPERTY_RELIABLE_WRITE: u32 = 256;
38
39pub const PROPERTY_WRITABLE_AUXILIARIES: u32 = 512;
40
41pub const PROPERTY_WRITE: u32 = 8;
42
43pub const PROPERTY_WRITE_WITHOUT_RESPONSE: u32 = 4;
44
45/// Errors that are returned by bluetooth.gatt methods.
46#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
47#[repr(u32)]
48pub enum Error {
49    /// A general error occurred that can not be classified as one of the more specific statuses.
50    Failure = 1,
51    /// Indicates that the response received from the server was invalid.
52    InvalidResponse = 2,
53    /// Indicates that more results were read than can fit in a FIDL response. Consider
54    /// reading attributes individually.
55    TooManyResults = 3,
56    /// This attribute requires authorization, but the client is not authorized.
57    InsufficientAuthorization = 4,
58    /// This attribute requires authentication, but the client is not authenticated.
59    InsufficientAuthentication = 5,
60    /// This attribute requires a connection encrypted by a larger encryption key.
61    InsufficientEncryptionKeySize = 6,
62    /// This attribute requires encryption, but the connection is not encrypted.
63    InsufficientEncryption = 7,
64    /// This attribute is not readable.
65    ReadNotPermitted = 8,
66}
67
68impl Error {
69    #[inline]
70    pub fn from_primitive(prim: u32) -> Option<Self> {
71        match prim {
72            1 => Some(Self::Failure),
73            2 => Some(Self::InvalidResponse),
74            3 => Some(Self::TooManyResults),
75            4 => Some(Self::InsufficientAuthorization),
76            5 => Some(Self::InsufficientAuthentication),
77            6 => Some(Self::InsufficientEncryptionKeySize),
78            7 => Some(Self::InsufficientEncryption),
79            8 => Some(Self::ReadNotPermitted),
80            _ => None,
81        }
82    }
83
84    #[inline]
85    pub const fn into_primitive(self) -> u32 {
86        self as u32
87    }
88}
89
90/// Codes that can be returned in the `protocol_error_code` field of a
91/// bluetooth.Error.
92#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
93#[repr(u32)]
94pub enum ErrorCode {
95    /// Indicates that the operation was successful.
96    NoError = 0,
97    /// Indicates that the offset used in a read or write request exceeds the
98    /// bounds of the value.
99    InvalidOffset = 1,
100    /// Indicates that the value given in a write request would exceed the maximum
101    /// length allowed for the destionation characteristic or descriptor.
102    InvalidValueLength = 2,
103    /// Indicates that a read or write request is not permitted.
104    NotPermitted = 3,
105}
106
107impl ErrorCode {
108    #[inline]
109    pub fn from_primitive(prim: u32) -> Option<Self> {
110        match prim {
111            0 => Some(Self::NoError),
112            1 => Some(Self::InvalidOffset),
113            2 => Some(Self::InvalidValueLength),
114            3 => Some(Self::NotPermitted),
115            _ => None,
116        }
117    }
118
119    #[inline]
120    pub const fn into_primitive(self) -> u32 {
121        self as u32
122    }
123}
124
125/// Represents the reliability mode during long and prepared write operations.
126///
127/// If enabled, every value blob is verified against an echo response from the server.
128/// The procedure is aborted if a value blob has not been reliably delivered to the peer.
129#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
130#[repr(u32)]
131pub enum ReliableMode {
132    Disabled = 1,
133    Enabled = 2,
134}
135
136impl ReliableMode {
137    #[inline]
138    pub fn from_primitive(prim: u32) -> Option<Self> {
139        match prim {
140            1 => Some(Self::Disabled),
141            2 => Some(Self::Enabled),
142            _ => None,
143        }
144    }
145
146    #[inline]
147    pub const fn into_primitive(self) -> u32 {
148        self as u32
149    }
150}
151
152/// Specifies the access permissions for a specific attribute value.
153#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
154pub struct AttributePermissions {
155    /// Specifies whether or not an attribute has the read permission. If null,
156    /// then the attribute value cannot be read. Otherwise, it can be read only if
157    /// the permissions specified in the Permissions struct are satisfied.
158    pub read: Option<Box<SecurityRequirements>>,
159    /// Specifies whether or not an attribute has the write permission. If null,
160    /// then the attribute value cannot be written. Otherwise, it be written only
161    /// if the permissions specified in the Permissions struct are satisfied.
162    pub write: Option<Box<SecurityRequirements>>,
163    /// Specifies the security requirements for a client to subscribe to
164    /// notifications or indications on a characteristic. A characteristic's
165    /// support for notifications or indiciations is specified using the NOTIFY and
166    /// INDICATE characteristic properties. If a local characteristic has one of
167    /// these properties then this field can not be null. Otherwise, this field
168    /// must be left as null.
169    ///
170    /// This field is ignored for Descriptors.
171    pub update: Option<Box<SecurityRequirements>>,
172}
173
174impl fidl::Persistable for AttributePermissions {}
175
176/// Represents a local or remote GATT characteristic.
177#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
178pub struct Characteristic {
179    /// Uniquely identifies this characteristic within a service.
180    pub id: u64,
181    /// The 128-bit UUID that identifies the type of this characteristic. This is a
182    /// string in the canonical 8-4-4-4-12 format.
183    pub type_: String,
184    /// The characteristic properties bitfield. See kProperty* above for possible
185    /// values.
186    pub properties: u32,
187    /// The attribute permissions of this characteristic. For remote
188    /// characteristics, this value will be null until the permissions are
189    /// discovered via read and write requests.
190    ///
191    /// For local characteristics, this value is mandatory.
192    pub permissions: Option<Box<AttributePermissions>>,
193    /// The descriptors of this characteristic.
194    pub descriptors: Option<Vec<Descriptor>>,
195}
196
197impl fidl::Persistable for Characteristic {}
198
199#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
200pub struct ClientListServicesRequest {
201    pub uuids: Option<Vec<String>>,
202}
203
204impl fidl::Persistable for ClientListServicesRequest {}
205
206#[derive(Clone, Debug, PartialEq)]
207pub struct ClientListServicesResponse {
208    pub status: fidl_fuchsia_bluetooth__common::Status,
209    pub services: Vec<ServiceInfo>,
210}
211
212impl fidl::Persistable for ClientListServicesResponse {}
213
214/// Represents a local or remote GATT characteristic descriptor.
215#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
216pub struct Descriptor {
217    /// Uniquely identifies this descriptor within the characteristic that it
218    /// belongs to.
219    pub id: u64,
220    /// The 128-bit UUID that identifies the type of this descriptor. This is a
221    /// string in the canonical 8-4-4-4-12 format.
222    pub type_: String,
223    /// The attribute permissions of this descriptor. For remote
224    /// descriptors, this value will be null until the permissions are
225    /// discovered via read and write requests.
226    ///
227    /// For local descriptors, this value is mandatory.
228    pub permissions: Option<Box<AttributePermissions>>,
229}
230
231impl fidl::Persistable for Descriptor {}
232
233#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
234pub struct LocalServiceDelegateOnCharacteristicConfigurationRequest {
235    pub characteristic_id: u64,
236    pub peer_id: String,
237    pub notify: bool,
238    pub indicate: bool,
239}
240
241impl fidl::Persistable for LocalServiceDelegateOnCharacteristicConfigurationRequest {}
242
243#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
244#[repr(C)]
245pub struct LocalServiceDelegateOnReadValueRequest {
246    pub id: u64,
247    pub offset: i32,
248}
249
250impl fidl::Persistable for LocalServiceDelegateOnReadValueRequest {}
251
252#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
253pub struct LocalServiceDelegateOnReadValueResponse {
254    pub value: Option<Vec<u8>>,
255    pub status: ErrorCode,
256}
257
258impl fidl::Persistable for LocalServiceDelegateOnReadValueResponse {}
259
260#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
261pub struct LocalServiceDelegateOnWriteValueRequest {
262    pub id: u64,
263    pub offset: u16,
264    pub value: Vec<u8>,
265}
266
267impl fidl::Persistable for LocalServiceDelegateOnWriteValueRequest {}
268
269#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
270pub struct LocalServiceDelegateOnWriteValueResponse {
271    pub status: ErrorCode,
272}
273
274impl fidl::Persistable for LocalServiceDelegateOnWriteValueResponse {}
275
276#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
277pub struct LocalServiceDelegateOnWriteWithoutResponseRequest {
278    pub id: u64,
279    pub offset: u16,
280    pub value: Vec<u8>,
281}
282
283impl fidl::Persistable for LocalServiceDelegateOnWriteWithoutResponseRequest {}
284
285#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
286pub struct LocalServiceNotifyValueRequest {
287    pub characteristic_id: u64,
288    pub peer_id: String,
289    pub value: Vec<u8>,
290    pub confirm: bool,
291}
292
293impl fidl::Persistable for LocalServiceNotifyValueRequest {}
294
295#[derive(Clone, Debug, PartialEq)]
296pub struct RemoteServiceDiscoverCharacteristicsResponse {
297    pub status: fidl_fuchsia_bluetooth__common::Status,
298    pub characteristics: Vec<Characteristic>,
299}
300
301impl fidl::Persistable for RemoteServiceDiscoverCharacteristicsResponse {}
302
303#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
304pub struct RemoteServiceNotifyCharacteristicRequest {
305    pub id: u64,
306    pub enable: bool,
307}
308
309impl fidl::Persistable for RemoteServiceNotifyCharacteristicRequest {}
310
311#[derive(Clone, Debug, PartialEq)]
312pub struct RemoteServiceNotifyCharacteristicResponse {
313    pub status: fidl_fuchsia_bluetooth__common::Status,
314}
315
316impl fidl::Persistable for RemoteServiceNotifyCharacteristicResponse {}
317
318#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
319pub struct RemoteServiceOnCharacteristicValueUpdatedRequest {
320    pub id: u64,
321    pub value: Vec<u8>,
322}
323
324impl fidl::Persistable for RemoteServiceOnCharacteristicValueUpdatedRequest {}
325
326#[derive(Clone, Debug, PartialEq)]
327pub struct RemoteServiceReadByTypeRequest {
328    pub uuid: fidl_fuchsia_bluetooth__common::Uuid,
329}
330
331impl fidl::Persistable for RemoteServiceReadByTypeRequest {}
332
333#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
334#[repr(C)]
335pub struct RemoteServiceReadCharacteristicRequest {
336    pub id: u64,
337}
338
339impl fidl::Persistable for RemoteServiceReadCharacteristicRequest {}
340
341#[derive(Clone, Debug, PartialEq)]
342pub struct RemoteServiceReadCharacteristicResponse {
343    pub status: fidl_fuchsia_bluetooth__common::Status,
344    pub value: Vec<u8>,
345}
346
347impl fidl::Persistable for RemoteServiceReadCharacteristicResponse {}
348
349#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
350#[repr(C)]
351pub struct RemoteServiceReadDescriptorRequest {
352    pub id: u64,
353}
354
355impl fidl::Persistable for RemoteServiceReadDescriptorRequest {}
356
357#[derive(Clone, Debug, PartialEq)]
358pub struct RemoteServiceReadDescriptorResponse {
359    pub status: fidl_fuchsia_bluetooth__common::Status,
360    pub value: Vec<u8>,
361}
362
363impl fidl::Persistable for RemoteServiceReadDescriptorResponse {}
364
365#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
366#[repr(C)]
367pub struct RemoteServiceReadLongCharacteristicRequest {
368    pub id: u64,
369    pub offset: u16,
370    pub max_bytes: u16,
371}
372
373impl fidl::Persistable for RemoteServiceReadLongCharacteristicRequest {}
374
375#[derive(Clone, Debug, PartialEq)]
376pub struct RemoteServiceReadLongCharacteristicResponse {
377    pub status: fidl_fuchsia_bluetooth__common::Status,
378    pub value: Vec<u8>,
379}
380
381impl fidl::Persistable for RemoteServiceReadLongCharacteristicResponse {}
382
383#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
384#[repr(C)]
385pub struct RemoteServiceReadLongDescriptorRequest {
386    pub id: u64,
387    pub offset: u16,
388    pub max_bytes: u16,
389}
390
391impl fidl::Persistable for RemoteServiceReadLongDescriptorRequest {}
392
393#[derive(Clone, Debug, PartialEq)]
394pub struct RemoteServiceReadLongDescriptorResponse {
395    pub status: fidl_fuchsia_bluetooth__common::Status,
396    pub value: Vec<u8>,
397}
398
399impl fidl::Persistable for RemoteServiceReadLongDescriptorResponse {}
400
401#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
402pub struct RemoteServiceWriteCharacteristicRequest {
403    pub id: u64,
404    pub value: Vec<u8>,
405}
406
407impl fidl::Persistable for RemoteServiceWriteCharacteristicRequest {}
408
409#[derive(Clone, Debug, PartialEq)]
410pub struct RemoteServiceWriteCharacteristicResponse {
411    pub status: fidl_fuchsia_bluetooth__common::Status,
412}
413
414impl fidl::Persistable for RemoteServiceWriteCharacteristicResponse {}
415
416#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
417pub struct RemoteServiceWriteCharacteristicWithoutResponseRequest {
418    pub id: u64,
419    pub value: Vec<u8>,
420}
421
422impl fidl::Persistable for RemoteServiceWriteCharacteristicWithoutResponseRequest {}
423
424#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
425pub struct RemoteServiceWriteDescriptorRequest {
426    pub id: u64,
427    pub value: Vec<u8>,
428}
429
430impl fidl::Persistable for RemoteServiceWriteDescriptorRequest {}
431
432#[derive(Clone, Debug, PartialEq)]
433pub struct RemoteServiceWriteDescriptorResponse {
434    pub status: fidl_fuchsia_bluetooth__common::Status,
435}
436
437impl fidl::Persistable for RemoteServiceWriteDescriptorResponse {}
438
439#[derive(Clone, Debug, PartialEq)]
440pub struct RemoteServiceWriteLongCharacteristicRequest {
441    pub id: u64,
442    pub offset: u16,
443    pub value: Vec<u8>,
444    pub write_options: WriteOptions,
445}
446
447impl fidl::Persistable for RemoteServiceWriteLongCharacteristicRequest {}
448
449#[derive(Clone, Debug, PartialEq)]
450pub struct RemoteServiceWriteLongCharacteristicResponse {
451    pub status: fidl_fuchsia_bluetooth__common::Status,
452}
453
454impl fidl::Persistable for RemoteServiceWriteLongCharacteristicResponse {}
455
456#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
457pub struct RemoteServiceWriteLongDescriptorRequest {
458    pub id: u64,
459    pub offset: u16,
460    pub value: Vec<u8>,
461}
462
463impl fidl::Persistable for RemoteServiceWriteLongDescriptorRequest {}
464
465#[derive(Clone, Debug, PartialEq)]
466pub struct RemoteServiceWriteLongDescriptorResponse {
467    pub status: fidl_fuchsia_bluetooth__common::Status,
468}
469
470impl fidl::Persistable for RemoteServiceWriteLongDescriptorResponse {}
471
472#[derive(Clone, Debug, PartialEq)]
473pub struct RemoteServiceReadByTypeResponse {
474    pub results: Vec<ReadByTypeResult>,
475}
476
477impl fidl::Persistable for RemoteServiceReadByTypeResponse {}
478
479/// Represents encryption, authentication, and authorization permissions that can
480/// be assigned to a specific access permission.
481#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
482pub struct SecurityRequirements {
483    /// If true, the physical link must be encrypted to access this attribute.
484    pub encryption_required: bool,
485    /// If true, the physical link must be authenticated to access this
486    /// attribute.
487    pub authentication_required: bool,
488    /// If true, the client needs to be authorized before accessing this
489    /// attribute.
490    pub authorization_required: bool,
491}
492
493impl fidl::Persistable for SecurityRequirements {}
494
495#[derive(Clone, Debug, PartialEq)]
496pub struct ServerPublishServiceResponse {
497    pub status: fidl_fuchsia_bluetooth__common::Status,
498}
499
500impl fidl::Persistable for ServerPublishServiceResponse {}
501
502/// Represents a local or remote GATT service.
503#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
504pub struct ServiceInfo {
505    /// Uniquely identifies this GATT service. This value will be ignored for local
506    /// services. Remote services will always have an identifier.
507    pub id: u64,
508    /// Indicates whether this is a primary or secondary service.
509    pub primary: bool,
510    /// The 128-bit UUID that identifies the type of this service. This is a string
511    /// in the canonical 8-4-4-4-12 format.
512    pub type_: String,
513    /// The characteristics of this service.
514    pub characteristics: Option<Vec<Characteristic>>,
515    /// Ids of other services that are included by this service.
516    pub includes: Option<Vec<u64>>,
517}
518
519impl fidl::Persistable for ServiceInfo {}
520
521#[derive(Clone, Debug, Default, PartialEq)]
522pub struct ReadByTypeResult {
523    /// Characteristic or descriptor id.
524    pub id: Option<u64>,
525    /// Truncated value of characteristic or descriptor, if it was read successfully.
526    pub value: Option<Vec<u8>>,
527    /// Reason the value could not be read, if reading it resulted in an error.
528    pub error: Option<Error>,
529    #[doc(hidden)]
530    pub __source_breaking: fidl::marker::SourceBreaking,
531}
532
533impl fidl::Persistable for ReadByTypeResult {}
534
535/// Represents the supported options to write a characteristic value to a server.
536#[derive(Clone, Debug, Default, PartialEq)]
537pub struct WriteOptions {
538    /// The reliable mode of the write operation.
539    ///
540    /// Defaults to [`fuchsia.bluetooth.gatt/ReliableMode.DISABLED`] if not present.
541    pub reliable_mode: Option<ReliableMode>,
542    #[doc(hidden)]
543    pub __source_breaking: fidl::marker::SourceBreaking,
544}
545
546impl fidl::Persistable for WriteOptions {}
547
548pub mod client_ordinals {
549    pub const LIST_SERVICES: u64 = 0x367b6c1e1540fb99;
550    pub const CONNECT_TO_SERVICE: u64 = 0x45ca1666a35cd25;
551}
552
553pub mod local_service_ordinals {
554    pub const REMOVE_SERVICE: u64 = 0x53c92ea8871606f1;
555    pub const NOTIFY_VALUE: u64 = 0x5bb142dfdd6d1fa9;
556}
557
558pub mod local_service_delegate_ordinals {
559    pub const ON_CHARACTERISTIC_CONFIGURATION: u64 = 0x71384022749a6e90;
560    pub const ON_READ_VALUE: u64 = 0x2f11da4cc774629;
561    pub const ON_WRITE_VALUE: u64 = 0x2869075d462d3ea5;
562    pub const ON_WRITE_WITHOUT_RESPONSE: u64 = 0x66ec30d296fd8d64;
563}
564
565pub mod remote_service_ordinals {
566    pub const DISCOVER_CHARACTERISTICS: u64 = 0x4c13b72543a8aa16;
567    pub const READ_CHARACTERISTIC: u64 = 0x200a5253bc0771c8;
568    pub const READ_LONG_CHARACTERISTIC: u64 = 0x2df2f20845555766;
569    pub const WRITE_CHARACTERISTIC: u64 = 0x5c1f529653cdad04;
570    pub const WRITE_LONG_CHARACTERISTIC: u64 = 0x2d358800658043e1;
571    pub const WRITE_CHARACTERISTIC_WITHOUT_RESPONSE: u64 = 0x6eee4a248275f56e;
572    pub const READ_DESCRIPTOR: u64 = 0x3d72215c1d23037a;
573    pub const READ_LONG_DESCRIPTOR: u64 = 0x779efe322414240b;
574    pub const WRITE_DESCRIPTOR: u64 = 0x24c813d96509895;
575    pub const WRITE_LONG_DESCRIPTOR: u64 = 0x653c9dbe0138b47;
576    pub const READ_BY_TYPE: u64 = 0x72e84b1d5eb5c245;
577    pub const NOTIFY_CHARACTERISTIC: u64 = 0x615750fd68cbd159;
578    pub const ON_CHARACTERISTIC_VALUE_UPDATED: u64 = 0x304debe9d0408fac;
579}
580
581pub mod server__ordinals {
582    pub const PUBLISH_SERVICE: u64 = 0x3b8b6f0988adb8c2;
583}
584
585mod internal {
586    use super::*;
587    unsafe impl fidl::encoding::TypeMarker for Error {
588        type Owned = Self;
589
590        #[inline(always)]
591        fn inline_align(_context: fidl::encoding::Context) -> usize {
592            std::mem::align_of::<u32>()
593        }
594
595        #[inline(always)]
596        fn inline_size(_context: fidl::encoding::Context) -> usize {
597            std::mem::size_of::<u32>()
598        }
599
600        #[inline(always)]
601        fn encode_is_copy() -> bool {
602            true
603        }
604
605        #[inline(always)]
606        fn decode_is_copy() -> bool {
607            false
608        }
609    }
610
611    impl fidl::encoding::ValueTypeMarker for Error {
612        type Borrowed<'a> = Self;
613        #[inline(always)]
614        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
615            *value
616        }
617    }
618
619    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Error {
620        #[inline]
621        unsafe fn encode(
622            self,
623            encoder: &mut fidl::encoding::Encoder<'_, D>,
624            offset: usize,
625            _depth: fidl::encoding::Depth,
626        ) -> fidl::Result<()> {
627            encoder.debug_check_bounds::<Self>(offset);
628            encoder.write_num(self.into_primitive(), offset);
629            Ok(())
630        }
631    }
632
633    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Error {
634        #[inline(always)]
635        fn new_empty() -> Self {
636            Self::Failure
637        }
638
639        #[inline]
640        unsafe fn decode(
641            &mut self,
642            decoder: &mut fidl::encoding::Decoder<'_, D>,
643            offset: usize,
644            _depth: fidl::encoding::Depth,
645        ) -> fidl::Result<()> {
646            decoder.debug_check_bounds::<Self>(offset);
647            let prim = decoder.read_num::<u32>(offset);
648
649            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
650            Ok(())
651        }
652    }
653    unsafe impl fidl::encoding::TypeMarker for ErrorCode {
654        type Owned = Self;
655
656        #[inline(always)]
657        fn inline_align(_context: fidl::encoding::Context) -> usize {
658            std::mem::align_of::<u32>()
659        }
660
661        #[inline(always)]
662        fn inline_size(_context: fidl::encoding::Context) -> usize {
663            std::mem::size_of::<u32>()
664        }
665
666        #[inline(always)]
667        fn encode_is_copy() -> bool {
668            true
669        }
670
671        #[inline(always)]
672        fn decode_is_copy() -> bool {
673            false
674        }
675    }
676
677    impl fidl::encoding::ValueTypeMarker for ErrorCode {
678        type Borrowed<'a> = Self;
679        #[inline(always)]
680        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
681            *value
682        }
683    }
684
685    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ErrorCode {
686        #[inline]
687        unsafe fn encode(
688            self,
689            encoder: &mut fidl::encoding::Encoder<'_, D>,
690            offset: usize,
691            _depth: fidl::encoding::Depth,
692        ) -> fidl::Result<()> {
693            encoder.debug_check_bounds::<Self>(offset);
694            encoder.write_num(self.into_primitive(), offset);
695            Ok(())
696        }
697    }
698
699    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ErrorCode {
700        #[inline(always)]
701        fn new_empty() -> Self {
702            Self::NoError
703        }
704
705        #[inline]
706        unsafe fn decode(
707            &mut self,
708            decoder: &mut fidl::encoding::Decoder<'_, D>,
709            offset: usize,
710            _depth: fidl::encoding::Depth,
711        ) -> fidl::Result<()> {
712            decoder.debug_check_bounds::<Self>(offset);
713            let prim = decoder.read_num::<u32>(offset);
714
715            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
716            Ok(())
717        }
718    }
719    unsafe impl fidl::encoding::TypeMarker for ReliableMode {
720        type Owned = Self;
721
722        #[inline(always)]
723        fn inline_align(_context: fidl::encoding::Context) -> usize {
724            std::mem::align_of::<u32>()
725        }
726
727        #[inline(always)]
728        fn inline_size(_context: fidl::encoding::Context) -> usize {
729            std::mem::size_of::<u32>()
730        }
731
732        #[inline(always)]
733        fn encode_is_copy() -> bool {
734            true
735        }
736
737        #[inline(always)]
738        fn decode_is_copy() -> bool {
739            false
740        }
741    }
742
743    impl fidl::encoding::ValueTypeMarker for ReliableMode {
744        type Borrowed<'a> = Self;
745        #[inline(always)]
746        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
747            *value
748        }
749    }
750
751    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ReliableMode {
752        #[inline]
753        unsafe fn encode(
754            self,
755            encoder: &mut fidl::encoding::Encoder<'_, D>,
756            offset: usize,
757            _depth: fidl::encoding::Depth,
758        ) -> fidl::Result<()> {
759            encoder.debug_check_bounds::<Self>(offset);
760            encoder.write_num(self.into_primitive(), offset);
761            Ok(())
762        }
763    }
764
765    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ReliableMode {
766        #[inline(always)]
767        fn new_empty() -> Self {
768            Self::Disabled
769        }
770
771        #[inline]
772        unsafe fn decode(
773            &mut self,
774            decoder: &mut fidl::encoding::Decoder<'_, D>,
775            offset: usize,
776            _depth: fidl::encoding::Depth,
777        ) -> fidl::Result<()> {
778            decoder.debug_check_bounds::<Self>(offset);
779            let prim = decoder.read_num::<u32>(offset);
780
781            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
782            Ok(())
783        }
784    }
785
786    impl fidl::encoding::ValueTypeMarker for AttributePermissions {
787        type Borrowed<'a> = &'a Self;
788        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
789            value
790        }
791    }
792
793    unsafe impl fidl::encoding::TypeMarker for AttributePermissions {
794        type Owned = Self;
795
796        #[inline(always)]
797        fn inline_align(_context: fidl::encoding::Context) -> usize {
798            8
799        }
800
801        #[inline(always)]
802        fn inline_size(_context: fidl::encoding::Context) -> usize {
803            24
804        }
805    }
806
807    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AttributePermissions, D>
808        for &AttributePermissions
809    {
810        #[inline]
811        unsafe fn encode(
812            self,
813            encoder: &mut fidl::encoding::Encoder<'_, D>,
814            offset: usize,
815            _depth: fidl::encoding::Depth,
816        ) -> fidl::Result<()> {
817            encoder.debug_check_bounds::<AttributePermissions>(offset);
818            // Delegate to tuple encoding.
819            fidl::encoding::Encode::<AttributePermissions, D>::encode(
820                (
821                    <fidl::encoding::Boxed<SecurityRequirements> as fidl::encoding::ValueTypeMarker>::borrow(&self.read),
822                    <fidl::encoding::Boxed<SecurityRequirements> as fidl::encoding::ValueTypeMarker>::borrow(&self.write),
823                    <fidl::encoding::Boxed<SecurityRequirements> as fidl::encoding::ValueTypeMarker>::borrow(&self.update),
824                ),
825                encoder, offset, _depth
826            )
827        }
828    }
829    unsafe impl<
830            D: fidl::encoding::ResourceDialect,
831            T0: fidl::encoding::Encode<fidl::encoding::Boxed<SecurityRequirements>, D>,
832            T1: fidl::encoding::Encode<fidl::encoding::Boxed<SecurityRequirements>, D>,
833            T2: fidl::encoding::Encode<fidl::encoding::Boxed<SecurityRequirements>, D>,
834        > fidl::encoding::Encode<AttributePermissions, D> for (T0, T1, T2)
835    {
836        #[inline]
837        unsafe fn encode(
838            self,
839            encoder: &mut fidl::encoding::Encoder<'_, D>,
840            offset: usize,
841            depth: fidl::encoding::Depth,
842        ) -> fidl::Result<()> {
843            encoder.debug_check_bounds::<AttributePermissions>(offset);
844            // Zero out padding regions. There's no need to apply masks
845            // because the unmasked parts will be overwritten by fields.
846            // Write the fields.
847            self.0.encode(encoder, offset + 0, depth)?;
848            self.1.encode(encoder, offset + 8, depth)?;
849            self.2.encode(encoder, offset + 16, depth)?;
850            Ok(())
851        }
852    }
853
854    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AttributePermissions {
855        #[inline(always)]
856        fn new_empty() -> Self {
857            Self {
858                read: fidl::new_empty!(fidl::encoding::Boxed<SecurityRequirements>, D),
859                write: fidl::new_empty!(fidl::encoding::Boxed<SecurityRequirements>, D),
860                update: fidl::new_empty!(fidl::encoding::Boxed<SecurityRequirements>, D),
861            }
862        }
863
864        #[inline]
865        unsafe fn decode(
866            &mut self,
867            decoder: &mut fidl::encoding::Decoder<'_, D>,
868            offset: usize,
869            _depth: fidl::encoding::Depth,
870        ) -> fidl::Result<()> {
871            decoder.debug_check_bounds::<Self>(offset);
872            // Verify that padding bytes are zero.
873            fidl::decode!(
874                fidl::encoding::Boxed<SecurityRequirements>,
875                D,
876                &mut self.read,
877                decoder,
878                offset + 0,
879                _depth
880            )?;
881            fidl::decode!(
882                fidl::encoding::Boxed<SecurityRequirements>,
883                D,
884                &mut self.write,
885                decoder,
886                offset + 8,
887                _depth
888            )?;
889            fidl::decode!(
890                fidl::encoding::Boxed<SecurityRequirements>,
891                D,
892                &mut self.update,
893                decoder,
894                offset + 16,
895                _depth
896            )?;
897            Ok(())
898        }
899    }
900
901    impl fidl::encoding::ValueTypeMarker for Characteristic {
902        type Borrowed<'a> = &'a Self;
903        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
904            value
905        }
906    }
907
908    unsafe impl fidl::encoding::TypeMarker for Characteristic {
909        type Owned = Self;
910
911        #[inline(always)]
912        fn inline_align(_context: fidl::encoding::Context) -> usize {
913            8
914        }
915
916        #[inline(always)]
917        fn inline_size(_context: fidl::encoding::Context) -> usize {
918            56
919        }
920    }
921
922    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Characteristic, D>
923        for &Characteristic
924    {
925        #[inline]
926        unsafe fn encode(
927            self,
928            encoder: &mut fidl::encoding::Encoder<'_, D>,
929            offset: usize,
930            _depth: fidl::encoding::Depth,
931        ) -> fidl::Result<()> {
932            encoder.debug_check_bounds::<Characteristic>(offset);
933            // Delegate to tuple encoding.
934            fidl::encoding::Encode::<Characteristic, D>::encode(
935                (
936                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
937                    <fidl::encoding::BoundedString<36> as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
938                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),
939                    <fidl::encoding::Boxed<AttributePermissions> as fidl::encoding::ValueTypeMarker>::borrow(&self.permissions),
940                    <fidl::encoding::Optional<fidl::encoding::Vector<Descriptor, 65532>> as fidl::encoding::ValueTypeMarker>::borrow(&self.descriptors),
941                ),
942                encoder, offset, _depth
943            )
944        }
945    }
946    unsafe impl<
947            D: fidl::encoding::ResourceDialect,
948            T0: fidl::encoding::Encode<u64, D>,
949            T1: fidl::encoding::Encode<fidl::encoding::BoundedString<36>, D>,
950            T2: fidl::encoding::Encode<u32, D>,
951            T3: fidl::encoding::Encode<fidl::encoding::Boxed<AttributePermissions>, D>,
952            T4: fidl::encoding::Encode<
953                fidl::encoding::Optional<fidl::encoding::Vector<Descriptor, 65532>>,
954                D,
955            >,
956        > fidl::encoding::Encode<Characteristic, D> for (T0, T1, T2, T3, T4)
957    {
958        #[inline]
959        unsafe fn encode(
960            self,
961            encoder: &mut fidl::encoding::Encoder<'_, D>,
962            offset: usize,
963            depth: fidl::encoding::Depth,
964        ) -> fidl::Result<()> {
965            encoder.debug_check_bounds::<Characteristic>(offset);
966            // Zero out padding regions. There's no need to apply masks
967            // because the unmasked parts will be overwritten by fields.
968            unsafe {
969                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
970                (ptr as *mut u64).write_unaligned(0);
971            }
972            // Write the fields.
973            self.0.encode(encoder, offset + 0, depth)?;
974            self.1.encode(encoder, offset + 8, depth)?;
975            self.2.encode(encoder, offset + 24, depth)?;
976            self.3.encode(encoder, offset + 32, depth)?;
977            self.4.encode(encoder, offset + 40, depth)?;
978            Ok(())
979        }
980    }
981
982    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Characteristic {
983        #[inline(always)]
984        fn new_empty() -> Self {
985            Self {
986                id: fidl::new_empty!(u64, D),
987                type_: fidl::new_empty!(fidl::encoding::BoundedString<36>, D),
988                properties: fidl::new_empty!(u32, D),
989                permissions: fidl::new_empty!(fidl::encoding::Boxed<AttributePermissions>, D),
990                descriptors: fidl::new_empty!(
991                    fidl::encoding::Optional<fidl::encoding::Vector<Descriptor, 65532>>,
992                    D
993                ),
994            }
995        }
996
997        #[inline]
998        unsafe fn decode(
999            &mut self,
1000            decoder: &mut fidl::encoding::Decoder<'_, D>,
1001            offset: usize,
1002            _depth: fidl::encoding::Depth,
1003        ) -> fidl::Result<()> {
1004            decoder.debug_check_bounds::<Self>(offset);
1005            // Verify that padding bytes are zero.
1006            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
1007            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1008            let mask = 0xffffffff00000000u64;
1009            let maskedval = padval & mask;
1010            if maskedval != 0 {
1011                return Err(fidl::Error::NonZeroPadding {
1012                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
1013                });
1014            }
1015            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
1016            fidl::decode!(
1017                fidl::encoding::BoundedString<36>,
1018                D,
1019                &mut self.type_,
1020                decoder,
1021                offset + 8,
1022                _depth
1023            )?;
1024            fidl::decode!(u32, D, &mut self.properties, decoder, offset + 24, _depth)?;
1025            fidl::decode!(
1026                fidl::encoding::Boxed<AttributePermissions>,
1027                D,
1028                &mut self.permissions,
1029                decoder,
1030                offset + 32,
1031                _depth
1032            )?;
1033            fidl::decode!(
1034                fidl::encoding::Optional<fidl::encoding::Vector<Descriptor, 65532>>,
1035                D,
1036                &mut self.descriptors,
1037                decoder,
1038                offset + 40,
1039                _depth
1040            )?;
1041            Ok(())
1042        }
1043    }
1044
1045    impl fidl::encoding::ValueTypeMarker for ClientListServicesRequest {
1046        type Borrowed<'a> = &'a Self;
1047        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1048            value
1049        }
1050    }
1051
1052    unsafe impl fidl::encoding::TypeMarker for ClientListServicesRequest {
1053        type Owned = Self;
1054
1055        #[inline(always)]
1056        fn inline_align(_context: fidl::encoding::Context) -> usize {
1057            8
1058        }
1059
1060        #[inline(always)]
1061        fn inline_size(_context: fidl::encoding::Context) -> usize {
1062            16
1063        }
1064    }
1065
1066    unsafe impl<D: fidl::encoding::ResourceDialect>
1067        fidl::encoding::Encode<ClientListServicesRequest, D> for &ClientListServicesRequest
1068    {
1069        #[inline]
1070        unsafe fn encode(
1071            self,
1072            encoder: &mut fidl::encoding::Encoder<'_, D>,
1073            offset: usize,
1074            _depth: fidl::encoding::Depth,
1075        ) -> fidl::Result<()> {
1076            encoder.debug_check_bounds::<ClientListServicesRequest>(offset);
1077            // Delegate to tuple encoding.
1078            fidl::encoding::Encode::<ClientListServicesRequest, D>::encode(
1079                (<fidl::encoding::Optional<
1080                    fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<36>>,
1081                > as fidl::encoding::ValueTypeMarker>::borrow(&self.uuids),),
1082                encoder,
1083                offset,
1084                _depth,
1085            )
1086        }
1087    }
1088    unsafe impl<
1089            D: fidl::encoding::ResourceDialect,
1090            T0: fidl::encoding::Encode<
1091                fidl::encoding::Optional<
1092                    fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<36>>,
1093                >,
1094                D,
1095            >,
1096        > fidl::encoding::Encode<ClientListServicesRequest, D> for (T0,)
1097    {
1098        #[inline]
1099        unsafe fn encode(
1100            self,
1101            encoder: &mut fidl::encoding::Encoder<'_, D>,
1102            offset: usize,
1103            depth: fidl::encoding::Depth,
1104        ) -> fidl::Result<()> {
1105            encoder.debug_check_bounds::<ClientListServicesRequest>(offset);
1106            // Zero out padding regions. There's no need to apply masks
1107            // because the unmasked parts will be overwritten by fields.
1108            // Write the fields.
1109            self.0.encode(encoder, offset + 0, depth)?;
1110            Ok(())
1111        }
1112    }
1113
1114    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1115        for ClientListServicesRequest
1116    {
1117        #[inline(always)]
1118        fn new_empty() -> Self {
1119            Self {
1120                uuids: fidl::new_empty!(
1121                    fidl::encoding::Optional<
1122                        fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<36>>,
1123                    >,
1124                    D
1125                ),
1126            }
1127        }
1128
1129        #[inline]
1130        unsafe fn decode(
1131            &mut self,
1132            decoder: &mut fidl::encoding::Decoder<'_, D>,
1133            offset: usize,
1134            _depth: fidl::encoding::Depth,
1135        ) -> fidl::Result<()> {
1136            decoder.debug_check_bounds::<Self>(offset);
1137            // Verify that padding bytes are zero.
1138            fidl::decode!(
1139                fidl::encoding::Optional<
1140                    fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<36>>,
1141                >,
1142                D,
1143                &mut self.uuids,
1144                decoder,
1145                offset + 0,
1146                _depth
1147            )?;
1148            Ok(())
1149        }
1150    }
1151
1152    impl fidl::encoding::ValueTypeMarker for ClientListServicesResponse {
1153        type Borrowed<'a> = &'a Self;
1154        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1155            value
1156        }
1157    }
1158
1159    unsafe impl fidl::encoding::TypeMarker for ClientListServicesResponse {
1160        type Owned = Self;
1161
1162        #[inline(always)]
1163        fn inline_align(_context: fidl::encoding::Context) -> usize {
1164            8
1165        }
1166
1167        #[inline(always)]
1168        fn inline_size(_context: fidl::encoding::Context) -> usize {
1169            24
1170        }
1171    }
1172
1173    unsafe impl<D: fidl::encoding::ResourceDialect>
1174        fidl::encoding::Encode<ClientListServicesResponse, D> for &ClientListServicesResponse
1175    {
1176        #[inline]
1177        unsafe fn encode(
1178            self,
1179            encoder: &mut fidl::encoding::Encoder<'_, D>,
1180            offset: usize,
1181            _depth: fidl::encoding::Depth,
1182        ) -> fidl::Result<()> {
1183            encoder.debug_check_bounds::<ClientListServicesResponse>(offset);
1184            // Delegate to tuple encoding.
1185            fidl::encoding::Encode::<ClientListServicesResponse, D>::encode(
1186                (
1187                    <fidl_fuchsia_bluetooth__common::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
1188                    <fidl::encoding::Vector<ServiceInfo, 65535> as fidl::encoding::ValueTypeMarker>::borrow(&self.services),
1189                ),
1190                encoder, offset, _depth
1191            )
1192        }
1193    }
1194    unsafe impl<
1195            D: fidl::encoding::ResourceDialect,
1196            T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth__common::Status, D>,
1197            T1: fidl::encoding::Encode<fidl::encoding::Vector<ServiceInfo, 65535>, D>,
1198        > fidl::encoding::Encode<ClientListServicesResponse, D> for (T0, T1)
1199    {
1200        #[inline]
1201        unsafe fn encode(
1202            self,
1203            encoder: &mut fidl::encoding::Encoder<'_, D>,
1204            offset: usize,
1205            depth: fidl::encoding::Depth,
1206        ) -> fidl::Result<()> {
1207            encoder.debug_check_bounds::<ClientListServicesResponse>(offset);
1208            // Zero out padding regions. There's no need to apply masks
1209            // because the unmasked parts will be overwritten by fields.
1210            // Write the fields.
1211            self.0.encode(encoder, offset + 0, depth)?;
1212            self.1.encode(encoder, offset + 8, depth)?;
1213            Ok(())
1214        }
1215    }
1216
1217    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1218        for ClientListServicesResponse
1219    {
1220        #[inline(always)]
1221        fn new_empty() -> Self {
1222            Self {
1223                status: fidl::new_empty!(fidl_fuchsia_bluetooth__common::Status, D),
1224                services: fidl::new_empty!(fidl::encoding::Vector<ServiceInfo, 65535>, D),
1225            }
1226        }
1227
1228        #[inline]
1229        unsafe fn decode(
1230            &mut self,
1231            decoder: &mut fidl::encoding::Decoder<'_, D>,
1232            offset: usize,
1233            _depth: fidl::encoding::Depth,
1234        ) -> fidl::Result<()> {
1235            decoder.debug_check_bounds::<Self>(offset);
1236            // Verify that padding bytes are zero.
1237            fidl::decode!(
1238                fidl_fuchsia_bluetooth__common::Status,
1239                D,
1240                &mut self.status,
1241                decoder,
1242                offset + 0,
1243                _depth
1244            )?;
1245            fidl::decode!(fidl::encoding::Vector<ServiceInfo, 65535>, D, &mut self.services, decoder, offset + 8, _depth)?;
1246            Ok(())
1247        }
1248    }
1249
1250    impl fidl::encoding::ValueTypeMarker for Descriptor {
1251        type Borrowed<'a> = &'a Self;
1252        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1253            value
1254        }
1255    }
1256
1257    unsafe impl fidl::encoding::TypeMarker for Descriptor {
1258        type Owned = Self;
1259
1260        #[inline(always)]
1261        fn inline_align(_context: fidl::encoding::Context) -> usize {
1262            8
1263        }
1264
1265        #[inline(always)]
1266        fn inline_size(_context: fidl::encoding::Context) -> usize {
1267            32
1268        }
1269    }
1270
1271    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Descriptor, D>
1272        for &Descriptor
1273    {
1274        #[inline]
1275        unsafe fn encode(
1276            self,
1277            encoder: &mut fidl::encoding::Encoder<'_, D>,
1278            offset: usize,
1279            _depth: fidl::encoding::Depth,
1280        ) -> fidl::Result<()> {
1281            encoder.debug_check_bounds::<Descriptor>(offset);
1282            // Delegate to tuple encoding.
1283            fidl::encoding::Encode::<Descriptor, D>::encode(
1284                (
1285                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
1286                    <fidl::encoding::BoundedString<36> as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
1287                    <fidl::encoding::Boxed<AttributePermissions> as fidl::encoding::ValueTypeMarker>::borrow(&self.permissions),
1288                ),
1289                encoder, offset, _depth
1290            )
1291        }
1292    }
1293    unsafe impl<
1294            D: fidl::encoding::ResourceDialect,
1295            T0: fidl::encoding::Encode<u64, D>,
1296            T1: fidl::encoding::Encode<fidl::encoding::BoundedString<36>, D>,
1297            T2: fidl::encoding::Encode<fidl::encoding::Boxed<AttributePermissions>, D>,
1298        > fidl::encoding::Encode<Descriptor, D> for (T0, T1, T2)
1299    {
1300        #[inline]
1301        unsafe fn encode(
1302            self,
1303            encoder: &mut fidl::encoding::Encoder<'_, D>,
1304            offset: usize,
1305            depth: fidl::encoding::Depth,
1306        ) -> fidl::Result<()> {
1307            encoder.debug_check_bounds::<Descriptor>(offset);
1308            // Zero out padding regions. There's no need to apply masks
1309            // because the unmasked parts will be overwritten by fields.
1310            // Write the fields.
1311            self.0.encode(encoder, offset + 0, depth)?;
1312            self.1.encode(encoder, offset + 8, depth)?;
1313            self.2.encode(encoder, offset + 24, depth)?;
1314            Ok(())
1315        }
1316    }
1317
1318    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Descriptor {
1319        #[inline(always)]
1320        fn new_empty() -> Self {
1321            Self {
1322                id: fidl::new_empty!(u64, D),
1323                type_: fidl::new_empty!(fidl::encoding::BoundedString<36>, D),
1324                permissions: fidl::new_empty!(fidl::encoding::Boxed<AttributePermissions>, D),
1325            }
1326        }
1327
1328        #[inline]
1329        unsafe fn decode(
1330            &mut self,
1331            decoder: &mut fidl::encoding::Decoder<'_, D>,
1332            offset: usize,
1333            _depth: fidl::encoding::Depth,
1334        ) -> fidl::Result<()> {
1335            decoder.debug_check_bounds::<Self>(offset);
1336            // Verify that padding bytes are zero.
1337            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
1338            fidl::decode!(
1339                fidl::encoding::BoundedString<36>,
1340                D,
1341                &mut self.type_,
1342                decoder,
1343                offset + 8,
1344                _depth
1345            )?;
1346            fidl::decode!(
1347                fidl::encoding::Boxed<AttributePermissions>,
1348                D,
1349                &mut self.permissions,
1350                decoder,
1351                offset + 24,
1352                _depth
1353            )?;
1354            Ok(())
1355        }
1356    }
1357
1358    impl fidl::encoding::ValueTypeMarker for LocalServiceDelegateOnCharacteristicConfigurationRequest {
1359        type Borrowed<'a> = &'a Self;
1360        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1361            value
1362        }
1363    }
1364
1365    unsafe impl fidl::encoding::TypeMarker
1366        for LocalServiceDelegateOnCharacteristicConfigurationRequest
1367    {
1368        type Owned = Self;
1369
1370        #[inline(always)]
1371        fn inline_align(_context: fidl::encoding::Context) -> usize {
1372            8
1373        }
1374
1375        #[inline(always)]
1376        fn inline_size(_context: fidl::encoding::Context) -> usize {
1377            32
1378        }
1379    }
1380
1381    unsafe impl<D: fidl::encoding::ResourceDialect>
1382        fidl::encoding::Encode<LocalServiceDelegateOnCharacteristicConfigurationRequest, D>
1383        for &LocalServiceDelegateOnCharacteristicConfigurationRequest
1384    {
1385        #[inline]
1386        unsafe fn encode(
1387            self,
1388            encoder: &mut fidl::encoding::Encoder<'_, D>,
1389            offset: usize,
1390            _depth: fidl::encoding::Depth,
1391        ) -> fidl::Result<()> {
1392            encoder.debug_check_bounds::<LocalServiceDelegateOnCharacteristicConfigurationRequest>(
1393                offset,
1394            );
1395            // Delegate to tuple encoding.
1396            fidl::encoding::Encode::<LocalServiceDelegateOnCharacteristicConfigurationRequest, D>::encode(
1397                (
1398                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.characteristic_id),
1399                    <fidl::encoding::BoundedString<16> as fidl::encoding::ValueTypeMarker>::borrow(&self.peer_id),
1400                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.notify),
1401                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.indicate),
1402                ),
1403                encoder, offset, _depth
1404            )
1405        }
1406    }
1407    unsafe impl<
1408            D: fidl::encoding::ResourceDialect,
1409            T0: fidl::encoding::Encode<u64, D>,
1410            T1: fidl::encoding::Encode<fidl::encoding::BoundedString<16>, D>,
1411            T2: fidl::encoding::Encode<bool, D>,
1412            T3: fidl::encoding::Encode<bool, D>,
1413        > fidl::encoding::Encode<LocalServiceDelegateOnCharacteristicConfigurationRequest, D>
1414        for (T0, T1, T2, T3)
1415    {
1416        #[inline]
1417        unsafe fn encode(
1418            self,
1419            encoder: &mut fidl::encoding::Encoder<'_, D>,
1420            offset: usize,
1421            depth: fidl::encoding::Depth,
1422        ) -> fidl::Result<()> {
1423            encoder.debug_check_bounds::<LocalServiceDelegateOnCharacteristicConfigurationRequest>(
1424                offset,
1425            );
1426            // Zero out padding regions. There's no need to apply masks
1427            // because the unmasked parts will be overwritten by fields.
1428            unsafe {
1429                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
1430                (ptr as *mut u64).write_unaligned(0);
1431            }
1432            // Write the fields.
1433            self.0.encode(encoder, offset + 0, depth)?;
1434            self.1.encode(encoder, offset + 8, depth)?;
1435            self.2.encode(encoder, offset + 24, depth)?;
1436            self.3.encode(encoder, offset + 25, depth)?;
1437            Ok(())
1438        }
1439    }
1440
1441    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1442        for LocalServiceDelegateOnCharacteristicConfigurationRequest
1443    {
1444        #[inline(always)]
1445        fn new_empty() -> Self {
1446            Self {
1447                characteristic_id: fidl::new_empty!(u64, D),
1448                peer_id: fidl::new_empty!(fidl::encoding::BoundedString<16>, D),
1449                notify: fidl::new_empty!(bool, D),
1450                indicate: fidl::new_empty!(bool, D),
1451            }
1452        }
1453
1454        #[inline]
1455        unsafe fn decode(
1456            &mut self,
1457            decoder: &mut fidl::encoding::Decoder<'_, D>,
1458            offset: usize,
1459            _depth: fidl::encoding::Depth,
1460        ) -> fidl::Result<()> {
1461            decoder.debug_check_bounds::<Self>(offset);
1462            // Verify that padding bytes are zero.
1463            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
1464            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1465            let mask = 0xffffffffffff0000u64;
1466            let maskedval = padval & mask;
1467            if maskedval != 0 {
1468                return Err(fidl::Error::NonZeroPadding {
1469                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
1470                });
1471            }
1472            fidl::decode!(u64, D, &mut self.characteristic_id, decoder, offset + 0, _depth)?;
1473            fidl::decode!(
1474                fidl::encoding::BoundedString<16>,
1475                D,
1476                &mut self.peer_id,
1477                decoder,
1478                offset + 8,
1479                _depth
1480            )?;
1481            fidl::decode!(bool, D, &mut self.notify, decoder, offset + 24, _depth)?;
1482            fidl::decode!(bool, D, &mut self.indicate, decoder, offset + 25, _depth)?;
1483            Ok(())
1484        }
1485    }
1486
1487    impl fidl::encoding::ValueTypeMarker for LocalServiceDelegateOnReadValueRequest {
1488        type Borrowed<'a> = &'a Self;
1489        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1490            value
1491        }
1492    }
1493
1494    unsafe impl fidl::encoding::TypeMarker for LocalServiceDelegateOnReadValueRequest {
1495        type Owned = Self;
1496
1497        #[inline(always)]
1498        fn inline_align(_context: fidl::encoding::Context) -> usize {
1499            8
1500        }
1501
1502        #[inline(always)]
1503        fn inline_size(_context: fidl::encoding::Context) -> usize {
1504            16
1505        }
1506    }
1507
1508    unsafe impl<D: fidl::encoding::ResourceDialect>
1509        fidl::encoding::Encode<LocalServiceDelegateOnReadValueRequest, D>
1510        for &LocalServiceDelegateOnReadValueRequest
1511    {
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::<LocalServiceDelegateOnReadValueRequest>(offset);
1520            unsafe {
1521                // Copy the object into the buffer.
1522                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1523                (buf_ptr as *mut LocalServiceDelegateOnReadValueRequest).write_unaligned(
1524                    (self as *const LocalServiceDelegateOnReadValueRequest).read(),
1525                );
1526                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1527                // done second because the memcpy will write garbage to these bytes.
1528                let padding_ptr = buf_ptr.offset(8) as *mut u64;
1529                let padding_mask = 0xffffffff00000000u64;
1530                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
1531            }
1532            Ok(())
1533        }
1534    }
1535    unsafe impl<
1536            D: fidl::encoding::ResourceDialect,
1537            T0: fidl::encoding::Encode<u64, D>,
1538            T1: fidl::encoding::Encode<i32, D>,
1539        > fidl::encoding::Encode<LocalServiceDelegateOnReadValueRequest, D> for (T0, T1)
1540    {
1541        #[inline]
1542        unsafe fn encode(
1543            self,
1544            encoder: &mut fidl::encoding::Encoder<'_, D>,
1545            offset: usize,
1546            depth: fidl::encoding::Depth,
1547        ) -> fidl::Result<()> {
1548            encoder.debug_check_bounds::<LocalServiceDelegateOnReadValueRequest>(offset);
1549            // Zero out padding regions. There's no need to apply masks
1550            // because the unmasked parts will be overwritten by fields.
1551            unsafe {
1552                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
1553                (ptr as *mut u64).write_unaligned(0);
1554            }
1555            // Write the fields.
1556            self.0.encode(encoder, offset + 0, depth)?;
1557            self.1.encode(encoder, offset + 8, depth)?;
1558            Ok(())
1559        }
1560    }
1561
1562    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1563        for LocalServiceDelegateOnReadValueRequest
1564    {
1565        #[inline(always)]
1566        fn new_empty() -> Self {
1567            Self { id: fidl::new_empty!(u64, D), offset: fidl::new_empty!(i32, D) }
1568        }
1569
1570        #[inline]
1571        unsafe fn decode(
1572            &mut self,
1573            decoder: &mut fidl::encoding::Decoder<'_, D>,
1574            offset: usize,
1575            _depth: fidl::encoding::Depth,
1576        ) -> fidl::Result<()> {
1577            decoder.debug_check_bounds::<Self>(offset);
1578            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1579            // Verify that padding bytes are zero.
1580            let ptr = unsafe { buf_ptr.offset(8) };
1581            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1582            let mask = 0xffffffff00000000u64;
1583            let maskedval = padval & mask;
1584            if maskedval != 0 {
1585                return Err(fidl::Error::NonZeroPadding {
1586                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
1587                });
1588            }
1589            // Copy from the buffer into the object.
1590            unsafe {
1591                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
1592            }
1593            Ok(())
1594        }
1595    }
1596
1597    impl fidl::encoding::ValueTypeMarker for LocalServiceDelegateOnReadValueResponse {
1598        type Borrowed<'a> = &'a Self;
1599        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1600            value
1601        }
1602    }
1603
1604    unsafe impl fidl::encoding::TypeMarker for LocalServiceDelegateOnReadValueResponse {
1605        type Owned = Self;
1606
1607        #[inline(always)]
1608        fn inline_align(_context: fidl::encoding::Context) -> usize {
1609            8
1610        }
1611
1612        #[inline(always)]
1613        fn inline_size(_context: fidl::encoding::Context) -> usize {
1614            24
1615        }
1616    }
1617
1618    unsafe impl<D: fidl::encoding::ResourceDialect>
1619        fidl::encoding::Encode<LocalServiceDelegateOnReadValueResponse, D>
1620        for &LocalServiceDelegateOnReadValueResponse
1621    {
1622        #[inline]
1623        unsafe fn encode(
1624            self,
1625            encoder: &mut fidl::encoding::Encoder<'_, D>,
1626            offset: usize,
1627            _depth: fidl::encoding::Depth,
1628        ) -> fidl::Result<()> {
1629            encoder.debug_check_bounds::<LocalServiceDelegateOnReadValueResponse>(offset);
1630            // Delegate to tuple encoding.
1631            fidl::encoding::Encode::<LocalServiceDelegateOnReadValueResponse, D>::encode(
1632                (
1633                    <fidl::encoding::Optional<fidl::encoding::UnboundedVector<u8>> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
1634                    <ErrorCode as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
1635                ),
1636                encoder, offset, _depth
1637            )
1638        }
1639    }
1640    unsafe impl<
1641            D: fidl::encoding::ResourceDialect,
1642            T0: fidl::encoding::Encode<
1643                fidl::encoding::Optional<fidl::encoding::UnboundedVector<u8>>,
1644                D,
1645            >,
1646            T1: fidl::encoding::Encode<ErrorCode, D>,
1647        > fidl::encoding::Encode<LocalServiceDelegateOnReadValueResponse, D> for (T0, T1)
1648    {
1649        #[inline]
1650        unsafe fn encode(
1651            self,
1652            encoder: &mut fidl::encoding::Encoder<'_, D>,
1653            offset: usize,
1654            depth: fidl::encoding::Depth,
1655        ) -> fidl::Result<()> {
1656            encoder.debug_check_bounds::<LocalServiceDelegateOnReadValueResponse>(offset);
1657            // Zero out padding regions. There's no need to apply masks
1658            // because the unmasked parts will be overwritten by fields.
1659            unsafe {
1660                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1661                (ptr as *mut u64).write_unaligned(0);
1662            }
1663            // Write the fields.
1664            self.0.encode(encoder, offset + 0, depth)?;
1665            self.1.encode(encoder, offset + 16, depth)?;
1666            Ok(())
1667        }
1668    }
1669
1670    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1671        for LocalServiceDelegateOnReadValueResponse
1672    {
1673        #[inline(always)]
1674        fn new_empty() -> Self {
1675            Self {
1676                value: fidl::new_empty!(
1677                    fidl::encoding::Optional<fidl::encoding::UnboundedVector<u8>>,
1678                    D
1679                ),
1680                status: fidl::new_empty!(ErrorCode, D),
1681            }
1682        }
1683
1684        #[inline]
1685        unsafe fn decode(
1686            &mut self,
1687            decoder: &mut fidl::encoding::Decoder<'_, D>,
1688            offset: usize,
1689            _depth: fidl::encoding::Depth,
1690        ) -> fidl::Result<()> {
1691            decoder.debug_check_bounds::<Self>(offset);
1692            // Verify that padding bytes are zero.
1693            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1694            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1695            let mask = 0xffffffff00000000u64;
1696            let maskedval = padval & mask;
1697            if maskedval != 0 {
1698                return Err(fidl::Error::NonZeroPadding {
1699                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1700                });
1701            }
1702            fidl::decode!(
1703                fidl::encoding::Optional<fidl::encoding::UnboundedVector<u8>>,
1704                D,
1705                &mut self.value,
1706                decoder,
1707                offset + 0,
1708                _depth
1709            )?;
1710            fidl::decode!(ErrorCode, D, &mut self.status, decoder, offset + 16, _depth)?;
1711            Ok(())
1712        }
1713    }
1714
1715    impl fidl::encoding::ValueTypeMarker for LocalServiceDelegateOnWriteValueRequest {
1716        type Borrowed<'a> = &'a Self;
1717        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1718            value
1719        }
1720    }
1721
1722    unsafe impl fidl::encoding::TypeMarker for LocalServiceDelegateOnWriteValueRequest {
1723        type Owned = Self;
1724
1725        #[inline(always)]
1726        fn inline_align(_context: fidl::encoding::Context) -> usize {
1727            8
1728        }
1729
1730        #[inline(always)]
1731        fn inline_size(_context: fidl::encoding::Context) -> usize {
1732            32
1733        }
1734    }
1735
1736    unsafe impl<D: fidl::encoding::ResourceDialect>
1737        fidl::encoding::Encode<LocalServiceDelegateOnWriteValueRequest, D>
1738        for &LocalServiceDelegateOnWriteValueRequest
1739    {
1740        #[inline]
1741        unsafe fn encode(
1742            self,
1743            encoder: &mut fidl::encoding::Encoder<'_, D>,
1744            offset: usize,
1745            _depth: fidl::encoding::Depth,
1746        ) -> fidl::Result<()> {
1747            encoder.debug_check_bounds::<LocalServiceDelegateOnWriteValueRequest>(offset);
1748            // Delegate to tuple encoding.
1749            fidl::encoding::Encode::<LocalServiceDelegateOnWriteValueRequest, D>::encode(
1750                (
1751                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
1752                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.offset),
1753                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
1754                ),
1755                encoder, offset, _depth
1756            )
1757        }
1758    }
1759    unsafe impl<
1760            D: fidl::encoding::ResourceDialect,
1761            T0: fidl::encoding::Encode<u64, D>,
1762            T1: fidl::encoding::Encode<u16, D>,
1763            T2: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
1764        > fidl::encoding::Encode<LocalServiceDelegateOnWriteValueRequest, D> for (T0, T1, T2)
1765    {
1766        #[inline]
1767        unsafe fn encode(
1768            self,
1769            encoder: &mut fidl::encoding::Encoder<'_, D>,
1770            offset: usize,
1771            depth: fidl::encoding::Depth,
1772        ) -> fidl::Result<()> {
1773            encoder.debug_check_bounds::<LocalServiceDelegateOnWriteValueRequest>(offset);
1774            // Zero out padding regions. There's no need to apply masks
1775            // because the unmasked parts will be overwritten by fields.
1776            unsafe {
1777                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
1778                (ptr as *mut u64).write_unaligned(0);
1779            }
1780            // Write the fields.
1781            self.0.encode(encoder, offset + 0, depth)?;
1782            self.1.encode(encoder, offset + 8, depth)?;
1783            self.2.encode(encoder, offset + 16, depth)?;
1784            Ok(())
1785        }
1786    }
1787
1788    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1789        for LocalServiceDelegateOnWriteValueRequest
1790    {
1791        #[inline(always)]
1792        fn new_empty() -> Self {
1793            Self {
1794                id: fidl::new_empty!(u64, D),
1795                offset: fidl::new_empty!(u16, D),
1796                value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
1797            }
1798        }
1799
1800        #[inline]
1801        unsafe fn decode(
1802            &mut self,
1803            decoder: &mut fidl::encoding::Decoder<'_, D>,
1804            offset: usize,
1805            _depth: fidl::encoding::Depth,
1806        ) -> fidl::Result<()> {
1807            decoder.debug_check_bounds::<Self>(offset);
1808            // Verify that padding bytes are zero.
1809            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
1810            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1811            let mask = 0xffffffffffff0000u64;
1812            let maskedval = padval & mask;
1813            if maskedval != 0 {
1814                return Err(fidl::Error::NonZeroPadding {
1815                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
1816                });
1817            }
1818            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
1819            fidl::decode!(u16, D, &mut self.offset, decoder, offset + 8, _depth)?;
1820            fidl::decode!(
1821                fidl::encoding::UnboundedVector<u8>,
1822                D,
1823                &mut self.value,
1824                decoder,
1825                offset + 16,
1826                _depth
1827            )?;
1828            Ok(())
1829        }
1830    }
1831
1832    impl fidl::encoding::ValueTypeMarker for LocalServiceDelegateOnWriteValueResponse {
1833        type Borrowed<'a> = &'a Self;
1834        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1835            value
1836        }
1837    }
1838
1839    unsafe impl fidl::encoding::TypeMarker for LocalServiceDelegateOnWriteValueResponse {
1840        type Owned = Self;
1841
1842        #[inline(always)]
1843        fn inline_align(_context: fidl::encoding::Context) -> usize {
1844            4
1845        }
1846
1847        #[inline(always)]
1848        fn inline_size(_context: fidl::encoding::Context) -> usize {
1849            4
1850        }
1851    }
1852
1853    unsafe impl<D: fidl::encoding::ResourceDialect>
1854        fidl::encoding::Encode<LocalServiceDelegateOnWriteValueResponse, D>
1855        for &LocalServiceDelegateOnWriteValueResponse
1856    {
1857        #[inline]
1858        unsafe fn encode(
1859            self,
1860            encoder: &mut fidl::encoding::Encoder<'_, D>,
1861            offset: usize,
1862            _depth: fidl::encoding::Depth,
1863        ) -> fidl::Result<()> {
1864            encoder.debug_check_bounds::<LocalServiceDelegateOnWriteValueResponse>(offset);
1865            // Delegate to tuple encoding.
1866            fidl::encoding::Encode::<LocalServiceDelegateOnWriteValueResponse, D>::encode(
1867                (<ErrorCode as fidl::encoding::ValueTypeMarker>::borrow(&self.status),),
1868                encoder,
1869                offset,
1870                _depth,
1871            )
1872        }
1873    }
1874    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<ErrorCode, D>>
1875        fidl::encoding::Encode<LocalServiceDelegateOnWriteValueResponse, D> for (T0,)
1876    {
1877        #[inline]
1878        unsafe fn encode(
1879            self,
1880            encoder: &mut fidl::encoding::Encoder<'_, D>,
1881            offset: usize,
1882            depth: fidl::encoding::Depth,
1883        ) -> fidl::Result<()> {
1884            encoder.debug_check_bounds::<LocalServiceDelegateOnWriteValueResponse>(offset);
1885            // Zero out padding regions. There's no need to apply masks
1886            // because the unmasked parts will be overwritten by fields.
1887            // Write the fields.
1888            self.0.encode(encoder, offset + 0, depth)?;
1889            Ok(())
1890        }
1891    }
1892
1893    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1894        for LocalServiceDelegateOnWriteValueResponse
1895    {
1896        #[inline(always)]
1897        fn new_empty() -> Self {
1898            Self { status: fidl::new_empty!(ErrorCode, D) }
1899        }
1900
1901        #[inline]
1902        unsafe fn decode(
1903            &mut self,
1904            decoder: &mut fidl::encoding::Decoder<'_, D>,
1905            offset: usize,
1906            _depth: fidl::encoding::Depth,
1907        ) -> fidl::Result<()> {
1908            decoder.debug_check_bounds::<Self>(offset);
1909            // Verify that padding bytes are zero.
1910            fidl::decode!(ErrorCode, D, &mut self.status, decoder, offset + 0, _depth)?;
1911            Ok(())
1912        }
1913    }
1914
1915    impl fidl::encoding::ValueTypeMarker for LocalServiceDelegateOnWriteWithoutResponseRequest {
1916        type Borrowed<'a> = &'a Self;
1917        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1918            value
1919        }
1920    }
1921
1922    unsafe impl fidl::encoding::TypeMarker for LocalServiceDelegateOnWriteWithoutResponseRequest {
1923        type Owned = Self;
1924
1925        #[inline(always)]
1926        fn inline_align(_context: fidl::encoding::Context) -> usize {
1927            8
1928        }
1929
1930        #[inline(always)]
1931        fn inline_size(_context: fidl::encoding::Context) -> usize {
1932            32
1933        }
1934    }
1935
1936    unsafe impl<D: fidl::encoding::ResourceDialect>
1937        fidl::encoding::Encode<LocalServiceDelegateOnWriteWithoutResponseRequest, D>
1938        for &LocalServiceDelegateOnWriteWithoutResponseRequest
1939    {
1940        #[inline]
1941        unsafe fn encode(
1942            self,
1943            encoder: &mut fidl::encoding::Encoder<'_, D>,
1944            offset: usize,
1945            _depth: fidl::encoding::Depth,
1946        ) -> fidl::Result<()> {
1947            encoder.debug_check_bounds::<LocalServiceDelegateOnWriteWithoutResponseRequest>(offset);
1948            // Delegate to tuple encoding.
1949            fidl::encoding::Encode::<LocalServiceDelegateOnWriteWithoutResponseRequest, D>::encode(
1950                (
1951                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
1952                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.offset),
1953                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
1954                ),
1955                encoder, offset, _depth
1956            )
1957        }
1958    }
1959    unsafe impl<
1960            D: fidl::encoding::ResourceDialect,
1961            T0: fidl::encoding::Encode<u64, D>,
1962            T1: fidl::encoding::Encode<u16, D>,
1963            T2: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
1964        > fidl::encoding::Encode<LocalServiceDelegateOnWriteWithoutResponseRequest, D>
1965        for (T0, T1, T2)
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::<LocalServiceDelegateOnWriteWithoutResponseRequest>(offset);
1975            // Zero out padding regions. There's no need to apply masks
1976            // because the unmasked parts will be overwritten by fields.
1977            unsafe {
1978                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
1979                (ptr as *mut u64).write_unaligned(0);
1980            }
1981            // Write the fields.
1982            self.0.encode(encoder, offset + 0, depth)?;
1983            self.1.encode(encoder, offset + 8, depth)?;
1984            self.2.encode(encoder, offset + 16, depth)?;
1985            Ok(())
1986        }
1987    }
1988
1989    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1990        for LocalServiceDelegateOnWriteWithoutResponseRequest
1991    {
1992        #[inline(always)]
1993        fn new_empty() -> Self {
1994            Self {
1995                id: fidl::new_empty!(u64, D),
1996                offset: fidl::new_empty!(u16, D),
1997                value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
1998            }
1999        }
2000
2001        #[inline]
2002        unsafe fn decode(
2003            &mut self,
2004            decoder: &mut fidl::encoding::Decoder<'_, D>,
2005            offset: usize,
2006            _depth: fidl::encoding::Depth,
2007        ) -> fidl::Result<()> {
2008            decoder.debug_check_bounds::<Self>(offset);
2009            // Verify that padding bytes are zero.
2010            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
2011            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2012            let mask = 0xffffffffffff0000u64;
2013            let maskedval = padval & mask;
2014            if maskedval != 0 {
2015                return Err(fidl::Error::NonZeroPadding {
2016                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
2017                });
2018            }
2019            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
2020            fidl::decode!(u16, D, &mut self.offset, decoder, offset + 8, _depth)?;
2021            fidl::decode!(
2022                fidl::encoding::UnboundedVector<u8>,
2023                D,
2024                &mut self.value,
2025                decoder,
2026                offset + 16,
2027                _depth
2028            )?;
2029            Ok(())
2030        }
2031    }
2032
2033    impl fidl::encoding::ValueTypeMarker for LocalServiceNotifyValueRequest {
2034        type Borrowed<'a> = &'a Self;
2035        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2036            value
2037        }
2038    }
2039
2040    unsafe impl fidl::encoding::TypeMarker for LocalServiceNotifyValueRequest {
2041        type Owned = Self;
2042
2043        #[inline(always)]
2044        fn inline_align(_context: fidl::encoding::Context) -> usize {
2045            8
2046        }
2047
2048        #[inline(always)]
2049        fn inline_size(_context: fidl::encoding::Context) -> usize {
2050            48
2051        }
2052    }
2053
2054    unsafe impl<D: fidl::encoding::ResourceDialect>
2055        fidl::encoding::Encode<LocalServiceNotifyValueRequest, D>
2056        for &LocalServiceNotifyValueRequest
2057    {
2058        #[inline]
2059        unsafe fn encode(
2060            self,
2061            encoder: &mut fidl::encoding::Encoder<'_, D>,
2062            offset: usize,
2063            _depth: fidl::encoding::Depth,
2064        ) -> fidl::Result<()> {
2065            encoder.debug_check_bounds::<LocalServiceNotifyValueRequest>(offset);
2066            // Delegate to tuple encoding.
2067            fidl::encoding::Encode::<LocalServiceNotifyValueRequest, D>::encode(
2068                (
2069                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.characteristic_id),
2070                    <fidl::encoding::BoundedString<16> as fidl::encoding::ValueTypeMarker>::borrow(&self.peer_id),
2071                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
2072                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.confirm),
2073                ),
2074                encoder, offset, _depth
2075            )
2076        }
2077    }
2078    unsafe impl<
2079            D: fidl::encoding::ResourceDialect,
2080            T0: fidl::encoding::Encode<u64, D>,
2081            T1: fidl::encoding::Encode<fidl::encoding::BoundedString<16>, D>,
2082            T2: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
2083            T3: fidl::encoding::Encode<bool, D>,
2084        > fidl::encoding::Encode<LocalServiceNotifyValueRequest, D> for (T0, T1, T2, T3)
2085    {
2086        #[inline]
2087        unsafe fn encode(
2088            self,
2089            encoder: &mut fidl::encoding::Encoder<'_, D>,
2090            offset: usize,
2091            depth: fidl::encoding::Depth,
2092        ) -> fidl::Result<()> {
2093            encoder.debug_check_bounds::<LocalServiceNotifyValueRequest>(offset);
2094            // Zero out padding regions. There's no need to apply masks
2095            // because the unmasked parts will be overwritten by fields.
2096            unsafe {
2097                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
2098                (ptr as *mut u64).write_unaligned(0);
2099            }
2100            // Write the fields.
2101            self.0.encode(encoder, offset + 0, depth)?;
2102            self.1.encode(encoder, offset + 8, depth)?;
2103            self.2.encode(encoder, offset + 24, depth)?;
2104            self.3.encode(encoder, offset + 40, depth)?;
2105            Ok(())
2106        }
2107    }
2108
2109    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2110        for LocalServiceNotifyValueRequest
2111    {
2112        #[inline(always)]
2113        fn new_empty() -> Self {
2114            Self {
2115                characteristic_id: fidl::new_empty!(u64, D),
2116                peer_id: fidl::new_empty!(fidl::encoding::BoundedString<16>, D),
2117                value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
2118                confirm: fidl::new_empty!(bool, D),
2119            }
2120        }
2121
2122        #[inline]
2123        unsafe fn decode(
2124            &mut self,
2125            decoder: &mut fidl::encoding::Decoder<'_, D>,
2126            offset: usize,
2127            _depth: fidl::encoding::Depth,
2128        ) -> fidl::Result<()> {
2129            decoder.debug_check_bounds::<Self>(offset);
2130            // Verify that padding bytes are zero.
2131            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
2132            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2133            let mask = 0xffffffffffffff00u64;
2134            let maskedval = padval & mask;
2135            if maskedval != 0 {
2136                return Err(fidl::Error::NonZeroPadding {
2137                    padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
2138                });
2139            }
2140            fidl::decode!(u64, D, &mut self.characteristic_id, decoder, offset + 0, _depth)?;
2141            fidl::decode!(
2142                fidl::encoding::BoundedString<16>,
2143                D,
2144                &mut self.peer_id,
2145                decoder,
2146                offset + 8,
2147                _depth
2148            )?;
2149            fidl::decode!(
2150                fidl::encoding::UnboundedVector<u8>,
2151                D,
2152                &mut self.value,
2153                decoder,
2154                offset + 24,
2155                _depth
2156            )?;
2157            fidl::decode!(bool, D, &mut self.confirm, decoder, offset + 40, _depth)?;
2158            Ok(())
2159        }
2160    }
2161
2162    impl fidl::encoding::ValueTypeMarker for RemoteServiceDiscoverCharacteristicsResponse {
2163        type Borrowed<'a> = &'a Self;
2164        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2165            value
2166        }
2167    }
2168
2169    unsafe impl fidl::encoding::TypeMarker for RemoteServiceDiscoverCharacteristicsResponse {
2170        type Owned = Self;
2171
2172        #[inline(always)]
2173        fn inline_align(_context: fidl::encoding::Context) -> usize {
2174            8
2175        }
2176
2177        #[inline(always)]
2178        fn inline_size(_context: fidl::encoding::Context) -> usize {
2179            24
2180        }
2181    }
2182
2183    unsafe impl<D: fidl::encoding::ResourceDialect>
2184        fidl::encoding::Encode<RemoteServiceDiscoverCharacteristicsResponse, D>
2185        for &RemoteServiceDiscoverCharacteristicsResponse
2186    {
2187        #[inline]
2188        unsafe fn encode(
2189            self,
2190            encoder: &mut fidl::encoding::Encoder<'_, D>,
2191            offset: usize,
2192            _depth: fidl::encoding::Depth,
2193        ) -> fidl::Result<()> {
2194            encoder.debug_check_bounds::<RemoteServiceDiscoverCharacteristicsResponse>(offset);
2195            // Delegate to tuple encoding.
2196            fidl::encoding::Encode::<RemoteServiceDiscoverCharacteristicsResponse, D>::encode(
2197                (
2198                    <fidl_fuchsia_bluetooth__common::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
2199                    <fidl::encoding::Vector<Characteristic, 32767> as fidl::encoding::ValueTypeMarker>::borrow(&self.characteristics),
2200                ),
2201                encoder, offset, _depth
2202            )
2203        }
2204    }
2205    unsafe impl<
2206            D: fidl::encoding::ResourceDialect,
2207            T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth__common::Status, D>,
2208            T1: fidl::encoding::Encode<fidl::encoding::Vector<Characteristic, 32767>, D>,
2209        > fidl::encoding::Encode<RemoteServiceDiscoverCharacteristicsResponse, D> for (T0, T1)
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::<RemoteServiceDiscoverCharacteristicsResponse>(offset);
2219            // Zero out padding regions. There's no need to apply masks
2220            // because the unmasked parts will be overwritten by fields.
2221            // Write the fields.
2222            self.0.encode(encoder, offset + 0, depth)?;
2223            self.1.encode(encoder, offset + 8, depth)?;
2224            Ok(())
2225        }
2226    }
2227
2228    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2229        for RemoteServiceDiscoverCharacteristicsResponse
2230    {
2231        #[inline(always)]
2232        fn new_empty() -> Self {
2233            Self {
2234                status: fidl::new_empty!(fidl_fuchsia_bluetooth__common::Status, D),
2235                characteristics: fidl::new_empty!(fidl::encoding::Vector<Characteristic, 32767>, D),
2236            }
2237        }
2238
2239        #[inline]
2240        unsafe fn decode(
2241            &mut self,
2242            decoder: &mut fidl::encoding::Decoder<'_, D>,
2243            offset: usize,
2244            _depth: fidl::encoding::Depth,
2245        ) -> fidl::Result<()> {
2246            decoder.debug_check_bounds::<Self>(offset);
2247            // Verify that padding bytes are zero.
2248            fidl::decode!(
2249                fidl_fuchsia_bluetooth__common::Status,
2250                D,
2251                &mut self.status,
2252                decoder,
2253                offset + 0,
2254                _depth
2255            )?;
2256            fidl::decode!(fidl::encoding::Vector<Characteristic, 32767>, D, &mut self.characteristics, decoder, offset + 8, _depth)?;
2257            Ok(())
2258        }
2259    }
2260
2261    impl fidl::encoding::ValueTypeMarker for RemoteServiceNotifyCharacteristicRequest {
2262        type Borrowed<'a> = &'a Self;
2263        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2264            value
2265        }
2266    }
2267
2268    unsafe impl fidl::encoding::TypeMarker for RemoteServiceNotifyCharacteristicRequest {
2269        type Owned = Self;
2270
2271        #[inline(always)]
2272        fn inline_align(_context: fidl::encoding::Context) -> usize {
2273            8
2274        }
2275
2276        #[inline(always)]
2277        fn inline_size(_context: fidl::encoding::Context) -> usize {
2278            16
2279        }
2280    }
2281
2282    unsafe impl<D: fidl::encoding::ResourceDialect>
2283        fidl::encoding::Encode<RemoteServiceNotifyCharacteristicRequest, D>
2284        for &RemoteServiceNotifyCharacteristicRequest
2285    {
2286        #[inline]
2287        unsafe fn encode(
2288            self,
2289            encoder: &mut fidl::encoding::Encoder<'_, D>,
2290            offset: usize,
2291            _depth: fidl::encoding::Depth,
2292        ) -> fidl::Result<()> {
2293            encoder.debug_check_bounds::<RemoteServiceNotifyCharacteristicRequest>(offset);
2294            // Delegate to tuple encoding.
2295            fidl::encoding::Encode::<RemoteServiceNotifyCharacteristicRequest, D>::encode(
2296                (
2297                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
2298                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enable),
2299                ),
2300                encoder,
2301                offset,
2302                _depth,
2303            )
2304        }
2305    }
2306    unsafe impl<
2307            D: fidl::encoding::ResourceDialect,
2308            T0: fidl::encoding::Encode<u64, D>,
2309            T1: fidl::encoding::Encode<bool, D>,
2310        > fidl::encoding::Encode<RemoteServiceNotifyCharacteristicRequest, D> for (T0, T1)
2311    {
2312        #[inline]
2313        unsafe fn encode(
2314            self,
2315            encoder: &mut fidl::encoding::Encoder<'_, D>,
2316            offset: usize,
2317            depth: fidl::encoding::Depth,
2318        ) -> fidl::Result<()> {
2319            encoder.debug_check_bounds::<RemoteServiceNotifyCharacteristicRequest>(offset);
2320            // Zero out padding regions. There's no need to apply masks
2321            // because the unmasked parts will be overwritten by fields.
2322            unsafe {
2323                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
2324                (ptr as *mut u64).write_unaligned(0);
2325            }
2326            // Write the fields.
2327            self.0.encode(encoder, offset + 0, depth)?;
2328            self.1.encode(encoder, offset + 8, depth)?;
2329            Ok(())
2330        }
2331    }
2332
2333    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2334        for RemoteServiceNotifyCharacteristicRequest
2335    {
2336        #[inline(always)]
2337        fn new_empty() -> Self {
2338            Self { id: fidl::new_empty!(u64, D), enable: fidl::new_empty!(bool, D) }
2339        }
2340
2341        #[inline]
2342        unsafe fn decode(
2343            &mut self,
2344            decoder: &mut fidl::encoding::Decoder<'_, D>,
2345            offset: usize,
2346            _depth: fidl::encoding::Depth,
2347        ) -> fidl::Result<()> {
2348            decoder.debug_check_bounds::<Self>(offset);
2349            // Verify that padding bytes are zero.
2350            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
2351            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2352            let mask = 0xffffffffffffff00u64;
2353            let maskedval = padval & mask;
2354            if maskedval != 0 {
2355                return Err(fidl::Error::NonZeroPadding {
2356                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
2357                });
2358            }
2359            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
2360            fidl::decode!(bool, D, &mut self.enable, decoder, offset + 8, _depth)?;
2361            Ok(())
2362        }
2363    }
2364
2365    impl fidl::encoding::ValueTypeMarker for RemoteServiceNotifyCharacteristicResponse {
2366        type Borrowed<'a> = &'a Self;
2367        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2368            value
2369        }
2370    }
2371
2372    unsafe impl fidl::encoding::TypeMarker for RemoteServiceNotifyCharacteristicResponse {
2373        type Owned = Self;
2374
2375        #[inline(always)]
2376        fn inline_align(_context: fidl::encoding::Context) -> usize {
2377            8
2378        }
2379
2380        #[inline(always)]
2381        fn inline_size(_context: fidl::encoding::Context) -> usize {
2382            8
2383        }
2384    }
2385
2386    unsafe impl<D: fidl::encoding::ResourceDialect>
2387        fidl::encoding::Encode<RemoteServiceNotifyCharacteristicResponse, D>
2388        for &RemoteServiceNotifyCharacteristicResponse
2389    {
2390        #[inline]
2391        unsafe fn encode(
2392            self,
2393            encoder: &mut fidl::encoding::Encoder<'_, D>,
2394            offset: usize,
2395            _depth: fidl::encoding::Depth,
2396        ) -> fidl::Result<()> {
2397            encoder.debug_check_bounds::<RemoteServiceNotifyCharacteristicResponse>(offset);
2398            // Delegate to tuple encoding.
2399            fidl::encoding::Encode::<RemoteServiceNotifyCharacteristicResponse, D>::encode(
2400                (
2401                    <fidl_fuchsia_bluetooth__common::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
2402                ),
2403                encoder, offset, _depth
2404            )
2405        }
2406    }
2407    unsafe impl<
2408            D: fidl::encoding::ResourceDialect,
2409            T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth__common::Status, D>,
2410        > fidl::encoding::Encode<RemoteServiceNotifyCharacteristicResponse, D> for (T0,)
2411    {
2412        #[inline]
2413        unsafe fn encode(
2414            self,
2415            encoder: &mut fidl::encoding::Encoder<'_, D>,
2416            offset: usize,
2417            depth: fidl::encoding::Depth,
2418        ) -> fidl::Result<()> {
2419            encoder.debug_check_bounds::<RemoteServiceNotifyCharacteristicResponse>(offset);
2420            // Zero out padding regions. There's no need to apply masks
2421            // because the unmasked parts will be overwritten by fields.
2422            // Write the fields.
2423            self.0.encode(encoder, offset + 0, depth)?;
2424            Ok(())
2425        }
2426    }
2427
2428    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2429        for RemoteServiceNotifyCharacteristicResponse
2430    {
2431        #[inline(always)]
2432        fn new_empty() -> Self {
2433            Self { status: fidl::new_empty!(fidl_fuchsia_bluetooth__common::Status, D) }
2434        }
2435
2436        #[inline]
2437        unsafe fn decode(
2438            &mut self,
2439            decoder: &mut fidl::encoding::Decoder<'_, D>,
2440            offset: usize,
2441            _depth: fidl::encoding::Depth,
2442        ) -> fidl::Result<()> {
2443            decoder.debug_check_bounds::<Self>(offset);
2444            // Verify that padding bytes are zero.
2445            fidl::decode!(
2446                fidl_fuchsia_bluetooth__common::Status,
2447                D,
2448                &mut self.status,
2449                decoder,
2450                offset + 0,
2451                _depth
2452            )?;
2453            Ok(())
2454        }
2455    }
2456
2457    impl fidl::encoding::ValueTypeMarker for RemoteServiceOnCharacteristicValueUpdatedRequest {
2458        type Borrowed<'a> = &'a Self;
2459        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2460            value
2461        }
2462    }
2463
2464    unsafe impl fidl::encoding::TypeMarker for RemoteServiceOnCharacteristicValueUpdatedRequest {
2465        type Owned = Self;
2466
2467        #[inline(always)]
2468        fn inline_align(_context: fidl::encoding::Context) -> usize {
2469            8
2470        }
2471
2472        #[inline(always)]
2473        fn inline_size(_context: fidl::encoding::Context) -> usize {
2474            24
2475        }
2476    }
2477
2478    unsafe impl<D: fidl::encoding::ResourceDialect>
2479        fidl::encoding::Encode<RemoteServiceOnCharacteristicValueUpdatedRequest, D>
2480        for &RemoteServiceOnCharacteristicValueUpdatedRequest
2481    {
2482        #[inline]
2483        unsafe fn encode(
2484            self,
2485            encoder: &mut fidl::encoding::Encoder<'_, D>,
2486            offset: usize,
2487            _depth: fidl::encoding::Depth,
2488        ) -> fidl::Result<()> {
2489            encoder.debug_check_bounds::<RemoteServiceOnCharacteristicValueUpdatedRequest>(offset);
2490            // Delegate to tuple encoding.
2491            fidl::encoding::Encode::<RemoteServiceOnCharacteristicValueUpdatedRequest, D>::encode(
2492                (
2493                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
2494                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
2495                ),
2496                encoder, offset, _depth
2497            )
2498        }
2499    }
2500    unsafe impl<
2501            D: fidl::encoding::ResourceDialect,
2502            T0: fidl::encoding::Encode<u64, D>,
2503            T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
2504        > fidl::encoding::Encode<RemoteServiceOnCharacteristicValueUpdatedRequest, D> for (T0, T1)
2505    {
2506        #[inline]
2507        unsafe fn encode(
2508            self,
2509            encoder: &mut fidl::encoding::Encoder<'_, D>,
2510            offset: usize,
2511            depth: fidl::encoding::Depth,
2512        ) -> fidl::Result<()> {
2513            encoder.debug_check_bounds::<RemoteServiceOnCharacteristicValueUpdatedRequest>(offset);
2514            // Zero out padding regions. There's no need to apply masks
2515            // because the unmasked parts will be overwritten by fields.
2516            // Write the fields.
2517            self.0.encode(encoder, offset + 0, depth)?;
2518            self.1.encode(encoder, offset + 8, depth)?;
2519            Ok(())
2520        }
2521    }
2522
2523    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2524        for RemoteServiceOnCharacteristicValueUpdatedRequest
2525    {
2526        #[inline(always)]
2527        fn new_empty() -> Self {
2528            Self {
2529                id: fidl::new_empty!(u64, D),
2530                value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
2531            }
2532        }
2533
2534        #[inline]
2535        unsafe fn decode(
2536            &mut self,
2537            decoder: &mut fidl::encoding::Decoder<'_, D>,
2538            offset: usize,
2539            _depth: fidl::encoding::Depth,
2540        ) -> fidl::Result<()> {
2541            decoder.debug_check_bounds::<Self>(offset);
2542            // Verify that padding bytes are zero.
2543            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
2544            fidl::decode!(
2545                fidl::encoding::UnboundedVector<u8>,
2546                D,
2547                &mut self.value,
2548                decoder,
2549                offset + 8,
2550                _depth
2551            )?;
2552            Ok(())
2553        }
2554    }
2555
2556    impl fidl::encoding::ValueTypeMarker for RemoteServiceReadByTypeRequest {
2557        type Borrowed<'a> = &'a Self;
2558        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2559            value
2560        }
2561    }
2562
2563    unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadByTypeRequest {
2564        type Owned = Self;
2565
2566        #[inline(always)]
2567        fn inline_align(_context: fidl::encoding::Context) -> usize {
2568            1
2569        }
2570
2571        #[inline(always)]
2572        fn inline_size(_context: fidl::encoding::Context) -> usize {
2573            16
2574        }
2575    }
2576
2577    unsafe impl<D: fidl::encoding::ResourceDialect>
2578        fidl::encoding::Encode<RemoteServiceReadByTypeRequest, D>
2579        for &RemoteServiceReadByTypeRequest
2580    {
2581        #[inline]
2582        unsafe fn encode(
2583            self,
2584            encoder: &mut fidl::encoding::Encoder<'_, D>,
2585            offset: usize,
2586            _depth: fidl::encoding::Depth,
2587        ) -> fidl::Result<()> {
2588            encoder.debug_check_bounds::<RemoteServiceReadByTypeRequest>(offset);
2589            // Delegate to tuple encoding.
2590            fidl::encoding::Encode::<RemoteServiceReadByTypeRequest, D>::encode(
2591                (
2592                    <fidl_fuchsia_bluetooth__common::Uuid as fidl::encoding::ValueTypeMarker>::borrow(&self.uuid),
2593                ),
2594                encoder, offset, _depth
2595            )
2596        }
2597    }
2598    unsafe impl<
2599            D: fidl::encoding::ResourceDialect,
2600            T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth__common::Uuid, D>,
2601        > fidl::encoding::Encode<RemoteServiceReadByTypeRequest, D> for (T0,)
2602    {
2603        #[inline]
2604        unsafe fn encode(
2605            self,
2606            encoder: &mut fidl::encoding::Encoder<'_, D>,
2607            offset: usize,
2608            depth: fidl::encoding::Depth,
2609        ) -> fidl::Result<()> {
2610            encoder.debug_check_bounds::<RemoteServiceReadByTypeRequest>(offset);
2611            // Zero out padding regions. There's no need to apply masks
2612            // because the unmasked parts will be overwritten by fields.
2613            // Write the fields.
2614            self.0.encode(encoder, offset + 0, depth)?;
2615            Ok(())
2616        }
2617    }
2618
2619    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2620        for RemoteServiceReadByTypeRequest
2621    {
2622        #[inline(always)]
2623        fn new_empty() -> Self {
2624            Self { uuid: fidl::new_empty!(fidl_fuchsia_bluetooth__common::Uuid, D) }
2625        }
2626
2627        #[inline]
2628        unsafe fn decode(
2629            &mut self,
2630            decoder: &mut fidl::encoding::Decoder<'_, D>,
2631            offset: usize,
2632            _depth: fidl::encoding::Depth,
2633        ) -> fidl::Result<()> {
2634            decoder.debug_check_bounds::<Self>(offset);
2635            // Verify that padding bytes are zero.
2636            fidl::decode!(
2637                fidl_fuchsia_bluetooth__common::Uuid,
2638                D,
2639                &mut self.uuid,
2640                decoder,
2641                offset + 0,
2642                _depth
2643            )?;
2644            Ok(())
2645        }
2646    }
2647
2648    impl fidl::encoding::ValueTypeMarker for RemoteServiceReadCharacteristicRequest {
2649        type Borrowed<'a> = &'a Self;
2650        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2651            value
2652        }
2653    }
2654
2655    unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadCharacteristicRequest {
2656        type Owned = Self;
2657
2658        #[inline(always)]
2659        fn inline_align(_context: fidl::encoding::Context) -> usize {
2660            8
2661        }
2662
2663        #[inline(always)]
2664        fn inline_size(_context: fidl::encoding::Context) -> usize {
2665            8
2666        }
2667        #[inline(always)]
2668        fn encode_is_copy() -> bool {
2669            true
2670        }
2671
2672        #[inline(always)]
2673        fn decode_is_copy() -> bool {
2674            true
2675        }
2676    }
2677
2678    unsafe impl<D: fidl::encoding::ResourceDialect>
2679        fidl::encoding::Encode<RemoteServiceReadCharacteristicRequest, D>
2680        for &RemoteServiceReadCharacteristicRequest
2681    {
2682        #[inline]
2683        unsafe fn encode(
2684            self,
2685            encoder: &mut fidl::encoding::Encoder<'_, D>,
2686            offset: usize,
2687            _depth: fidl::encoding::Depth,
2688        ) -> fidl::Result<()> {
2689            encoder.debug_check_bounds::<RemoteServiceReadCharacteristicRequest>(offset);
2690            unsafe {
2691                // Copy the object into the buffer.
2692                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2693                (buf_ptr as *mut RemoteServiceReadCharacteristicRequest).write_unaligned(
2694                    (self as *const RemoteServiceReadCharacteristicRequest).read(),
2695                );
2696                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2697                // done second because the memcpy will write garbage to these bytes.
2698            }
2699            Ok(())
2700        }
2701    }
2702    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
2703        fidl::encoding::Encode<RemoteServiceReadCharacteristicRequest, D> for (T0,)
2704    {
2705        #[inline]
2706        unsafe fn encode(
2707            self,
2708            encoder: &mut fidl::encoding::Encoder<'_, D>,
2709            offset: usize,
2710            depth: fidl::encoding::Depth,
2711        ) -> fidl::Result<()> {
2712            encoder.debug_check_bounds::<RemoteServiceReadCharacteristicRequest>(offset);
2713            // Zero out padding regions. There's no need to apply masks
2714            // because the unmasked parts will be overwritten by fields.
2715            // Write the fields.
2716            self.0.encode(encoder, offset + 0, depth)?;
2717            Ok(())
2718        }
2719    }
2720
2721    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2722        for RemoteServiceReadCharacteristicRequest
2723    {
2724        #[inline(always)]
2725        fn new_empty() -> Self {
2726            Self { id: fidl::new_empty!(u64, D) }
2727        }
2728
2729        #[inline]
2730        unsafe fn decode(
2731            &mut self,
2732            decoder: &mut fidl::encoding::Decoder<'_, D>,
2733            offset: usize,
2734            _depth: fidl::encoding::Depth,
2735        ) -> fidl::Result<()> {
2736            decoder.debug_check_bounds::<Self>(offset);
2737            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2738            // Verify that padding bytes are zero.
2739            // Copy from the buffer into the object.
2740            unsafe {
2741                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
2742            }
2743            Ok(())
2744        }
2745    }
2746
2747    impl fidl::encoding::ValueTypeMarker for RemoteServiceReadCharacteristicResponse {
2748        type Borrowed<'a> = &'a Self;
2749        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2750            value
2751        }
2752    }
2753
2754    unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadCharacteristicResponse {
2755        type Owned = Self;
2756
2757        #[inline(always)]
2758        fn inline_align(_context: fidl::encoding::Context) -> usize {
2759            8
2760        }
2761
2762        #[inline(always)]
2763        fn inline_size(_context: fidl::encoding::Context) -> usize {
2764            24
2765        }
2766    }
2767
2768    unsafe impl<D: fidl::encoding::ResourceDialect>
2769        fidl::encoding::Encode<RemoteServiceReadCharacteristicResponse, D>
2770        for &RemoteServiceReadCharacteristicResponse
2771    {
2772        #[inline]
2773        unsafe fn encode(
2774            self,
2775            encoder: &mut fidl::encoding::Encoder<'_, D>,
2776            offset: usize,
2777            _depth: fidl::encoding::Depth,
2778        ) -> fidl::Result<()> {
2779            encoder.debug_check_bounds::<RemoteServiceReadCharacteristicResponse>(offset);
2780            // Delegate to tuple encoding.
2781            fidl::encoding::Encode::<RemoteServiceReadCharacteristicResponse, D>::encode(
2782                (
2783                    <fidl_fuchsia_bluetooth__common::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
2784                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
2785                ),
2786                encoder, offset, _depth
2787            )
2788        }
2789    }
2790    unsafe impl<
2791            D: fidl::encoding::ResourceDialect,
2792            T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth__common::Status, D>,
2793            T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
2794        > fidl::encoding::Encode<RemoteServiceReadCharacteristicResponse, D> for (T0, T1)
2795    {
2796        #[inline]
2797        unsafe fn encode(
2798            self,
2799            encoder: &mut fidl::encoding::Encoder<'_, D>,
2800            offset: usize,
2801            depth: fidl::encoding::Depth,
2802        ) -> fidl::Result<()> {
2803            encoder.debug_check_bounds::<RemoteServiceReadCharacteristicResponse>(offset);
2804            // Zero out padding regions. There's no need to apply masks
2805            // because the unmasked parts will be overwritten by fields.
2806            // Write the fields.
2807            self.0.encode(encoder, offset + 0, depth)?;
2808            self.1.encode(encoder, offset + 8, depth)?;
2809            Ok(())
2810        }
2811    }
2812
2813    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2814        for RemoteServiceReadCharacteristicResponse
2815    {
2816        #[inline(always)]
2817        fn new_empty() -> Self {
2818            Self {
2819                status: fidl::new_empty!(fidl_fuchsia_bluetooth__common::Status, D),
2820                value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
2821            }
2822        }
2823
2824        #[inline]
2825        unsafe fn decode(
2826            &mut self,
2827            decoder: &mut fidl::encoding::Decoder<'_, D>,
2828            offset: usize,
2829            _depth: fidl::encoding::Depth,
2830        ) -> fidl::Result<()> {
2831            decoder.debug_check_bounds::<Self>(offset);
2832            // Verify that padding bytes are zero.
2833            fidl::decode!(
2834                fidl_fuchsia_bluetooth__common::Status,
2835                D,
2836                &mut self.status,
2837                decoder,
2838                offset + 0,
2839                _depth
2840            )?;
2841            fidl::decode!(
2842                fidl::encoding::UnboundedVector<u8>,
2843                D,
2844                &mut self.value,
2845                decoder,
2846                offset + 8,
2847                _depth
2848            )?;
2849            Ok(())
2850        }
2851    }
2852
2853    impl fidl::encoding::ValueTypeMarker for RemoteServiceReadDescriptorRequest {
2854        type Borrowed<'a> = &'a Self;
2855        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2856            value
2857        }
2858    }
2859
2860    unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadDescriptorRequest {
2861        type Owned = Self;
2862
2863        #[inline(always)]
2864        fn inline_align(_context: fidl::encoding::Context) -> usize {
2865            8
2866        }
2867
2868        #[inline(always)]
2869        fn inline_size(_context: fidl::encoding::Context) -> usize {
2870            8
2871        }
2872        #[inline(always)]
2873        fn encode_is_copy() -> bool {
2874            true
2875        }
2876
2877        #[inline(always)]
2878        fn decode_is_copy() -> bool {
2879            true
2880        }
2881    }
2882
2883    unsafe impl<D: fidl::encoding::ResourceDialect>
2884        fidl::encoding::Encode<RemoteServiceReadDescriptorRequest, D>
2885        for &RemoteServiceReadDescriptorRequest
2886    {
2887        #[inline]
2888        unsafe fn encode(
2889            self,
2890            encoder: &mut fidl::encoding::Encoder<'_, D>,
2891            offset: usize,
2892            _depth: fidl::encoding::Depth,
2893        ) -> fidl::Result<()> {
2894            encoder.debug_check_bounds::<RemoteServiceReadDescriptorRequest>(offset);
2895            unsafe {
2896                // Copy the object into the buffer.
2897                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2898                (buf_ptr as *mut RemoteServiceReadDescriptorRequest)
2899                    .write_unaligned((self as *const RemoteServiceReadDescriptorRequest).read());
2900                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2901                // done second because the memcpy will write garbage to these bytes.
2902            }
2903            Ok(())
2904        }
2905    }
2906    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
2907        fidl::encoding::Encode<RemoteServiceReadDescriptorRequest, D> for (T0,)
2908    {
2909        #[inline]
2910        unsafe fn encode(
2911            self,
2912            encoder: &mut fidl::encoding::Encoder<'_, D>,
2913            offset: usize,
2914            depth: fidl::encoding::Depth,
2915        ) -> fidl::Result<()> {
2916            encoder.debug_check_bounds::<RemoteServiceReadDescriptorRequest>(offset);
2917            // Zero out padding regions. There's no need to apply masks
2918            // because the unmasked parts will be overwritten by fields.
2919            // Write the fields.
2920            self.0.encode(encoder, offset + 0, depth)?;
2921            Ok(())
2922        }
2923    }
2924
2925    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2926        for RemoteServiceReadDescriptorRequest
2927    {
2928        #[inline(always)]
2929        fn new_empty() -> Self {
2930            Self { id: fidl::new_empty!(u64, D) }
2931        }
2932
2933        #[inline]
2934        unsafe fn decode(
2935            &mut self,
2936            decoder: &mut fidl::encoding::Decoder<'_, D>,
2937            offset: usize,
2938            _depth: fidl::encoding::Depth,
2939        ) -> fidl::Result<()> {
2940            decoder.debug_check_bounds::<Self>(offset);
2941            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2942            // Verify that padding bytes are zero.
2943            // Copy from the buffer into the object.
2944            unsafe {
2945                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
2946            }
2947            Ok(())
2948        }
2949    }
2950
2951    impl fidl::encoding::ValueTypeMarker for RemoteServiceReadDescriptorResponse {
2952        type Borrowed<'a> = &'a Self;
2953        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2954            value
2955        }
2956    }
2957
2958    unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadDescriptorResponse {
2959        type Owned = Self;
2960
2961        #[inline(always)]
2962        fn inline_align(_context: fidl::encoding::Context) -> usize {
2963            8
2964        }
2965
2966        #[inline(always)]
2967        fn inline_size(_context: fidl::encoding::Context) -> usize {
2968            24
2969        }
2970    }
2971
2972    unsafe impl<D: fidl::encoding::ResourceDialect>
2973        fidl::encoding::Encode<RemoteServiceReadDescriptorResponse, D>
2974        for &RemoteServiceReadDescriptorResponse
2975    {
2976        #[inline]
2977        unsafe fn encode(
2978            self,
2979            encoder: &mut fidl::encoding::Encoder<'_, D>,
2980            offset: usize,
2981            _depth: fidl::encoding::Depth,
2982        ) -> fidl::Result<()> {
2983            encoder.debug_check_bounds::<RemoteServiceReadDescriptorResponse>(offset);
2984            // Delegate to tuple encoding.
2985            fidl::encoding::Encode::<RemoteServiceReadDescriptorResponse, D>::encode(
2986                (
2987                    <fidl_fuchsia_bluetooth__common::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
2988                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
2989                ),
2990                encoder, offset, _depth
2991            )
2992        }
2993    }
2994    unsafe impl<
2995            D: fidl::encoding::ResourceDialect,
2996            T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth__common::Status, D>,
2997            T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
2998        > fidl::encoding::Encode<RemoteServiceReadDescriptorResponse, D> for (T0, T1)
2999    {
3000        #[inline]
3001        unsafe fn encode(
3002            self,
3003            encoder: &mut fidl::encoding::Encoder<'_, D>,
3004            offset: usize,
3005            depth: fidl::encoding::Depth,
3006        ) -> fidl::Result<()> {
3007            encoder.debug_check_bounds::<RemoteServiceReadDescriptorResponse>(offset);
3008            // Zero out padding regions. There's no need to apply masks
3009            // because the unmasked parts will be overwritten by fields.
3010            // Write the fields.
3011            self.0.encode(encoder, offset + 0, depth)?;
3012            self.1.encode(encoder, offset + 8, depth)?;
3013            Ok(())
3014        }
3015    }
3016
3017    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3018        for RemoteServiceReadDescriptorResponse
3019    {
3020        #[inline(always)]
3021        fn new_empty() -> Self {
3022            Self {
3023                status: fidl::new_empty!(fidl_fuchsia_bluetooth__common::Status, D),
3024                value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
3025            }
3026        }
3027
3028        #[inline]
3029        unsafe fn decode(
3030            &mut self,
3031            decoder: &mut fidl::encoding::Decoder<'_, D>,
3032            offset: usize,
3033            _depth: fidl::encoding::Depth,
3034        ) -> fidl::Result<()> {
3035            decoder.debug_check_bounds::<Self>(offset);
3036            // Verify that padding bytes are zero.
3037            fidl::decode!(
3038                fidl_fuchsia_bluetooth__common::Status,
3039                D,
3040                &mut self.status,
3041                decoder,
3042                offset + 0,
3043                _depth
3044            )?;
3045            fidl::decode!(
3046                fidl::encoding::UnboundedVector<u8>,
3047                D,
3048                &mut self.value,
3049                decoder,
3050                offset + 8,
3051                _depth
3052            )?;
3053            Ok(())
3054        }
3055    }
3056
3057    impl fidl::encoding::ValueTypeMarker for RemoteServiceReadLongCharacteristicRequest {
3058        type Borrowed<'a> = &'a Self;
3059        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3060            value
3061        }
3062    }
3063
3064    unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadLongCharacteristicRequest {
3065        type Owned = Self;
3066
3067        #[inline(always)]
3068        fn inline_align(_context: fidl::encoding::Context) -> usize {
3069            8
3070        }
3071
3072        #[inline(always)]
3073        fn inline_size(_context: fidl::encoding::Context) -> usize {
3074            16
3075        }
3076    }
3077
3078    unsafe impl<D: fidl::encoding::ResourceDialect>
3079        fidl::encoding::Encode<RemoteServiceReadLongCharacteristicRequest, D>
3080        for &RemoteServiceReadLongCharacteristicRequest
3081    {
3082        #[inline]
3083        unsafe fn encode(
3084            self,
3085            encoder: &mut fidl::encoding::Encoder<'_, D>,
3086            offset: usize,
3087            _depth: fidl::encoding::Depth,
3088        ) -> fidl::Result<()> {
3089            encoder.debug_check_bounds::<RemoteServiceReadLongCharacteristicRequest>(offset);
3090            unsafe {
3091                // Copy the object into the buffer.
3092                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3093                (buf_ptr as *mut RemoteServiceReadLongCharacteristicRequest).write_unaligned(
3094                    (self as *const RemoteServiceReadLongCharacteristicRequest).read(),
3095                );
3096                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3097                // done second because the memcpy will write garbage to these bytes.
3098                let padding_ptr = buf_ptr.offset(8) as *mut u64;
3099                let padding_mask = 0xffffffff00000000u64;
3100                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
3101            }
3102            Ok(())
3103        }
3104    }
3105    unsafe impl<
3106            D: fidl::encoding::ResourceDialect,
3107            T0: fidl::encoding::Encode<u64, D>,
3108            T1: fidl::encoding::Encode<u16, D>,
3109            T2: fidl::encoding::Encode<u16, D>,
3110        > fidl::encoding::Encode<RemoteServiceReadLongCharacteristicRequest, D> for (T0, T1, T2)
3111    {
3112        #[inline]
3113        unsafe fn encode(
3114            self,
3115            encoder: &mut fidl::encoding::Encoder<'_, D>,
3116            offset: usize,
3117            depth: fidl::encoding::Depth,
3118        ) -> fidl::Result<()> {
3119            encoder.debug_check_bounds::<RemoteServiceReadLongCharacteristicRequest>(offset);
3120            // Zero out padding regions. There's no need to apply masks
3121            // because the unmasked parts will be overwritten by fields.
3122            unsafe {
3123                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
3124                (ptr as *mut u64).write_unaligned(0);
3125            }
3126            // Write the fields.
3127            self.0.encode(encoder, offset + 0, depth)?;
3128            self.1.encode(encoder, offset + 8, depth)?;
3129            self.2.encode(encoder, offset + 10, depth)?;
3130            Ok(())
3131        }
3132    }
3133
3134    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3135        for RemoteServiceReadLongCharacteristicRequest
3136    {
3137        #[inline(always)]
3138        fn new_empty() -> Self {
3139            Self {
3140                id: fidl::new_empty!(u64, D),
3141                offset: fidl::new_empty!(u16, D),
3142                max_bytes: fidl::new_empty!(u16, D),
3143            }
3144        }
3145
3146        #[inline]
3147        unsafe fn decode(
3148            &mut self,
3149            decoder: &mut fidl::encoding::Decoder<'_, D>,
3150            offset: usize,
3151            _depth: fidl::encoding::Depth,
3152        ) -> fidl::Result<()> {
3153            decoder.debug_check_bounds::<Self>(offset);
3154            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3155            // Verify that padding bytes are zero.
3156            let ptr = unsafe { buf_ptr.offset(8) };
3157            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3158            let mask = 0xffffffff00000000u64;
3159            let maskedval = padval & mask;
3160            if maskedval != 0 {
3161                return Err(fidl::Error::NonZeroPadding {
3162                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
3163                });
3164            }
3165            // Copy from the buffer into the object.
3166            unsafe {
3167                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
3168            }
3169            Ok(())
3170        }
3171    }
3172
3173    impl fidl::encoding::ValueTypeMarker for RemoteServiceReadLongCharacteristicResponse {
3174        type Borrowed<'a> = &'a Self;
3175        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3176            value
3177        }
3178    }
3179
3180    unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadLongCharacteristicResponse {
3181        type Owned = Self;
3182
3183        #[inline(always)]
3184        fn inline_align(_context: fidl::encoding::Context) -> usize {
3185            8
3186        }
3187
3188        #[inline(always)]
3189        fn inline_size(_context: fidl::encoding::Context) -> usize {
3190            24
3191        }
3192    }
3193
3194    unsafe impl<D: fidl::encoding::ResourceDialect>
3195        fidl::encoding::Encode<RemoteServiceReadLongCharacteristicResponse, D>
3196        for &RemoteServiceReadLongCharacteristicResponse
3197    {
3198        #[inline]
3199        unsafe fn encode(
3200            self,
3201            encoder: &mut fidl::encoding::Encoder<'_, D>,
3202            offset: usize,
3203            _depth: fidl::encoding::Depth,
3204        ) -> fidl::Result<()> {
3205            encoder.debug_check_bounds::<RemoteServiceReadLongCharacteristicResponse>(offset);
3206            // Delegate to tuple encoding.
3207            fidl::encoding::Encode::<RemoteServiceReadLongCharacteristicResponse, D>::encode(
3208                (
3209                    <fidl_fuchsia_bluetooth__common::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
3210                    <fidl::encoding::Vector<u8, 512> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
3211                ),
3212                encoder, offset, _depth
3213            )
3214        }
3215    }
3216    unsafe impl<
3217            D: fidl::encoding::ResourceDialect,
3218            T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth__common::Status, D>,
3219            T1: fidl::encoding::Encode<fidl::encoding::Vector<u8, 512>, D>,
3220        > fidl::encoding::Encode<RemoteServiceReadLongCharacteristicResponse, D> for (T0, T1)
3221    {
3222        #[inline]
3223        unsafe fn encode(
3224            self,
3225            encoder: &mut fidl::encoding::Encoder<'_, D>,
3226            offset: usize,
3227            depth: fidl::encoding::Depth,
3228        ) -> fidl::Result<()> {
3229            encoder.debug_check_bounds::<RemoteServiceReadLongCharacteristicResponse>(offset);
3230            // Zero out padding regions. There's no need to apply masks
3231            // because the unmasked parts will be overwritten by fields.
3232            // Write the fields.
3233            self.0.encode(encoder, offset + 0, depth)?;
3234            self.1.encode(encoder, offset + 8, depth)?;
3235            Ok(())
3236        }
3237    }
3238
3239    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3240        for RemoteServiceReadLongCharacteristicResponse
3241    {
3242        #[inline(always)]
3243        fn new_empty() -> Self {
3244            Self {
3245                status: fidl::new_empty!(fidl_fuchsia_bluetooth__common::Status, D),
3246                value: fidl::new_empty!(fidl::encoding::Vector<u8, 512>, D),
3247            }
3248        }
3249
3250        #[inline]
3251        unsafe fn decode(
3252            &mut self,
3253            decoder: &mut fidl::encoding::Decoder<'_, D>,
3254            offset: usize,
3255            _depth: fidl::encoding::Depth,
3256        ) -> fidl::Result<()> {
3257            decoder.debug_check_bounds::<Self>(offset);
3258            // Verify that padding bytes are zero.
3259            fidl::decode!(
3260                fidl_fuchsia_bluetooth__common::Status,
3261                D,
3262                &mut self.status,
3263                decoder,
3264                offset + 0,
3265                _depth
3266            )?;
3267            fidl::decode!(fidl::encoding::Vector<u8, 512>, D, &mut self.value, decoder, offset + 8, _depth)?;
3268            Ok(())
3269        }
3270    }
3271
3272    impl fidl::encoding::ValueTypeMarker for RemoteServiceReadLongDescriptorRequest {
3273        type Borrowed<'a> = &'a Self;
3274        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3275            value
3276        }
3277    }
3278
3279    unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadLongDescriptorRequest {
3280        type Owned = Self;
3281
3282        #[inline(always)]
3283        fn inline_align(_context: fidl::encoding::Context) -> usize {
3284            8
3285        }
3286
3287        #[inline(always)]
3288        fn inline_size(_context: fidl::encoding::Context) -> usize {
3289            16
3290        }
3291    }
3292
3293    unsafe impl<D: fidl::encoding::ResourceDialect>
3294        fidl::encoding::Encode<RemoteServiceReadLongDescriptorRequest, D>
3295        for &RemoteServiceReadLongDescriptorRequest
3296    {
3297        #[inline]
3298        unsafe fn encode(
3299            self,
3300            encoder: &mut fidl::encoding::Encoder<'_, D>,
3301            offset: usize,
3302            _depth: fidl::encoding::Depth,
3303        ) -> fidl::Result<()> {
3304            encoder.debug_check_bounds::<RemoteServiceReadLongDescriptorRequest>(offset);
3305            unsafe {
3306                // Copy the object into the buffer.
3307                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3308                (buf_ptr as *mut RemoteServiceReadLongDescriptorRequest).write_unaligned(
3309                    (self as *const RemoteServiceReadLongDescriptorRequest).read(),
3310                );
3311                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3312                // done second because the memcpy will write garbage to these bytes.
3313                let padding_ptr = buf_ptr.offset(8) as *mut u64;
3314                let padding_mask = 0xffffffff00000000u64;
3315                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
3316            }
3317            Ok(())
3318        }
3319    }
3320    unsafe impl<
3321            D: fidl::encoding::ResourceDialect,
3322            T0: fidl::encoding::Encode<u64, D>,
3323            T1: fidl::encoding::Encode<u16, D>,
3324            T2: fidl::encoding::Encode<u16, D>,
3325        > fidl::encoding::Encode<RemoteServiceReadLongDescriptorRequest, D> for (T0, T1, T2)
3326    {
3327        #[inline]
3328        unsafe fn encode(
3329            self,
3330            encoder: &mut fidl::encoding::Encoder<'_, D>,
3331            offset: usize,
3332            depth: fidl::encoding::Depth,
3333        ) -> fidl::Result<()> {
3334            encoder.debug_check_bounds::<RemoteServiceReadLongDescriptorRequest>(offset);
3335            // Zero out padding regions. There's no need to apply masks
3336            // because the unmasked parts will be overwritten by fields.
3337            unsafe {
3338                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
3339                (ptr as *mut u64).write_unaligned(0);
3340            }
3341            // Write the fields.
3342            self.0.encode(encoder, offset + 0, depth)?;
3343            self.1.encode(encoder, offset + 8, depth)?;
3344            self.2.encode(encoder, offset + 10, depth)?;
3345            Ok(())
3346        }
3347    }
3348
3349    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3350        for RemoteServiceReadLongDescriptorRequest
3351    {
3352        #[inline(always)]
3353        fn new_empty() -> Self {
3354            Self {
3355                id: fidl::new_empty!(u64, D),
3356                offset: fidl::new_empty!(u16, D),
3357                max_bytes: fidl::new_empty!(u16, D),
3358            }
3359        }
3360
3361        #[inline]
3362        unsafe fn decode(
3363            &mut self,
3364            decoder: &mut fidl::encoding::Decoder<'_, D>,
3365            offset: usize,
3366            _depth: fidl::encoding::Depth,
3367        ) -> fidl::Result<()> {
3368            decoder.debug_check_bounds::<Self>(offset);
3369            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3370            // Verify that padding bytes are zero.
3371            let ptr = unsafe { buf_ptr.offset(8) };
3372            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3373            let mask = 0xffffffff00000000u64;
3374            let maskedval = padval & mask;
3375            if maskedval != 0 {
3376                return Err(fidl::Error::NonZeroPadding {
3377                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
3378                });
3379            }
3380            // Copy from the buffer into the object.
3381            unsafe {
3382                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
3383            }
3384            Ok(())
3385        }
3386    }
3387
3388    impl fidl::encoding::ValueTypeMarker for RemoteServiceReadLongDescriptorResponse {
3389        type Borrowed<'a> = &'a Self;
3390        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3391            value
3392        }
3393    }
3394
3395    unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadLongDescriptorResponse {
3396        type Owned = Self;
3397
3398        #[inline(always)]
3399        fn inline_align(_context: fidl::encoding::Context) -> usize {
3400            8
3401        }
3402
3403        #[inline(always)]
3404        fn inline_size(_context: fidl::encoding::Context) -> usize {
3405            24
3406        }
3407    }
3408
3409    unsafe impl<D: fidl::encoding::ResourceDialect>
3410        fidl::encoding::Encode<RemoteServiceReadLongDescriptorResponse, D>
3411        for &RemoteServiceReadLongDescriptorResponse
3412    {
3413        #[inline]
3414        unsafe fn encode(
3415            self,
3416            encoder: &mut fidl::encoding::Encoder<'_, D>,
3417            offset: usize,
3418            _depth: fidl::encoding::Depth,
3419        ) -> fidl::Result<()> {
3420            encoder.debug_check_bounds::<RemoteServiceReadLongDescriptorResponse>(offset);
3421            // Delegate to tuple encoding.
3422            fidl::encoding::Encode::<RemoteServiceReadLongDescriptorResponse, D>::encode(
3423                (
3424                    <fidl_fuchsia_bluetooth__common::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
3425                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
3426                ),
3427                encoder, offset, _depth
3428            )
3429        }
3430    }
3431    unsafe impl<
3432            D: fidl::encoding::ResourceDialect,
3433            T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth__common::Status, D>,
3434            T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
3435        > fidl::encoding::Encode<RemoteServiceReadLongDescriptorResponse, D> for (T0, T1)
3436    {
3437        #[inline]
3438        unsafe fn encode(
3439            self,
3440            encoder: &mut fidl::encoding::Encoder<'_, D>,
3441            offset: usize,
3442            depth: fidl::encoding::Depth,
3443        ) -> fidl::Result<()> {
3444            encoder.debug_check_bounds::<RemoteServiceReadLongDescriptorResponse>(offset);
3445            // Zero out padding regions. There's no need to apply masks
3446            // because the unmasked parts will be overwritten by fields.
3447            // Write the fields.
3448            self.0.encode(encoder, offset + 0, depth)?;
3449            self.1.encode(encoder, offset + 8, depth)?;
3450            Ok(())
3451        }
3452    }
3453
3454    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3455        for RemoteServiceReadLongDescriptorResponse
3456    {
3457        #[inline(always)]
3458        fn new_empty() -> Self {
3459            Self {
3460                status: fidl::new_empty!(fidl_fuchsia_bluetooth__common::Status, D),
3461                value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
3462            }
3463        }
3464
3465        #[inline]
3466        unsafe fn decode(
3467            &mut self,
3468            decoder: &mut fidl::encoding::Decoder<'_, D>,
3469            offset: usize,
3470            _depth: fidl::encoding::Depth,
3471        ) -> fidl::Result<()> {
3472            decoder.debug_check_bounds::<Self>(offset);
3473            // Verify that padding bytes are zero.
3474            fidl::decode!(
3475                fidl_fuchsia_bluetooth__common::Status,
3476                D,
3477                &mut self.status,
3478                decoder,
3479                offset + 0,
3480                _depth
3481            )?;
3482            fidl::decode!(
3483                fidl::encoding::UnboundedVector<u8>,
3484                D,
3485                &mut self.value,
3486                decoder,
3487                offset + 8,
3488                _depth
3489            )?;
3490            Ok(())
3491        }
3492    }
3493
3494    impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteCharacteristicRequest {
3495        type Borrowed<'a> = &'a Self;
3496        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3497            value
3498        }
3499    }
3500
3501    unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteCharacteristicRequest {
3502        type Owned = Self;
3503
3504        #[inline(always)]
3505        fn inline_align(_context: fidl::encoding::Context) -> usize {
3506            8
3507        }
3508
3509        #[inline(always)]
3510        fn inline_size(_context: fidl::encoding::Context) -> usize {
3511            24
3512        }
3513    }
3514
3515    unsafe impl<D: fidl::encoding::ResourceDialect>
3516        fidl::encoding::Encode<RemoteServiceWriteCharacteristicRequest, D>
3517        for &RemoteServiceWriteCharacteristicRequest
3518    {
3519        #[inline]
3520        unsafe fn encode(
3521            self,
3522            encoder: &mut fidl::encoding::Encoder<'_, D>,
3523            offset: usize,
3524            _depth: fidl::encoding::Depth,
3525        ) -> fidl::Result<()> {
3526            encoder.debug_check_bounds::<RemoteServiceWriteCharacteristicRequest>(offset);
3527            // Delegate to tuple encoding.
3528            fidl::encoding::Encode::<RemoteServiceWriteCharacteristicRequest, D>::encode(
3529                (
3530                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
3531                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
3532                ),
3533                encoder, offset, _depth
3534            )
3535        }
3536    }
3537    unsafe impl<
3538            D: fidl::encoding::ResourceDialect,
3539            T0: fidl::encoding::Encode<u64, D>,
3540            T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
3541        > fidl::encoding::Encode<RemoteServiceWriteCharacteristicRequest, D> for (T0, T1)
3542    {
3543        #[inline]
3544        unsafe fn encode(
3545            self,
3546            encoder: &mut fidl::encoding::Encoder<'_, D>,
3547            offset: usize,
3548            depth: fidl::encoding::Depth,
3549        ) -> fidl::Result<()> {
3550            encoder.debug_check_bounds::<RemoteServiceWriteCharacteristicRequest>(offset);
3551            // Zero out padding regions. There's no need to apply masks
3552            // because the unmasked parts will be overwritten by fields.
3553            // Write the fields.
3554            self.0.encode(encoder, offset + 0, depth)?;
3555            self.1.encode(encoder, offset + 8, depth)?;
3556            Ok(())
3557        }
3558    }
3559
3560    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3561        for RemoteServiceWriteCharacteristicRequest
3562    {
3563        #[inline(always)]
3564        fn new_empty() -> Self {
3565            Self {
3566                id: fidl::new_empty!(u64, D),
3567                value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
3568            }
3569        }
3570
3571        #[inline]
3572        unsafe fn decode(
3573            &mut self,
3574            decoder: &mut fidl::encoding::Decoder<'_, D>,
3575            offset: usize,
3576            _depth: fidl::encoding::Depth,
3577        ) -> fidl::Result<()> {
3578            decoder.debug_check_bounds::<Self>(offset);
3579            // Verify that padding bytes are zero.
3580            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
3581            fidl::decode!(
3582                fidl::encoding::UnboundedVector<u8>,
3583                D,
3584                &mut self.value,
3585                decoder,
3586                offset + 8,
3587                _depth
3588            )?;
3589            Ok(())
3590        }
3591    }
3592
3593    impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteCharacteristicResponse {
3594        type Borrowed<'a> = &'a Self;
3595        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3596            value
3597        }
3598    }
3599
3600    unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteCharacteristicResponse {
3601        type Owned = Self;
3602
3603        #[inline(always)]
3604        fn inline_align(_context: fidl::encoding::Context) -> usize {
3605            8
3606        }
3607
3608        #[inline(always)]
3609        fn inline_size(_context: fidl::encoding::Context) -> usize {
3610            8
3611        }
3612    }
3613
3614    unsafe impl<D: fidl::encoding::ResourceDialect>
3615        fidl::encoding::Encode<RemoteServiceWriteCharacteristicResponse, D>
3616        for &RemoteServiceWriteCharacteristicResponse
3617    {
3618        #[inline]
3619        unsafe fn encode(
3620            self,
3621            encoder: &mut fidl::encoding::Encoder<'_, D>,
3622            offset: usize,
3623            _depth: fidl::encoding::Depth,
3624        ) -> fidl::Result<()> {
3625            encoder.debug_check_bounds::<RemoteServiceWriteCharacteristicResponse>(offset);
3626            // Delegate to tuple encoding.
3627            fidl::encoding::Encode::<RemoteServiceWriteCharacteristicResponse, D>::encode(
3628                (
3629                    <fidl_fuchsia_bluetooth__common::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
3630                ),
3631                encoder, offset, _depth
3632            )
3633        }
3634    }
3635    unsafe impl<
3636            D: fidl::encoding::ResourceDialect,
3637            T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth__common::Status, D>,
3638        > fidl::encoding::Encode<RemoteServiceWriteCharacteristicResponse, D> for (T0,)
3639    {
3640        #[inline]
3641        unsafe fn encode(
3642            self,
3643            encoder: &mut fidl::encoding::Encoder<'_, D>,
3644            offset: usize,
3645            depth: fidl::encoding::Depth,
3646        ) -> fidl::Result<()> {
3647            encoder.debug_check_bounds::<RemoteServiceWriteCharacteristicResponse>(offset);
3648            // Zero out padding regions. There's no need to apply masks
3649            // because the unmasked parts will be overwritten by fields.
3650            // Write the fields.
3651            self.0.encode(encoder, offset + 0, depth)?;
3652            Ok(())
3653        }
3654    }
3655
3656    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3657        for RemoteServiceWriteCharacteristicResponse
3658    {
3659        #[inline(always)]
3660        fn new_empty() -> Self {
3661            Self { status: fidl::new_empty!(fidl_fuchsia_bluetooth__common::Status, D) }
3662        }
3663
3664        #[inline]
3665        unsafe fn decode(
3666            &mut self,
3667            decoder: &mut fidl::encoding::Decoder<'_, D>,
3668            offset: usize,
3669            _depth: fidl::encoding::Depth,
3670        ) -> fidl::Result<()> {
3671            decoder.debug_check_bounds::<Self>(offset);
3672            // Verify that padding bytes are zero.
3673            fidl::decode!(
3674                fidl_fuchsia_bluetooth__common::Status,
3675                D,
3676                &mut self.status,
3677                decoder,
3678                offset + 0,
3679                _depth
3680            )?;
3681            Ok(())
3682        }
3683    }
3684
3685    impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteCharacteristicWithoutResponseRequest {
3686        type Borrowed<'a> = &'a Self;
3687        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3688            value
3689        }
3690    }
3691
3692    unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteCharacteristicWithoutResponseRequest {
3693        type Owned = Self;
3694
3695        #[inline(always)]
3696        fn inline_align(_context: fidl::encoding::Context) -> usize {
3697            8
3698        }
3699
3700        #[inline(always)]
3701        fn inline_size(_context: fidl::encoding::Context) -> usize {
3702            24
3703        }
3704    }
3705
3706    unsafe impl<D: fidl::encoding::ResourceDialect>
3707        fidl::encoding::Encode<RemoteServiceWriteCharacteristicWithoutResponseRequest, D>
3708        for &RemoteServiceWriteCharacteristicWithoutResponseRequest
3709    {
3710        #[inline]
3711        unsafe fn encode(
3712            self,
3713            encoder: &mut fidl::encoding::Encoder<'_, D>,
3714            offset: usize,
3715            _depth: fidl::encoding::Depth,
3716        ) -> fidl::Result<()> {
3717            encoder.debug_check_bounds::<RemoteServiceWriteCharacteristicWithoutResponseRequest>(
3718                offset,
3719            );
3720            // Delegate to tuple encoding.
3721            fidl::encoding::Encode::<RemoteServiceWriteCharacteristicWithoutResponseRequest, D>::encode(
3722                (
3723                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
3724                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
3725                ),
3726                encoder, offset, _depth
3727            )
3728        }
3729    }
3730    unsafe impl<
3731            D: fidl::encoding::ResourceDialect,
3732            T0: fidl::encoding::Encode<u64, D>,
3733            T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
3734        > fidl::encoding::Encode<RemoteServiceWriteCharacteristicWithoutResponseRequest, D>
3735        for (T0, T1)
3736    {
3737        #[inline]
3738        unsafe fn encode(
3739            self,
3740            encoder: &mut fidl::encoding::Encoder<'_, D>,
3741            offset: usize,
3742            depth: fidl::encoding::Depth,
3743        ) -> fidl::Result<()> {
3744            encoder.debug_check_bounds::<RemoteServiceWriteCharacteristicWithoutResponseRequest>(
3745                offset,
3746            );
3747            // Zero out padding regions. There's no need to apply masks
3748            // because the unmasked parts will be overwritten by fields.
3749            // Write the fields.
3750            self.0.encode(encoder, offset + 0, depth)?;
3751            self.1.encode(encoder, offset + 8, depth)?;
3752            Ok(())
3753        }
3754    }
3755
3756    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3757        for RemoteServiceWriteCharacteristicWithoutResponseRequest
3758    {
3759        #[inline(always)]
3760        fn new_empty() -> Self {
3761            Self {
3762                id: fidl::new_empty!(u64, D),
3763                value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
3764            }
3765        }
3766
3767        #[inline]
3768        unsafe fn decode(
3769            &mut self,
3770            decoder: &mut fidl::encoding::Decoder<'_, D>,
3771            offset: usize,
3772            _depth: fidl::encoding::Depth,
3773        ) -> fidl::Result<()> {
3774            decoder.debug_check_bounds::<Self>(offset);
3775            // Verify that padding bytes are zero.
3776            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
3777            fidl::decode!(
3778                fidl::encoding::UnboundedVector<u8>,
3779                D,
3780                &mut self.value,
3781                decoder,
3782                offset + 8,
3783                _depth
3784            )?;
3785            Ok(())
3786        }
3787    }
3788
3789    impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteDescriptorRequest {
3790        type Borrowed<'a> = &'a Self;
3791        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3792            value
3793        }
3794    }
3795
3796    unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteDescriptorRequest {
3797        type Owned = Self;
3798
3799        #[inline(always)]
3800        fn inline_align(_context: fidl::encoding::Context) -> usize {
3801            8
3802        }
3803
3804        #[inline(always)]
3805        fn inline_size(_context: fidl::encoding::Context) -> usize {
3806            24
3807        }
3808    }
3809
3810    unsafe impl<D: fidl::encoding::ResourceDialect>
3811        fidl::encoding::Encode<RemoteServiceWriteDescriptorRequest, D>
3812        for &RemoteServiceWriteDescriptorRequest
3813    {
3814        #[inline]
3815        unsafe fn encode(
3816            self,
3817            encoder: &mut fidl::encoding::Encoder<'_, D>,
3818            offset: usize,
3819            _depth: fidl::encoding::Depth,
3820        ) -> fidl::Result<()> {
3821            encoder.debug_check_bounds::<RemoteServiceWriteDescriptorRequest>(offset);
3822            // Delegate to tuple encoding.
3823            fidl::encoding::Encode::<RemoteServiceWriteDescriptorRequest, D>::encode(
3824                (
3825                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
3826                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
3827                ),
3828                encoder, offset, _depth
3829            )
3830        }
3831    }
3832    unsafe impl<
3833            D: fidl::encoding::ResourceDialect,
3834            T0: fidl::encoding::Encode<u64, D>,
3835            T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
3836        > fidl::encoding::Encode<RemoteServiceWriteDescriptorRequest, D> for (T0, T1)
3837    {
3838        #[inline]
3839        unsafe fn encode(
3840            self,
3841            encoder: &mut fidl::encoding::Encoder<'_, D>,
3842            offset: usize,
3843            depth: fidl::encoding::Depth,
3844        ) -> fidl::Result<()> {
3845            encoder.debug_check_bounds::<RemoteServiceWriteDescriptorRequest>(offset);
3846            // Zero out padding regions. There's no need to apply masks
3847            // because the unmasked parts will be overwritten by fields.
3848            // Write the fields.
3849            self.0.encode(encoder, offset + 0, depth)?;
3850            self.1.encode(encoder, offset + 8, depth)?;
3851            Ok(())
3852        }
3853    }
3854
3855    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3856        for RemoteServiceWriteDescriptorRequest
3857    {
3858        #[inline(always)]
3859        fn new_empty() -> Self {
3860            Self {
3861                id: fidl::new_empty!(u64, D),
3862                value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
3863            }
3864        }
3865
3866        #[inline]
3867        unsafe fn decode(
3868            &mut self,
3869            decoder: &mut fidl::encoding::Decoder<'_, D>,
3870            offset: usize,
3871            _depth: fidl::encoding::Depth,
3872        ) -> fidl::Result<()> {
3873            decoder.debug_check_bounds::<Self>(offset);
3874            // Verify that padding bytes are zero.
3875            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
3876            fidl::decode!(
3877                fidl::encoding::UnboundedVector<u8>,
3878                D,
3879                &mut self.value,
3880                decoder,
3881                offset + 8,
3882                _depth
3883            )?;
3884            Ok(())
3885        }
3886    }
3887
3888    impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteDescriptorResponse {
3889        type Borrowed<'a> = &'a Self;
3890        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3891            value
3892        }
3893    }
3894
3895    unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteDescriptorResponse {
3896        type Owned = Self;
3897
3898        #[inline(always)]
3899        fn inline_align(_context: fidl::encoding::Context) -> usize {
3900            8
3901        }
3902
3903        #[inline(always)]
3904        fn inline_size(_context: fidl::encoding::Context) -> usize {
3905            8
3906        }
3907    }
3908
3909    unsafe impl<D: fidl::encoding::ResourceDialect>
3910        fidl::encoding::Encode<RemoteServiceWriteDescriptorResponse, D>
3911        for &RemoteServiceWriteDescriptorResponse
3912    {
3913        #[inline]
3914        unsafe fn encode(
3915            self,
3916            encoder: &mut fidl::encoding::Encoder<'_, D>,
3917            offset: usize,
3918            _depth: fidl::encoding::Depth,
3919        ) -> fidl::Result<()> {
3920            encoder.debug_check_bounds::<RemoteServiceWriteDescriptorResponse>(offset);
3921            // Delegate to tuple encoding.
3922            fidl::encoding::Encode::<RemoteServiceWriteDescriptorResponse, D>::encode(
3923                (
3924                    <fidl_fuchsia_bluetooth__common::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
3925                ),
3926                encoder, offset, _depth
3927            )
3928        }
3929    }
3930    unsafe impl<
3931            D: fidl::encoding::ResourceDialect,
3932            T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth__common::Status, D>,
3933        > fidl::encoding::Encode<RemoteServiceWriteDescriptorResponse, D> for (T0,)
3934    {
3935        #[inline]
3936        unsafe fn encode(
3937            self,
3938            encoder: &mut fidl::encoding::Encoder<'_, D>,
3939            offset: usize,
3940            depth: fidl::encoding::Depth,
3941        ) -> fidl::Result<()> {
3942            encoder.debug_check_bounds::<RemoteServiceWriteDescriptorResponse>(offset);
3943            // Zero out padding regions. There's no need to apply masks
3944            // because the unmasked parts will be overwritten by fields.
3945            // Write the fields.
3946            self.0.encode(encoder, offset + 0, depth)?;
3947            Ok(())
3948        }
3949    }
3950
3951    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3952        for RemoteServiceWriteDescriptorResponse
3953    {
3954        #[inline(always)]
3955        fn new_empty() -> Self {
3956            Self { status: fidl::new_empty!(fidl_fuchsia_bluetooth__common::Status, D) }
3957        }
3958
3959        #[inline]
3960        unsafe fn decode(
3961            &mut self,
3962            decoder: &mut fidl::encoding::Decoder<'_, D>,
3963            offset: usize,
3964            _depth: fidl::encoding::Depth,
3965        ) -> fidl::Result<()> {
3966            decoder.debug_check_bounds::<Self>(offset);
3967            // Verify that padding bytes are zero.
3968            fidl::decode!(
3969                fidl_fuchsia_bluetooth__common::Status,
3970                D,
3971                &mut self.status,
3972                decoder,
3973                offset + 0,
3974                _depth
3975            )?;
3976            Ok(())
3977        }
3978    }
3979
3980    impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteLongCharacteristicRequest {
3981        type Borrowed<'a> = &'a Self;
3982        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3983            value
3984        }
3985    }
3986
3987    unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteLongCharacteristicRequest {
3988        type Owned = Self;
3989
3990        #[inline(always)]
3991        fn inline_align(_context: fidl::encoding::Context) -> usize {
3992            8
3993        }
3994
3995        #[inline(always)]
3996        fn inline_size(_context: fidl::encoding::Context) -> usize {
3997            48
3998        }
3999    }
4000
4001    unsafe impl<D: fidl::encoding::ResourceDialect>
4002        fidl::encoding::Encode<RemoteServiceWriteLongCharacteristicRequest, D>
4003        for &RemoteServiceWriteLongCharacteristicRequest
4004    {
4005        #[inline]
4006        unsafe fn encode(
4007            self,
4008            encoder: &mut fidl::encoding::Encoder<'_, D>,
4009            offset: usize,
4010            _depth: fidl::encoding::Depth,
4011        ) -> fidl::Result<()> {
4012            encoder.debug_check_bounds::<RemoteServiceWriteLongCharacteristicRequest>(offset);
4013            // Delegate to tuple encoding.
4014            fidl::encoding::Encode::<RemoteServiceWriteLongCharacteristicRequest, D>::encode(
4015                (
4016                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
4017                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.offset),
4018                    <fidl::encoding::Vector<u8, 512> as fidl::encoding::ValueTypeMarker>::borrow(
4019                        &self.value,
4020                    ),
4021                    <WriteOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.write_options),
4022                ),
4023                encoder,
4024                offset,
4025                _depth,
4026            )
4027        }
4028    }
4029    unsafe impl<
4030            D: fidl::encoding::ResourceDialect,
4031            T0: fidl::encoding::Encode<u64, D>,
4032            T1: fidl::encoding::Encode<u16, D>,
4033            T2: fidl::encoding::Encode<fidl::encoding::Vector<u8, 512>, D>,
4034            T3: fidl::encoding::Encode<WriteOptions, D>,
4035        > fidl::encoding::Encode<RemoteServiceWriteLongCharacteristicRequest, D>
4036        for (T0, T1, T2, T3)
4037    {
4038        #[inline]
4039        unsafe fn encode(
4040            self,
4041            encoder: &mut fidl::encoding::Encoder<'_, D>,
4042            offset: usize,
4043            depth: fidl::encoding::Depth,
4044        ) -> fidl::Result<()> {
4045            encoder.debug_check_bounds::<RemoteServiceWriteLongCharacteristicRequest>(offset);
4046            // Zero out padding regions. There's no need to apply masks
4047            // because the unmasked parts will be overwritten by fields.
4048            unsafe {
4049                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
4050                (ptr as *mut u64).write_unaligned(0);
4051            }
4052            // Write the fields.
4053            self.0.encode(encoder, offset + 0, depth)?;
4054            self.1.encode(encoder, offset + 8, depth)?;
4055            self.2.encode(encoder, offset + 16, depth)?;
4056            self.3.encode(encoder, offset + 32, depth)?;
4057            Ok(())
4058        }
4059    }
4060
4061    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4062        for RemoteServiceWriteLongCharacteristicRequest
4063    {
4064        #[inline(always)]
4065        fn new_empty() -> Self {
4066            Self {
4067                id: fidl::new_empty!(u64, D),
4068                offset: fidl::new_empty!(u16, D),
4069                value: fidl::new_empty!(fidl::encoding::Vector<u8, 512>, D),
4070                write_options: fidl::new_empty!(WriteOptions, D),
4071            }
4072        }
4073
4074        #[inline]
4075        unsafe fn decode(
4076            &mut self,
4077            decoder: &mut fidl::encoding::Decoder<'_, D>,
4078            offset: usize,
4079            _depth: fidl::encoding::Depth,
4080        ) -> fidl::Result<()> {
4081            decoder.debug_check_bounds::<Self>(offset);
4082            // Verify that padding bytes are zero.
4083            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
4084            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4085            let mask = 0xffffffffffff0000u64;
4086            let maskedval = padval & mask;
4087            if maskedval != 0 {
4088                return Err(fidl::Error::NonZeroPadding {
4089                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
4090                });
4091            }
4092            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
4093            fidl::decode!(u16, D, &mut self.offset, decoder, offset + 8, _depth)?;
4094            fidl::decode!(fidl::encoding::Vector<u8, 512>, D, &mut self.value, decoder, offset + 16, _depth)?;
4095            fidl::decode!(WriteOptions, D, &mut self.write_options, decoder, offset + 32, _depth)?;
4096            Ok(())
4097        }
4098    }
4099
4100    impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteLongCharacteristicResponse {
4101        type Borrowed<'a> = &'a Self;
4102        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4103            value
4104        }
4105    }
4106
4107    unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteLongCharacteristicResponse {
4108        type Owned = Self;
4109
4110        #[inline(always)]
4111        fn inline_align(_context: fidl::encoding::Context) -> usize {
4112            8
4113        }
4114
4115        #[inline(always)]
4116        fn inline_size(_context: fidl::encoding::Context) -> usize {
4117            8
4118        }
4119    }
4120
4121    unsafe impl<D: fidl::encoding::ResourceDialect>
4122        fidl::encoding::Encode<RemoteServiceWriteLongCharacteristicResponse, D>
4123        for &RemoteServiceWriteLongCharacteristicResponse
4124    {
4125        #[inline]
4126        unsafe fn encode(
4127            self,
4128            encoder: &mut fidl::encoding::Encoder<'_, D>,
4129            offset: usize,
4130            _depth: fidl::encoding::Depth,
4131        ) -> fidl::Result<()> {
4132            encoder.debug_check_bounds::<RemoteServiceWriteLongCharacteristicResponse>(offset);
4133            // Delegate to tuple encoding.
4134            fidl::encoding::Encode::<RemoteServiceWriteLongCharacteristicResponse, D>::encode(
4135                (
4136                    <fidl_fuchsia_bluetooth__common::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
4137                ),
4138                encoder, offset, _depth
4139            )
4140        }
4141    }
4142    unsafe impl<
4143            D: fidl::encoding::ResourceDialect,
4144            T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth__common::Status, D>,
4145        > fidl::encoding::Encode<RemoteServiceWriteLongCharacteristicResponse, D> for (T0,)
4146    {
4147        #[inline]
4148        unsafe fn encode(
4149            self,
4150            encoder: &mut fidl::encoding::Encoder<'_, D>,
4151            offset: usize,
4152            depth: fidl::encoding::Depth,
4153        ) -> fidl::Result<()> {
4154            encoder.debug_check_bounds::<RemoteServiceWriteLongCharacteristicResponse>(offset);
4155            // Zero out padding regions. There's no need to apply masks
4156            // because the unmasked parts will be overwritten by fields.
4157            // Write the fields.
4158            self.0.encode(encoder, offset + 0, depth)?;
4159            Ok(())
4160        }
4161    }
4162
4163    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4164        for RemoteServiceWriteLongCharacteristicResponse
4165    {
4166        #[inline(always)]
4167        fn new_empty() -> Self {
4168            Self { status: fidl::new_empty!(fidl_fuchsia_bluetooth__common::Status, D) }
4169        }
4170
4171        #[inline]
4172        unsafe fn decode(
4173            &mut self,
4174            decoder: &mut fidl::encoding::Decoder<'_, D>,
4175            offset: usize,
4176            _depth: fidl::encoding::Depth,
4177        ) -> fidl::Result<()> {
4178            decoder.debug_check_bounds::<Self>(offset);
4179            // Verify that padding bytes are zero.
4180            fidl::decode!(
4181                fidl_fuchsia_bluetooth__common::Status,
4182                D,
4183                &mut self.status,
4184                decoder,
4185                offset + 0,
4186                _depth
4187            )?;
4188            Ok(())
4189        }
4190    }
4191
4192    impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteLongDescriptorRequest {
4193        type Borrowed<'a> = &'a Self;
4194        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4195            value
4196        }
4197    }
4198
4199    unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteLongDescriptorRequest {
4200        type Owned = Self;
4201
4202        #[inline(always)]
4203        fn inline_align(_context: fidl::encoding::Context) -> usize {
4204            8
4205        }
4206
4207        #[inline(always)]
4208        fn inline_size(_context: fidl::encoding::Context) -> usize {
4209            32
4210        }
4211    }
4212
4213    unsafe impl<D: fidl::encoding::ResourceDialect>
4214        fidl::encoding::Encode<RemoteServiceWriteLongDescriptorRequest, D>
4215        for &RemoteServiceWriteLongDescriptorRequest
4216    {
4217        #[inline]
4218        unsafe fn encode(
4219            self,
4220            encoder: &mut fidl::encoding::Encoder<'_, D>,
4221            offset: usize,
4222            _depth: fidl::encoding::Depth,
4223        ) -> fidl::Result<()> {
4224            encoder.debug_check_bounds::<RemoteServiceWriteLongDescriptorRequest>(offset);
4225            // Delegate to tuple encoding.
4226            fidl::encoding::Encode::<RemoteServiceWriteLongDescriptorRequest, D>::encode(
4227                (
4228                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
4229                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.offset),
4230                    <fidl::encoding::Vector<u8, 512> as fidl::encoding::ValueTypeMarker>::borrow(
4231                        &self.value,
4232                    ),
4233                ),
4234                encoder,
4235                offset,
4236                _depth,
4237            )
4238        }
4239    }
4240    unsafe impl<
4241            D: fidl::encoding::ResourceDialect,
4242            T0: fidl::encoding::Encode<u64, D>,
4243            T1: fidl::encoding::Encode<u16, D>,
4244            T2: fidl::encoding::Encode<fidl::encoding::Vector<u8, 512>, D>,
4245        > fidl::encoding::Encode<RemoteServiceWriteLongDescriptorRequest, D> for (T0, T1, T2)
4246    {
4247        #[inline]
4248        unsafe fn encode(
4249            self,
4250            encoder: &mut fidl::encoding::Encoder<'_, D>,
4251            offset: usize,
4252            depth: fidl::encoding::Depth,
4253        ) -> fidl::Result<()> {
4254            encoder.debug_check_bounds::<RemoteServiceWriteLongDescriptorRequest>(offset);
4255            // Zero out padding regions. There's no need to apply masks
4256            // because the unmasked parts will be overwritten by fields.
4257            unsafe {
4258                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
4259                (ptr as *mut u64).write_unaligned(0);
4260            }
4261            // Write the fields.
4262            self.0.encode(encoder, offset + 0, depth)?;
4263            self.1.encode(encoder, offset + 8, depth)?;
4264            self.2.encode(encoder, offset + 16, depth)?;
4265            Ok(())
4266        }
4267    }
4268
4269    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4270        for RemoteServiceWriteLongDescriptorRequest
4271    {
4272        #[inline(always)]
4273        fn new_empty() -> Self {
4274            Self {
4275                id: fidl::new_empty!(u64, D),
4276                offset: fidl::new_empty!(u16, D),
4277                value: fidl::new_empty!(fidl::encoding::Vector<u8, 512>, D),
4278            }
4279        }
4280
4281        #[inline]
4282        unsafe fn decode(
4283            &mut self,
4284            decoder: &mut fidl::encoding::Decoder<'_, D>,
4285            offset: usize,
4286            _depth: fidl::encoding::Depth,
4287        ) -> fidl::Result<()> {
4288            decoder.debug_check_bounds::<Self>(offset);
4289            // Verify that padding bytes are zero.
4290            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
4291            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4292            let mask = 0xffffffffffff0000u64;
4293            let maskedval = padval & mask;
4294            if maskedval != 0 {
4295                return Err(fidl::Error::NonZeroPadding {
4296                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
4297                });
4298            }
4299            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
4300            fidl::decode!(u16, D, &mut self.offset, decoder, offset + 8, _depth)?;
4301            fidl::decode!(fidl::encoding::Vector<u8, 512>, D, &mut self.value, decoder, offset + 16, _depth)?;
4302            Ok(())
4303        }
4304    }
4305
4306    impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteLongDescriptorResponse {
4307        type Borrowed<'a> = &'a Self;
4308        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4309            value
4310        }
4311    }
4312
4313    unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteLongDescriptorResponse {
4314        type Owned = Self;
4315
4316        #[inline(always)]
4317        fn inline_align(_context: fidl::encoding::Context) -> usize {
4318            8
4319        }
4320
4321        #[inline(always)]
4322        fn inline_size(_context: fidl::encoding::Context) -> usize {
4323            8
4324        }
4325    }
4326
4327    unsafe impl<D: fidl::encoding::ResourceDialect>
4328        fidl::encoding::Encode<RemoteServiceWriteLongDescriptorResponse, D>
4329        for &RemoteServiceWriteLongDescriptorResponse
4330    {
4331        #[inline]
4332        unsafe fn encode(
4333            self,
4334            encoder: &mut fidl::encoding::Encoder<'_, D>,
4335            offset: usize,
4336            _depth: fidl::encoding::Depth,
4337        ) -> fidl::Result<()> {
4338            encoder.debug_check_bounds::<RemoteServiceWriteLongDescriptorResponse>(offset);
4339            // Delegate to tuple encoding.
4340            fidl::encoding::Encode::<RemoteServiceWriteLongDescriptorResponse, D>::encode(
4341                (
4342                    <fidl_fuchsia_bluetooth__common::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
4343                ),
4344                encoder, offset, _depth
4345            )
4346        }
4347    }
4348    unsafe impl<
4349            D: fidl::encoding::ResourceDialect,
4350            T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth__common::Status, D>,
4351        > fidl::encoding::Encode<RemoteServiceWriteLongDescriptorResponse, D> for (T0,)
4352    {
4353        #[inline]
4354        unsafe fn encode(
4355            self,
4356            encoder: &mut fidl::encoding::Encoder<'_, D>,
4357            offset: usize,
4358            depth: fidl::encoding::Depth,
4359        ) -> fidl::Result<()> {
4360            encoder.debug_check_bounds::<RemoteServiceWriteLongDescriptorResponse>(offset);
4361            // Zero out padding regions. There's no need to apply masks
4362            // because the unmasked parts will be overwritten by fields.
4363            // Write the fields.
4364            self.0.encode(encoder, offset + 0, depth)?;
4365            Ok(())
4366        }
4367    }
4368
4369    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4370        for RemoteServiceWriteLongDescriptorResponse
4371    {
4372        #[inline(always)]
4373        fn new_empty() -> Self {
4374            Self { status: fidl::new_empty!(fidl_fuchsia_bluetooth__common::Status, D) }
4375        }
4376
4377        #[inline]
4378        unsafe fn decode(
4379            &mut self,
4380            decoder: &mut fidl::encoding::Decoder<'_, D>,
4381            offset: usize,
4382            _depth: fidl::encoding::Depth,
4383        ) -> fidl::Result<()> {
4384            decoder.debug_check_bounds::<Self>(offset);
4385            // Verify that padding bytes are zero.
4386            fidl::decode!(
4387                fidl_fuchsia_bluetooth__common::Status,
4388                D,
4389                &mut self.status,
4390                decoder,
4391                offset + 0,
4392                _depth
4393            )?;
4394            Ok(())
4395        }
4396    }
4397
4398    impl fidl::encoding::ValueTypeMarker for RemoteServiceReadByTypeResponse {
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 RemoteServiceReadByTypeResponse {
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<RemoteServiceReadByTypeResponse, D>
4421        for &RemoteServiceReadByTypeResponse
4422    {
4423        #[inline]
4424        unsafe fn encode(
4425            self,
4426            encoder: &mut fidl::encoding::Encoder<'_, D>,
4427            offset: usize,
4428            _depth: fidl::encoding::Depth,
4429        ) -> fidl::Result<()> {
4430            encoder.debug_check_bounds::<RemoteServiceReadByTypeResponse>(offset);
4431            // Delegate to tuple encoding.
4432            fidl::encoding::Encode::<RemoteServiceReadByTypeResponse, D>::encode(
4433                (
4434                    <fidl::encoding::Vector<ReadByTypeResult, 189> as fidl::encoding::ValueTypeMarker>::borrow(&self.results),
4435                ),
4436                encoder, offset, _depth
4437            )
4438        }
4439    }
4440    unsafe impl<
4441            D: fidl::encoding::ResourceDialect,
4442            T0: fidl::encoding::Encode<fidl::encoding::Vector<ReadByTypeResult, 189>, D>,
4443        > fidl::encoding::Encode<RemoteServiceReadByTypeResponse, D> for (T0,)
4444    {
4445        #[inline]
4446        unsafe fn encode(
4447            self,
4448            encoder: &mut fidl::encoding::Encoder<'_, D>,
4449            offset: usize,
4450            depth: fidl::encoding::Depth,
4451        ) -> fidl::Result<()> {
4452            encoder.debug_check_bounds::<RemoteServiceReadByTypeResponse>(offset);
4453            // Zero out padding regions. There's no need to apply masks
4454            // because the unmasked parts will be overwritten by fields.
4455            // Write the fields.
4456            self.0.encode(encoder, offset + 0, depth)?;
4457            Ok(())
4458        }
4459    }
4460
4461    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4462        for RemoteServiceReadByTypeResponse
4463    {
4464        #[inline(always)]
4465        fn new_empty() -> Self {
4466            Self { results: fidl::new_empty!(fidl::encoding::Vector<ReadByTypeResult, 189>, D) }
4467        }
4468
4469        #[inline]
4470        unsafe fn decode(
4471            &mut self,
4472            decoder: &mut fidl::encoding::Decoder<'_, D>,
4473            offset: usize,
4474            _depth: fidl::encoding::Depth,
4475        ) -> fidl::Result<()> {
4476            decoder.debug_check_bounds::<Self>(offset);
4477            // Verify that padding bytes are zero.
4478            fidl::decode!(fidl::encoding::Vector<ReadByTypeResult, 189>, D, &mut self.results, decoder, offset + 0, _depth)?;
4479            Ok(())
4480        }
4481    }
4482
4483    impl fidl::encoding::ValueTypeMarker for SecurityRequirements {
4484        type Borrowed<'a> = &'a Self;
4485        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4486            value
4487        }
4488    }
4489
4490    unsafe impl fidl::encoding::TypeMarker for SecurityRequirements {
4491        type Owned = Self;
4492
4493        #[inline(always)]
4494        fn inline_align(_context: fidl::encoding::Context) -> usize {
4495            1
4496        }
4497
4498        #[inline(always)]
4499        fn inline_size(_context: fidl::encoding::Context) -> usize {
4500            3
4501        }
4502    }
4503
4504    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SecurityRequirements, D>
4505        for &SecurityRequirements
4506    {
4507        #[inline]
4508        unsafe fn encode(
4509            self,
4510            encoder: &mut fidl::encoding::Encoder<'_, D>,
4511            offset: usize,
4512            _depth: fidl::encoding::Depth,
4513        ) -> fidl::Result<()> {
4514            encoder.debug_check_bounds::<SecurityRequirements>(offset);
4515            // Delegate to tuple encoding.
4516            fidl::encoding::Encode::<SecurityRequirements, D>::encode(
4517                (
4518                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.encryption_required),
4519                    <bool as fidl::encoding::ValueTypeMarker>::borrow(
4520                        &self.authentication_required,
4521                    ),
4522                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.authorization_required),
4523                ),
4524                encoder,
4525                offset,
4526                _depth,
4527            )
4528        }
4529    }
4530    unsafe impl<
4531            D: fidl::encoding::ResourceDialect,
4532            T0: fidl::encoding::Encode<bool, D>,
4533            T1: fidl::encoding::Encode<bool, D>,
4534            T2: fidl::encoding::Encode<bool, D>,
4535        > fidl::encoding::Encode<SecurityRequirements, D> for (T0, T1, T2)
4536    {
4537        #[inline]
4538        unsafe fn encode(
4539            self,
4540            encoder: &mut fidl::encoding::Encoder<'_, D>,
4541            offset: usize,
4542            depth: fidl::encoding::Depth,
4543        ) -> fidl::Result<()> {
4544            encoder.debug_check_bounds::<SecurityRequirements>(offset);
4545            // Zero out padding regions. There's no need to apply masks
4546            // because the unmasked parts will be overwritten by fields.
4547            // Write the fields.
4548            self.0.encode(encoder, offset + 0, depth)?;
4549            self.1.encode(encoder, offset + 1, depth)?;
4550            self.2.encode(encoder, offset + 2, depth)?;
4551            Ok(())
4552        }
4553    }
4554
4555    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SecurityRequirements {
4556        #[inline(always)]
4557        fn new_empty() -> Self {
4558            Self {
4559                encryption_required: fidl::new_empty!(bool, D),
4560                authentication_required: fidl::new_empty!(bool, D),
4561                authorization_required: fidl::new_empty!(bool, D),
4562            }
4563        }
4564
4565        #[inline]
4566        unsafe fn decode(
4567            &mut self,
4568            decoder: &mut fidl::encoding::Decoder<'_, D>,
4569            offset: usize,
4570            _depth: fidl::encoding::Depth,
4571        ) -> fidl::Result<()> {
4572            decoder.debug_check_bounds::<Self>(offset);
4573            // Verify that padding bytes are zero.
4574            fidl::decode!(bool, D, &mut self.encryption_required, decoder, offset + 0, _depth)?;
4575            fidl::decode!(bool, D, &mut self.authentication_required, decoder, offset + 1, _depth)?;
4576            fidl::decode!(bool, D, &mut self.authorization_required, decoder, offset + 2, _depth)?;
4577            Ok(())
4578        }
4579    }
4580
4581    impl fidl::encoding::ValueTypeMarker for ServerPublishServiceResponse {
4582        type Borrowed<'a> = &'a Self;
4583        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4584            value
4585        }
4586    }
4587
4588    unsafe impl fidl::encoding::TypeMarker for ServerPublishServiceResponse {
4589        type Owned = Self;
4590
4591        #[inline(always)]
4592        fn inline_align(_context: fidl::encoding::Context) -> usize {
4593            8
4594        }
4595
4596        #[inline(always)]
4597        fn inline_size(_context: fidl::encoding::Context) -> usize {
4598            8
4599        }
4600    }
4601
4602    unsafe impl<D: fidl::encoding::ResourceDialect>
4603        fidl::encoding::Encode<ServerPublishServiceResponse, D> for &ServerPublishServiceResponse
4604    {
4605        #[inline]
4606        unsafe fn encode(
4607            self,
4608            encoder: &mut fidl::encoding::Encoder<'_, D>,
4609            offset: usize,
4610            _depth: fidl::encoding::Depth,
4611        ) -> fidl::Result<()> {
4612            encoder.debug_check_bounds::<ServerPublishServiceResponse>(offset);
4613            // Delegate to tuple encoding.
4614            fidl::encoding::Encode::<ServerPublishServiceResponse, D>::encode(
4615                (
4616                    <fidl_fuchsia_bluetooth__common::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
4617                ),
4618                encoder, offset, _depth
4619            )
4620        }
4621    }
4622    unsafe impl<
4623            D: fidl::encoding::ResourceDialect,
4624            T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth__common::Status, D>,
4625        > fidl::encoding::Encode<ServerPublishServiceResponse, D> for (T0,)
4626    {
4627        #[inline]
4628        unsafe fn encode(
4629            self,
4630            encoder: &mut fidl::encoding::Encoder<'_, D>,
4631            offset: usize,
4632            depth: fidl::encoding::Depth,
4633        ) -> fidl::Result<()> {
4634            encoder.debug_check_bounds::<ServerPublishServiceResponse>(offset);
4635            // Zero out padding regions. There's no need to apply masks
4636            // because the unmasked parts will be overwritten by fields.
4637            // Write the fields.
4638            self.0.encode(encoder, offset + 0, depth)?;
4639            Ok(())
4640        }
4641    }
4642
4643    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4644        for ServerPublishServiceResponse
4645    {
4646        #[inline(always)]
4647        fn new_empty() -> Self {
4648            Self { status: fidl::new_empty!(fidl_fuchsia_bluetooth__common::Status, D) }
4649        }
4650
4651        #[inline]
4652        unsafe fn decode(
4653            &mut self,
4654            decoder: &mut fidl::encoding::Decoder<'_, D>,
4655            offset: usize,
4656            _depth: fidl::encoding::Depth,
4657        ) -> fidl::Result<()> {
4658            decoder.debug_check_bounds::<Self>(offset);
4659            // Verify that padding bytes are zero.
4660            fidl::decode!(
4661                fidl_fuchsia_bluetooth__common::Status,
4662                D,
4663                &mut self.status,
4664                decoder,
4665                offset + 0,
4666                _depth
4667            )?;
4668            Ok(())
4669        }
4670    }
4671
4672    impl fidl::encoding::ValueTypeMarker for ServiceInfo {
4673        type Borrowed<'a> = &'a Self;
4674        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4675            value
4676        }
4677    }
4678
4679    unsafe impl fidl::encoding::TypeMarker for ServiceInfo {
4680        type Owned = Self;
4681
4682        #[inline(always)]
4683        fn inline_align(_context: fidl::encoding::Context) -> usize {
4684            8
4685        }
4686
4687        #[inline(always)]
4688        fn inline_size(_context: fidl::encoding::Context) -> usize {
4689            64
4690        }
4691    }
4692
4693    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ServiceInfo, D>
4694        for &ServiceInfo
4695    {
4696        #[inline]
4697        unsafe fn encode(
4698            self,
4699            encoder: &mut fidl::encoding::Encoder<'_, D>,
4700            offset: usize,
4701            _depth: fidl::encoding::Depth,
4702        ) -> fidl::Result<()> {
4703            encoder.debug_check_bounds::<ServiceInfo>(offset);
4704            // Delegate to tuple encoding.
4705            fidl::encoding::Encode::<ServiceInfo, D>::encode(
4706                (
4707                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
4708                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.primary),
4709                    <fidl::encoding::BoundedString<36> as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
4710                    <fidl::encoding::Optional<fidl::encoding::Vector<Characteristic, 32767>> as fidl::encoding::ValueTypeMarker>::borrow(&self.characteristics),
4711                    <fidl::encoding::Optional<fidl::encoding::Vector<u64, 65535>> as fidl::encoding::ValueTypeMarker>::borrow(&self.includes),
4712                ),
4713                encoder, offset, _depth
4714            )
4715        }
4716    }
4717    unsafe impl<
4718            D: fidl::encoding::ResourceDialect,
4719            T0: fidl::encoding::Encode<u64, D>,
4720            T1: fidl::encoding::Encode<bool, D>,
4721            T2: fidl::encoding::Encode<fidl::encoding::BoundedString<36>, D>,
4722            T3: fidl::encoding::Encode<
4723                fidl::encoding::Optional<fidl::encoding::Vector<Characteristic, 32767>>,
4724                D,
4725            >,
4726            T4: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::Vector<u64, 65535>>, D>,
4727        > fidl::encoding::Encode<ServiceInfo, D> for (T0, T1, T2, T3, T4)
4728    {
4729        #[inline]
4730        unsafe fn encode(
4731            self,
4732            encoder: &mut fidl::encoding::Encoder<'_, D>,
4733            offset: usize,
4734            depth: fidl::encoding::Depth,
4735        ) -> fidl::Result<()> {
4736            encoder.debug_check_bounds::<ServiceInfo>(offset);
4737            // Zero out padding regions. There's no need to apply masks
4738            // because the unmasked parts will be overwritten by fields.
4739            unsafe {
4740                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
4741                (ptr as *mut u64).write_unaligned(0);
4742            }
4743            // Write the fields.
4744            self.0.encode(encoder, offset + 0, depth)?;
4745            self.1.encode(encoder, offset + 8, depth)?;
4746            self.2.encode(encoder, offset + 16, depth)?;
4747            self.3.encode(encoder, offset + 32, depth)?;
4748            self.4.encode(encoder, offset + 48, depth)?;
4749            Ok(())
4750        }
4751    }
4752
4753    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ServiceInfo {
4754        #[inline(always)]
4755        fn new_empty() -> Self {
4756            Self {
4757                id: fidl::new_empty!(u64, D),
4758                primary: fidl::new_empty!(bool, D),
4759                type_: fidl::new_empty!(fidl::encoding::BoundedString<36>, D),
4760                characteristics: fidl::new_empty!(
4761                    fidl::encoding::Optional<fidl::encoding::Vector<Characteristic, 32767>>,
4762                    D
4763                ),
4764                includes: fidl::new_empty!(
4765                    fidl::encoding::Optional<fidl::encoding::Vector<u64, 65535>>,
4766                    D
4767                ),
4768            }
4769        }
4770
4771        #[inline]
4772        unsafe fn decode(
4773            &mut self,
4774            decoder: &mut fidl::encoding::Decoder<'_, D>,
4775            offset: usize,
4776            _depth: fidl::encoding::Depth,
4777        ) -> fidl::Result<()> {
4778            decoder.debug_check_bounds::<Self>(offset);
4779            // Verify that padding bytes are zero.
4780            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
4781            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4782            let mask = 0xffffffffffffff00u64;
4783            let maskedval = padval & mask;
4784            if maskedval != 0 {
4785                return Err(fidl::Error::NonZeroPadding {
4786                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
4787                });
4788            }
4789            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
4790            fidl::decode!(bool, D, &mut self.primary, decoder, offset + 8, _depth)?;
4791            fidl::decode!(
4792                fidl::encoding::BoundedString<36>,
4793                D,
4794                &mut self.type_,
4795                decoder,
4796                offset + 16,
4797                _depth
4798            )?;
4799            fidl::decode!(
4800                fidl::encoding::Optional<fidl::encoding::Vector<Characteristic, 32767>>,
4801                D,
4802                &mut self.characteristics,
4803                decoder,
4804                offset + 32,
4805                _depth
4806            )?;
4807            fidl::decode!(
4808                fidl::encoding::Optional<fidl::encoding::Vector<u64, 65535>>,
4809                D,
4810                &mut self.includes,
4811                decoder,
4812                offset + 48,
4813                _depth
4814            )?;
4815            Ok(())
4816        }
4817    }
4818
4819    impl ReadByTypeResult {
4820        #[inline(always)]
4821        fn max_ordinal_present(&self) -> u64 {
4822            if let Some(_) = self.error {
4823                return 3;
4824            }
4825            if let Some(_) = self.value {
4826                return 2;
4827            }
4828            if let Some(_) = self.id {
4829                return 1;
4830            }
4831            0
4832        }
4833    }
4834
4835    impl fidl::encoding::ValueTypeMarker for ReadByTypeResult {
4836        type Borrowed<'a> = &'a Self;
4837        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4838            value
4839        }
4840    }
4841
4842    unsafe impl fidl::encoding::TypeMarker for ReadByTypeResult {
4843        type Owned = Self;
4844
4845        #[inline(always)]
4846        fn inline_align(_context: fidl::encoding::Context) -> usize {
4847            8
4848        }
4849
4850        #[inline(always)]
4851        fn inline_size(_context: fidl::encoding::Context) -> usize {
4852            16
4853        }
4854    }
4855
4856    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ReadByTypeResult, D>
4857        for &ReadByTypeResult
4858    {
4859        unsafe fn encode(
4860            self,
4861            encoder: &mut fidl::encoding::Encoder<'_, D>,
4862            offset: usize,
4863            mut depth: fidl::encoding::Depth,
4864        ) -> fidl::Result<()> {
4865            encoder.debug_check_bounds::<ReadByTypeResult>(offset);
4866            // Vector header
4867            let max_ordinal: u64 = self.max_ordinal_present();
4868            encoder.write_num(max_ordinal, offset);
4869            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4870            // Calling encoder.out_of_line_offset(0) is not allowed.
4871            if max_ordinal == 0 {
4872                return Ok(());
4873            }
4874            depth.increment()?;
4875            let envelope_size = 8;
4876            let bytes_len = max_ordinal as usize * envelope_size;
4877            #[allow(unused_variables)]
4878            let offset = encoder.out_of_line_offset(bytes_len);
4879            let mut _prev_end_offset: usize = 0;
4880            if 1 > max_ordinal {
4881                return Ok(());
4882            }
4883
4884            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4885            // are envelope_size bytes.
4886            let cur_offset: usize = (1 - 1) * envelope_size;
4887
4888            // Zero reserved fields.
4889            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4890
4891            // Safety:
4892            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4893            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4894            //   envelope_size bytes, there is always sufficient room.
4895            fidl::encoding::encode_in_envelope_optional::<u64, D>(
4896                self.id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
4897                encoder,
4898                offset + cur_offset,
4899                depth,
4900            )?;
4901
4902            _prev_end_offset = cur_offset + envelope_size;
4903            if 2 > max_ordinal {
4904                return Ok(());
4905            }
4906
4907            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4908            // are envelope_size bytes.
4909            let cur_offset: usize = (2 - 1) * envelope_size;
4910
4911            // Zero reserved fields.
4912            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4913
4914            // Safety:
4915            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4916            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4917            //   envelope_size bytes, there is always sufficient room.
4918            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 253>, D>(
4919                self.value.as_ref().map(
4920                    <fidl::encoding::Vector<u8, 253> as fidl::encoding::ValueTypeMarker>::borrow,
4921                ),
4922                encoder,
4923                offset + cur_offset,
4924                depth,
4925            )?;
4926
4927            _prev_end_offset = cur_offset + envelope_size;
4928            if 3 > max_ordinal {
4929                return Ok(());
4930            }
4931
4932            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4933            // are envelope_size bytes.
4934            let cur_offset: usize = (3 - 1) * envelope_size;
4935
4936            // Zero reserved fields.
4937            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4938
4939            // Safety:
4940            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4941            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4942            //   envelope_size bytes, there is always sufficient room.
4943            fidl::encoding::encode_in_envelope_optional::<Error, D>(
4944                self.error.as_ref().map(<Error as fidl::encoding::ValueTypeMarker>::borrow),
4945                encoder,
4946                offset + cur_offset,
4947                depth,
4948            )?;
4949
4950            _prev_end_offset = cur_offset + envelope_size;
4951
4952            Ok(())
4953        }
4954    }
4955
4956    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ReadByTypeResult {
4957        #[inline(always)]
4958        fn new_empty() -> Self {
4959            Self::default()
4960        }
4961
4962        unsafe fn decode(
4963            &mut self,
4964            decoder: &mut fidl::encoding::Decoder<'_, D>,
4965            offset: usize,
4966            mut depth: fidl::encoding::Depth,
4967        ) -> fidl::Result<()> {
4968            decoder.debug_check_bounds::<Self>(offset);
4969            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4970                None => return Err(fidl::Error::NotNullable),
4971                Some(len) => len,
4972            };
4973            // Calling decoder.out_of_line_offset(0) is not allowed.
4974            if len == 0 {
4975                return Ok(());
4976            };
4977            depth.increment()?;
4978            let envelope_size = 8;
4979            let bytes_len = len * envelope_size;
4980            let offset = decoder.out_of_line_offset(bytes_len)?;
4981            // Decode the envelope for each type.
4982            let mut _next_ordinal_to_read = 0;
4983            let mut next_offset = offset;
4984            let end_offset = offset + bytes_len;
4985            _next_ordinal_to_read += 1;
4986            if next_offset >= end_offset {
4987                return Ok(());
4988            }
4989
4990            // Decode unknown envelopes for gaps in ordinals.
4991            while _next_ordinal_to_read < 1 {
4992                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4993                _next_ordinal_to_read += 1;
4994                next_offset += envelope_size;
4995            }
4996
4997            let next_out_of_line = decoder.next_out_of_line();
4998            let handles_before = decoder.remaining_handles();
4999            if let Some((inlined, num_bytes, num_handles)) =
5000                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5001            {
5002                let member_inline_size =
5003                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5004                if inlined != (member_inline_size <= 4) {
5005                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5006                }
5007                let inner_offset;
5008                let mut inner_depth = depth.clone();
5009                if inlined {
5010                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5011                    inner_offset = next_offset;
5012                } else {
5013                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5014                    inner_depth.increment()?;
5015                }
5016                let val_ref = self.id.get_or_insert_with(|| fidl::new_empty!(u64, D));
5017                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
5018                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5019                {
5020                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5021                }
5022                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5023                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5024                }
5025            }
5026
5027            next_offset += envelope_size;
5028            _next_ordinal_to_read += 1;
5029            if next_offset >= end_offset {
5030                return Ok(());
5031            }
5032
5033            // Decode unknown envelopes for gaps in ordinals.
5034            while _next_ordinal_to_read < 2 {
5035                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5036                _next_ordinal_to_read += 1;
5037                next_offset += envelope_size;
5038            }
5039
5040            let next_out_of_line = decoder.next_out_of_line();
5041            let handles_before = decoder.remaining_handles();
5042            if let Some((inlined, num_bytes, num_handles)) =
5043                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5044            {
5045                let member_inline_size =
5046                    <fidl::encoding::Vector<u8, 253> as fidl::encoding::TypeMarker>::inline_size(
5047                        decoder.context,
5048                    );
5049                if inlined != (member_inline_size <= 4) {
5050                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5051                }
5052                let inner_offset;
5053                let mut inner_depth = depth.clone();
5054                if inlined {
5055                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5056                    inner_offset = next_offset;
5057                } else {
5058                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5059                    inner_depth.increment()?;
5060                }
5061                let val_ref = self
5062                    .value
5063                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 253>, D));
5064                fidl::decode!(fidl::encoding::Vector<u8, 253>, D, val_ref, decoder, inner_offset, inner_depth)?;
5065                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5066                {
5067                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5068                }
5069                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5070                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5071                }
5072            }
5073
5074            next_offset += envelope_size;
5075            _next_ordinal_to_read += 1;
5076            if next_offset >= end_offset {
5077                return Ok(());
5078            }
5079
5080            // Decode unknown envelopes for gaps in ordinals.
5081            while _next_ordinal_to_read < 3 {
5082                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5083                _next_ordinal_to_read += 1;
5084                next_offset += envelope_size;
5085            }
5086
5087            let next_out_of_line = decoder.next_out_of_line();
5088            let handles_before = decoder.remaining_handles();
5089            if let Some((inlined, num_bytes, num_handles)) =
5090                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5091            {
5092                let member_inline_size =
5093                    <Error as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5094                if inlined != (member_inline_size <= 4) {
5095                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5096                }
5097                let inner_offset;
5098                let mut inner_depth = depth.clone();
5099                if inlined {
5100                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5101                    inner_offset = next_offset;
5102                } else {
5103                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5104                    inner_depth.increment()?;
5105                }
5106                let val_ref = self.error.get_or_insert_with(|| fidl::new_empty!(Error, D));
5107                fidl::decode!(Error, D, val_ref, decoder, inner_offset, inner_depth)?;
5108                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5109                {
5110                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5111                }
5112                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5113                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5114                }
5115            }
5116
5117            next_offset += envelope_size;
5118
5119            // Decode the remaining unknown envelopes.
5120            while next_offset < end_offset {
5121                _next_ordinal_to_read += 1;
5122                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5123                next_offset += envelope_size;
5124            }
5125
5126            Ok(())
5127        }
5128    }
5129
5130    impl WriteOptions {
5131        #[inline(always)]
5132        fn max_ordinal_present(&self) -> u64 {
5133            if let Some(_) = self.reliable_mode {
5134                return 1;
5135            }
5136            0
5137        }
5138    }
5139
5140    impl fidl::encoding::ValueTypeMarker for WriteOptions {
5141        type Borrowed<'a> = &'a Self;
5142        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5143            value
5144        }
5145    }
5146
5147    unsafe impl fidl::encoding::TypeMarker for WriteOptions {
5148        type Owned = Self;
5149
5150        #[inline(always)]
5151        fn inline_align(_context: fidl::encoding::Context) -> usize {
5152            8
5153        }
5154
5155        #[inline(always)]
5156        fn inline_size(_context: fidl::encoding::Context) -> usize {
5157            16
5158        }
5159    }
5160
5161    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WriteOptions, D>
5162        for &WriteOptions
5163    {
5164        unsafe fn encode(
5165            self,
5166            encoder: &mut fidl::encoding::Encoder<'_, D>,
5167            offset: usize,
5168            mut depth: fidl::encoding::Depth,
5169        ) -> fidl::Result<()> {
5170            encoder.debug_check_bounds::<WriteOptions>(offset);
5171            // Vector header
5172            let max_ordinal: u64 = self.max_ordinal_present();
5173            encoder.write_num(max_ordinal, offset);
5174            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5175            // Calling encoder.out_of_line_offset(0) is not allowed.
5176            if max_ordinal == 0 {
5177                return Ok(());
5178            }
5179            depth.increment()?;
5180            let envelope_size = 8;
5181            let bytes_len = max_ordinal as usize * envelope_size;
5182            #[allow(unused_variables)]
5183            let offset = encoder.out_of_line_offset(bytes_len);
5184            let mut _prev_end_offset: usize = 0;
5185            if 1 > max_ordinal {
5186                return Ok(());
5187            }
5188
5189            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5190            // are envelope_size bytes.
5191            let cur_offset: usize = (1 - 1) * envelope_size;
5192
5193            // Zero reserved fields.
5194            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5195
5196            // Safety:
5197            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5198            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5199            //   envelope_size bytes, there is always sufficient room.
5200            fidl::encoding::encode_in_envelope_optional::<ReliableMode, D>(
5201                self.reliable_mode
5202                    .as_ref()
5203                    .map(<ReliableMode as fidl::encoding::ValueTypeMarker>::borrow),
5204                encoder,
5205                offset + cur_offset,
5206                depth,
5207            )?;
5208
5209            _prev_end_offset = cur_offset + envelope_size;
5210
5211            Ok(())
5212        }
5213    }
5214
5215    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WriteOptions {
5216        #[inline(always)]
5217        fn new_empty() -> Self {
5218            Self::default()
5219        }
5220
5221        unsafe fn decode(
5222            &mut self,
5223            decoder: &mut fidl::encoding::Decoder<'_, D>,
5224            offset: usize,
5225            mut depth: fidl::encoding::Depth,
5226        ) -> fidl::Result<()> {
5227            decoder.debug_check_bounds::<Self>(offset);
5228            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5229                None => return Err(fidl::Error::NotNullable),
5230                Some(len) => len,
5231            };
5232            // Calling decoder.out_of_line_offset(0) is not allowed.
5233            if len == 0 {
5234                return Ok(());
5235            };
5236            depth.increment()?;
5237            let envelope_size = 8;
5238            let bytes_len = len * envelope_size;
5239            let offset = decoder.out_of_line_offset(bytes_len)?;
5240            // Decode the envelope for each type.
5241            let mut _next_ordinal_to_read = 0;
5242            let mut next_offset = offset;
5243            let end_offset = offset + bytes_len;
5244            _next_ordinal_to_read += 1;
5245            if next_offset >= end_offset {
5246                return Ok(());
5247            }
5248
5249            // Decode unknown envelopes for gaps in ordinals.
5250            while _next_ordinal_to_read < 1 {
5251                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5252                _next_ordinal_to_read += 1;
5253                next_offset += envelope_size;
5254            }
5255
5256            let next_out_of_line = decoder.next_out_of_line();
5257            let handles_before = decoder.remaining_handles();
5258            if let Some((inlined, num_bytes, num_handles)) =
5259                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5260            {
5261                let member_inline_size =
5262                    <ReliableMode as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5263                if inlined != (member_inline_size <= 4) {
5264                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5265                }
5266                let inner_offset;
5267                let mut inner_depth = depth.clone();
5268                if inlined {
5269                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5270                    inner_offset = next_offset;
5271                } else {
5272                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5273                    inner_depth.increment()?;
5274                }
5275                let val_ref =
5276                    self.reliable_mode.get_or_insert_with(|| fidl::new_empty!(ReliableMode, D));
5277                fidl::decode!(ReliableMode, D, val_ref, decoder, inner_offset, inner_depth)?;
5278                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5279                {
5280                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5281                }
5282                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5283                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5284                }
5285            }
5286
5287            next_offset += envelope_size;
5288
5289            // Decode the remaining unknown envelopes.
5290            while next_offset < end_offset {
5291                _next_ordinal_to_read += 1;
5292                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5293                next_offset += envelope_size;
5294            }
5295
5296            Ok(())
5297        }
5298    }
5299}