Skip to main content

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<fidl::encoding::Optional<fidl::encoding::UnboundedVector<u8>>, D>,
1643        T1: fidl::encoding::Encode<ErrorCode, D>,
1644    > fidl::encoding::Encode<LocalServiceDelegateOnReadValueResponse, D> for (T0, T1)
1645    {
1646        #[inline]
1647        unsafe fn encode(
1648            self,
1649            encoder: &mut fidl::encoding::Encoder<'_, D>,
1650            offset: usize,
1651            depth: fidl::encoding::Depth,
1652        ) -> fidl::Result<()> {
1653            encoder.debug_check_bounds::<LocalServiceDelegateOnReadValueResponse>(offset);
1654            // Zero out padding regions. There's no need to apply masks
1655            // because the unmasked parts will be overwritten by fields.
1656            unsafe {
1657                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1658                (ptr as *mut u64).write_unaligned(0);
1659            }
1660            // Write the fields.
1661            self.0.encode(encoder, offset + 0, depth)?;
1662            self.1.encode(encoder, offset + 16, depth)?;
1663            Ok(())
1664        }
1665    }
1666
1667    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1668        for LocalServiceDelegateOnReadValueResponse
1669    {
1670        #[inline(always)]
1671        fn new_empty() -> Self {
1672            Self {
1673                value: fidl::new_empty!(
1674                    fidl::encoding::Optional<fidl::encoding::UnboundedVector<u8>>,
1675                    D
1676                ),
1677                status: fidl::new_empty!(ErrorCode, D),
1678            }
1679        }
1680
1681        #[inline]
1682        unsafe fn decode(
1683            &mut self,
1684            decoder: &mut fidl::encoding::Decoder<'_, D>,
1685            offset: usize,
1686            _depth: fidl::encoding::Depth,
1687        ) -> fidl::Result<()> {
1688            decoder.debug_check_bounds::<Self>(offset);
1689            // Verify that padding bytes are zero.
1690            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1691            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1692            let mask = 0xffffffff00000000u64;
1693            let maskedval = padval & mask;
1694            if maskedval != 0 {
1695                return Err(fidl::Error::NonZeroPadding {
1696                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1697                });
1698            }
1699            fidl::decode!(
1700                fidl::encoding::Optional<fidl::encoding::UnboundedVector<u8>>,
1701                D,
1702                &mut self.value,
1703                decoder,
1704                offset + 0,
1705                _depth
1706            )?;
1707            fidl::decode!(ErrorCode, D, &mut self.status, decoder, offset + 16, _depth)?;
1708            Ok(())
1709        }
1710    }
1711
1712    impl fidl::encoding::ValueTypeMarker for LocalServiceDelegateOnWriteValueRequest {
1713        type Borrowed<'a> = &'a Self;
1714        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1715            value
1716        }
1717    }
1718
1719    unsafe impl fidl::encoding::TypeMarker for LocalServiceDelegateOnWriteValueRequest {
1720        type Owned = Self;
1721
1722        #[inline(always)]
1723        fn inline_align(_context: fidl::encoding::Context) -> usize {
1724            8
1725        }
1726
1727        #[inline(always)]
1728        fn inline_size(_context: fidl::encoding::Context) -> usize {
1729            32
1730        }
1731    }
1732
1733    unsafe impl<D: fidl::encoding::ResourceDialect>
1734        fidl::encoding::Encode<LocalServiceDelegateOnWriteValueRequest, D>
1735        for &LocalServiceDelegateOnWriteValueRequest
1736    {
1737        #[inline]
1738        unsafe fn encode(
1739            self,
1740            encoder: &mut fidl::encoding::Encoder<'_, D>,
1741            offset: usize,
1742            _depth: fidl::encoding::Depth,
1743        ) -> fidl::Result<()> {
1744            encoder.debug_check_bounds::<LocalServiceDelegateOnWriteValueRequest>(offset);
1745            // Delegate to tuple encoding.
1746            fidl::encoding::Encode::<LocalServiceDelegateOnWriteValueRequest, D>::encode(
1747                (
1748                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
1749                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.offset),
1750                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
1751                ),
1752                encoder, offset, _depth
1753            )
1754        }
1755    }
1756    unsafe impl<
1757        D: fidl::encoding::ResourceDialect,
1758        T0: fidl::encoding::Encode<u64, D>,
1759        T1: fidl::encoding::Encode<u16, D>,
1760        T2: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
1761    > fidl::encoding::Encode<LocalServiceDelegateOnWriteValueRequest, D> for (T0, T1, T2)
1762    {
1763        #[inline]
1764        unsafe fn encode(
1765            self,
1766            encoder: &mut fidl::encoding::Encoder<'_, D>,
1767            offset: usize,
1768            depth: fidl::encoding::Depth,
1769        ) -> fidl::Result<()> {
1770            encoder.debug_check_bounds::<LocalServiceDelegateOnWriteValueRequest>(offset);
1771            // Zero out padding regions. There's no need to apply masks
1772            // because the unmasked parts will be overwritten by fields.
1773            unsafe {
1774                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
1775                (ptr as *mut u64).write_unaligned(0);
1776            }
1777            // Write the fields.
1778            self.0.encode(encoder, offset + 0, depth)?;
1779            self.1.encode(encoder, offset + 8, depth)?;
1780            self.2.encode(encoder, offset + 16, depth)?;
1781            Ok(())
1782        }
1783    }
1784
1785    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1786        for LocalServiceDelegateOnWriteValueRequest
1787    {
1788        #[inline(always)]
1789        fn new_empty() -> Self {
1790            Self {
1791                id: fidl::new_empty!(u64, D),
1792                offset: fidl::new_empty!(u16, D),
1793                value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
1794            }
1795        }
1796
1797        #[inline]
1798        unsafe fn decode(
1799            &mut self,
1800            decoder: &mut fidl::encoding::Decoder<'_, D>,
1801            offset: usize,
1802            _depth: fidl::encoding::Depth,
1803        ) -> fidl::Result<()> {
1804            decoder.debug_check_bounds::<Self>(offset);
1805            // Verify that padding bytes are zero.
1806            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
1807            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1808            let mask = 0xffffffffffff0000u64;
1809            let maskedval = padval & mask;
1810            if maskedval != 0 {
1811                return Err(fidl::Error::NonZeroPadding {
1812                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
1813                });
1814            }
1815            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
1816            fidl::decode!(u16, D, &mut self.offset, decoder, offset + 8, _depth)?;
1817            fidl::decode!(
1818                fidl::encoding::UnboundedVector<u8>,
1819                D,
1820                &mut self.value,
1821                decoder,
1822                offset + 16,
1823                _depth
1824            )?;
1825            Ok(())
1826        }
1827    }
1828
1829    impl fidl::encoding::ValueTypeMarker for LocalServiceDelegateOnWriteValueResponse {
1830        type Borrowed<'a> = &'a Self;
1831        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1832            value
1833        }
1834    }
1835
1836    unsafe impl fidl::encoding::TypeMarker for LocalServiceDelegateOnWriteValueResponse {
1837        type Owned = Self;
1838
1839        #[inline(always)]
1840        fn inline_align(_context: fidl::encoding::Context) -> usize {
1841            4
1842        }
1843
1844        #[inline(always)]
1845        fn inline_size(_context: fidl::encoding::Context) -> usize {
1846            4
1847        }
1848    }
1849
1850    unsafe impl<D: fidl::encoding::ResourceDialect>
1851        fidl::encoding::Encode<LocalServiceDelegateOnWriteValueResponse, D>
1852        for &LocalServiceDelegateOnWriteValueResponse
1853    {
1854        #[inline]
1855        unsafe fn encode(
1856            self,
1857            encoder: &mut fidl::encoding::Encoder<'_, D>,
1858            offset: usize,
1859            _depth: fidl::encoding::Depth,
1860        ) -> fidl::Result<()> {
1861            encoder.debug_check_bounds::<LocalServiceDelegateOnWriteValueResponse>(offset);
1862            // Delegate to tuple encoding.
1863            fidl::encoding::Encode::<LocalServiceDelegateOnWriteValueResponse, D>::encode(
1864                (<ErrorCode as fidl::encoding::ValueTypeMarker>::borrow(&self.status),),
1865                encoder,
1866                offset,
1867                _depth,
1868            )
1869        }
1870    }
1871    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<ErrorCode, D>>
1872        fidl::encoding::Encode<LocalServiceDelegateOnWriteValueResponse, D> for (T0,)
1873    {
1874        #[inline]
1875        unsafe fn encode(
1876            self,
1877            encoder: &mut fidl::encoding::Encoder<'_, D>,
1878            offset: usize,
1879            depth: fidl::encoding::Depth,
1880        ) -> fidl::Result<()> {
1881            encoder.debug_check_bounds::<LocalServiceDelegateOnWriteValueResponse>(offset);
1882            // Zero out padding regions. There's no need to apply masks
1883            // because the unmasked parts will be overwritten by fields.
1884            // Write the fields.
1885            self.0.encode(encoder, offset + 0, depth)?;
1886            Ok(())
1887        }
1888    }
1889
1890    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1891        for LocalServiceDelegateOnWriteValueResponse
1892    {
1893        #[inline(always)]
1894        fn new_empty() -> Self {
1895            Self { status: fidl::new_empty!(ErrorCode, D) }
1896        }
1897
1898        #[inline]
1899        unsafe fn decode(
1900            &mut self,
1901            decoder: &mut fidl::encoding::Decoder<'_, D>,
1902            offset: usize,
1903            _depth: fidl::encoding::Depth,
1904        ) -> fidl::Result<()> {
1905            decoder.debug_check_bounds::<Self>(offset);
1906            // Verify that padding bytes are zero.
1907            fidl::decode!(ErrorCode, D, &mut self.status, decoder, offset + 0, _depth)?;
1908            Ok(())
1909        }
1910    }
1911
1912    impl fidl::encoding::ValueTypeMarker for LocalServiceDelegateOnWriteWithoutResponseRequest {
1913        type Borrowed<'a> = &'a Self;
1914        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1915            value
1916        }
1917    }
1918
1919    unsafe impl fidl::encoding::TypeMarker for LocalServiceDelegateOnWriteWithoutResponseRequest {
1920        type Owned = Self;
1921
1922        #[inline(always)]
1923        fn inline_align(_context: fidl::encoding::Context) -> usize {
1924            8
1925        }
1926
1927        #[inline(always)]
1928        fn inline_size(_context: fidl::encoding::Context) -> usize {
1929            32
1930        }
1931    }
1932
1933    unsafe impl<D: fidl::encoding::ResourceDialect>
1934        fidl::encoding::Encode<LocalServiceDelegateOnWriteWithoutResponseRequest, D>
1935        for &LocalServiceDelegateOnWriteWithoutResponseRequest
1936    {
1937        #[inline]
1938        unsafe fn encode(
1939            self,
1940            encoder: &mut fidl::encoding::Encoder<'_, D>,
1941            offset: usize,
1942            _depth: fidl::encoding::Depth,
1943        ) -> fidl::Result<()> {
1944            encoder.debug_check_bounds::<LocalServiceDelegateOnWriteWithoutResponseRequest>(offset);
1945            // Delegate to tuple encoding.
1946            fidl::encoding::Encode::<LocalServiceDelegateOnWriteWithoutResponseRequest, D>::encode(
1947                (
1948                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
1949                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.offset),
1950                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
1951                ),
1952                encoder, offset, _depth
1953            )
1954        }
1955    }
1956    unsafe impl<
1957        D: fidl::encoding::ResourceDialect,
1958        T0: fidl::encoding::Encode<u64, D>,
1959        T1: fidl::encoding::Encode<u16, D>,
1960        T2: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
1961    > fidl::encoding::Encode<LocalServiceDelegateOnWriteWithoutResponseRequest, D>
1962        for (T0, T1, T2)
1963    {
1964        #[inline]
1965        unsafe fn encode(
1966            self,
1967            encoder: &mut fidl::encoding::Encoder<'_, D>,
1968            offset: usize,
1969            depth: fidl::encoding::Depth,
1970        ) -> fidl::Result<()> {
1971            encoder.debug_check_bounds::<LocalServiceDelegateOnWriteWithoutResponseRequest>(offset);
1972            // Zero out padding regions. There's no need to apply masks
1973            // because the unmasked parts will be overwritten by fields.
1974            unsafe {
1975                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
1976                (ptr as *mut u64).write_unaligned(0);
1977            }
1978            // Write the fields.
1979            self.0.encode(encoder, offset + 0, depth)?;
1980            self.1.encode(encoder, offset + 8, depth)?;
1981            self.2.encode(encoder, offset + 16, depth)?;
1982            Ok(())
1983        }
1984    }
1985
1986    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1987        for LocalServiceDelegateOnWriteWithoutResponseRequest
1988    {
1989        #[inline(always)]
1990        fn new_empty() -> Self {
1991            Self {
1992                id: fidl::new_empty!(u64, D),
1993                offset: fidl::new_empty!(u16, D),
1994                value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
1995            }
1996        }
1997
1998        #[inline]
1999        unsafe fn decode(
2000            &mut self,
2001            decoder: &mut fidl::encoding::Decoder<'_, D>,
2002            offset: usize,
2003            _depth: fidl::encoding::Depth,
2004        ) -> fidl::Result<()> {
2005            decoder.debug_check_bounds::<Self>(offset);
2006            // Verify that padding bytes are zero.
2007            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
2008            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2009            let mask = 0xffffffffffff0000u64;
2010            let maskedval = padval & mask;
2011            if maskedval != 0 {
2012                return Err(fidl::Error::NonZeroPadding {
2013                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
2014                });
2015            }
2016            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
2017            fidl::decode!(u16, D, &mut self.offset, decoder, offset + 8, _depth)?;
2018            fidl::decode!(
2019                fidl::encoding::UnboundedVector<u8>,
2020                D,
2021                &mut self.value,
2022                decoder,
2023                offset + 16,
2024                _depth
2025            )?;
2026            Ok(())
2027        }
2028    }
2029
2030    impl fidl::encoding::ValueTypeMarker for LocalServiceNotifyValueRequest {
2031        type Borrowed<'a> = &'a Self;
2032        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2033            value
2034        }
2035    }
2036
2037    unsafe impl fidl::encoding::TypeMarker for LocalServiceNotifyValueRequest {
2038        type Owned = Self;
2039
2040        #[inline(always)]
2041        fn inline_align(_context: fidl::encoding::Context) -> usize {
2042            8
2043        }
2044
2045        #[inline(always)]
2046        fn inline_size(_context: fidl::encoding::Context) -> usize {
2047            48
2048        }
2049    }
2050
2051    unsafe impl<D: fidl::encoding::ResourceDialect>
2052        fidl::encoding::Encode<LocalServiceNotifyValueRequest, D>
2053        for &LocalServiceNotifyValueRequest
2054    {
2055        #[inline]
2056        unsafe fn encode(
2057            self,
2058            encoder: &mut fidl::encoding::Encoder<'_, D>,
2059            offset: usize,
2060            _depth: fidl::encoding::Depth,
2061        ) -> fidl::Result<()> {
2062            encoder.debug_check_bounds::<LocalServiceNotifyValueRequest>(offset);
2063            // Delegate to tuple encoding.
2064            fidl::encoding::Encode::<LocalServiceNotifyValueRequest, D>::encode(
2065                (
2066                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.characteristic_id),
2067                    <fidl::encoding::BoundedString<16> as fidl::encoding::ValueTypeMarker>::borrow(&self.peer_id),
2068                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
2069                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.confirm),
2070                ),
2071                encoder, offset, _depth
2072            )
2073        }
2074    }
2075    unsafe impl<
2076        D: fidl::encoding::ResourceDialect,
2077        T0: fidl::encoding::Encode<u64, D>,
2078        T1: fidl::encoding::Encode<fidl::encoding::BoundedString<16>, D>,
2079        T2: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
2080        T3: fidl::encoding::Encode<bool, D>,
2081    > fidl::encoding::Encode<LocalServiceNotifyValueRequest, D> for (T0, T1, T2, T3)
2082    {
2083        #[inline]
2084        unsafe fn encode(
2085            self,
2086            encoder: &mut fidl::encoding::Encoder<'_, D>,
2087            offset: usize,
2088            depth: fidl::encoding::Depth,
2089        ) -> fidl::Result<()> {
2090            encoder.debug_check_bounds::<LocalServiceNotifyValueRequest>(offset);
2091            // Zero out padding regions. There's no need to apply masks
2092            // because the unmasked parts will be overwritten by fields.
2093            unsafe {
2094                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
2095                (ptr as *mut u64).write_unaligned(0);
2096            }
2097            // Write the fields.
2098            self.0.encode(encoder, offset + 0, depth)?;
2099            self.1.encode(encoder, offset + 8, depth)?;
2100            self.2.encode(encoder, offset + 24, depth)?;
2101            self.3.encode(encoder, offset + 40, depth)?;
2102            Ok(())
2103        }
2104    }
2105
2106    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2107        for LocalServiceNotifyValueRequest
2108    {
2109        #[inline(always)]
2110        fn new_empty() -> Self {
2111            Self {
2112                characteristic_id: fidl::new_empty!(u64, D),
2113                peer_id: fidl::new_empty!(fidl::encoding::BoundedString<16>, D),
2114                value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
2115                confirm: fidl::new_empty!(bool, D),
2116            }
2117        }
2118
2119        #[inline]
2120        unsafe fn decode(
2121            &mut self,
2122            decoder: &mut fidl::encoding::Decoder<'_, D>,
2123            offset: usize,
2124            _depth: fidl::encoding::Depth,
2125        ) -> fidl::Result<()> {
2126            decoder.debug_check_bounds::<Self>(offset);
2127            // Verify that padding bytes are zero.
2128            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
2129            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2130            let mask = 0xffffffffffffff00u64;
2131            let maskedval = padval & mask;
2132            if maskedval != 0 {
2133                return Err(fidl::Error::NonZeroPadding {
2134                    padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
2135                });
2136            }
2137            fidl::decode!(u64, D, &mut self.characteristic_id, decoder, offset + 0, _depth)?;
2138            fidl::decode!(
2139                fidl::encoding::BoundedString<16>,
2140                D,
2141                &mut self.peer_id,
2142                decoder,
2143                offset + 8,
2144                _depth
2145            )?;
2146            fidl::decode!(
2147                fidl::encoding::UnboundedVector<u8>,
2148                D,
2149                &mut self.value,
2150                decoder,
2151                offset + 24,
2152                _depth
2153            )?;
2154            fidl::decode!(bool, D, &mut self.confirm, decoder, offset + 40, _depth)?;
2155            Ok(())
2156        }
2157    }
2158
2159    impl fidl::encoding::ValueTypeMarker for RemoteServiceDiscoverCharacteristicsResponse {
2160        type Borrowed<'a> = &'a Self;
2161        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2162            value
2163        }
2164    }
2165
2166    unsafe impl fidl::encoding::TypeMarker for RemoteServiceDiscoverCharacteristicsResponse {
2167        type Owned = Self;
2168
2169        #[inline(always)]
2170        fn inline_align(_context: fidl::encoding::Context) -> usize {
2171            8
2172        }
2173
2174        #[inline(always)]
2175        fn inline_size(_context: fidl::encoding::Context) -> usize {
2176            24
2177        }
2178    }
2179
2180    unsafe impl<D: fidl::encoding::ResourceDialect>
2181        fidl::encoding::Encode<RemoteServiceDiscoverCharacteristicsResponse, D>
2182        for &RemoteServiceDiscoverCharacteristicsResponse
2183    {
2184        #[inline]
2185        unsafe fn encode(
2186            self,
2187            encoder: &mut fidl::encoding::Encoder<'_, D>,
2188            offset: usize,
2189            _depth: fidl::encoding::Depth,
2190        ) -> fidl::Result<()> {
2191            encoder.debug_check_bounds::<RemoteServiceDiscoverCharacteristicsResponse>(offset);
2192            // Delegate to tuple encoding.
2193            fidl::encoding::Encode::<RemoteServiceDiscoverCharacteristicsResponse, D>::encode(
2194                (
2195                    <fidl_fuchsia_bluetooth_common::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
2196                    <fidl::encoding::Vector<Characteristic, 32767> as fidl::encoding::ValueTypeMarker>::borrow(&self.characteristics),
2197                ),
2198                encoder, offset, _depth
2199            )
2200        }
2201    }
2202    unsafe impl<
2203        D: fidl::encoding::ResourceDialect,
2204        T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth_common::Status, D>,
2205        T1: fidl::encoding::Encode<fidl::encoding::Vector<Characteristic, 32767>, D>,
2206    > fidl::encoding::Encode<RemoteServiceDiscoverCharacteristicsResponse, D> for (T0, T1)
2207    {
2208        #[inline]
2209        unsafe fn encode(
2210            self,
2211            encoder: &mut fidl::encoding::Encoder<'_, D>,
2212            offset: usize,
2213            depth: fidl::encoding::Depth,
2214        ) -> fidl::Result<()> {
2215            encoder.debug_check_bounds::<RemoteServiceDiscoverCharacteristicsResponse>(offset);
2216            // Zero out padding regions. There's no need to apply masks
2217            // because the unmasked parts will be overwritten by fields.
2218            // Write the fields.
2219            self.0.encode(encoder, offset + 0, depth)?;
2220            self.1.encode(encoder, offset + 8, depth)?;
2221            Ok(())
2222        }
2223    }
2224
2225    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2226        for RemoteServiceDiscoverCharacteristicsResponse
2227    {
2228        #[inline(always)]
2229        fn new_empty() -> Self {
2230            Self {
2231                status: fidl::new_empty!(fidl_fuchsia_bluetooth_common::Status, D),
2232                characteristics: fidl::new_empty!(fidl::encoding::Vector<Characteristic, 32767>, D),
2233            }
2234        }
2235
2236        #[inline]
2237        unsafe fn decode(
2238            &mut self,
2239            decoder: &mut fidl::encoding::Decoder<'_, D>,
2240            offset: usize,
2241            _depth: fidl::encoding::Depth,
2242        ) -> fidl::Result<()> {
2243            decoder.debug_check_bounds::<Self>(offset);
2244            // Verify that padding bytes are zero.
2245            fidl::decode!(
2246                fidl_fuchsia_bluetooth_common::Status,
2247                D,
2248                &mut self.status,
2249                decoder,
2250                offset + 0,
2251                _depth
2252            )?;
2253            fidl::decode!(fidl::encoding::Vector<Characteristic, 32767>, D, &mut self.characteristics, decoder, offset + 8, _depth)?;
2254            Ok(())
2255        }
2256    }
2257
2258    impl fidl::encoding::ValueTypeMarker for RemoteServiceNotifyCharacteristicRequest {
2259        type Borrowed<'a> = &'a Self;
2260        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2261            value
2262        }
2263    }
2264
2265    unsafe impl fidl::encoding::TypeMarker for RemoteServiceNotifyCharacteristicRequest {
2266        type Owned = Self;
2267
2268        #[inline(always)]
2269        fn inline_align(_context: fidl::encoding::Context) -> usize {
2270            8
2271        }
2272
2273        #[inline(always)]
2274        fn inline_size(_context: fidl::encoding::Context) -> usize {
2275            16
2276        }
2277    }
2278
2279    unsafe impl<D: fidl::encoding::ResourceDialect>
2280        fidl::encoding::Encode<RemoteServiceNotifyCharacteristicRequest, D>
2281        for &RemoteServiceNotifyCharacteristicRequest
2282    {
2283        #[inline]
2284        unsafe fn encode(
2285            self,
2286            encoder: &mut fidl::encoding::Encoder<'_, D>,
2287            offset: usize,
2288            _depth: fidl::encoding::Depth,
2289        ) -> fidl::Result<()> {
2290            encoder.debug_check_bounds::<RemoteServiceNotifyCharacteristicRequest>(offset);
2291            // Delegate to tuple encoding.
2292            fidl::encoding::Encode::<RemoteServiceNotifyCharacteristicRequest, D>::encode(
2293                (
2294                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
2295                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enable),
2296                ),
2297                encoder,
2298                offset,
2299                _depth,
2300            )
2301        }
2302    }
2303    unsafe impl<
2304        D: fidl::encoding::ResourceDialect,
2305        T0: fidl::encoding::Encode<u64, D>,
2306        T1: fidl::encoding::Encode<bool, D>,
2307    > fidl::encoding::Encode<RemoteServiceNotifyCharacteristicRequest, D> for (T0, T1)
2308    {
2309        #[inline]
2310        unsafe fn encode(
2311            self,
2312            encoder: &mut fidl::encoding::Encoder<'_, D>,
2313            offset: usize,
2314            depth: fidl::encoding::Depth,
2315        ) -> fidl::Result<()> {
2316            encoder.debug_check_bounds::<RemoteServiceNotifyCharacteristicRequest>(offset);
2317            // Zero out padding regions. There's no need to apply masks
2318            // because the unmasked parts will be overwritten by fields.
2319            unsafe {
2320                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
2321                (ptr as *mut u64).write_unaligned(0);
2322            }
2323            // Write the fields.
2324            self.0.encode(encoder, offset + 0, depth)?;
2325            self.1.encode(encoder, offset + 8, depth)?;
2326            Ok(())
2327        }
2328    }
2329
2330    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2331        for RemoteServiceNotifyCharacteristicRequest
2332    {
2333        #[inline(always)]
2334        fn new_empty() -> Self {
2335            Self { id: fidl::new_empty!(u64, D), enable: fidl::new_empty!(bool, D) }
2336        }
2337
2338        #[inline]
2339        unsafe fn decode(
2340            &mut self,
2341            decoder: &mut fidl::encoding::Decoder<'_, D>,
2342            offset: usize,
2343            _depth: fidl::encoding::Depth,
2344        ) -> fidl::Result<()> {
2345            decoder.debug_check_bounds::<Self>(offset);
2346            // Verify that padding bytes are zero.
2347            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
2348            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2349            let mask = 0xffffffffffffff00u64;
2350            let maskedval = padval & mask;
2351            if maskedval != 0 {
2352                return Err(fidl::Error::NonZeroPadding {
2353                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
2354                });
2355            }
2356            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
2357            fidl::decode!(bool, D, &mut self.enable, decoder, offset + 8, _depth)?;
2358            Ok(())
2359        }
2360    }
2361
2362    impl fidl::encoding::ValueTypeMarker for RemoteServiceNotifyCharacteristicResponse {
2363        type Borrowed<'a> = &'a Self;
2364        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2365            value
2366        }
2367    }
2368
2369    unsafe impl fidl::encoding::TypeMarker for RemoteServiceNotifyCharacteristicResponse {
2370        type Owned = Self;
2371
2372        #[inline(always)]
2373        fn inline_align(_context: fidl::encoding::Context) -> usize {
2374            8
2375        }
2376
2377        #[inline(always)]
2378        fn inline_size(_context: fidl::encoding::Context) -> usize {
2379            8
2380        }
2381    }
2382
2383    unsafe impl<D: fidl::encoding::ResourceDialect>
2384        fidl::encoding::Encode<RemoteServiceNotifyCharacteristicResponse, D>
2385        for &RemoteServiceNotifyCharacteristicResponse
2386    {
2387        #[inline]
2388        unsafe fn encode(
2389            self,
2390            encoder: &mut fidl::encoding::Encoder<'_, D>,
2391            offset: usize,
2392            _depth: fidl::encoding::Depth,
2393        ) -> fidl::Result<()> {
2394            encoder.debug_check_bounds::<RemoteServiceNotifyCharacteristicResponse>(offset);
2395            // Delegate to tuple encoding.
2396            fidl::encoding::Encode::<RemoteServiceNotifyCharacteristicResponse, D>::encode(
2397                (
2398                    <fidl_fuchsia_bluetooth_common::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
2399                ),
2400                encoder, offset, _depth
2401            )
2402        }
2403    }
2404    unsafe impl<
2405        D: fidl::encoding::ResourceDialect,
2406        T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth_common::Status, D>,
2407    > fidl::encoding::Encode<RemoteServiceNotifyCharacteristicResponse, D> for (T0,)
2408    {
2409        #[inline]
2410        unsafe fn encode(
2411            self,
2412            encoder: &mut fidl::encoding::Encoder<'_, D>,
2413            offset: usize,
2414            depth: fidl::encoding::Depth,
2415        ) -> fidl::Result<()> {
2416            encoder.debug_check_bounds::<RemoteServiceNotifyCharacteristicResponse>(offset);
2417            // Zero out padding regions. There's no need to apply masks
2418            // because the unmasked parts will be overwritten by fields.
2419            // Write the fields.
2420            self.0.encode(encoder, offset + 0, depth)?;
2421            Ok(())
2422        }
2423    }
2424
2425    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2426        for RemoteServiceNotifyCharacteristicResponse
2427    {
2428        #[inline(always)]
2429        fn new_empty() -> Self {
2430            Self { status: fidl::new_empty!(fidl_fuchsia_bluetooth_common::Status, D) }
2431        }
2432
2433        #[inline]
2434        unsafe fn decode(
2435            &mut self,
2436            decoder: &mut fidl::encoding::Decoder<'_, D>,
2437            offset: usize,
2438            _depth: fidl::encoding::Depth,
2439        ) -> fidl::Result<()> {
2440            decoder.debug_check_bounds::<Self>(offset);
2441            // Verify that padding bytes are zero.
2442            fidl::decode!(
2443                fidl_fuchsia_bluetooth_common::Status,
2444                D,
2445                &mut self.status,
2446                decoder,
2447                offset + 0,
2448                _depth
2449            )?;
2450            Ok(())
2451        }
2452    }
2453
2454    impl fidl::encoding::ValueTypeMarker for RemoteServiceOnCharacteristicValueUpdatedRequest {
2455        type Borrowed<'a> = &'a Self;
2456        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2457            value
2458        }
2459    }
2460
2461    unsafe impl fidl::encoding::TypeMarker for RemoteServiceOnCharacteristicValueUpdatedRequest {
2462        type Owned = Self;
2463
2464        #[inline(always)]
2465        fn inline_align(_context: fidl::encoding::Context) -> usize {
2466            8
2467        }
2468
2469        #[inline(always)]
2470        fn inline_size(_context: fidl::encoding::Context) -> usize {
2471            24
2472        }
2473    }
2474
2475    unsafe impl<D: fidl::encoding::ResourceDialect>
2476        fidl::encoding::Encode<RemoteServiceOnCharacteristicValueUpdatedRequest, D>
2477        for &RemoteServiceOnCharacteristicValueUpdatedRequest
2478    {
2479        #[inline]
2480        unsafe fn encode(
2481            self,
2482            encoder: &mut fidl::encoding::Encoder<'_, D>,
2483            offset: usize,
2484            _depth: fidl::encoding::Depth,
2485        ) -> fidl::Result<()> {
2486            encoder.debug_check_bounds::<RemoteServiceOnCharacteristicValueUpdatedRequest>(offset);
2487            // Delegate to tuple encoding.
2488            fidl::encoding::Encode::<RemoteServiceOnCharacteristicValueUpdatedRequest, D>::encode(
2489                (
2490                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
2491                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
2492                ),
2493                encoder, offset, _depth
2494            )
2495        }
2496    }
2497    unsafe impl<
2498        D: fidl::encoding::ResourceDialect,
2499        T0: fidl::encoding::Encode<u64, D>,
2500        T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
2501    > fidl::encoding::Encode<RemoteServiceOnCharacteristicValueUpdatedRequest, D> for (T0, T1)
2502    {
2503        #[inline]
2504        unsafe fn encode(
2505            self,
2506            encoder: &mut fidl::encoding::Encoder<'_, D>,
2507            offset: usize,
2508            depth: fidl::encoding::Depth,
2509        ) -> fidl::Result<()> {
2510            encoder.debug_check_bounds::<RemoteServiceOnCharacteristicValueUpdatedRequest>(offset);
2511            // Zero out padding regions. There's no need to apply masks
2512            // because the unmasked parts will be overwritten by fields.
2513            // Write the fields.
2514            self.0.encode(encoder, offset + 0, depth)?;
2515            self.1.encode(encoder, offset + 8, depth)?;
2516            Ok(())
2517        }
2518    }
2519
2520    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2521        for RemoteServiceOnCharacteristicValueUpdatedRequest
2522    {
2523        #[inline(always)]
2524        fn new_empty() -> Self {
2525            Self {
2526                id: fidl::new_empty!(u64, D),
2527                value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
2528            }
2529        }
2530
2531        #[inline]
2532        unsafe fn decode(
2533            &mut self,
2534            decoder: &mut fidl::encoding::Decoder<'_, D>,
2535            offset: usize,
2536            _depth: fidl::encoding::Depth,
2537        ) -> fidl::Result<()> {
2538            decoder.debug_check_bounds::<Self>(offset);
2539            // Verify that padding bytes are zero.
2540            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
2541            fidl::decode!(
2542                fidl::encoding::UnboundedVector<u8>,
2543                D,
2544                &mut self.value,
2545                decoder,
2546                offset + 8,
2547                _depth
2548            )?;
2549            Ok(())
2550        }
2551    }
2552
2553    impl fidl::encoding::ValueTypeMarker for RemoteServiceReadByTypeRequest {
2554        type Borrowed<'a> = &'a Self;
2555        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2556            value
2557        }
2558    }
2559
2560    unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadByTypeRequest {
2561        type Owned = Self;
2562
2563        #[inline(always)]
2564        fn inline_align(_context: fidl::encoding::Context) -> usize {
2565            1
2566        }
2567
2568        #[inline(always)]
2569        fn inline_size(_context: fidl::encoding::Context) -> usize {
2570            16
2571        }
2572    }
2573
2574    unsafe impl<D: fidl::encoding::ResourceDialect>
2575        fidl::encoding::Encode<RemoteServiceReadByTypeRequest, D>
2576        for &RemoteServiceReadByTypeRequest
2577    {
2578        #[inline]
2579        unsafe fn encode(
2580            self,
2581            encoder: &mut fidl::encoding::Encoder<'_, D>,
2582            offset: usize,
2583            _depth: fidl::encoding::Depth,
2584        ) -> fidl::Result<()> {
2585            encoder.debug_check_bounds::<RemoteServiceReadByTypeRequest>(offset);
2586            // Delegate to tuple encoding.
2587            fidl::encoding::Encode::<RemoteServiceReadByTypeRequest, D>::encode(
2588                (<fidl_fuchsia_bluetooth_common::Uuid as fidl::encoding::ValueTypeMarker>::borrow(
2589                    &self.uuid,
2590                ),),
2591                encoder,
2592                offset,
2593                _depth,
2594            )
2595        }
2596    }
2597    unsafe impl<
2598        D: fidl::encoding::ResourceDialect,
2599        T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth_common::Uuid, D>,
2600    > fidl::encoding::Encode<RemoteServiceReadByTypeRequest, D> for (T0,)
2601    {
2602        #[inline]
2603        unsafe fn encode(
2604            self,
2605            encoder: &mut fidl::encoding::Encoder<'_, D>,
2606            offset: usize,
2607            depth: fidl::encoding::Depth,
2608        ) -> fidl::Result<()> {
2609            encoder.debug_check_bounds::<RemoteServiceReadByTypeRequest>(offset);
2610            // Zero out padding regions. There's no need to apply masks
2611            // because the unmasked parts will be overwritten by fields.
2612            // Write the fields.
2613            self.0.encode(encoder, offset + 0, depth)?;
2614            Ok(())
2615        }
2616    }
2617
2618    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2619        for RemoteServiceReadByTypeRequest
2620    {
2621        #[inline(always)]
2622        fn new_empty() -> Self {
2623            Self { uuid: fidl::new_empty!(fidl_fuchsia_bluetooth_common::Uuid, D) }
2624        }
2625
2626        #[inline]
2627        unsafe fn decode(
2628            &mut self,
2629            decoder: &mut fidl::encoding::Decoder<'_, D>,
2630            offset: usize,
2631            _depth: fidl::encoding::Depth,
2632        ) -> fidl::Result<()> {
2633            decoder.debug_check_bounds::<Self>(offset);
2634            // Verify that padding bytes are zero.
2635            fidl::decode!(
2636                fidl_fuchsia_bluetooth_common::Uuid,
2637                D,
2638                &mut self.uuid,
2639                decoder,
2640                offset + 0,
2641                _depth
2642            )?;
2643            Ok(())
2644        }
2645    }
2646
2647    impl fidl::encoding::ValueTypeMarker for RemoteServiceReadCharacteristicRequest {
2648        type Borrowed<'a> = &'a Self;
2649        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2650            value
2651        }
2652    }
2653
2654    unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadCharacteristicRequest {
2655        type Owned = Self;
2656
2657        #[inline(always)]
2658        fn inline_align(_context: fidl::encoding::Context) -> usize {
2659            8
2660        }
2661
2662        #[inline(always)]
2663        fn inline_size(_context: fidl::encoding::Context) -> usize {
2664            8
2665        }
2666        #[inline(always)]
2667        fn encode_is_copy() -> bool {
2668            true
2669        }
2670
2671        #[inline(always)]
2672        fn decode_is_copy() -> bool {
2673            true
2674        }
2675    }
2676
2677    unsafe impl<D: fidl::encoding::ResourceDialect>
2678        fidl::encoding::Encode<RemoteServiceReadCharacteristicRequest, D>
2679        for &RemoteServiceReadCharacteristicRequest
2680    {
2681        #[inline]
2682        unsafe fn encode(
2683            self,
2684            encoder: &mut fidl::encoding::Encoder<'_, D>,
2685            offset: usize,
2686            _depth: fidl::encoding::Depth,
2687        ) -> fidl::Result<()> {
2688            encoder.debug_check_bounds::<RemoteServiceReadCharacteristicRequest>(offset);
2689            unsafe {
2690                // Copy the object into the buffer.
2691                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2692                (buf_ptr as *mut RemoteServiceReadCharacteristicRequest).write_unaligned(
2693                    (self as *const RemoteServiceReadCharacteristicRequest).read(),
2694                );
2695                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2696                // done second because the memcpy will write garbage to these bytes.
2697            }
2698            Ok(())
2699        }
2700    }
2701    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
2702        fidl::encoding::Encode<RemoteServiceReadCharacteristicRequest, D> for (T0,)
2703    {
2704        #[inline]
2705        unsafe fn encode(
2706            self,
2707            encoder: &mut fidl::encoding::Encoder<'_, D>,
2708            offset: usize,
2709            depth: fidl::encoding::Depth,
2710        ) -> fidl::Result<()> {
2711            encoder.debug_check_bounds::<RemoteServiceReadCharacteristicRequest>(offset);
2712            // Zero out padding regions. There's no need to apply masks
2713            // because the unmasked parts will be overwritten by fields.
2714            // Write the fields.
2715            self.0.encode(encoder, offset + 0, depth)?;
2716            Ok(())
2717        }
2718    }
2719
2720    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2721        for RemoteServiceReadCharacteristicRequest
2722    {
2723        #[inline(always)]
2724        fn new_empty() -> Self {
2725            Self { id: fidl::new_empty!(u64, D) }
2726        }
2727
2728        #[inline]
2729        unsafe fn decode(
2730            &mut self,
2731            decoder: &mut fidl::encoding::Decoder<'_, D>,
2732            offset: usize,
2733            _depth: fidl::encoding::Depth,
2734        ) -> fidl::Result<()> {
2735            decoder.debug_check_bounds::<Self>(offset);
2736            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2737            // Verify that padding bytes are zero.
2738            // Copy from the buffer into the object.
2739            unsafe {
2740                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
2741            }
2742            Ok(())
2743        }
2744    }
2745
2746    impl fidl::encoding::ValueTypeMarker for RemoteServiceReadCharacteristicResponse {
2747        type Borrowed<'a> = &'a Self;
2748        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2749            value
2750        }
2751    }
2752
2753    unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadCharacteristicResponse {
2754        type Owned = Self;
2755
2756        #[inline(always)]
2757        fn inline_align(_context: fidl::encoding::Context) -> usize {
2758            8
2759        }
2760
2761        #[inline(always)]
2762        fn inline_size(_context: fidl::encoding::Context) -> usize {
2763            24
2764        }
2765    }
2766
2767    unsafe impl<D: fidl::encoding::ResourceDialect>
2768        fidl::encoding::Encode<RemoteServiceReadCharacteristicResponse, D>
2769        for &RemoteServiceReadCharacteristicResponse
2770    {
2771        #[inline]
2772        unsafe fn encode(
2773            self,
2774            encoder: &mut fidl::encoding::Encoder<'_, D>,
2775            offset: usize,
2776            _depth: fidl::encoding::Depth,
2777        ) -> fidl::Result<()> {
2778            encoder.debug_check_bounds::<RemoteServiceReadCharacteristicResponse>(offset);
2779            // Delegate to tuple encoding.
2780            fidl::encoding::Encode::<RemoteServiceReadCharacteristicResponse, D>::encode(
2781                (
2782                    <fidl_fuchsia_bluetooth_common::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
2783                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
2784                ),
2785                encoder, offset, _depth
2786            )
2787        }
2788    }
2789    unsafe impl<
2790        D: fidl::encoding::ResourceDialect,
2791        T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth_common::Status, D>,
2792        T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
2793    > fidl::encoding::Encode<RemoteServiceReadCharacteristicResponse, D> for (T0, T1)
2794    {
2795        #[inline]
2796        unsafe fn encode(
2797            self,
2798            encoder: &mut fidl::encoding::Encoder<'_, D>,
2799            offset: usize,
2800            depth: fidl::encoding::Depth,
2801        ) -> fidl::Result<()> {
2802            encoder.debug_check_bounds::<RemoteServiceReadCharacteristicResponse>(offset);
2803            // Zero out padding regions. There's no need to apply masks
2804            // because the unmasked parts will be overwritten by fields.
2805            // Write the fields.
2806            self.0.encode(encoder, offset + 0, depth)?;
2807            self.1.encode(encoder, offset + 8, depth)?;
2808            Ok(())
2809        }
2810    }
2811
2812    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2813        for RemoteServiceReadCharacteristicResponse
2814    {
2815        #[inline(always)]
2816        fn new_empty() -> Self {
2817            Self {
2818                status: fidl::new_empty!(fidl_fuchsia_bluetooth_common::Status, D),
2819                value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
2820            }
2821        }
2822
2823        #[inline]
2824        unsafe fn decode(
2825            &mut self,
2826            decoder: &mut fidl::encoding::Decoder<'_, D>,
2827            offset: usize,
2828            _depth: fidl::encoding::Depth,
2829        ) -> fidl::Result<()> {
2830            decoder.debug_check_bounds::<Self>(offset);
2831            // Verify that padding bytes are zero.
2832            fidl::decode!(
2833                fidl_fuchsia_bluetooth_common::Status,
2834                D,
2835                &mut self.status,
2836                decoder,
2837                offset + 0,
2838                _depth
2839            )?;
2840            fidl::decode!(
2841                fidl::encoding::UnboundedVector<u8>,
2842                D,
2843                &mut self.value,
2844                decoder,
2845                offset + 8,
2846                _depth
2847            )?;
2848            Ok(())
2849        }
2850    }
2851
2852    impl fidl::encoding::ValueTypeMarker for RemoteServiceReadDescriptorRequest {
2853        type Borrowed<'a> = &'a Self;
2854        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2855            value
2856        }
2857    }
2858
2859    unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadDescriptorRequest {
2860        type Owned = Self;
2861
2862        #[inline(always)]
2863        fn inline_align(_context: fidl::encoding::Context) -> usize {
2864            8
2865        }
2866
2867        #[inline(always)]
2868        fn inline_size(_context: fidl::encoding::Context) -> usize {
2869            8
2870        }
2871        #[inline(always)]
2872        fn encode_is_copy() -> bool {
2873            true
2874        }
2875
2876        #[inline(always)]
2877        fn decode_is_copy() -> bool {
2878            true
2879        }
2880    }
2881
2882    unsafe impl<D: fidl::encoding::ResourceDialect>
2883        fidl::encoding::Encode<RemoteServiceReadDescriptorRequest, D>
2884        for &RemoteServiceReadDescriptorRequest
2885    {
2886        #[inline]
2887        unsafe fn encode(
2888            self,
2889            encoder: &mut fidl::encoding::Encoder<'_, D>,
2890            offset: usize,
2891            _depth: fidl::encoding::Depth,
2892        ) -> fidl::Result<()> {
2893            encoder.debug_check_bounds::<RemoteServiceReadDescriptorRequest>(offset);
2894            unsafe {
2895                // Copy the object into the buffer.
2896                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2897                (buf_ptr as *mut RemoteServiceReadDescriptorRequest)
2898                    .write_unaligned((self as *const RemoteServiceReadDescriptorRequest).read());
2899                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2900                // done second because the memcpy will write garbage to these bytes.
2901            }
2902            Ok(())
2903        }
2904    }
2905    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
2906        fidl::encoding::Encode<RemoteServiceReadDescriptorRequest, D> for (T0,)
2907    {
2908        #[inline]
2909        unsafe fn encode(
2910            self,
2911            encoder: &mut fidl::encoding::Encoder<'_, D>,
2912            offset: usize,
2913            depth: fidl::encoding::Depth,
2914        ) -> fidl::Result<()> {
2915            encoder.debug_check_bounds::<RemoteServiceReadDescriptorRequest>(offset);
2916            // Zero out padding regions. There's no need to apply masks
2917            // because the unmasked parts will be overwritten by fields.
2918            // Write the fields.
2919            self.0.encode(encoder, offset + 0, depth)?;
2920            Ok(())
2921        }
2922    }
2923
2924    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2925        for RemoteServiceReadDescriptorRequest
2926    {
2927        #[inline(always)]
2928        fn new_empty() -> Self {
2929            Self { id: fidl::new_empty!(u64, D) }
2930        }
2931
2932        #[inline]
2933        unsafe fn decode(
2934            &mut self,
2935            decoder: &mut fidl::encoding::Decoder<'_, D>,
2936            offset: usize,
2937            _depth: fidl::encoding::Depth,
2938        ) -> fidl::Result<()> {
2939            decoder.debug_check_bounds::<Self>(offset);
2940            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2941            // Verify that padding bytes are zero.
2942            // Copy from the buffer into the object.
2943            unsafe {
2944                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
2945            }
2946            Ok(())
2947        }
2948    }
2949
2950    impl fidl::encoding::ValueTypeMarker for RemoteServiceReadDescriptorResponse {
2951        type Borrowed<'a> = &'a Self;
2952        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2953            value
2954        }
2955    }
2956
2957    unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadDescriptorResponse {
2958        type Owned = Self;
2959
2960        #[inline(always)]
2961        fn inline_align(_context: fidl::encoding::Context) -> usize {
2962            8
2963        }
2964
2965        #[inline(always)]
2966        fn inline_size(_context: fidl::encoding::Context) -> usize {
2967            24
2968        }
2969    }
2970
2971    unsafe impl<D: fidl::encoding::ResourceDialect>
2972        fidl::encoding::Encode<RemoteServiceReadDescriptorResponse, D>
2973        for &RemoteServiceReadDescriptorResponse
2974    {
2975        #[inline]
2976        unsafe fn encode(
2977            self,
2978            encoder: &mut fidl::encoding::Encoder<'_, D>,
2979            offset: usize,
2980            _depth: fidl::encoding::Depth,
2981        ) -> fidl::Result<()> {
2982            encoder.debug_check_bounds::<RemoteServiceReadDescriptorResponse>(offset);
2983            // Delegate to tuple encoding.
2984            fidl::encoding::Encode::<RemoteServiceReadDescriptorResponse, D>::encode(
2985                (
2986                    <fidl_fuchsia_bluetooth_common::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
2987                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
2988                ),
2989                encoder, offset, _depth
2990            )
2991        }
2992    }
2993    unsafe impl<
2994        D: fidl::encoding::ResourceDialect,
2995        T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth_common::Status, D>,
2996        T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
2997    > fidl::encoding::Encode<RemoteServiceReadDescriptorResponse, D> for (T0, T1)
2998    {
2999        #[inline]
3000        unsafe fn encode(
3001            self,
3002            encoder: &mut fidl::encoding::Encoder<'_, D>,
3003            offset: usize,
3004            depth: fidl::encoding::Depth,
3005        ) -> fidl::Result<()> {
3006            encoder.debug_check_bounds::<RemoteServiceReadDescriptorResponse>(offset);
3007            // Zero out padding regions. There's no need to apply masks
3008            // because the unmasked parts will be overwritten by fields.
3009            // Write the fields.
3010            self.0.encode(encoder, offset + 0, depth)?;
3011            self.1.encode(encoder, offset + 8, depth)?;
3012            Ok(())
3013        }
3014    }
3015
3016    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3017        for RemoteServiceReadDescriptorResponse
3018    {
3019        #[inline(always)]
3020        fn new_empty() -> Self {
3021            Self {
3022                status: fidl::new_empty!(fidl_fuchsia_bluetooth_common::Status, D),
3023                value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
3024            }
3025        }
3026
3027        #[inline]
3028        unsafe fn decode(
3029            &mut self,
3030            decoder: &mut fidl::encoding::Decoder<'_, D>,
3031            offset: usize,
3032            _depth: fidl::encoding::Depth,
3033        ) -> fidl::Result<()> {
3034            decoder.debug_check_bounds::<Self>(offset);
3035            // Verify that padding bytes are zero.
3036            fidl::decode!(
3037                fidl_fuchsia_bluetooth_common::Status,
3038                D,
3039                &mut self.status,
3040                decoder,
3041                offset + 0,
3042                _depth
3043            )?;
3044            fidl::decode!(
3045                fidl::encoding::UnboundedVector<u8>,
3046                D,
3047                &mut self.value,
3048                decoder,
3049                offset + 8,
3050                _depth
3051            )?;
3052            Ok(())
3053        }
3054    }
3055
3056    impl fidl::encoding::ValueTypeMarker for RemoteServiceReadLongCharacteristicRequest {
3057        type Borrowed<'a> = &'a Self;
3058        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3059            value
3060        }
3061    }
3062
3063    unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadLongCharacteristicRequest {
3064        type Owned = Self;
3065
3066        #[inline(always)]
3067        fn inline_align(_context: fidl::encoding::Context) -> usize {
3068            8
3069        }
3070
3071        #[inline(always)]
3072        fn inline_size(_context: fidl::encoding::Context) -> usize {
3073            16
3074        }
3075    }
3076
3077    unsafe impl<D: fidl::encoding::ResourceDialect>
3078        fidl::encoding::Encode<RemoteServiceReadLongCharacteristicRequest, D>
3079        for &RemoteServiceReadLongCharacteristicRequest
3080    {
3081        #[inline]
3082        unsafe fn encode(
3083            self,
3084            encoder: &mut fidl::encoding::Encoder<'_, D>,
3085            offset: usize,
3086            _depth: fidl::encoding::Depth,
3087        ) -> fidl::Result<()> {
3088            encoder.debug_check_bounds::<RemoteServiceReadLongCharacteristicRequest>(offset);
3089            unsafe {
3090                // Copy the object into the buffer.
3091                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3092                (buf_ptr as *mut RemoteServiceReadLongCharacteristicRequest).write_unaligned(
3093                    (self as *const RemoteServiceReadLongCharacteristicRequest).read(),
3094                );
3095                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3096                // done second because the memcpy will write garbage to these bytes.
3097                let padding_ptr = buf_ptr.offset(8) as *mut u64;
3098                let padding_mask = 0xffffffff00000000u64;
3099                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
3100            }
3101            Ok(())
3102        }
3103    }
3104    unsafe impl<
3105        D: fidl::encoding::ResourceDialect,
3106        T0: fidl::encoding::Encode<u64, D>,
3107        T1: fidl::encoding::Encode<u16, D>,
3108        T2: fidl::encoding::Encode<u16, D>,
3109    > fidl::encoding::Encode<RemoteServiceReadLongCharacteristicRequest, D> for (T0, T1, T2)
3110    {
3111        #[inline]
3112        unsafe fn encode(
3113            self,
3114            encoder: &mut fidl::encoding::Encoder<'_, D>,
3115            offset: usize,
3116            depth: fidl::encoding::Depth,
3117        ) -> fidl::Result<()> {
3118            encoder.debug_check_bounds::<RemoteServiceReadLongCharacteristicRequest>(offset);
3119            // Zero out padding regions. There's no need to apply masks
3120            // because the unmasked parts will be overwritten by fields.
3121            unsafe {
3122                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
3123                (ptr as *mut u64).write_unaligned(0);
3124            }
3125            // Write the fields.
3126            self.0.encode(encoder, offset + 0, depth)?;
3127            self.1.encode(encoder, offset + 8, depth)?;
3128            self.2.encode(encoder, offset + 10, depth)?;
3129            Ok(())
3130        }
3131    }
3132
3133    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3134        for RemoteServiceReadLongCharacteristicRequest
3135    {
3136        #[inline(always)]
3137        fn new_empty() -> Self {
3138            Self {
3139                id: fidl::new_empty!(u64, D),
3140                offset: fidl::new_empty!(u16, D),
3141                max_bytes: fidl::new_empty!(u16, D),
3142            }
3143        }
3144
3145        #[inline]
3146        unsafe fn decode(
3147            &mut self,
3148            decoder: &mut fidl::encoding::Decoder<'_, D>,
3149            offset: usize,
3150            _depth: fidl::encoding::Depth,
3151        ) -> fidl::Result<()> {
3152            decoder.debug_check_bounds::<Self>(offset);
3153            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3154            // Verify that padding bytes are zero.
3155            let ptr = unsafe { buf_ptr.offset(8) };
3156            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3157            let mask = 0xffffffff00000000u64;
3158            let maskedval = padval & mask;
3159            if maskedval != 0 {
3160                return Err(fidl::Error::NonZeroPadding {
3161                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
3162                });
3163            }
3164            // Copy from the buffer into the object.
3165            unsafe {
3166                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
3167            }
3168            Ok(())
3169        }
3170    }
3171
3172    impl fidl::encoding::ValueTypeMarker for RemoteServiceReadLongCharacteristicResponse {
3173        type Borrowed<'a> = &'a Self;
3174        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3175            value
3176        }
3177    }
3178
3179    unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadLongCharacteristicResponse {
3180        type Owned = Self;
3181
3182        #[inline(always)]
3183        fn inline_align(_context: fidl::encoding::Context) -> usize {
3184            8
3185        }
3186
3187        #[inline(always)]
3188        fn inline_size(_context: fidl::encoding::Context) -> usize {
3189            24
3190        }
3191    }
3192
3193    unsafe impl<D: fidl::encoding::ResourceDialect>
3194        fidl::encoding::Encode<RemoteServiceReadLongCharacteristicResponse, D>
3195        for &RemoteServiceReadLongCharacteristicResponse
3196    {
3197        #[inline]
3198        unsafe fn encode(
3199            self,
3200            encoder: &mut fidl::encoding::Encoder<'_, D>,
3201            offset: usize,
3202            _depth: fidl::encoding::Depth,
3203        ) -> fidl::Result<()> {
3204            encoder.debug_check_bounds::<RemoteServiceReadLongCharacteristicResponse>(offset);
3205            // Delegate to tuple encoding.
3206            fidl::encoding::Encode::<RemoteServiceReadLongCharacteristicResponse, D>::encode(
3207                (
3208                    <fidl_fuchsia_bluetooth_common::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
3209                    <fidl::encoding::Vector<u8, 512> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
3210                ),
3211                encoder, offset, _depth
3212            )
3213        }
3214    }
3215    unsafe impl<
3216        D: fidl::encoding::ResourceDialect,
3217        T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth_common::Status, D>,
3218        T1: fidl::encoding::Encode<fidl::encoding::Vector<u8, 512>, D>,
3219    > fidl::encoding::Encode<RemoteServiceReadLongCharacteristicResponse, D> for (T0, T1)
3220    {
3221        #[inline]
3222        unsafe fn encode(
3223            self,
3224            encoder: &mut fidl::encoding::Encoder<'_, D>,
3225            offset: usize,
3226            depth: fidl::encoding::Depth,
3227        ) -> fidl::Result<()> {
3228            encoder.debug_check_bounds::<RemoteServiceReadLongCharacteristicResponse>(offset);
3229            // Zero out padding regions. There's no need to apply masks
3230            // because the unmasked parts will be overwritten by fields.
3231            // Write the fields.
3232            self.0.encode(encoder, offset + 0, depth)?;
3233            self.1.encode(encoder, offset + 8, depth)?;
3234            Ok(())
3235        }
3236    }
3237
3238    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3239        for RemoteServiceReadLongCharacteristicResponse
3240    {
3241        #[inline(always)]
3242        fn new_empty() -> Self {
3243            Self {
3244                status: fidl::new_empty!(fidl_fuchsia_bluetooth_common::Status, D),
3245                value: fidl::new_empty!(fidl::encoding::Vector<u8, 512>, D),
3246            }
3247        }
3248
3249        #[inline]
3250        unsafe fn decode(
3251            &mut self,
3252            decoder: &mut fidl::encoding::Decoder<'_, D>,
3253            offset: usize,
3254            _depth: fidl::encoding::Depth,
3255        ) -> fidl::Result<()> {
3256            decoder.debug_check_bounds::<Self>(offset);
3257            // Verify that padding bytes are zero.
3258            fidl::decode!(
3259                fidl_fuchsia_bluetooth_common::Status,
3260                D,
3261                &mut self.status,
3262                decoder,
3263                offset + 0,
3264                _depth
3265            )?;
3266            fidl::decode!(fidl::encoding::Vector<u8, 512>, D, &mut self.value, decoder, offset + 8, _depth)?;
3267            Ok(())
3268        }
3269    }
3270
3271    impl fidl::encoding::ValueTypeMarker for RemoteServiceReadLongDescriptorRequest {
3272        type Borrowed<'a> = &'a Self;
3273        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3274            value
3275        }
3276    }
3277
3278    unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadLongDescriptorRequest {
3279        type Owned = Self;
3280
3281        #[inline(always)]
3282        fn inline_align(_context: fidl::encoding::Context) -> usize {
3283            8
3284        }
3285
3286        #[inline(always)]
3287        fn inline_size(_context: fidl::encoding::Context) -> usize {
3288            16
3289        }
3290    }
3291
3292    unsafe impl<D: fidl::encoding::ResourceDialect>
3293        fidl::encoding::Encode<RemoteServiceReadLongDescriptorRequest, D>
3294        for &RemoteServiceReadLongDescriptorRequest
3295    {
3296        #[inline]
3297        unsafe fn encode(
3298            self,
3299            encoder: &mut fidl::encoding::Encoder<'_, D>,
3300            offset: usize,
3301            _depth: fidl::encoding::Depth,
3302        ) -> fidl::Result<()> {
3303            encoder.debug_check_bounds::<RemoteServiceReadLongDescriptorRequest>(offset);
3304            unsafe {
3305                // Copy the object into the buffer.
3306                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3307                (buf_ptr as *mut RemoteServiceReadLongDescriptorRequest).write_unaligned(
3308                    (self as *const RemoteServiceReadLongDescriptorRequest).read(),
3309                );
3310                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3311                // done second because the memcpy will write garbage to these bytes.
3312                let padding_ptr = buf_ptr.offset(8) as *mut u64;
3313                let padding_mask = 0xffffffff00000000u64;
3314                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
3315            }
3316            Ok(())
3317        }
3318    }
3319    unsafe impl<
3320        D: fidl::encoding::ResourceDialect,
3321        T0: fidl::encoding::Encode<u64, D>,
3322        T1: fidl::encoding::Encode<u16, D>,
3323        T2: fidl::encoding::Encode<u16, D>,
3324    > fidl::encoding::Encode<RemoteServiceReadLongDescriptorRequest, D> for (T0, T1, T2)
3325    {
3326        #[inline]
3327        unsafe fn encode(
3328            self,
3329            encoder: &mut fidl::encoding::Encoder<'_, D>,
3330            offset: usize,
3331            depth: fidl::encoding::Depth,
3332        ) -> fidl::Result<()> {
3333            encoder.debug_check_bounds::<RemoteServiceReadLongDescriptorRequest>(offset);
3334            // Zero out padding regions. There's no need to apply masks
3335            // because the unmasked parts will be overwritten by fields.
3336            unsafe {
3337                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
3338                (ptr as *mut u64).write_unaligned(0);
3339            }
3340            // Write the fields.
3341            self.0.encode(encoder, offset + 0, depth)?;
3342            self.1.encode(encoder, offset + 8, depth)?;
3343            self.2.encode(encoder, offset + 10, depth)?;
3344            Ok(())
3345        }
3346    }
3347
3348    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3349        for RemoteServiceReadLongDescriptorRequest
3350    {
3351        #[inline(always)]
3352        fn new_empty() -> Self {
3353            Self {
3354                id: fidl::new_empty!(u64, D),
3355                offset: fidl::new_empty!(u16, D),
3356                max_bytes: fidl::new_empty!(u16, D),
3357            }
3358        }
3359
3360        #[inline]
3361        unsafe fn decode(
3362            &mut self,
3363            decoder: &mut fidl::encoding::Decoder<'_, D>,
3364            offset: usize,
3365            _depth: fidl::encoding::Depth,
3366        ) -> fidl::Result<()> {
3367            decoder.debug_check_bounds::<Self>(offset);
3368            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3369            // Verify that padding bytes are zero.
3370            let ptr = unsafe { buf_ptr.offset(8) };
3371            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3372            let mask = 0xffffffff00000000u64;
3373            let maskedval = padval & mask;
3374            if maskedval != 0 {
3375                return Err(fidl::Error::NonZeroPadding {
3376                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
3377                });
3378            }
3379            // Copy from the buffer into the object.
3380            unsafe {
3381                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
3382            }
3383            Ok(())
3384        }
3385    }
3386
3387    impl fidl::encoding::ValueTypeMarker for RemoteServiceReadLongDescriptorResponse {
3388        type Borrowed<'a> = &'a Self;
3389        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3390            value
3391        }
3392    }
3393
3394    unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadLongDescriptorResponse {
3395        type Owned = Self;
3396
3397        #[inline(always)]
3398        fn inline_align(_context: fidl::encoding::Context) -> usize {
3399            8
3400        }
3401
3402        #[inline(always)]
3403        fn inline_size(_context: fidl::encoding::Context) -> usize {
3404            24
3405        }
3406    }
3407
3408    unsafe impl<D: fidl::encoding::ResourceDialect>
3409        fidl::encoding::Encode<RemoteServiceReadLongDescriptorResponse, D>
3410        for &RemoteServiceReadLongDescriptorResponse
3411    {
3412        #[inline]
3413        unsafe fn encode(
3414            self,
3415            encoder: &mut fidl::encoding::Encoder<'_, D>,
3416            offset: usize,
3417            _depth: fidl::encoding::Depth,
3418        ) -> fidl::Result<()> {
3419            encoder.debug_check_bounds::<RemoteServiceReadLongDescriptorResponse>(offset);
3420            // Delegate to tuple encoding.
3421            fidl::encoding::Encode::<RemoteServiceReadLongDescriptorResponse, D>::encode(
3422                (
3423                    <fidl_fuchsia_bluetooth_common::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
3424                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
3425                ),
3426                encoder, offset, _depth
3427            )
3428        }
3429    }
3430    unsafe impl<
3431        D: fidl::encoding::ResourceDialect,
3432        T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth_common::Status, D>,
3433        T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
3434    > fidl::encoding::Encode<RemoteServiceReadLongDescriptorResponse, D> for (T0, T1)
3435    {
3436        #[inline]
3437        unsafe fn encode(
3438            self,
3439            encoder: &mut fidl::encoding::Encoder<'_, D>,
3440            offset: usize,
3441            depth: fidl::encoding::Depth,
3442        ) -> fidl::Result<()> {
3443            encoder.debug_check_bounds::<RemoteServiceReadLongDescriptorResponse>(offset);
3444            // Zero out padding regions. There's no need to apply masks
3445            // because the unmasked parts will be overwritten by fields.
3446            // Write the fields.
3447            self.0.encode(encoder, offset + 0, depth)?;
3448            self.1.encode(encoder, offset + 8, depth)?;
3449            Ok(())
3450        }
3451    }
3452
3453    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3454        for RemoteServiceReadLongDescriptorResponse
3455    {
3456        #[inline(always)]
3457        fn new_empty() -> Self {
3458            Self {
3459                status: fidl::new_empty!(fidl_fuchsia_bluetooth_common::Status, D),
3460                value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
3461            }
3462        }
3463
3464        #[inline]
3465        unsafe fn decode(
3466            &mut self,
3467            decoder: &mut fidl::encoding::Decoder<'_, D>,
3468            offset: usize,
3469            _depth: fidl::encoding::Depth,
3470        ) -> fidl::Result<()> {
3471            decoder.debug_check_bounds::<Self>(offset);
3472            // Verify that padding bytes are zero.
3473            fidl::decode!(
3474                fidl_fuchsia_bluetooth_common::Status,
3475                D,
3476                &mut self.status,
3477                decoder,
3478                offset + 0,
3479                _depth
3480            )?;
3481            fidl::decode!(
3482                fidl::encoding::UnboundedVector<u8>,
3483                D,
3484                &mut self.value,
3485                decoder,
3486                offset + 8,
3487                _depth
3488            )?;
3489            Ok(())
3490        }
3491    }
3492
3493    impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteCharacteristicRequest {
3494        type Borrowed<'a> = &'a Self;
3495        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3496            value
3497        }
3498    }
3499
3500    unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteCharacteristicRequest {
3501        type Owned = Self;
3502
3503        #[inline(always)]
3504        fn inline_align(_context: fidl::encoding::Context) -> usize {
3505            8
3506        }
3507
3508        #[inline(always)]
3509        fn inline_size(_context: fidl::encoding::Context) -> usize {
3510            24
3511        }
3512    }
3513
3514    unsafe impl<D: fidl::encoding::ResourceDialect>
3515        fidl::encoding::Encode<RemoteServiceWriteCharacteristicRequest, D>
3516        for &RemoteServiceWriteCharacteristicRequest
3517    {
3518        #[inline]
3519        unsafe fn encode(
3520            self,
3521            encoder: &mut fidl::encoding::Encoder<'_, D>,
3522            offset: usize,
3523            _depth: fidl::encoding::Depth,
3524        ) -> fidl::Result<()> {
3525            encoder.debug_check_bounds::<RemoteServiceWriteCharacteristicRequest>(offset);
3526            // Delegate to tuple encoding.
3527            fidl::encoding::Encode::<RemoteServiceWriteCharacteristicRequest, D>::encode(
3528                (
3529                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
3530                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
3531                ),
3532                encoder, offset, _depth
3533            )
3534        }
3535    }
3536    unsafe impl<
3537        D: fidl::encoding::ResourceDialect,
3538        T0: fidl::encoding::Encode<u64, D>,
3539        T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
3540    > fidl::encoding::Encode<RemoteServiceWriteCharacteristicRequest, D> for (T0, T1)
3541    {
3542        #[inline]
3543        unsafe fn encode(
3544            self,
3545            encoder: &mut fidl::encoding::Encoder<'_, D>,
3546            offset: usize,
3547            depth: fidl::encoding::Depth,
3548        ) -> fidl::Result<()> {
3549            encoder.debug_check_bounds::<RemoteServiceWriteCharacteristicRequest>(offset);
3550            // Zero out padding regions. There's no need to apply masks
3551            // because the unmasked parts will be overwritten by fields.
3552            // Write the fields.
3553            self.0.encode(encoder, offset + 0, depth)?;
3554            self.1.encode(encoder, offset + 8, depth)?;
3555            Ok(())
3556        }
3557    }
3558
3559    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3560        for RemoteServiceWriteCharacteristicRequest
3561    {
3562        #[inline(always)]
3563        fn new_empty() -> Self {
3564            Self {
3565                id: fidl::new_empty!(u64, D),
3566                value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
3567            }
3568        }
3569
3570        #[inline]
3571        unsafe fn decode(
3572            &mut self,
3573            decoder: &mut fidl::encoding::Decoder<'_, D>,
3574            offset: usize,
3575            _depth: fidl::encoding::Depth,
3576        ) -> fidl::Result<()> {
3577            decoder.debug_check_bounds::<Self>(offset);
3578            // Verify that padding bytes are zero.
3579            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
3580            fidl::decode!(
3581                fidl::encoding::UnboundedVector<u8>,
3582                D,
3583                &mut self.value,
3584                decoder,
3585                offset + 8,
3586                _depth
3587            )?;
3588            Ok(())
3589        }
3590    }
3591
3592    impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteCharacteristicResponse {
3593        type Borrowed<'a> = &'a Self;
3594        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3595            value
3596        }
3597    }
3598
3599    unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteCharacteristicResponse {
3600        type Owned = Self;
3601
3602        #[inline(always)]
3603        fn inline_align(_context: fidl::encoding::Context) -> usize {
3604            8
3605        }
3606
3607        #[inline(always)]
3608        fn inline_size(_context: fidl::encoding::Context) -> usize {
3609            8
3610        }
3611    }
3612
3613    unsafe impl<D: fidl::encoding::ResourceDialect>
3614        fidl::encoding::Encode<RemoteServiceWriteCharacteristicResponse, D>
3615        for &RemoteServiceWriteCharacteristicResponse
3616    {
3617        #[inline]
3618        unsafe fn encode(
3619            self,
3620            encoder: &mut fidl::encoding::Encoder<'_, D>,
3621            offset: usize,
3622            _depth: fidl::encoding::Depth,
3623        ) -> fidl::Result<()> {
3624            encoder.debug_check_bounds::<RemoteServiceWriteCharacteristicResponse>(offset);
3625            // Delegate to tuple encoding.
3626            fidl::encoding::Encode::<RemoteServiceWriteCharacteristicResponse, D>::encode(
3627                (
3628                    <fidl_fuchsia_bluetooth_common::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
3629                ),
3630                encoder, offset, _depth
3631            )
3632        }
3633    }
3634    unsafe impl<
3635        D: fidl::encoding::ResourceDialect,
3636        T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth_common::Status, D>,
3637    > fidl::encoding::Encode<RemoteServiceWriteCharacteristicResponse, D> for (T0,)
3638    {
3639        #[inline]
3640        unsafe fn encode(
3641            self,
3642            encoder: &mut fidl::encoding::Encoder<'_, D>,
3643            offset: usize,
3644            depth: fidl::encoding::Depth,
3645        ) -> fidl::Result<()> {
3646            encoder.debug_check_bounds::<RemoteServiceWriteCharacteristicResponse>(offset);
3647            // Zero out padding regions. There's no need to apply masks
3648            // because the unmasked parts will be overwritten by fields.
3649            // Write the fields.
3650            self.0.encode(encoder, offset + 0, depth)?;
3651            Ok(())
3652        }
3653    }
3654
3655    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3656        for RemoteServiceWriteCharacteristicResponse
3657    {
3658        #[inline(always)]
3659        fn new_empty() -> Self {
3660            Self { status: fidl::new_empty!(fidl_fuchsia_bluetooth_common::Status, D) }
3661        }
3662
3663        #[inline]
3664        unsafe fn decode(
3665            &mut self,
3666            decoder: &mut fidl::encoding::Decoder<'_, D>,
3667            offset: usize,
3668            _depth: fidl::encoding::Depth,
3669        ) -> fidl::Result<()> {
3670            decoder.debug_check_bounds::<Self>(offset);
3671            // Verify that padding bytes are zero.
3672            fidl::decode!(
3673                fidl_fuchsia_bluetooth_common::Status,
3674                D,
3675                &mut self.status,
3676                decoder,
3677                offset + 0,
3678                _depth
3679            )?;
3680            Ok(())
3681        }
3682    }
3683
3684    impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteCharacteristicWithoutResponseRequest {
3685        type Borrowed<'a> = &'a Self;
3686        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3687            value
3688        }
3689    }
3690
3691    unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteCharacteristicWithoutResponseRequest {
3692        type Owned = Self;
3693
3694        #[inline(always)]
3695        fn inline_align(_context: fidl::encoding::Context) -> usize {
3696            8
3697        }
3698
3699        #[inline(always)]
3700        fn inline_size(_context: fidl::encoding::Context) -> usize {
3701            24
3702        }
3703    }
3704
3705    unsafe impl<D: fidl::encoding::ResourceDialect>
3706        fidl::encoding::Encode<RemoteServiceWriteCharacteristicWithoutResponseRequest, D>
3707        for &RemoteServiceWriteCharacteristicWithoutResponseRequest
3708    {
3709        #[inline]
3710        unsafe fn encode(
3711            self,
3712            encoder: &mut fidl::encoding::Encoder<'_, D>,
3713            offset: usize,
3714            _depth: fidl::encoding::Depth,
3715        ) -> fidl::Result<()> {
3716            encoder.debug_check_bounds::<RemoteServiceWriteCharacteristicWithoutResponseRequest>(
3717                offset,
3718            );
3719            // Delegate to tuple encoding.
3720            fidl::encoding::Encode::<RemoteServiceWriteCharacteristicWithoutResponseRequest, D>::encode(
3721                (
3722                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
3723                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
3724                ),
3725                encoder, offset, _depth
3726            )
3727        }
3728    }
3729    unsafe impl<
3730        D: fidl::encoding::ResourceDialect,
3731        T0: fidl::encoding::Encode<u64, D>,
3732        T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
3733    > fidl::encoding::Encode<RemoteServiceWriteCharacteristicWithoutResponseRequest, D>
3734        for (T0, T1)
3735    {
3736        #[inline]
3737        unsafe fn encode(
3738            self,
3739            encoder: &mut fidl::encoding::Encoder<'_, D>,
3740            offset: usize,
3741            depth: fidl::encoding::Depth,
3742        ) -> fidl::Result<()> {
3743            encoder.debug_check_bounds::<RemoteServiceWriteCharacteristicWithoutResponseRequest>(
3744                offset,
3745            );
3746            // Zero out padding regions. There's no need to apply masks
3747            // because the unmasked parts will be overwritten by fields.
3748            // Write the fields.
3749            self.0.encode(encoder, offset + 0, depth)?;
3750            self.1.encode(encoder, offset + 8, depth)?;
3751            Ok(())
3752        }
3753    }
3754
3755    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3756        for RemoteServiceWriteCharacteristicWithoutResponseRequest
3757    {
3758        #[inline(always)]
3759        fn new_empty() -> Self {
3760            Self {
3761                id: fidl::new_empty!(u64, D),
3762                value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
3763            }
3764        }
3765
3766        #[inline]
3767        unsafe fn decode(
3768            &mut self,
3769            decoder: &mut fidl::encoding::Decoder<'_, D>,
3770            offset: usize,
3771            _depth: fidl::encoding::Depth,
3772        ) -> fidl::Result<()> {
3773            decoder.debug_check_bounds::<Self>(offset);
3774            // Verify that padding bytes are zero.
3775            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
3776            fidl::decode!(
3777                fidl::encoding::UnboundedVector<u8>,
3778                D,
3779                &mut self.value,
3780                decoder,
3781                offset + 8,
3782                _depth
3783            )?;
3784            Ok(())
3785        }
3786    }
3787
3788    impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteDescriptorRequest {
3789        type Borrowed<'a> = &'a Self;
3790        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3791            value
3792        }
3793    }
3794
3795    unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteDescriptorRequest {
3796        type Owned = Self;
3797
3798        #[inline(always)]
3799        fn inline_align(_context: fidl::encoding::Context) -> usize {
3800            8
3801        }
3802
3803        #[inline(always)]
3804        fn inline_size(_context: fidl::encoding::Context) -> usize {
3805            24
3806        }
3807    }
3808
3809    unsafe impl<D: fidl::encoding::ResourceDialect>
3810        fidl::encoding::Encode<RemoteServiceWriteDescriptorRequest, D>
3811        for &RemoteServiceWriteDescriptorRequest
3812    {
3813        #[inline]
3814        unsafe fn encode(
3815            self,
3816            encoder: &mut fidl::encoding::Encoder<'_, D>,
3817            offset: usize,
3818            _depth: fidl::encoding::Depth,
3819        ) -> fidl::Result<()> {
3820            encoder.debug_check_bounds::<RemoteServiceWriteDescriptorRequest>(offset);
3821            // Delegate to tuple encoding.
3822            fidl::encoding::Encode::<RemoteServiceWriteDescriptorRequest, D>::encode(
3823                (
3824                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
3825                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
3826                ),
3827                encoder, offset, _depth
3828            )
3829        }
3830    }
3831    unsafe impl<
3832        D: fidl::encoding::ResourceDialect,
3833        T0: fidl::encoding::Encode<u64, D>,
3834        T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
3835    > fidl::encoding::Encode<RemoteServiceWriteDescriptorRequest, D> for (T0, T1)
3836    {
3837        #[inline]
3838        unsafe fn encode(
3839            self,
3840            encoder: &mut fidl::encoding::Encoder<'_, D>,
3841            offset: usize,
3842            depth: fidl::encoding::Depth,
3843        ) -> fidl::Result<()> {
3844            encoder.debug_check_bounds::<RemoteServiceWriteDescriptorRequest>(offset);
3845            // Zero out padding regions. There's no need to apply masks
3846            // because the unmasked parts will be overwritten by fields.
3847            // Write the fields.
3848            self.0.encode(encoder, offset + 0, depth)?;
3849            self.1.encode(encoder, offset + 8, depth)?;
3850            Ok(())
3851        }
3852    }
3853
3854    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3855        for RemoteServiceWriteDescriptorRequest
3856    {
3857        #[inline(always)]
3858        fn new_empty() -> Self {
3859            Self {
3860                id: fidl::new_empty!(u64, D),
3861                value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
3862            }
3863        }
3864
3865        #[inline]
3866        unsafe fn decode(
3867            &mut self,
3868            decoder: &mut fidl::encoding::Decoder<'_, D>,
3869            offset: usize,
3870            _depth: fidl::encoding::Depth,
3871        ) -> fidl::Result<()> {
3872            decoder.debug_check_bounds::<Self>(offset);
3873            // Verify that padding bytes are zero.
3874            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
3875            fidl::decode!(
3876                fidl::encoding::UnboundedVector<u8>,
3877                D,
3878                &mut self.value,
3879                decoder,
3880                offset + 8,
3881                _depth
3882            )?;
3883            Ok(())
3884        }
3885    }
3886
3887    impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteDescriptorResponse {
3888        type Borrowed<'a> = &'a Self;
3889        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3890            value
3891        }
3892    }
3893
3894    unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteDescriptorResponse {
3895        type Owned = Self;
3896
3897        #[inline(always)]
3898        fn inline_align(_context: fidl::encoding::Context) -> usize {
3899            8
3900        }
3901
3902        #[inline(always)]
3903        fn inline_size(_context: fidl::encoding::Context) -> usize {
3904            8
3905        }
3906    }
3907
3908    unsafe impl<D: fidl::encoding::ResourceDialect>
3909        fidl::encoding::Encode<RemoteServiceWriteDescriptorResponse, D>
3910        for &RemoteServiceWriteDescriptorResponse
3911    {
3912        #[inline]
3913        unsafe fn encode(
3914            self,
3915            encoder: &mut fidl::encoding::Encoder<'_, D>,
3916            offset: usize,
3917            _depth: fidl::encoding::Depth,
3918        ) -> fidl::Result<()> {
3919            encoder.debug_check_bounds::<RemoteServiceWriteDescriptorResponse>(offset);
3920            // Delegate to tuple encoding.
3921            fidl::encoding::Encode::<RemoteServiceWriteDescriptorResponse, D>::encode(
3922                (
3923                    <fidl_fuchsia_bluetooth_common::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
3924                ),
3925                encoder, offset, _depth
3926            )
3927        }
3928    }
3929    unsafe impl<
3930        D: fidl::encoding::ResourceDialect,
3931        T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth_common::Status, D>,
3932    > fidl::encoding::Encode<RemoteServiceWriteDescriptorResponse, D> for (T0,)
3933    {
3934        #[inline]
3935        unsafe fn encode(
3936            self,
3937            encoder: &mut fidl::encoding::Encoder<'_, D>,
3938            offset: usize,
3939            depth: fidl::encoding::Depth,
3940        ) -> fidl::Result<()> {
3941            encoder.debug_check_bounds::<RemoteServiceWriteDescriptorResponse>(offset);
3942            // Zero out padding regions. There's no need to apply masks
3943            // because the unmasked parts will be overwritten by fields.
3944            // Write the fields.
3945            self.0.encode(encoder, offset + 0, depth)?;
3946            Ok(())
3947        }
3948    }
3949
3950    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3951        for RemoteServiceWriteDescriptorResponse
3952    {
3953        #[inline(always)]
3954        fn new_empty() -> Self {
3955            Self { status: fidl::new_empty!(fidl_fuchsia_bluetooth_common::Status, D) }
3956        }
3957
3958        #[inline]
3959        unsafe fn decode(
3960            &mut self,
3961            decoder: &mut fidl::encoding::Decoder<'_, D>,
3962            offset: usize,
3963            _depth: fidl::encoding::Depth,
3964        ) -> fidl::Result<()> {
3965            decoder.debug_check_bounds::<Self>(offset);
3966            // Verify that padding bytes are zero.
3967            fidl::decode!(
3968                fidl_fuchsia_bluetooth_common::Status,
3969                D,
3970                &mut self.status,
3971                decoder,
3972                offset + 0,
3973                _depth
3974            )?;
3975            Ok(())
3976        }
3977    }
3978
3979    impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteLongCharacteristicRequest {
3980        type Borrowed<'a> = &'a Self;
3981        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3982            value
3983        }
3984    }
3985
3986    unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteLongCharacteristicRequest {
3987        type Owned = Self;
3988
3989        #[inline(always)]
3990        fn inline_align(_context: fidl::encoding::Context) -> usize {
3991            8
3992        }
3993
3994        #[inline(always)]
3995        fn inline_size(_context: fidl::encoding::Context) -> usize {
3996            48
3997        }
3998    }
3999
4000    unsafe impl<D: fidl::encoding::ResourceDialect>
4001        fidl::encoding::Encode<RemoteServiceWriteLongCharacteristicRequest, D>
4002        for &RemoteServiceWriteLongCharacteristicRequest
4003    {
4004        #[inline]
4005        unsafe fn encode(
4006            self,
4007            encoder: &mut fidl::encoding::Encoder<'_, D>,
4008            offset: usize,
4009            _depth: fidl::encoding::Depth,
4010        ) -> fidl::Result<()> {
4011            encoder.debug_check_bounds::<RemoteServiceWriteLongCharacteristicRequest>(offset);
4012            // Delegate to tuple encoding.
4013            fidl::encoding::Encode::<RemoteServiceWriteLongCharacteristicRequest, D>::encode(
4014                (
4015                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
4016                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.offset),
4017                    <fidl::encoding::Vector<u8, 512> as fidl::encoding::ValueTypeMarker>::borrow(
4018                        &self.value,
4019                    ),
4020                    <WriteOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.write_options),
4021                ),
4022                encoder,
4023                offset,
4024                _depth,
4025            )
4026        }
4027    }
4028    unsafe impl<
4029        D: fidl::encoding::ResourceDialect,
4030        T0: fidl::encoding::Encode<u64, D>,
4031        T1: fidl::encoding::Encode<u16, D>,
4032        T2: fidl::encoding::Encode<fidl::encoding::Vector<u8, 512>, D>,
4033        T3: fidl::encoding::Encode<WriteOptions, D>,
4034    > fidl::encoding::Encode<RemoteServiceWriteLongCharacteristicRequest, D> for (T0, T1, T2, T3)
4035    {
4036        #[inline]
4037        unsafe fn encode(
4038            self,
4039            encoder: &mut fidl::encoding::Encoder<'_, D>,
4040            offset: usize,
4041            depth: fidl::encoding::Depth,
4042        ) -> fidl::Result<()> {
4043            encoder.debug_check_bounds::<RemoteServiceWriteLongCharacteristicRequest>(offset);
4044            // Zero out padding regions. There's no need to apply masks
4045            // because the unmasked parts will be overwritten by fields.
4046            unsafe {
4047                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
4048                (ptr as *mut u64).write_unaligned(0);
4049            }
4050            // Write the fields.
4051            self.0.encode(encoder, offset + 0, depth)?;
4052            self.1.encode(encoder, offset + 8, depth)?;
4053            self.2.encode(encoder, offset + 16, depth)?;
4054            self.3.encode(encoder, offset + 32, depth)?;
4055            Ok(())
4056        }
4057    }
4058
4059    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4060        for RemoteServiceWriteLongCharacteristicRequest
4061    {
4062        #[inline(always)]
4063        fn new_empty() -> Self {
4064            Self {
4065                id: fidl::new_empty!(u64, D),
4066                offset: fidl::new_empty!(u16, D),
4067                value: fidl::new_empty!(fidl::encoding::Vector<u8, 512>, D),
4068                write_options: fidl::new_empty!(WriteOptions, D),
4069            }
4070        }
4071
4072        #[inline]
4073        unsafe fn decode(
4074            &mut self,
4075            decoder: &mut fidl::encoding::Decoder<'_, D>,
4076            offset: usize,
4077            _depth: fidl::encoding::Depth,
4078        ) -> fidl::Result<()> {
4079            decoder.debug_check_bounds::<Self>(offset);
4080            // Verify that padding bytes are zero.
4081            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
4082            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4083            let mask = 0xffffffffffff0000u64;
4084            let maskedval = padval & mask;
4085            if maskedval != 0 {
4086                return Err(fidl::Error::NonZeroPadding {
4087                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
4088                });
4089            }
4090            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
4091            fidl::decode!(u16, D, &mut self.offset, decoder, offset + 8, _depth)?;
4092            fidl::decode!(fidl::encoding::Vector<u8, 512>, D, &mut self.value, decoder, offset + 16, _depth)?;
4093            fidl::decode!(WriteOptions, D, &mut self.write_options, decoder, offset + 32, _depth)?;
4094            Ok(())
4095        }
4096    }
4097
4098    impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteLongCharacteristicResponse {
4099        type Borrowed<'a> = &'a Self;
4100        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4101            value
4102        }
4103    }
4104
4105    unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteLongCharacteristicResponse {
4106        type Owned = Self;
4107
4108        #[inline(always)]
4109        fn inline_align(_context: fidl::encoding::Context) -> usize {
4110            8
4111        }
4112
4113        #[inline(always)]
4114        fn inline_size(_context: fidl::encoding::Context) -> usize {
4115            8
4116        }
4117    }
4118
4119    unsafe impl<D: fidl::encoding::ResourceDialect>
4120        fidl::encoding::Encode<RemoteServiceWriteLongCharacteristicResponse, D>
4121        for &RemoteServiceWriteLongCharacteristicResponse
4122    {
4123        #[inline]
4124        unsafe fn encode(
4125            self,
4126            encoder: &mut fidl::encoding::Encoder<'_, D>,
4127            offset: usize,
4128            _depth: fidl::encoding::Depth,
4129        ) -> fidl::Result<()> {
4130            encoder.debug_check_bounds::<RemoteServiceWriteLongCharacteristicResponse>(offset);
4131            // Delegate to tuple encoding.
4132            fidl::encoding::Encode::<RemoteServiceWriteLongCharacteristicResponse, D>::encode(
4133                (
4134                    <fidl_fuchsia_bluetooth_common::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
4135                ),
4136                encoder, offset, _depth
4137            )
4138        }
4139    }
4140    unsafe impl<
4141        D: fidl::encoding::ResourceDialect,
4142        T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth_common::Status, D>,
4143    > fidl::encoding::Encode<RemoteServiceWriteLongCharacteristicResponse, D> for (T0,)
4144    {
4145        #[inline]
4146        unsafe fn encode(
4147            self,
4148            encoder: &mut fidl::encoding::Encoder<'_, D>,
4149            offset: usize,
4150            depth: fidl::encoding::Depth,
4151        ) -> fidl::Result<()> {
4152            encoder.debug_check_bounds::<RemoteServiceWriteLongCharacteristicResponse>(offset);
4153            // Zero out padding regions. There's no need to apply masks
4154            // because the unmasked parts will be overwritten by fields.
4155            // Write the fields.
4156            self.0.encode(encoder, offset + 0, depth)?;
4157            Ok(())
4158        }
4159    }
4160
4161    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4162        for RemoteServiceWriteLongCharacteristicResponse
4163    {
4164        #[inline(always)]
4165        fn new_empty() -> Self {
4166            Self { status: fidl::new_empty!(fidl_fuchsia_bluetooth_common::Status, D) }
4167        }
4168
4169        #[inline]
4170        unsafe fn decode(
4171            &mut self,
4172            decoder: &mut fidl::encoding::Decoder<'_, D>,
4173            offset: usize,
4174            _depth: fidl::encoding::Depth,
4175        ) -> fidl::Result<()> {
4176            decoder.debug_check_bounds::<Self>(offset);
4177            // Verify that padding bytes are zero.
4178            fidl::decode!(
4179                fidl_fuchsia_bluetooth_common::Status,
4180                D,
4181                &mut self.status,
4182                decoder,
4183                offset + 0,
4184                _depth
4185            )?;
4186            Ok(())
4187        }
4188    }
4189
4190    impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteLongDescriptorRequest {
4191        type Borrowed<'a> = &'a Self;
4192        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4193            value
4194        }
4195    }
4196
4197    unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteLongDescriptorRequest {
4198        type Owned = Self;
4199
4200        #[inline(always)]
4201        fn inline_align(_context: fidl::encoding::Context) -> usize {
4202            8
4203        }
4204
4205        #[inline(always)]
4206        fn inline_size(_context: fidl::encoding::Context) -> usize {
4207            32
4208        }
4209    }
4210
4211    unsafe impl<D: fidl::encoding::ResourceDialect>
4212        fidl::encoding::Encode<RemoteServiceWriteLongDescriptorRequest, D>
4213        for &RemoteServiceWriteLongDescriptorRequest
4214    {
4215        #[inline]
4216        unsafe fn encode(
4217            self,
4218            encoder: &mut fidl::encoding::Encoder<'_, D>,
4219            offset: usize,
4220            _depth: fidl::encoding::Depth,
4221        ) -> fidl::Result<()> {
4222            encoder.debug_check_bounds::<RemoteServiceWriteLongDescriptorRequest>(offset);
4223            // Delegate to tuple encoding.
4224            fidl::encoding::Encode::<RemoteServiceWriteLongDescriptorRequest, D>::encode(
4225                (
4226                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
4227                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.offset),
4228                    <fidl::encoding::Vector<u8, 512> as fidl::encoding::ValueTypeMarker>::borrow(
4229                        &self.value,
4230                    ),
4231                ),
4232                encoder,
4233                offset,
4234                _depth,
4235            )
4236        }
4237    }
4238    unsafe impl<
4239        D: fidl::encoding::ResourceDialect,
4240        T0: fidl::encoding::Encode<u64, D>,
4241        T1: fidl::encoding::Encode<u16, D>,
4242        T2: fidl::encoding::Encode<fidl::encoding::Vector<u8, 512>, D>,
4243    > fidl::encoding::Encode<RemoteServiceWriteLongDescriptorRequest, D> for (T0, T1, T2)
4244    {
4245        #[inline]
4246        unsafe fn encode(
4247            self,
4248            encoder: &mut fidl::encoding::Encoder<'_, D>,
4249            offset: usize,
4250            depth: fidl::encoding::Depth,
4251        ) -> fidl::Result<()> {
4252            encoder.debug_check_bounds::<RemoteServiceWriteLongDescriptorRequest>(offset);
4253            // Zero out padding regions. There's no need to apply masks
4254            // because the unmasked parts will be overwritten by fields.
4255            unsafe {
4256                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
4257                (ptr as *mut u64).write_unaligned(0);
4258            }
4259            // Write the fields.
4260            self.0.encode(encoder, offset + 0, depth)?;
4261            self.1.encode(encoder, offset + 8, depth)?;
4262            self.2.encode(encoder, offset + 16, depth)?;
4263            Ok(())
4264        }
4265    }
4266
4267    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4268        for RemoteServiceWriteLongDescriptorRequest
4269    {
4270        #[inline(always)]
4271        fn new_empty() -> Self {
4272            Self {
4273                id: fidl::new_empty!(u64, D),
4274                offset: fidl::new_empty!(u16, D),
4275                value: fidl::new_empty!(fidl::encoding::Vector<u8, 512>, D),
4276            }
4277        }
4278
4279        #[inline]
4280        unsafe fn decode(
4281            &mut self,
4282            decoder: &mut fidl::encoding::Decoder<'_, D>,
4283            offset: usize,
4284            _depth: fidl::encoding::Depth,
4285        ) -> fidl::Result<()> {
4286            decoder.debug_check_bounds::<Self>(offset);
4287            // Verify that padding bytes are zero.
4288            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
4289            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4290            let mask = 0xffffffffffff0000u64;
4291            let maskedval = padval & mask;
4292            if maskedval != 0 {
4293                return Err(fidl::Error::NonZeroPadding {
4294                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
4295                });
4296            }
4297            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
4298            fidl::decode!(u16, D, &mut self.offset, decoder, offset + 8, _depth)?;
4299            fidl::decode!(fidl::encoding::Vector<u8, 512>, D, &mut self.value, decoder, offset + 16, _depth)?;
4300            Ok(())
4301        }
4302    }
4303
4304    impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteLongDescriptorResponse {
4305        type Borrowed<'a> = &'a Self;
4306        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4307            value
4308        }
4309    }
4310
4311    unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteLongDescriptorResponse {
4312        type Owned = Self;
4313
4314        #[inline(always)]
4315        fn inline_align(_context: fidl::encoding::Context) -> usize {
4316            8
4317        }
4318
4319        #[inline(always)]
4320        fn inline_size(_context: fidl::encoding::Context) -> usize {
4321            8
4322        }
4323    }
4324
4325    unsafe impl<D: fidl::encoding::ResourceDialect>
4326        fidl::encoding::Encode<RemoteServiceWriteLongDescriptorResponse, D>
4327        for &RemoteServiceWriteLongDescriptorResponse
4328    {
4329        #[inline]
4330        unsafe fn encode(
4331            self,
4332            encoder: &mut fidl::encoding::Encoder<'_, D>,
4333            offset: usize,
4334            _depth: fidl::encoding::Depth,
4335        ) -> fidl::Result<()> {
4336            encoder.debug_check_bounds::<RemoteServiceWriteLongDescriptorResponse>(offset);
4337            // Delegate to tuple encoding.
4338            fidl::encoding::Encode::<RemoteServiceWriteLongDescriptorResponse, D>::encode(
4339                (
4340                    <fidl_fuchsia_bluetooth_common::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
4341                ),
4342                encoder, offset, _depth
4343            )
4344        }
4345    }
4346    unsafe impl<
4347        D: fidl::encoding::ResourceDialect,
4348        T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth_common::Status, D>,
4349    > fidl::encoding::Encode<RemoteServiceWriteLongDescriptorResponse, D> for (T0,)
4350    {
4351        #[inline]
4352        unsafe fn encode(
4353            self,
4354            encoder: &mut fidl::encoding::Encoder<'_, D>,
4355            offset: usize,
4356            depth: fidl::encoding::Depth,
4357        ) -> fidl::Result<()> {
4358            encoder.debug_check_bounds::<RemoteServiceWriteLongDescriptorResponse>(offset);
4359            // Zero out padding regions. There's no need to apply masks
4360            // because the unmasked parts will be overwritten by fields.
4361            // Write the fields.
4362            self.0.encode(encoder, offset + 0, depth)?;
4363            Ok(())
4364        }
4365    }
4366
4367    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4368        for RemoteServiceWriteLongDescriptorResponse
4369    {
4370        #[inline(always)]
4371        fn new_empty() -> Self {
4372            Self { status: fidl::new_empty!(fidl_fuchsia_bluetooth_common::Status, D) }
4373        }
4374
4375        #[inline]
4376        unsafe fn decode(
4377            &mut self,
4378            decoder: &mut fidl::encoding::Decoder<'_, D>,
4379            offset: usize,
4380            _depth: fidl::encoding::Depth,
4381        ) -> fidl::Result<()> {
4382            decoder.debug_check_bounds::<Self>(offset);
4383            // Verify that padding bytes are zero.
4384            fidl::decode!(
4385                fidl_fuchsia_bluetooth_common::Status,
4386                D,
4387                &mut self.status,
4388                decoder,
4389                offset + 0,
4390                _depth
4391            )?;
4392            Ok(())
4393        }
4394    }
4395
4396    impl fidl::encoding::ValueTypeMarker for RemoteServiceReadByTypeResponse {
4397        type Borrowed<'a> = &'a Self;
4398        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4399            value
4400        }
4401    }
4402
4403    unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadByTypeResponse {
4404        type Owned = Self;
4405
4406        #[inline(always)]
4407        fn inline_align(_context: fidl::encoding::Context) -> usize {
4408            8
4409        }
4410
4411        #[inline(always)]
4412        fn inline_size(_context: fidl::encoding::Context) -> usize {
4413            16
4414        }
4415    }
4416
4417    unsafe impl<D: fidl::encoding::ResourceDialect>
4418        fidl::encoding::Encode<RemoteServiceReadByTypeResponse, D>
4419        for &RemoteServiceReadByTypeResponse
4420    {
4421        #[inline]
4422        unsafe fn encode(
4423            self,
4424            encoder: &mut fidl::encoding::Encoder<'_, D>,
4425            offset: usize,
4426            _depth: fidl::encoding::Depth,
4427        ) -> fidl::Result<()> {
4428            encoder.debug_check_bounds::<RemoteServiceReadByTypeResponse>(offset);
4429            // Delegate to tuple encoding.
4430            fidl::encoding::Encode::<RemoteServiceReadByTypeResponse, D>::encode(
4431                (
4432                    <fidl::encoding::Vector<ReadByTypeResult, 189> as fidl::encoding::ValueTypeMarker>::borrow(&self.results),
4433                ),
4434                encoder, offset, _depth
4435            )
4436        }
4437    }
4438    unsafe impl<
4439        D: fidl::encoding::ResourceDialect,
4440        T0: fidl::encoding::Encode<fidl::encoding::Vector<ReadByTypeResult, 189>, D>,
4441    > fidl::encoding::Encode<RemoteServiceReadByTypeResponse, D> for (T0,)
4442    {
4443        #[inline]
4444        unsafe fn encode(
4445            self,
4446            encoder: &mut fidl::encoding::Encoder<'_, D>,
4447            offset: usize,
4448            depth: fidl::encoding::Depth,
4449        ) -> fidl::Result<()> {
4450            encoder.debug_check_bounds::<RemoteServiceReadByTypeResponse>(offset);
4451            // Zero out padding regions. There's no need to apply masks
4452            // because the unmasked parts will be overwritten by fields.
4453            // Write the fields.
4454            self.0.encode(encoder, offset + 0, depth)?;
4455            Ok(())
4456        }
4457    }
4458
4459    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4460        for RemoteServiceReadByTypeResponse
4461    {
4462        #[inline(always)]
4463        fn new_empty() -> Self {
4464            Self { results: fidl::new_empty!(fidl::encoding::Vector<ReadByTypeResult, 189>, D) }
4465        }
4466
4467        #[inline]
4468        unsafe fn decode(
4469            &mut self,
4470            decoder: &mut fidl::encoding::Decoder<'_, D>,
4471            offset: usize,
4472            _depth: fidl::encoding::Depth,
4473        ) -> fidl::Result<()> {
4474            decoder.debug_check_bounds::<Self>(offset);
4475            // Verify that padding bytes are zero.
4476            fidl::decode!(fidl::encoding::Vector<ReadByTypeResult, 189>, D, &mut self.results, decoder, offset + 0, _depth)?;
4477            Ok(())
4478        }
4479    }
4480
4481    impl fidl::encoding::ValueTypeMarker for SecurityRequirements {
4482        type Borrowed<'a> = &'a Self;
4483        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4484            value
4485        }
4486    }
4487
4488    unsafe impl fidl::encoding::TypeMarker for SecurityRequirements {
4489        type Owned = Self;
4490
4491        #[inline(always)]
4492        fn inline_align(_context: fidl::encoding::Context) -> usize {
4493            1
4494        }
4495
4496        #[inline(always)]
4497        fn inline_size(_context: fidl::encoding::Context) -> usize {
4498            3
4499        }
4500    }
4501
4502    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SecurityRequirements, D>
4503        for &SecurityRequirements
4504    {
4505        #[inline]
4506        unsafe fn encode(
4507            self,
4508            encoder: &mut fidl::encoding::Encoder<'_, D>,
4509            offset: usize,
4510            _depth: fidl::encoding::Depth,
4511        ) -> fidl::Result<()> {
4512            encoder.debug_check_bounds::<SecurityRequirements>(offset);
4513            // Delegate to tuple encoding.
4514            fidl::encoding::Encode::<SecurityRequirements, D>::encode(
4515                (
4516                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.encryption_required),
4517                    <bool as fidl::encoding::ValueTypeMarker>::borrow(
4518                        &self.authentication_required,
4519                    ),
4520                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.authorization_required),
4521                ),
4522                encoder,
4523                offset,
4524                _depth,
4525            )
4526        }
4527    }
4528    unsafe impl<
4529        D: fidl::encoding::ResourceDialect,
4530        T0: fidl::encoding::Encode<bool, D>,
4531        T1: fidl::encoding::Encode<bool, D>,
4532        T2: fidl::encoding::Encode<bool, D>,
4533    > fidl::encoding::Encode<SecurityRequirements, D> for (T0, T1, T2)
4534    {
4535        #[inline]
4536        unsafe fn encode(
4537            self,
4538            encoder: &mut fidl::encoding::Encoder<'_, D>,
4539            offset: usize,
4540            depth: fidl::encoding::Depth,
4541        ) -> fidl::Result<()> {
4542            encoder.debug_check_bounds::<SecurityRequirements>(offset);
4543            // Zero out padding regions. There's no need to apply masks
4544            // because the unmasked parts will be overwritten by fields.
4545            // Write the fields.
4546            self.0.encode(encoder, offset + 0, depth)?;
4547            self.1.encode(encoder, offset + 1, depth)?;
4548            self.2.encode(encoder, offset + 2, depth)?;
4549            Ok(())
4550        }
4551    }
4552
4553    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SecurityRequirements {
4554        #[inline(always)]
4555        fn new_empty() -> Self {
4556            Self {
4557                encryption_required: fidl::new_empty!(bool, D),
4558                authentication_required: fidl::new_empty!(bool, D),
4559                authorization_required: fidl::new_empty!(bool, D),
4560            }
4561        }
4562
4563        #[inline]
4564        unsafe fn decode(
4565            &mut self,
4566            decoder: &mut fidl::encoding::Decoder<'_, D>,
4567            offset: usize,
4568            _depth: fidl::encoding::Depth,
4569        ) -> fidl::Result<()> {
4570            decoder.debug_check_bounds::<Self>(offset);
4571            // Verify that padding bytes are zero.
4572            fidl::decode!(bool, D, &mut self.encryption_required, decoder, offset + 0, _depth)?;
4573            fidl::decode!(bool, D, &mut self.authentication_required, decoder, offset + 1, _depth)?;
4574            fidl::decode!(bool, D, &mut self.authorization_required, decoder, offset + 2, _depth)?;
4575            Ok(())
4576        }
4577    }
4578
4579    impl fidl::encoding::ValueTypeMarker for ServerPublishServiceResponse {
4580        type Borrowed<'a> = &'a Self;
4581        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4582            value
4583        }
4584    }
4585
4586    unsafe impl fidl::encoding::TypeMarker for ServerPublishServiceResponse {
4587        type Owned = Self;
4588
4589        #[inline(always)]
4590        fn inline_align(_context: fidl::encoding::Context) -> usize {
4591            8
4592        }
4593
4594        #[inline(always)]
4595        fn inline_size(_context: fidl::encoding::Context) -> usize {
4596            8
4597        }
4598    }
4599
4600    unsafe impl<D: fidl::encoding::ResourceDialect>
4601        fidl::encoding::Encode<ServerPublishServiceResponse, D> for &ServerPublishServiceResponse
4602    {
4603        #[inline]
4604        unsafe fn encode(
4605            self,
4606            encoder: &mut fidl::encoding::Encoder<'_, D>,
4607            offset: usize,
4608            _depth: fidl::encoding::Depth,
4609        ) -> fidl::Result<()> {
4610            encoder.debug_check_bounds::<ServerPublishServiceResponse>(offset);
4611            // Delegate to tuple encoding.
4612            fidl::encoding::Encode::<ServerPublishServiceResponse, D>::encode(
4613                (
4614                    <fidl_fuchsia_bluetooth_common::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
4615                ),
4616                encoder, offset, _depth
4617            )
4618        }
4619    }
4620    unsafe impl<
4621        D: fidl::encoding::ResourceDialect,
4622        T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth_common::Status, D>,
4623    > fidl::encoding::Encode<ServerPublishServiceResponse, D> for (T0,)
4624    {
4625        #[inline]
4626        unsafe fn encode(
4627            self,
4628            encoder: &mut fidl::encoding::Encoder<'_, D>,
4629            offset: usize,
4630            depth: fidl::encoding::Depth,
4631        ) -> fidl::Result<()> {
4632            encoder.debug_check_bounds::<ServerPublishServiceResponse>(offset);
4633            // Zero out padding regions. There's no need to apply masks
4634            // because the unmasked parts will be overwritten by fields.
4635            // Write the fields.
4636            self.0.encode(encoder, offset + 0, depth)?;
4637            Ok(())
4638        }
4639    }
4640
4641    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4642        for ServerPublishServiceResponse
4643    {
4644        #[inline(always)]
4645        fn new_empty() -> Self {
4646            Self { status: fidl::new_empty!(fidl_fuchsia_bluetooth_common::Status, D) }
4647        }
4648
4649        #[inline]
4650        unsafe fn decode(
4651            &mut self,
4652            decoder: &mut fidl::encoding::Decoder<'_, D>,
4653            offset: usize,
4654            _depth: fidl::encoding::Depth,
4655        ) -> fidl::Result<()> {
4656            decoder.debug_check_bounds::<Self>(offset);
4657            // Verify that padding bytes are zero.
4658            fidl::decode!(
4659                fidl_fuchsia_bluetooth_common::Status,
4660                D,
4661                &mut self.status,
4662                decoder,
4663                offset + 0,
4664                _depth
4665            )?;
4666            Ok(())
4667        }
4668    }
4669
4670    impl fidl::encoding::ValueTypeMarker for ServiceInfo {
4671        type Borrowed<'a> = &'a Self;
4672        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4673            value
4674        }
4675    }
4676
4677    unsafe impl fidl::encoding::TypeMarker for ServiceInfo {
4678        type Owned = Self;
4679
4680        #[inline(always)]
4681        fn inline_align(_context: fidl::encoding::Context) -> usize {
4682            8
4683        }
4684
4685        #[inline(always)]
4686        fn inline_size(_context: fidl::encoding::Context) -> usize {
4687            64
4688        }
4689    }
4690
4691    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ServiceInfo, D>
4692        for &ServiceInfo
4693    {
4694        #[inline]
4695        unsafe fn encode(
4696            self,
4697            encoder: &mut fidl::encoding::Encoder<'_, D>,
4698            offset: usize,
4699            _depth: fidl::encoding::Depth,
4700        ) -> fidl::Result<()> {
4701            encoder.debug_check_bounds::<ServiceInfo>(offset);
4702            // Delegate to tuple encoding.
4703            fidl::encoding::Encode::<ServiceInfo, D>::encode(
4704                (
4705                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
4706                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.primary),
4707                    <fidl::encoding::BoundedString<36> as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
4708                    <fidl::encoding::Optional<fidl::encoding::Vector<Characteristic, 32767>> as fidl::encoding::ValueTypeMarker>::borrow(&self.characteristics),
4709                    <fidl::encoding::Optional<fidl::encoding::Vector<u64, 65535>> as fidl::encoding::ValueTypeMarker>::borrow(&self.includes),
4710                ),
4711                encoder, offset, _depth
4712            )
4713        }
4714    }
4715    unsafe impl<
4716        D: fidl::encoding::ResourceDialect,
4717        T0: fidl::encoding::Encode<u64, D>,
4718        T1: fidl::encoding::Encode<bool, D>,
4719        T2: fidl::encoding::Encode<fidl::encoding::BoundedString<36>, D>,
4720        T3: fidl::encoding::Encode<
4721                fidl::encoding::Optional<fidl::encoding::Vector<Characteristic, 32767>>,
4722                D,
4723            >,
4724        T4: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::Vector<u64, 65535>>, D>,
4725    > fidl::encoding::Encode<ServiceInfo, D> for (T0, T1, T2, T3, T4)
4726    {
4727        #[inline]
4728        unsafe fn encode(
4729            self,
4730            encoder: &mut fidl::encoding::Encoder<'_, D>,
4731            offset: usize,
4732            depth: fidl::encoding::Depth,
4733        ) -> fidl::Result<()> {
4734            encoder.debug_check_bounds::<ServiceInfo>(offset);
4735            // Zero out padding regions. There's no need to apply masks
4736            // because the unmasked parts will be overwritten by fields.
4737            unsafe {
4738                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
4739                (ptr as *mut u64).write_unaligned(0);
4740            }
4741            // Write the fields.
4742            self.0.encode(encoder, offset + 0, depth)?;
4743            self.1.encode(encoder, offset + 8, depth)?;
4744            self.2.encode(encoder, offset + 16, depth)?;
4745            self.3.encode(encoder, offset + 32, depth)?;
4746            self.4.encode(encoder, offset + 48, depth)?;
4747            Ok(())
4748        }
4749    }
4750
4751    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ServiceInfo {
4752        #[inline(always)]
4753        fn new_empty() -> Self {
4754            Self {
4755                id: fidl::new_empty!(u64, D),
4756                primary: fidl::new_empty!(bool, D),
4757                type_: fidl::new_empty!(fidl::encoding::BoundedString<36>, D),
4758                characteristics: fidl::new_empty!(
4759                    fidl::encoding::Optional<fidl::encoding::Vector<Characteristic, 32767>>,
4760                    D
4761                ),
4762                includes: fidl::new_empty!(
4763                    fidl::encoding::Optional<fidl::encoding::Vector<u64, 65535>>,
4764                    D
4765                ),
4766            }
4767        }
4768
4769        #[inline]
4770        unsafe fn decode(
4771            &mut self,
4772            decoder: &mut fidl::encoding::Decoder<'_, D>,
4773            offset: usize,
4774            _depth: fidl::encoding::Depth,
4775        ) -> fidl::Result<()> {
4776            decoder.debug_check_bounds::<Self>(offset);
4777            // Verify that padding bytes are zero.
4778            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
4779            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4780            let mask = 0xffffffffffffff00u64;
4781            let maskedval = padval & mask;
4782            if maskedval != 0 {
4783                return Err(fidl::Error::NonZeroPadding {
4784                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
4785                });
4786            }
4787            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
4788            fidl::decode!(bool, D, &mut self.primary, decoder, offset + 8, _depth)?;
4789            fidl::decode!(
4790                fidl::encoding::BoundedString<36>,
4791                D,
4792                &mut self.type_,
4793                decoder,
4794                offset + 16,
4795                _depth
4796            )?;
4797            fidl::decode!(
4798                fidl::encoding::Optional<fidl::encoding::Vector<Characteristic, 32767>>,
4799                D,
4800                &mut self.characteristics,
4801                decoder,
4802                offset + 32,
4803                _depth
4804            )?;
4805            fidl::decode!(
4806                fidl::encoding::Optional<fidl::encoding::Vector<u64, 65535>>,
4807                D,
4808                &mut self.includes,
4809                decoder,
4810                offset + 48,
4811                _depth
4812            )?;
4813            Ok(())
4814        }
4815    }
4816
4817    impl ReadByTypeResult {
4818        #[inline(always)]
4819        fn max_ordinal_present(&self) -> u64 {
4820            if let Some(_) = self.error {
4821                return 3;
4822            }
4823            if let Some(_) = self.value {
4824                return 2;
4825            }
4826            if let Some(_) = self.id {
4827                return 1;
4828            }
4829            0
4830        }
4831    }
4832
4833    impl fidl::encoding::ValueTypeMarker for ReadByTypeResult {
4834        type Borrowed<'a> = &'a Self;
4835        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4836            value
4837        }
4838    }
4839
4840    unsafe impl fidl::encoding::TypeMarker for ReadByTypeResult {
4841        type Owned = Self;
4842
4843        #[inline(always)]
4844        fn inline_align(_context: fidl::encoding::Context) -> usize {
4845            8
4846        }
4847
4848        #[inline(always)]
4849        fn inline_size(_context: fidl::encoding::Context) -> usize {
4850            16
4851        }
4852    }
4853
4854    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ReadByTypeResult, D>
4855        for &ReadByTypeResult
4856    {
4857        unsafe fn encode(
4858            self,
4859            encoder: &mut fidl::encoding::Encoder<'_, D>,
4860            offset: usize,
4861            mut depth: fidl::encoding::Depth,
4862        ) -> fidl::Result<()> {
4863            encoder.debug_check_bounds::<ReadByTypeResult>(offset);
4864            // Vector header
4865            let max_ordinal: u64 = self.max_ordinal_present();
4866            encoder.write_num(max_ordinal, offset);
4867            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4868            // Calling encoder.out_of_line_offset(0) is not allowed.
4869            if max_ordinal == 0 {
4870                return Ok(());
4871            }
4872            depth.increment()?;
4873            let envelope_size = 8;
4874            let bytes_len = max_ordinal as usize * envelope_size;
4875            #[allow(unused_variables)]
4876            let offset = encoder.out_of_line_offset(bytes_len);
4877            let mut _prev_end_offset: usize = 0;
4878            if 1 > max_ordinal {
4879                return Ok(());
4880            }
4881
4882            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4883            // are envelope_size bytes.
4884            let cur_offset: usize = (1 - 1) * envelope_size;
4885
4886            // Zero reserved fields.
4887            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4888
4889            // Safety:
4890            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4891            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4892            //   envelope_size bytes, there is always sufficient room.
4893            fidl::encoding::encode_in_envelope_optional::<u64, D>(
4894                self.id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
4895                encoder,
4896                offset + cur_offset,
4897                depth,
4898            )?;
4899
4900            _prev_end_offset = cur_offset + envelope_size;
4901            if 2 > max_ordinal {
4902                return Ok(());
4903            }
4904
4905            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4906            // are envelope_size bytes.
4907            let cur_offset: usize = (2 - 1) * envelope_size;
4908
4909            // Zero reserved fields.
4910            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4911
4912            // Safety:
4913            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4914            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4915            //   envelope_size bytes, there is always sufficient room.
4916            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 253>, D>(
4917                self.value.as_ref().map(
4918                    <fidl::encoding::Vector<u8, 253> as fidl::encoding::ValueTypeMarker>::borrow,
4919                ),
4920                encoder,
4921                offset + cur_offset,
4922                depth,
4923            )?;
4924
4925            _prev_end_offset = cur_offset + envelope_size;
4926            if 3 > max_ordinal {
4927                return Ok(());
4928            }
4929
4930            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4931            // are envelope_size bytes.
4932            let cur_offset: usize = (3 - 1) * envelope_size;
4933
4934            // Zero reserved fields.
4935            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4936
4937            // Safety:
4938            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4939            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4940            //   envelope_size bytes, there is always sufficient room.
4941            fidl::encoding::encode_in_envelope_optional::<Error, D>(
4942                self.error.as_ref().map(<Error as fidl::encoding::ValueTypeMarker>::borrow),
4943                encoder,
4944                offset + cur_offset,
4945                depth,
4946            )?;
4947
4948            _prev_end_offset = cur_offset + envelope_size;
4949
4950            Ok(())
4951        }
4952    }
4953
4954    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ReadByTypeResult {
4955        #[inline(always)]
4956        fn new_empty() -> Self {
4957            Self::default()
4958        }
4959
4960        unsafe fn decode(
4961            &mut self,
4962            decoder: &mut fidl::encoding::Decoder<'_, D>,
4963            offset: usize,
4964            mut depth: fidl::encoding::Depth,
4965        ) -> fidl::Result<()> {
4966            decoder.debug_check_bounds::<Self>(offset);
4967            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4968                None => return Err(fidl::Error::NotNullable),
4969                Some(len) => len,
4970            };
4971            // Calling decoder.out_of_line_offset(0) is not allowed.
4972            if len == 0 {
4973                return Ok(());
4974            };
4975            depth.increment()?;
4976            let envelope_size = 8;
4977            let bytes_len = len * envelope_size;
4978            let offset = decoder.out_of_line_offset(bytes_len)?;
4979            // Decode the envelope for each type.
4980            let mut _next_ordinal_to_read = 0;
4981            let mut next_offset = offset;
4982            let end_offset = offset + bytes_len;
4983            _next_ordinal_to_read += 1;
4984            if next_offset >= end_offset {
4985                return Ok(());
4986            }
4987
4988            // Decode unknown envelopes for gaps in ordinals.
4989            while _next_ordinal_to_read < 1 {
4990                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4991                _next_ordinal_to_read += 1;
4992                next_offset += envelope_size;
4993            }
4994
4995            let next_out_of_line = decoder.next_out_of_line();
4996            let handles_before = decoder.remaining_handles();
4997            if let Some((inlined, num_bytes, num_handles)) =
4998                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4999            {
5000                let member_inline_size =
5001                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5002                if inlined != (member_inline_size <= 4) {
5003                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5004                }
5005                let inner_offset;
5006                let mut inner_depth = depth.clone();
5007                if inlined {
5008                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5009                    inner_offset = next_offset;
5010                } else {
5011                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5012                    inner_depth.increment()?;
5013                }
5014                let val_ref = self.id.get_or_insert_with(|| fidl::new_empty!(u64, D));
5015                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
5016                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5017                {
5018                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5019                }
5020                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5021                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5022                }
5023            }
5024
5025            next_offset += envelope_size;
5026            _next_ordinal_to_read += 1;
5027            if next_offset >= end_offset {
5028                return Ok(());
5029            }
5030
5031            // Decode unknown envelopes for gaps in ordinals.
5032            while _next_ordinal_to_read < 2 {
5033                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5034                _next_ordinal_to_read += 1;
5035                next_offset += envelope_size;
5036            }
5037
5038            let next_out_of_line = decoder.next_out_of_line();
5039            let handles_before = decoder.remaining_handles();
5040            if let Some((inlined, num_bytes, num_handles)) =
5041                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5042            {
5043                let member_inline_size =
5044                    <fidl::encoding::Vector<u8, 253> as fidl::encoding::TypeMarker>::inline_size(
5045                        decoder.context,
5046                    );
5047                if inlined != (member_inline_size <= 4) {
5048                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5049                }
5050                let inner_offset;
5051                let mut inner_depth = depth.clone();
5052                if inlined {
5053                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5054                    inner_offset = next_offset;
5055                } else {
5056                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5057                    inner_depth.increment()?;
5058                }
5059                let val_ref = self
5060                    .value
5061                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 253>, D));
5062                fidl::decode!(fidl::encoding::Vector<u8, 253>, D, val_ref, decoder, inner_offset, inner_depth)?;
5063                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5064                {
5065                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5066                }
5067                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5068                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5069                }
5070            }
5071
5072            next_offset += envelope_size;
5073            _next_ordinal_to_read += 1;
5074            if next_offset >= end_offset {
5075                return Ok(());
5076            }
5077
5078            // Decode unknown envelopes for gaps in ordinals.
5079            while _next_ordinal_to_read < 3 {
5080                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5081                _next_ordinal_to_read += 1;
5082                next_offset += envelope_size;
5083            }
5084
5085            let next_out_of_line = decoder.next_out_of_line();
5086            let handles_before = decoder.remaining_handles();
5087            if let Some((inlined, num_bytes, num_handles)) =
5088                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5089            {
5090                let member_inline_size =
5091                    <Error as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5092                if inlined != (member_inline_size <= 4) {
5093                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5094                }
5095                let inner_offset;
5096                let mut inner_depth = depth.clone();
5097                if inlined {
5098                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5099                    inner_offset = next_offset;
5100                } else {
5101                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5102                    inner_depth.increment()?;
5103                }
5104                let val_ref = self.error.get_or_insert_with(|| fidl::new_empty!(Error, D));
5105                fidl::decode!(Error, D, val_ref, decoder, inner_offset, inner_depth)?;
5106                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5107                {
5108                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5109                }
5110                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5111                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5112                }
5113            }
5114
5115            next_offset += envelope_size;
5116
5117            // Decode the remaining unknown envelopes.
5118            while next_offset < end_offset {
5119                _next_ordinal_to_read += 1;
5120                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5121                next_offset += envelope_size;
5122            }
5123
5124            Ok(())
5125        }
5126    }
5127
5128    impl WriteOptions {
5129        #[inline(always)]
5130        fn max_ordinal_present(&self) -> u64 {
5131            if let Some(_) = self.reliable_mode {
5132                return 1;
5133            }
5134            0
5135        }
5136    }
5137
5138    impl fidl::encoding::ValueTypeMarker for WriteOptions {
5139        type Borrowed<'a> = &'a Self;
5140        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5141            value
5142        }
5143    }
5144
5145    unsafe impl fidl::encoding::TypeMarker for WriteOptions {
5146        type Owned = Self;
5147
5148        #[inline(always)]
5149        fn inline_align(_context: fidl::encoding::Context) -> usize {
5150            8
5151        }
5152
5153        #[inline(always)]
5154        fn inline_size(_context: fidl::encoding::Context) -> usize {
5155            16
5156        }
5157    }
5158
5159    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WriteOptions, D>
5160        for &WriteOptions
5161    {
5162        unsafe fn encode(
5163            self,
5164            encoder: &mut fidl::encoding::Encoder<'_, D>,
5165            offset: usize,
5166            mut depth: fidl::encoding::Depth,
5167        ) -> fidl::Result<()> {
5168            encoder.debug_check_bounds::<WriteOptions>(offset);
5169            // Vector header
5170            let max_ordinal: u64 = self.max_ordinal_present();
5171            encoder.write_num(max_ordinal, offset);
5172            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5173            // Calling encoder.out_of_line_offset(0) is not allowed.
5174            if max_ordinal == 0 {
5175                return Ok(());
5176            }
5177            depth.increment()?;
5178            let envelope_size = 8;
5179            let bytes_len = max_ordinal as usize * envelope_size;
5180            #[allow(unused_variables)]
5181            let offset = encoder.out_of_line_offset(bytes_len);
5182            let mut _prev_end_offset: usize = 0;
5183            if 1 > max_ordinal {
5184                return Ok(());
5185            }
5186
5187            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5188            // are envelope_size bytes.
5189            let cur_offset: usize = (1 - 1) * envelope_size;
5190
5191            // Zero reserved fields.
5192            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5193
5194            // Safety:
5195            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5196            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5197            //   envelope_size bytes, there is always sufficient room.
5198            fidl::encoding::encode_in_envelope_optional::<ReliableMode, D>(
5199                self.reliable_mode
5200                    .as_ref()
5201                    .map(<ReliableMode as fidl::encoding::ValueTypeMarker>::borrow),
5202                encoder,
5203                offset + cur_offset,
5204                depth,
5205            )?;
5206
5207            _prev_end_offset = cur_offset + envelope_size;
5208
5209            Ok(())
5210        }
5211    }
5212
5213    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WriteOptions {
5214        #[inline(always)]
5215        fn new_empty() -> Self {
5216            Self::default()
5217        }
5218
5219        unsafe fn decode(
5220            &mut self,
5221            decoder: &mut fidl::encoding::Decoder<'_, D>,
5222            offset: usize,
5223            mut depth: fidl::encoding::Depth,
5224        ) -> fidl::Result<()> {
5225            decoder.debug_check_bounds::<Self>(offset);
5226            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5227                None => return Err(fidl::Error::NotNullable),
5228                Some(len) => len,
5229            };
5230            // Calling decoder.out_of_line_offset(0) is not allowed.
5231            if len == 0 {
5232                return Ok(());
5233            };
5234            depth.increment()?;
5235            let envelope_size = 8;
5236            let bytes_len = len * envelope_size;
5237            let offset = decoder.out_of_line_offset(bytes_len)?;
5238            // Decode the envelope for each type.
5239            let mut _next_ordinal_to_read = 0;
5240            let mut next_offset = offset;
5241            let end_offset = offset + bytes_len;
5242            _next_ordinal_to_read += 1;
5243            if next_offset >= end_offset {
5244                return Ok(());
5245            }
5246
5247            // Decode unknown envelopes for gaps in ordinals.
5248            while _next_ordinal_to_read < 1 {
5249                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5250                _next_ordinal_to_read += 1;
5251                next_offset += envelope_size;
5252            }
5253
5254            let next_out_of_line = decoder.next_out_of_line();
5255            let handles_before = decoder.remaining_handles();
5256            if let Some((inlined, num_bytes, num_handles)) =
5257                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5258            {
5259                let member_inline_size =
5260                    <ReliableMode as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5261                if inlined != (member_inline_size <= 4) {
5262                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5263                }
5264                let inner_offset;
5265                let mut inner_depth = depth.clone();
5266                if inlined {
5267                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5268                    inner_offset = next_offset;
5269                } else {
5270                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5271                    inner_depth.increment()?;
5272                }
5273                let val_ref =
5274                    self.reliable_mode.get_or_insert_with(|| fidl::new_empty!(ReliableMode, D));
5275                fidl::decode!(ReliableMode, D, val_ref, decoder, inner_offset, inner_depth)?;
5276                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5277                {
5278                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5279                }
5280                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5281                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5282                }
5283            }
5284
5285            next_offset += envelope_size;
5286
5287            // Decode the remaining unknown envelopes.
5288            while next_offset < end_offset {
5289                _next_ordinal_to_read += 1;
5290                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5291                next_offset += envelope_size;
5292            }
5293
5294            Ok(())
5295        }
5296    }
5297}