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                (
2589                    <fidl_fuchsia_bluetooth__common::Uuid as fidl::encoding::ValueTypeMarker>::borrow(&self.uuid),
2590                ),
2591                encoder, offset, _depth
2592            )
2593        }
2594    }
2595    unsafe impl<
2596        D: fidl::encoding::ResourceDialect,
2597        T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth__common::Uuid, D>,
2598    > fidl::encoding::Encode<RemoteServiceReadByTypeRequest, D> for (T0,)
2599    {
2600        #[inline]
2601        unsafe fn encode(
2602            self,
2603            encoder: &mut fidl::encoding::Encoder<'_, D>,
2604            offset: usize,
2605            depth: fidl::encoding::Depth,
2606        ) -> fidl::Result<()> {
2607            encoder.debug_check_bounds::<RemoteServiceReadByTypeRequest>(offset);
2608            // Zero out padding regions. There's no need to apply masks
2609            // because the unmasked parts will be overwritten by fields.
2610            // Write the fields.
2611            self.0.encode(encoder, offset + 0, depth)?;
2612            Ok(())
2613        }
2614    }
2615
2616    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2617        for RemoteServiceReadByTypeRequest
2618    {
2619        #[inline(always)]
2620        fn new_empty() -> Self {
2621            Self { uuid: fidl::new_empty!(fidl_fuchsia_bluetooth__common::Uuid, D) }
2622        }
2623
2624        #[inline]
2625        unsafe fn decode(
2626            &mut self,
2627            decoder: &mut fidl::encoding::Decoder<'_, D>,
2628            offset: usize,
2629            _depth: fidl::encoding::Depth,
2630        ) -> fidl::Result<()> {
2631            decoder.debug_check_bounds::<Self>(offset);
2632            // Verify that padding bytes are zero.
2633            fidl::decode!(
2634                fidl_fuchsia_bluetooth__common::Uuid,
2635                D,
2636                &mut self.uuid,
2637                decoder,
2638                offset + 0,
2639                _depth
2640            )?;
2641            Ok(())
2642        }
2643    }
2644
2645    impl fidl::encoding::ValueTypeMarker for RemoteServiceReadCharacteristicRequest {
2646        type Borrowed<'a> = &'a Self;
2647        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2648            value
2649        }
2650    }
2651
2652    unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadCharacteristicRequest {
2653        type Owned = Self;
2654
2655        #[inline(always)]
2656        fn inline_align(_context: fidl::encoding::Context) -> usize {
2657            8
2658        }
2659
2660        #[inline(always)]
2661        fn inline_size(_context: fidl::encoding::Context) -> usize {
2662            8
2663        }
2664        #[inline(always)]
2665        fn encode_is_copy() -> bool {
2666            true
2667        }
2668
2669        #[inline(always)]
2670        fn decode_is_copy() -> bool {
2671            true
2672        }
2673    }
2674
2675    unsafe impl<D: fidl::encoding::ResourceDialect>
2676        fidl::encoding::Encode<RemoteServiceReadCharacteristicRequest, D>
2677        for &RemoteServiceReadCharacteristicRequest
2678    {
2679        #[inline]
2680        unsafe fn encode(
2681            self,
2682            encoder: &mut fidl::encoding::Encoder<'_, D>,
2683            offset: usize,
2684            _depth: fidl::encoding::Depth,
2685        ) -> fidl::Result<()> {
2686            encoder.debug_check_bounds::<RemoteServiceReadCharacteristicRequest>(offset);
2687            unsafe {
2688                // Copy the object into the buffer.
2689                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2690                (buf_ptr as *mut RemoteServiceReadCharacteristicRequest).write_unaligned(
2691                    (self as *const RemoteServiceReadCharacteristicRequest).read(),
2692                );
2693                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2694                // done second because the memcpy will write garbage to these bytes.
2695            }
2696            Ok(())
2697        }
2698    }
2699    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
2700        fidl::encoding::Encode<RemoteServiceReadCharacteristicRequest, D> for (T0,)
2701    {
2702        #[inline]
2703        unsafe fn encode(
2704            self,
2705            encoder: &mut fidl::encoding::Encoder<'_, D>,
2706            offset: usize,
2707            depth: fidl::encoding::Depth,
2708        ) -> fidl::Result<()> {
2709            encoder.debug_check_bounds::<RemoteServiceReadCharacteristicRequest>(offset);
2710            // Zero out padding regions. There's no need to apply masks
2711            // because the unmasked parts will be overwritten by fields.
2712            // Write the fields.
2713            self.0.encode(encoder, offset + 0, depth)?;
2714            Ok(())
2715        }
2716    }
2717
2718    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2719        for RemoteServiceReadCharacteristicRequest
2720    {
2721        #[inline(always)]
2722        fn new_empty() -> Self {
2723            Self { id: fidl::new_empty!(u64, D) }
2724        }
2725
2726        #[inline]
2727        unsafe fn decode(
2728            &mut self,
2729            decoder: &mut fidl::encoding::Decoder<'_, D>,
2730            offset: usize,
2731            _depth: fidl::encoding::Depth,
2732        ) -> fidl::Result<()> {
2733            decoder.debug_check_bounds::<Self>(offset);
2734            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2735            // Verify that padding bytes are zero.
2736            // Copy from the buffer into the object.
2737            unsafe {
2738                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
2739            }
2740            Ok(())
2741        }
2742    }
2743
2744    impl fidl::encoding::ValueTypeMarker for RemoteServiceReadCharacteristicResponse {
2745        type Borrowed<'a> = &'a Self;
2746        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2747            value
2748        }
2749    }
2750
2751    unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadCharacteristicResponse {
2752        type Owned = Self;
2753
2754        #[inline(always)]
2755        fn inline_align(_context: fidl::encoding::Context) -> usize {
2756            8
2757        }
2758
2759        #[inline(always)]
2760        fn inline_size(_context: fidl::encoding::Context) -> usize {
2761            24
2762        }
2763    }
2764
2765    unsafe impl<D: fidl::encoding::ResourceDialect>
2766        fidl::encoding::Encode<RemoteServiceReadCharacteristicResponse, D>
2767        for &RemoteServiceReadCharacteristicResponse
2768    {
2769        #[inline]
2770        unsafe fn encode(
2771            self,
2772            encoder: &mut fidl::encoding::Encoder<'_, D>,
2773            offset: usize,
2774            _depth: fidl::encoding::Depth,
2775        ) -> fidl::Result<()> {
2776            encoder.debug_check_bounds::<RemoteServiceReadCharacteristicResponse>(offset);
2777            // Delegate to tuple encoding.
2778            fidl::encoding::Encode::<RemoteServiceReadCharacteristicResponse, D>::encode(
2779                (
2780                    <fidl_fuchsia_bluetooth__common::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
2781                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
2782                ),
2783                encoder, offset, _depth
2784            )
2785        }
2786    }
2787    unsafe impl<
2788        D: fidl::encoding::ResourceDialect,
2789        T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth__common::Status, D>,
2790        T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
2791    > fidl::encoding::Encode<RemoteServiceReadCharacteristicResponse, D> for (T0, T1)
2792    {
2793        #[inline]
2794        unsafe fn encode(
2795            self,
2796            encoder: &mut fidl::encoding::Encoder<'_, D>,
2797            offset: usize,
2798            depth: fidl::encoding::Depth,
2799        ) -> fidl::Result<()> {
2800            encoder.debug_check_bounds::<RemoteServiceReadCharacteristicResponse>(offset);
2801            // Zero out padding regions. There's no need to apply masks
2802            // because the unmasked parts will be overwritten by fields.
2803            // Write the fields.
2804            self.0.encode(encoder, offset + 0, depth)?;
2805            self.1.encode(encoder, offset + 8, depth)?;
2806            Ok(())
2807        }
2808    }
2809
2810    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2811        for RemoteServiceReadCharacteristicResponse
2812    {
2813        #[inline(always)]
2814        fn new_empty() -> Self {
2815            Self {
2816                status: fidl::new_empty!(fidl_fuchsia_bluetooth__common::Status, D),
2817                value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
2818            }
2819        }
2820
2821        #[inline]
2822        unsafe fn decode(
2823            &mut self,
2824            decoder: &mut fidl::encoding::Decoder<'_, D>,
2825            offset: usize,
2826            _depth: fidl::encoding::Depth,
2827        ) -> fidl::Result<()> {
2828            decoder.debug_check_bounds::<Self>(offset);
2829            // Verify that padding bytes are zero.
2830            fidl::decode!(
2831                fidl_fuchsia_bluetooth__common::Status,
2832                D,
2833                &mut self.status,
2834                decoder,
2835                offset + 0,
2836                _depth
2837            )?;
2838            fidl::decode!(
2839                fidl::encoding::UnboundedVector<u8>,
2840                D,
2841                &mut self.value,
2842                decoder,
2843                offset + 8,
2844                _depth
2845            )?;
2846            Ok(())
2847        }
2848    }
2849
2850    impl fidl::encoding::ValueTypeMarker for RemoteServiceReadDescriptorRequest {
2851        type Borrowed<'a> = &'a Self;
2852        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2853            value
2854        }
2855    }
2856
2857    unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadDescriptorRequest {
2858        type Owned = Self;
2859
2860        #[inline(always)]
2861        fn inline_align(_context: fidl::encoding::Context) -> usize {
2862            8
2863        }
2864
2865        #[inline(always)]
2866        fn inline_size(_context: fidl::encoding::Context) -> usize {
2867            8
2868        }
2869        #[inline(always)]
2870        fn encode_is_copy() -> bool {
2871            true
2872        }
2873
2874        #[inline(always)]
2875        fn decode_is_copy() -> bool {
2876            true
2877        }
2878    }
2879
2880    unsafe impl<D: fidl::encoding::ResourceDialect>
2881        fidl::encoding::Encode<RemoteServiceReadDescriptorRequest, D>
2882        for &RemoteServiceReadDescriptorRequest
2883    {
2884        #[inline]
2885        unsafe fn encode(
2886            self,
2887            encoder: &mut fidl::encoding::Encoder<'_, D>,
2888            offset: usize,
2889            _depth: fidl::encoding::Depth,
2890        ) -> fidl::Result<()> {
2891            encoder.debug_check_bounds::<RemoteServiceReadDescriptorRequest>(offset);
2892            unsafe {
2893                // Copy the object into the buffer.
2894                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2895                (buf_ptr as *mut RemoteServiceReadDescriptorRequest)
2896                    .write_unaligned((self as *const RemoteServiceReadDescriptorRequest).read());
2897                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2898                // done second because the memcpy will write garbage to these bytes.
2899            }
2900            Ok(())
2901        }
2902    }
2903    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
2904        fidl::encoding::Encode<RemoteServiceReadDescriptorRequest, D> for (T0,)
2905    {
2906        #[inline]
2907        unsafe fn encode(
2908            self,
2909            encoder: &mut fidl::encoding::Encoder<'_, D>,
2910            offset: usize,
2911            depth: fidl::encoding::Depth,
2912        ) -> fidl::Result<()> {
2913            encoder.debug_check_bounds::<RemoteServiceReadDescriptorRequest>(offset);
2914            // Zero out padding regions. There's no need to apply masks
2915            // because the unmasked parts will be overwritten by fields.
2916            // Write the fields.
2917            self.0.encode(encoder, offset + 0, depth)?;
2918            Ok(())
2919        }
2920    }
2921
2922    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2923        for RemoteServiceReadDescriptorRequest
2924    {
2925        #[inline(always)]
2926        fn new_empty() -> Self {
2927            Self { id: fidl::new_empty!(u64, D) }
2928        }
2929
2930        #[inline]
2931        unsafe fn decode(
2932            &mut self,
2933            decoder: &mut fidl::encoding::Decoder<'_, D>,
2934            offset: usize,
2935            _depth: fidl::encoding::Depth,
2936        ) -> fidl::Result<()> {
2937            decoder.debug_check_bounds::<Self>(offset);
2938            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2939            // Verify that padding bytes are zero.
2940            // Copy from the buffer into the object.
2941            unsafe {
2942                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
2943            }
2944            Ok(())
2945        }
2946    }
2947
2948    impl fidl::encoding::ValueTypeMarker for RemoteServiceReadDescriptorResponse {
2949        type Borrowed<'a> = &'a Self;
2950        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2951            value
2952        }
2953    }
2954
2955    unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadDescriptorResponse {
2956        type Owned = Self;
2957
2958        #[inline(always)]
2959        fn inline_align(_context: fidl::encoding::Context) -> usize {
2960            8
2961        }
2962
2963        #[inline(always)]
2964        fn inline_size(_context: fidl::encoding::Context) -> usize {
2965            24
2966        }
2967    }
2968
2969    unsafe impl<D: fidl::encoding::ResourceDialect>
2970        fidl::encoding::Encode<RemoteServiceReadDescriptorResponse, D>
2971        for &RemoteServiceReadDescriptorResponse
2972    {
2973        #[inline]
2974        unsafe fn encode(
2975            self,
2976            encoder: &mut fidl::encoding::Encoder<'_, D>,
2977            offset: usize,
2978            _depth: fidl::encoding::Depth,
2979        ) -> fidl::Result<()> {
2980            encoder.debug_check_bounds::<RemoteServiceReadDescriptorResponse>(offset);
2981            // Delegate to tuple encoding.
2982            fidl::encoding::Encode::<RemoteServiceReadDescriptorResponse, D>::encode(
2983                (
2984                    <fidl_fuchsia_bluetooth__common::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
2985                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
2986                ),
2987                encoder, offset, _depth
2988            )
2989        }
2990    }
2991    unsafe impl<
2992        D: fidl::encoding::ResourceDialect,
2993        T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth__common::Status, D>,
2994        T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
2995    > fidl::encoding::Encode<RemoteServiceReadDescriptorResponse, D> for (T0, T1)
2996    {
2997        #[inline]
2998        unsafe fn encode(
2999            self,
3000            encoder: &mut fidl::encoding::Encoder<'_, D>,
3001            offset: usize,
3002            depth: fidl::encoding::Depth,
3003        ) -> fidl::Result<()> {
3004            encoder.debug_check_bounds::<RemoteServiceReadDescriptorResponse>(offset);
3005            // Zero out padding regions. There's no need to apply masks
3006            // because the unmasked parts will be overwritten by fields.
3007            // Write the fields.
3008            self.0.encode(encoder, offset + 0, depth)?;
3009            self.1.encode(encoder, offset + 8, depth)?;
3010            Ok(())
3011        }
3012    }
3013
3014    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3015        for RemoteServiceReadDescriptorResponse
3016    {
3017        #[inline(always)]
3018        fn new_empty() -> Self {
3019            Self {
3020                status: fidl::new_empty!(fidl_fuchsia_bluetooth__common::Status, D),
3021                value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
3022            }
3023        }
3024
3025        #[inline]
3026        unsafe fn decode(
3027            &mut self,
3028            decoder: &mut fidl::encoding::Decoder<'_, D>,
3029            offset: usize,
3030            _depth: fidl::encoding::Depth,
3031        ) -> fidl::Result<()> {
3032            decoder.debug_check_bounds::<Self>(offset);
3033            // Verify that padding bytes are zero.
3034            fidl::decode!(
3035                fidl_fuchsia_bluetooth__common::Status,
3036                D,
3037                &mut self.status,
3038                decoder,
3039                offset + 0,
3040                _depth
3041            )?;
3042            fidl::decode!(
3043                fidl::encoding::UnboundedVector<u8>,
3044                D,
3045                &mut self.value,
3046                decoder,
3047                offset + 8,
3048                _depth
3049            )?;
3050            Ok(())
3051        }
3052    }
3053
3054    impl fidl::encoding::ValueTypeMarker for RemoteServiceReadLongCharacteristicRequest {
3055        type Borrowed<'a> = &'a Self;
3056        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3057            value
3058        }
3059    }
3060
3061    unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadLongCharacteristicRequest {
3062        type Owned = Self;
3063
3064        #[inline(always)]
3065        fn inline_align(_context: fidl::encoding::Context) -> usize {
3066            8
3067        }
3068
3069        #[inline(always)]
3070        fn inline_size(_context: fidl::encoding::Context) -> usize {
3071            16
3072        }
3073    }
3074
3075    unsafe impl<D: fidl::encoding::ResourceDialect>
3076        fidl::encoding::Encode<RemoteServiceReadLongCharacteristicRequest, D>
3077        for &RemoteServiceReadLongCharacteristicRequest
3078    {
3079        #[inline]
3080        unsafe fn encode(
3081            self,
3082            encoder: &mut fidl::encoding::Encoder<'_, D>,
3083            offset: usize,
3084            _depth: fidl::encoding::Depth,
3085        ) -> fidl::Result<()> {
3086            encoder.debug_check_bounds::<RemoteServiceReadLongCharacteristicRequest>(offset);
3087            unsafe {
3088                // Copy the object into the buffer.
3089                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3090                (buf_ptr as *mut RemoteServiceReadLongCharacteristicRequest).write_unaligned(
3091                    (self as *const RemoteServiceReadLongCharacteristicRequest).read(),
3092                );
3093                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3094                // done second because the memcpy will write garbage to these bytes.
3095                let padding_ptr = buf_ptr.offset(8) as *mut u64;
3096                let padding_mask = 0xffffffff00000000u64;
3097                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
3098            }
3099            Ok(())
3100        }
3101    }
3102    unsafe impl<
3103        D: fidl::encoding::ResourceDialect,
3104        T0: fidl::encoding::Encode<u64, D>,
3105        T1: fidl::encoding::Encode<u16, D>,
3106        T2: fidl::encoding::Encode<u16, D>,
3107    > fidl::encoding::Encode<RemoteServiceReadLongCharacteristicRequest, D> for (T0, T1, T2)
3108    {
3109        #[inline]
3110        unsafe fn encode(
3111            self,
3112            encoder: &mut fidl::encoding::Encoder<'_, D>,
3113            offset: usize,
3114            depth: fidl::encoding::Depth,
3115        ) -> fidl::Result<()> {
3116            encoder.debug_check_bounds::<RemoteServiceReadLongCharacteristicRequest>(offset);
3117            // Zero out padding regions. There's no need to apply masks
3118            // because the unmasked parts will be overwritten by fields.
3119            unsafe {
3120                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
3121                (ptr as *mut u64).write_unaligned(0);
3122            }
3123            // Write the fields.
3124            self.0.encode(encoder, offset + 0, depth)?;
3125            self.1.encode(encoder, offset + 8, depth)?;
3126            self.2.encode(encoder, offset + 10, depth)?;
3127            Ok(())
3128        }
3129    }
3130
3131    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3132        for RemoteServiceReadLongCharacteristicRequest
3133    {
3134        #[inline(always)]
3135        fn new_empty() -> Self {
3136            Self {
3137                id: fidl::new_empty!(u64, D),
3138                offset: fidl::new_empty!(u16, D),
3139                max_bytes: fidl::new_empty!(u16, D),
3140            }
3141        }
3142
3143        #[inline]
3144        unsafe fn decode(
3145            &mut self,
3146            decoder: &mut fidl::encoding::Decoder<'_, D>,
3147            offset: usize,
3148            _depth: fidl::encoding::Depth,
3149        ) -> fidl::Result<()> {
3150            decoder.debug_check_bounds::<Self>(offset);
3151            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3152            // Verify that padding bytes are zero.
3153            let ptr = unsafe { buf_ptr.offset(8) };
3154            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3155            let mask = 0xffffffff00000000u64;
3156            let maskedval = padval & mask;
3157            if maskedval != 0 {
3158                return Err(fidl::Error::NonZeroPadding {
3159                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
3160                });
3161            }
3162            // Copy from the buffer into the object.
3163            unsafe {
3164                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
3165            }
3166            Ok(())
3167        }
3168    }
3169
3170    impl fidl::encoding::ValueTypeMarker for RemoteServiceReadLongCharacteristicResponse {
3171        type Borrowed<'a> = &'a Self;
3172        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3173            value
3174        }
3175    }
3176
3177    unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadLongCharacteristicResponse {
3178        type Owned = Self;
3179
3180        #[inline(always)]
3181        fn inline_align(_context: fidl::encoding::Context) -> usize {
3182            8
3183        }
3184
3185        #[inline(always)]
3186        fn inline_size(_context: fidl::encoding::Context) -> usize {
3187            24
3188        }
3189    }
3190
3191    unsafe impl<D: fidl::encoding::ResourceDialect>
3192        fidl::encoding::Encode<RemoteServiceReadLongCharacteristicResponse, D>
3193        for &RemoteServiceReadLongCharacteristicResponse
3194    {
3195        #[inline]
3196        unsafe fn encode(
3197            self,
3198            encoder: &mut fidl::encoding::Encoder<'_, D>,
3199            offset: usize,
3200            _depth: fidl::encoding::Depth,
3201        ) -> fidl::Result<()> {
3202            encoder.debug_check_bounds::<RemoteServiceReadLongCharacteristicResponse>(offset);
3203            // Delegate to tuple encoding.
3204            fidl::encoding::Encode::<RemoteServiceReadLongCharacteristicResponse, D>::encode(
3205                (
3206                    <fidl_fuchsia_bluetooth__common::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
3207                    <fidl::encoding::Vector<u8, 512> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
3208                ),
3209                encoder, offset, _depth
3210            )
3211        }
3212    }
3213    unsafe impl<
3214        D: fidl::encoding::ResourceDialect,
3215        T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth__common::Status, D>,
3216        T1: fidl::encoding::Encode<fidl::encoding::Vector<u8, 512>, D>,
3217    > fidl::encoding::Encode<RemoteServiceReadLongCharacteristicResponse, D> for (T0, T1)
3218    {
3219        #[inline]
3220        unsafe fn encode(
3221            self,
3222            encoder: &mut fidl::encoding::Encoder<'_, D>,
3223            offset: usize,
3224            depth: fidl::encoding::Depth,
3225        ) -> fidl::Result<()> {
3226            encoder.debug_check_bounds::<RemoteServiceReadLongCharacteristicResponse>(offset);
3227            // Zero out padding regions. There's no need to apply masks
3228            // because the unmasked parts will be overwritten by fields.
3229            // Write the fields.
3230            self.0.encode(encoder, offset + 0, depth)?;
3231            self.1.encode(encoder, offset + 8, depth)?;
3232            Ok(())
3233        }
3234    }
3235
3236    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3237        for RemoteServiceReadLongCharacteristicResponse
3238    {
3239        #[inline(always)]
3240        fn new_empty() -> Self {
3241            Self {
3242                status: fidl::new_empty!(fidl_fuchsia_bluetooth__common::Status, D),
3243                value: fidl::new_empty!(fidl::encoding::Vector<u8, 512>, D),
3244            }
3245        }
3246
3247        #[inline]
3248        unsafe fn decode(
3249            &mut self,
3250            decoder: &mut fidl::encoding::Decoder<'_, D>,
3251            offset: usize,
3252            _depth: fidl::encoding::Depth,
3253        ) -> fidl::Result<()> {
3254            decoder.debug_check_bounds::<Self>(offset);
3255            // Verify that padding bytes are zero.
3256            fidl::decode!(
3257                fidl_fuchsia_bluetooth__common::Status,
3258                D,
3259                &mut self.status,
3260                decoder,
3261                offset + 0,
3262                _depth
3263            )?;
3264            fidl::decode!(fidl::encoding::Vector<u8, 512>, D, &mut self.value, decoder, offset + 8, _depth)?;
3265            Ok(())
3266        }
3267    }
3268
3269    impl fidl::encoding::ValueTypeMarker for RemoteServiceReadLongDescriptorRequest {
3270        type Borrowed<'a> = &'a Self;
3271        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3272            value
3273        }
3274    }
3275
3276    unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadLongDescriptorRequest {
3277        type Owned = Self;
3278
3279        #[inline(always)]
3280        fn inline_align(_context: fidl::encoding::Context) -> usize {
3281            8
3282        }
3283
3284        #[inline(always)]
3285        fn inline_size(_context: fidl::encoding::Context) -> usize {
3286            16
3287        }
3288    }
3289
3290    unsafe impl<D: fidl::encoding::ResourceDialect>
3291        fidl::encoding::Encode<RemoteServiceReadLongDescriptorRequest, D>
3292        for &RemoteServiceReadLongDescriptorRequest
3293    {
3294        #[inline]
3295        unsafe fn encode(
3296            self,
3297            encoder: &mut fidl::encoding::Encoder<'_, D>,
3298            offset: usize,
3299            _depth: fidl::encoding::Depth,
3300        ) -> fidl::Result<()> {
3301            encoder.debug_check_bounds::<RemoteServiceReadLongDescriptorRequest>(offset);
3302            unsafe {
3303                // Copy the object into the buffer.
3304                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3305                (buf_ptr as *mut RemoteServiceReadLongDescriptorRequest).write_unaligned(
3306                    (self as *const RemoteServiceReadLongDescriptorRequest).read(),
3307                );
3308                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3309                // done second because the memcpy will write garbage to these bytes.
3310                let padding_ptr = buf_ptr.offset(8) as *mut u64;
3311                let padding_mask = 0xffffffff00000000u64;
3312                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
3313            }
3314            Ok(())
3315        }
3316    }
3317    unsafe impl<
3318        D: fidl::encoding::ResourceDialect,
3319        T0: fidl::encoding::Encode<u64, D>,
3320        T1: fidl::encoding::Encode<u16, D>,
3321        T2: fidl::encoding::Encode<u16, D>,
3322    > fidl::encoding::Encode<RemoteServiceReadLongDescriptorRequest, D> for (T0, T1, T2)
3323    {
3324        #[inline]
3325        unsafe fn encode(
3326            self,
3327            encoder: &mut fidl::encoding::Encoder<'_, D>,
3328            offset: usize,
3329            depth: fidl::encoding::Depth,
3330        ) -> fidl::Result<()> {
3331            encoder.debug_check_bounds::<RemoteServiceReadLongDescriptorRequest>(offset);
3332            // Zero out padding regions. There's no need to apply masks
3333            // because the unmasked parts will be overwritten by fields.
3334            unsafe {
3335                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
3336                (ptr as *mut u64).write_unaligned(0);
3337            }
3338            // Write the fields.
3339            self.0.encode(encoder, offset + 0, depth)?;
3340            self.1.encode(encoder, offset + 8, depth)?;
3341            self.2.encode(encoder, offset + 10, depth)?;
3342            Ok(())
3343        }
3344    }
3345
3346    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3347        for RemoteServiceReadLongDescriptorRequest
3348    {
3349        #[inline(always)]
3350        fn new_empty() -> Self {
3351            Self {
3352                id: fidl::new_empty!(u64, D),
3353                offset: fidl::new_empty!(u16, D),
3354                max_bytes: fidl::new_empty!(u16, D),
3355            }
3356        }
3357
3358        #[inline]
3359        unsafe fn decode(
3360            &mut self,
3361            decoder: &mut fidl::encoding::Decoder<'_, D>,
3362            offset: usize,
3363            _depth: fidl::encoding::Depth,
3364        ) -> fidl::Result<()> {
3365            decoder.debug_check_bounds::<Self>(offset);
3366            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3367            // Verify that padding bytes are zero.
3368            let ptr = unsafe { buf_ptr.offset(8) };
3369            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3370            let mask = 0xffffffff00000000u64;
3371            let maskedval = padval & mask;
3372            if maskedval != 0 {
3373                return Err(fidl::Error::NonZeroPadding {
3374                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
3375                });
3376            }
3377            // Copy from the buffer into the object.
3378            unsafe {
3379                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
3380            }
3381            Ok(())
3382        }
3383    }
3384
3385    impl fidl::encoding::ValueTypeMarker for RemoteServiceReadLongDescriptorResponse {
3386        type Borrowed<'a> = &'a Self;
3387        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3388            value
3389        }
3390    }
3391
3392    unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadLongDescriptorResponse {
3393        type Owned = Self;
3394
3395        #[inline(always)]
3396        fn inline_align(_context: fidl::encoding::Context) -> usize {
3397            8
3398        }
3399
3400        #[inline(always)]
3401        fn inline_size(_context: fidl::encoding::Context) -> usize {
3402            24
3403        }
3404    }
3405
3406    unsafe impl<D: fidl::encoding::ResourceDialect>
3407        fidl::encoding::Encode<RemoteServiceReadLongDescriptorResponse, D>
3408        for &RemoteServiceReadLongDescriptorResponse
3409    {
3410        #[inline]
3411        unsafe fn encode(
3412            self,
3413            encoder: &mut fidl::encoding::Encoder<'_, D>,
3414            offset: usize,
3415            _depth: fidl::encoding::Depth,
3416        ) -> fidl::Result<()> {
3417            encoder.debug_check_bounds::<RemoteServiceReadLongDescriptorResponse>(offset);
3418            // Delegate to tuple encoding.
3419            fidl::encoding::Encode::<RemoteServiceReadLongDescriptorResponse, D>::encode(
3420                (
3421                    <fidl_fuchsia_bluetooth__common::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
3422                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
3423                ),
3424                encoder, offset, _depth
3425            )
3426        }
3427    }
3428    unsafe impl<
3429        D: fidl::encoding::ResourceDialect,
3430        T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth__common::Status, D>,
3431        T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
3432    > fidl::encoding::Encode<RemoteServiceReadLongDescriptorResponse, D> for (T0, T1)
3433    {
3434        #[inline]
3435        unsafe fn encode(
3436            self,
3437            encoder: &mut fidl::encoding::Encoder<'_, D>,
3438            offset: usize,
3439            depth: fidl::encoding::Depth,
3440        ) -> fidl::Result<()> {
3441            encoder.debug_check_bounds::<RemoteServiceReadLongDescriptorResponse>(offset);
3442            // Zero out padding regions. There's no need to apply masks
3443            // because the unmasked parts will be overwritten by fields.
3444            // Write the fields.
3445            self.0.encode(encoder, offset + 0, depth)?;
3446            self.1.encode(encoder, offset + 8, depth)?;
3447            Ok(())
3448        }
3449    }
3450
3451    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3452        for RemoteServiceReadLongDescriptorResponse
3453    {
3454        #[inline(always)]
3455        fn new_empty() -> Self {
3456            Self {
3457                status: fidl::new_empty!(fidl_fuchsia_bluetooth__common::Status, D),
3458                value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
3459            }
3460        }
3461
3462        #[inline]
3463        unsafe fn decode(
3464            &mut self,
3465            decoder: &mut fidl::encoding::Decoder<'_, D>,
3466            offset: usize,
3467            _depth: fidl::encoding::Depth,
3468        ) -> fidl::Result<()> {
3469            decoder.debug_check_bounds::<Self>(offset);
3470            // Verify that padding bytes are zero.
3471            fidl::decode!(
3472                fidl_fuchsia_bluetooth__common::Status,
3473                D,
3474                &mut self.status,
3475                decoder,
3476                offset + 0,
3477                _depth
3478            )?;
3479            fidl::decode!(
3480                fidl::encoding::UnboundedVector<u8>,
3481                D,
3482                &mut self.value,
3483                decoder,
3484                offset + 8,
3485                _depth
3486            )?;
3487            Ok(())
3488        }
3489    }
3490
3491    impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteCharacteristicRequest {
3492        type Borrowed<'a> = &'a Self;
3493        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3494            value
3495        }
3496    }
3497
3498    unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteCharacteristicRequest {
3499        type Owned = Self;
3500
3501        #[inline(always)]
3502        fn inline_align(_context: fidl::encoding::Context) -> usize {
3503            8
3504        }
3505
3506        #[inline(always)]
3507        fn inline_size(_context: fidl::encoding::Context) -> usize {
3508            24
3509        }
3510    }
3511
3512    unsafe impl<D: fidl::encoding::ResourceDialect>
3513        fidl::encoding::Encode<RemoteServiceWriteCharacteristicRequest, D>
3514        for &RemoteServiceWriteCharacteristicRequest
3515    {
3516        #[inline]
3517        unsafe fn encode(
3518            self,
3519            encoder: &mut fidl::encoding::Encoder<'_, D>,
3520            offset: usize,
3521            _depth: fidl::encoding::Depth,
3522        ) -> fidl::Result<()> {
3523            encoder.debug_check_bounds::<RemoteServiceWriteCharacteristicRequest>(offset);
3524            // Delegate to tuple encoding.
3525            fidl::encoding::Encode::<RemoteServiceWriteCharacteristicRequest, D>::encode(
3526                (
3527                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
3528                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
3529                ),
3530                encoder, offset, _depth
3531            )
3532        }
3533    }
3534    unsafe impl<
3535        D: fidl::encoding::ResourceDialect,
3536        T0: fidl::encoding::Encode<u64, D>,
3537        T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
3538    > fidl::encoding::Encode<RemoteServiceWriteCharacteristicRequest, D> for (T0, T1)
3539    {
3540        #[inline]
3541        unsafe fn encode(
3542            self,
3543            encoder: &mut fidl::encoding::Encoder<'_, D>,
3544            offset: usize,
3545            depth: fidl::encoding::Depth,
3546        ) -> fidl::Result<()> {
3547            encoder.debug_check_bounds::<RemoteServiceWriteCharacteristicRequest>(offset);
3548            // Zero out padding regions. There's no need to apply masks
3549            // because the unmasked parts will be overwritten by fields.
3550            // Write the fields.
3551            self.0.encode(encoder, offset + 0, depth)?;
3552            self.1.encode(encoder, offset + 8, depth)?;
3553            Ok(())
3554        }
3555    }
3556
3557    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3558        for RemoteServiceWriteCharacteristicRequest
3559    {
3560        #[inline(always)]
3561        fn new_empty() -> Self {
3562            Self {
3563                id: fidl::new_empty!(u64, D),
3564                value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
3565            }
3566        }
3567
3568        #[inline]
3569        unsafe fn decode(
3570            &mut self,
3571            decoder: &mut fidl::encoding::Decoder<'_, D>,
3572            offset: usize,
3573            _depth: fidl::encoding::Depth,
3574        ) -> fidl::Result<()> {
3575            decoder.debug_check_bounds::<Self>(offset);
3576            // Verify that padding bytes are zero.
3577            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
3578            fidl::decode!(
3579                fidl::encoding::UnboundedVector<u8>,
3580                D,
3581                &mut self.value,
3582                decoder,
3583                offset + 8,
3584                _depth
3585            )?;
3586            Ok(())
3587        }
3588    }
3589
3590    impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteCharacteristicResponse {
3591        type Borrowed<'a> = &'a Self;
3592        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3593            value
3594        }
3595    }
3596
3597    unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteCharacteristicResponse {
3598        type Owned = Self;
3599
3600        #[inline(always)]
3601        fn inline_align(_context: fidl::encoding::Context) -> usize {
3602            8
3603        }
3604
3605        #[inline(always)]
3606        fn inline_size(_context: fidl::encoding::Context) -> usize {
3607            8
3608        }
3609    }
3610
3611    unsafe impl<D: fidl::encoding::ResourceDialect>
3612        fidl::encoding::Encode<RemoteServiceWriteCharacteristicResponse, D>
3613        for &RemoteServiceWriteCharacteristicResponse
3614    {
3615        #[inline]
3616        unsafe fn encode(
3617            self,
3618            encoder: &mut fidl::encoding::Encoder<'_, D>,
3619            offset: usize,
3620            _depth: fidl::encoding::Depth,
3621        ) -> fidl::Result<()> {
3622            encoder.debug_check_bounds::<RemoteServiceWriteCharacteristicResponse>(offset);
3623            // Delegate to tuple encoding.
3624            fidl::encoding::Encode::<RemoteServiceWriteCharacteristicResponse, D>::encode(
3625                (
3626                    <fidl_fuchsia_bluetooth__common::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
3627                ),
3628                encoder, offset, _depth
3629            )
3630        }
3631    }
3632    unsafe impl<
3633        D: fidl::encoding::ResourceDialect,
3634        T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth__common::Status, D>,
3635    > fidl::encoding::Encode<RemoteServiceWriteCharacteristicResponse, D> for (T0,)
3636    {
3637        #[inline]
3638        unsafe fn encode(
3639            self,
3640            encoder: &mut fidl::encoding::Encoder<'_, D>,
3641            offset: usize,
3642            depth: fidl::encoding::Depth,
3643        ) -> fidl::Result<()> {
3644            encoder.debug_check_bounds::<RemoteServiceWriteCharacteristicResponse>(offset);
3645            // Zero out padding regions. There's no need to apply masks
3646            // because the unmasked parts will be overwritten by fields.
3647            // Write the fields.
3648            self.0.encode(encoder, offset + 0, depth)?;
3649            Ok(())
3650        }
3651    }
3652
3653    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3654        for RemoteServiceWriteCharacteristicResponse
3655    {
3656        #[inline(always)]
3657        fn new_empty() -> Self {
3658            Self { status: fidl::new_empty!(fidl_fuchsia_bluetooth__common::Status, D) }
3659        }
3660
3661        #[inline]
3662        unsafe fn decode(
3663            &mut self,
3664            decoder: &mut fidl::encoding::Decoder<'_, D>,
3665            offset: usize,
3666            _depth: fidl::encoding::Depth,
3667        ) -> fidl::Result<()> {
3668            decoder.debug_check_bounds::<Self>(offset);
3669            // Verify that padding bytes are zero.
3670            fidl::decode!(
3671                fidl_fuchsia_bluetooth__common::Status,
3672                D,
3673                &mut self.status,
3674                decoder,
3675                offset + 0,
3676                _depth
3677            )?;
3678            Ok(())
3679        }
3680    }
3681
3682    impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteCharacteristicWithoutResponseRequest {
3683        type Borrowed<'a> = &'a Self;
3684        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3685            value
3686        }
3687    }
3688
3689    unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteCharacteristicWithoutResponseRequest {
3690        type Owned = Self;
3691
3692        #[inline(always)]
3693        fn inline_align(_context: fidl::encoding::Context) -> usize {
3694            8
3695        }
3696
3697        #[inline(always)]
3698        fn inline_size(_context: fidl::encoding::Context) -> usize {
3699            24
3700        }
3701    }
3702
3703    unsafe impl<D: fidl::encoding::ResourceDialect>
3704        fidl::encoding::Encode<RemoteServiceWriteCharacteristicWithoutResponseRequest, D>
3705        for &RemoteServiceWriteCharacteristicWithoutResponseRequest
3706    {
3707        #[inline]
3708        unsafe fn encode(
3709            self,
3710            encoder: &mut fidl::encoding::Encoder<'_, D>,
3711            offset: usize,
3712            _depth: fidl::encoding::Depth,
3713        ) -> fidl::Result<()> {
3714            encoder.debug_check_bounds::<RemoteServiceWriteCharacteristicWithoutResponseRequest>(
3715                offset,
3716            );
3717            // Delegate to tuple encoding.
3718            fidl::encoding::Encode::<RemoteServiceWriteCharacteristicWithoutResponseRequest, D>::encode(
3719                (
3720                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
3721                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
3722                ),
3723                encoder, offset, _depth
3724            )
3725        }
3726    }
3727    unsafe impl<
3728        D: fidl::encoding::ResourceDialect,
3729        T0: fidl::encoding::Encode<u64, D>,
3730        T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
3731    > fidl::encoding::Encode<RemoteServiceWriteCharacteristicWithoutResponseRequest, D>
3732        for (T0, T1)
3733    {
3734        #[inline]
3735        unsafe fn encode(
3736            self,
3737            encoder: &mut fidl::encoding::Encoder<'_, D>,
3738            offset: usize,
3739            depth: fidl::encoding::Depth,
3740        ) -> fidl::Result<()> {
3741            encoder.debug_check_bounds::<RemoteServiceWriteCharacteristicWithoutResponseRequest>(
3742                offset,
3743            );
3744            // Zero out padding regions. There's no need to apply masks
3745            // because the unmasked parts will be overwritten by fields.
3746            // Write the fields.
3747            self.0.encode(encoder, offset + 0, depth)?;
3748            self.1.encode(encoder, offset + 8, depth)?;
3749            Ok(())
3750        }
3751    }
3752
3753    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3754        for RemoteServiceWriteCharacteristicWithoutResponseRequest
3755    {
3756        #[inline(always)]
3757        fn new_empty() -> Self {
3758            Self {
3759                id: fidl::new_empty!(u64, D),
3760                value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
3761            }
3762        }
3763
3764        #[inline]
3765        unsafe fn decode(
3766            &mut self,
3767            decoder: &mut fidl::encoding::Decoder<'_, D>,
3768            offset: usize,
3769            _depth: fidl::encoding::Depth,
3770        ) -> fidl::Result<()> {
3771            decoder.debug_check_bounds::<Self>(offset);
3772            // Verify that padding bytes are zero.
3773            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
3774            fidl::decode!(
3775                fidl::encoding::UnboundedVector<u8>,
3776                D,
3777                &mut self.value,
3778                decoder,
3779                offset + 8,
3780                _depth
3781            )?;
3782            Ok(())
3783        }
3784    }
3785
3786    impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteDescriptorRequest {
3787        type Borrowed<'a> = &'a Self;
3788        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3789            value
3790        }
3791    }
3792
3793    unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteDescriptorRequest {
3794        type Owned = Self;
3795
3796        #[inline(always)]
3797        fn inline_align(_context: fidl::encoding::Context) -> usize {
3798            8
3799        }
3800
3801        #[inline(always)]
3802        fn inline_size(_context: fidl::encoding::Context) -> usize {
3803            24
3804        }
3805    }
3806
3807    unsafe impl<D: fidl::encoding::ResourceDialect>
3808        fidl::encoding::Encode<RemoteServiceWriteDescriptorRequest, D>
3809        for &RemoteServiceWriteDescriptorRequest
3810    {
3811        #[inline]
3812        unsafe fn encode(
3813            self,
3814            encoder: &mut fidl::encoding::Encoder<'_, D>,
3815            offset: usize,
3816            _depth: fidl::encoding::Depth,
3817        ) -> fidl::Result<()> {
3818            encoder.debug_check_bounds::<RemoteServiceWriteDescriptorRequest>(offset);
3819            // Delegate to tuple encoding.
3820            fidl::encoding::Encode::<RemoteServiceWriteDescriptorRequest, D>::encode(
3821                (
3822                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
3823                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
3824                ),
3825                encoder, offset, _depth
3826            )
3827        }
3828    }
3829    unsafe impl<
3830        D: fidl::encoding::ResourceDialect,
3831        T0: fidl::encoding::Encode<u64, D>,
3832        T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
3833    > fidl::encoding::Encode<RemoteServiceWriteDescriptorRequest, D> for (T0, T1)
3834    {
3835        #[inline]
3836        unsafe fn encode(
3837            self,
3838            encoder: &mut fidl::encoding::Encoder<'_, D>,
3839            offset: usize,
3840            depth: fidl::encoding::Depth,
3841        ) -> fidl::Result<()> {
3842            encoder.debug_check_bounds::<RemoteServiceWriteDescriptorRequest>(offset);
3843            // Zero out padding regions. There's no need to apply masks
3844            // because the unmasked parts will be overwritten by fields.
3845            // Write the fields.
3846            self.0.encode(encoder, offset + 0, depth)?;
3847            self.1.encode(encoder, offset + 8, depth)?;
3848            Ok(())
3849        }
3850    }
3851
3852    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3853        for RemoteServiceWriteDescriptorRequest
3854    {
3855        #[inline(always)]
3856        fn new_empty() -> Self {
3857            Self {
3858                id: fidl::new_empty!(u64, D),
3859                value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
3860            }
3861        }
3862
3863        #[inline]
3864        unsafe fn decode(
3865            &mut self,
3866            decoder: &mut fidl::encoding::Decoder<'_, D>,
3867            offset: usize,
3868            _depth: fidl::encoding::Depth,
3869        ) -> fidl::Result<()> {
3870            decoder.debug_check_bounds::<Self>(offset);
3871            // Verify that padding bytes are zero.
3872            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
3873            fidl::decode!(
3874                fidl::encoding::UnboundedVector<u8>,
3875                D,
3876                &mut self.value,
3877                decoder,
3878                offset + 8,
3879                _depth
3880            )?;
3881            Ok(())
3882        }
3883    }
3884
3885    impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteDescriptorResponse {
3886        type Borrowed<'a> = &'a Self;
3887        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3888            value
3889        }
3890    }
3891
3892    unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteDescriptorResponse {
3893        type Owned = Self;
3894
3895        #[inline(always)]
3896        fn inline_align(_context: fidl::encoding::Context) -> usize {
3897            8
3898        }
3899
3900        #[inline(always)]
3901        fn inline_size(_context: fidl::encoding::Context) -> usize {
3902            8
3903        }
3904    }
3905
3906    unsafe impl<D: fidl::encoding::ResourceDialect>
3907        fidl::encoding::Encode<RemoteServiceWriteDescriptorResponse, D>
3908        for &RemoteServiceWriteDescriptorResponse
3909    {
3910        #[inline]
3911        unsafe fn encode(
3912            self,
3913            encoder: &mut fidl::encoding::Encoder<'_, D>,
3914            offset: usize,
3915            _depth: fidl::encoding::Depth,
3916        ) -> fidl::Result<()> {
3917            encoder.debug_check_bounds::<RemoteServiceWriteDescriptorResponse>(offset);
3918            // Delegate to tuple encoding.
3919            fidl::encoding::Encode::<RemoteServiceWriteDescriptorResponse, D>::encode(
3920                (
3921                    <fidl_fuchsia_bluetooth__common::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
3922                ),
3923                encoder, offset, _depth
3924            )
3925        }
3926    }
3927    unsafe impl<
3928        D: fidl::encoding::ResourceDialect,
3929        T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth__common::Status, D>,
3930    > fidl::encoding::Encode<RemoteServiceWriteDescriptorResponse, D> for (T0,)
3931    {
3932        #[inline]
3933        unsafe fn encode(
3934            self,
3935            encoder: &mut fidl::encoding::Encoder<'_, D>,
3936            offset: usize,
3937            depth: fidl::encoding::Depth,
3938        ) -> fidl::Result<()> {
3939            encoder.debug_check_bounds::<RemoteServiceWriteDescriptorResponse>(offset);
3940            // Zero out padding regions. There's no need to apply masks
3941            // because the unmasked parts will be overwritten by fields.
3942            // Write the fields.
3943            self.0.encode(encoder, offset + 0, depth)?;
3944            Ok(())
3945        }
3946    }
3947
3948    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3949        for RemoteServiceWriteDescriptorResponse
3950    {
3951        #[inline(always)]
3952        fn new_empty() -> Self {
3953            Self { status: fidl::new_empty!(fidl_fuchsia_bluetooth__common::Status, D) }
3954        }
3955
3956        #[inline]
3957        unsafe fn decode(
3958            &mut self,
3959            decoder: &mut fidl::encoding::Decoder<'_, D>,
3960            offset: usize,
3961            _depth: fidl::encoding::Depth,
3962        ) -> fidl::Result<()> {
3963            decoder.debug_check_bounds::<Self>(offset);
3964            // Verify that padding bytes are zero.
3965            fidl::decode!(
3966                fidl_fuchsia_bluetooth__common::Status,
3967                D,
3968                &mut self.status,
3969                decoder,
3970                offset + 0,
3971                _depth
3972            )?;
3973            Ok(())
3974        }
3975    }
3976
3977    impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteLongCharacteristicRequest {
3978        type Borrowed<'a> = &'a Self;
3979        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3980            value
3981        }
3982    }
3983
3984    unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteLongCharacteristicRequest {
3985        type Owned = Self;
3986
3987        #[inline(always)]
3988        fn inline_align(_context: fidl::encoding::Context) -> usize {
3989            8
3990        }
3991
3992        #[inline(always)]
3993        fn inline_size(_context: fidl::encoding::Context) -> usize {
3994            48
3995        }
3996    }
3997
3998    unsafe impl<D: fidl::encoding::ResourceDialect>
3999        fidl::encoding::Encode<RemoteServiceWriteLongCharacteristicRequest, D>
4000        for &RemoteServiceWriteLongCharacteristicRequest
4001    {
4002        #[inline]
4003        unsafe fn encode(
4004            self,
4005            encoder: &mut fidl::encoding::Encoder<'_, D>,
4006            offset: usize,
4007            _depth: fidl::encoding::Depth,
4008        ) -> fidl::Result<()> {
4009            encoder.debug_check_bounds::<RemoteServiceWriteLongCharacteristicRequest>(offset);
4010            // Delegate to tuple encoding.
4011            fidl::encoding::Encode::<RemoteServiceWriteLongCharacteristicRequest, D>::encode(
4012                (
4013                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
4014                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.offset),
4015                    <fidl::encoding::Vector<u8, 512> as fidl::encoding::ValueTypeMarker>::borrow(
4016                        &self.value,
4017                    ),
4018                    <WriteOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.write_options),
4019                ),
4020                encoder,
4021                offset,
4022                _depth,
4023            )
4024        }
4025    }
4026    unsafe impl<
4027        D: fidl::encoding::ResourceDialect,
4028        T0: fidl::encoding::Encode<u64, D>,
4029        T1: fidl::encoding::Encode<u16, D>,
4030        T2: fidl::encoding::Encode<fidl::encoding::Vector<u8, 512>, D>,
4031        T3: fidl::encoding::Encode<WriteOptions, D>,
4032    > fidl::encoding::Encode<RemoteServiceWriteLongCharacteristicRequest, D> for (T0, T1, T2, T3)
4033    {
4034        #[inline]
4035        unsafe fn encode(
4036            self,
4037            encoder: &mut fidl::encoding::Encoder<'_, D>,
4038            offset: usize,
4039            depth: fidl::encoding::Depth,
4040        ) -> fidl::Result<()> {
4041            encoder.debug_check_bounds::<RemoteServiceWriteLongCharacteristicRequest>(offset);
4042            // Zero out padding regions. There's no need to apply masks
4043            // because the unmasked parts will be overwritten by fields.
4044            unsafe {
4045                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
4046                (ptr as *mut u64).write_unaligned(0);
4047            }
4048            // Write the fields.
4049            self.0.encode(encoder, offset + 0, depth)?;
4050            self.1.encode(encoder, offset + 8, depth)?;
4051            self.2.encode(encoder, offset + 16, depth)?;
4052            self.3.encode(encoder, offset + 32, depth)?;
4053            Ok(())
4054        }
4055    }
4056
4057    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4058        for RemoteServiceWriteLongCharacteristicRequest
4059    {
4060        #[inline(always)]
4061        fn new_empty() -> Self {
4062            Self {
4063                id: fidl::new_empty!(u64, D),
4064                offset: fidl::new_empty!(u16, D),
4065                value: fidl::new_empty!(fidl::encoding::Vector<u8, 512>, D),
4066                write_options: fidl::new_empty!(WriteOptions, D),
4067            }
4068        }
4069
4070        #[inline]
4071        unsafe fn decode(
4072            &mut self,
4073            decoder: &mut fidl::encoding::Decoder<'_, D>,
4074            offset: usize,
4075            _depth: fidl::encoding::Depth,
4076        ) -> fidl::Result<()> {
4077            decoder.debug_check_bounds::<Self>(offset);
4078            // Verify that padding bytes are zero.
4079            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
4080            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4081            let mask = 0xffffffffffff0000u64;
4082            let maskedval = padval & mask;
4083            if maskedval != 0 {
4084                return Err(fidl::Error::NonZeroPadding {
4085                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
4086                });
4087            }
4088            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
4089            fidl::decode!(u16, D, &mut self.offset, decoder, offset + 8, _depth)?;
4090            fidl::decode!(fidl::encoding::Vector<u8, 512>, D, &mut self.value, decoder, offset + 16, _depth)?;
4091            fidl::decode!(WriteOptions, D, &mut self.write_options, decoder, offset + 32, _depth)?;
4092            Ok(())
4093        }
4094    }
4095
4096    impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteLongCharacteristicResponse {
4097        type Borrowed<'a> = &'a Self;
4098        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4099            value
4100        }
4101    }
4102
4103    unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteLongCharacteristicResponse {
4104        type Owned = Self;
4105
4106        #[inline(always)]
4107        fn inline_align(_context: fidl::encoding::Context) -> usize {
4108            8
4109        }
4110
4111        #[inline(always)]
4112        fn inline_size(_context: fidl::encoding::Context) -> usize {
4113            8
4114        }
4115    }
4116
4117    unsafe impl<D: fidl::encoding::ResourceDialect>
4118        fidl::encoding::Encode<RemoteServiceWriteLongCharacteristicResponse, D>
4119        for &RemoteServiceWriteLongCharacteristicResponse
4120    {
4121        #[inline]
4122        unsafe fn encode(
4123            self,
4124            encoder: &mut fidl::encoding::Encoder<'_, D>,
4125            offset: usize,
4126            _depth: fidl::encoding::Depth,
4127        ) -> fidl::Result<()> {
4128            encoder.debug_check_bounds::<RemoteServiceWriteLongCharacteristicResponse>(offset);
4129            // Delegate to tuple encoding.
4130            fidl::encoding::Encode::<RemoteServiceWriteLongCharacteristicResponse, D>::encode(
4131                (
4132                    <fidl_fuchsia_bluetooth__common::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
4133                ),
4134                encoder, offset, _depth
4135            )
4136        }
4137    }
4138    unsafe impl<
4139        D: fidl::encoding::ResourceDialect,
4140        T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth__common::Status, D>,
4141    > fidl::encoding::Encode<RemoteServiceWriteLongCharacteristicResponse, D> for (T0,)
4142    {
4143        #[inline]
4144        unsafe fn encode(
4145            self,
4146            encoder: &mut fidl::encoding::Encoder<'_, D>,
4147            offset: usize,
4148            depth: fidl::encoding::Depth,
4149        ) -> fidl::Result<()> {
4150            encoder.debug_check_bounds::<RemoteServiceWriteLongCharacteristicResponse>(offset);
4151            // Zero out padding regions. There's no need to apply masks
4152            // because the unmasked parts will be overwritten by fields.
4153            // Write the fields.
4154            self.0.encode(encoder, offset + 0, depth)?;
4155            Ok(())
4156        }
4157    }
4158
4159    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4160        for RemoteServiceWriteLongCharacteristicResponse
4161    {
4162        #[inline(always)]
4163        fn new_empty() -> Self {
4164            Self { status: fidl::new_empty!(fidl_fuchsia_bluetooth__common::Status, D) }
4165        }
4166
4167        #[inline]
4168        unsafe fn decode(
4169            &mut self,
4170            decoder: &mut fidl::encoding::Decoder<'_, D>,
4171            offset: usize,
4172            _depth: fidl::encoding::Depth,
4173        ) -> fidl::Result<()> {
4174            decoder.debug_check_bounds::<Self>(offset);
4175            // Verify that padding bytes are zero.
4176            fidl::decode!(
4177                fidl_fuchsia_bluetooth__common::Status,
4178                D,
4179                &mut self.status,
4180                decoder,
4181                offset + 0,
4182                _depth
4183            )?;
4184            Ok(())
4185        }
4186    }
4187
4188    impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteLongDescriptorRequest {
4189        type Borrowed<'a> = &'a Self;
4190        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4191            value
4192        }
4193    }
4194
4195    unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteLongDescriptorRequest {
4196        type Owned = Self;
4197
4198        #[inline(always)]
4199        fn inline_align(_context: fidl::encoding::Context) -> usize {
4200            8
4201        }
4202
4203        #[inline(always)]
4204        fn inline_size(_context: fidl::encoding::Context) -> usize {
4205            32
4206        }
4207    }
4208
4209    unsafe impl<D: fidl::encoding::ResourceDialect>
4210        fidl::encoding::Encode<RemoteServiceWriteLongDescriptorRequest, D>
4211        for &RemoteServiceWriteLongDescriptorRequest
4212    {
4213        #[inline]
4214        unsafe fn encode(
4215            self,
4216            encoder: &mut fidl::encoding::Encoder<'_, D>,
4217            offset: usize,
4218            _depth: fidl::encoding::Depth,
4219        ) -> fidl::Result<()> {
4220            encoder.debug_check_bounds::<RemoteServiceWriteLongDescriptorRequest>(offset);
4221            // Delegate to tuple encoding.
4222            fidl::encoding::Encode::<RemoteServiceWriteLongDescriptorRequest, D>::encode(
4223                (
4224                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
4225                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.offset),
4226                    <fidl::encoding::Vector<u8, 512> as fidl::encoding::ValueTypeMarker>::borrow(
4227                        &self.value,
4228                    ),
4229                ),
4230                encoder,
4231                offset,
4232                _depth,
4233            )
4234        }
4235    }
4236    unsafe impl<
4237        D: fidl::encoding::ResourceDialect,
4238        T0: fidl::encoding::Encode<u64, D>,
4239        T1: fidl::encoding::Encode<u16, D>,
4240        T2: fidl::encoding::Encode<fidl::encoding::Vector<u8, 512>, D>,
4241    > fidl::encoding::Encode<RemoteServiceWriteLongDescriptorRequest, D> for (T0, T1, T2)
4242    {
4243        #[inline]
4244        unsafe fn encode(
4245            self,
4246            encoder: &mut fidl::encoding::Encoder<'_, D>,
4247            offset: usize,
4248            depth: fidl::encoding::Depth,
4249        ) -> fidl::Result<()> {
4250            encoder.debug_check_bounds::<RemoteServiceWriteLongDescriptorRequest>(offset);
4251            // Zero out padding regions. There's no need to apply masks
4252            // because the unmasked parts will be overwritten by fields.
4253            unsafe {
4254                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
4255                (ptr as *mut u64).write_unaligned(0);
4256            }
4257            // Write the fields.
4258            self.0.encode(encoder, offset + 0, depth)?;
4259            self.1.encode(encoder, offset + 8, depth)?;
4260            self.2.encode(encoder, offset + 16, depth)?;
4261            Ok(())
4262        }
4263    }
4264
4265    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4266        for RemoteServiceWriteLongDescriptorRequest
4267    {
4268        #[inline(always)]
4269        fn new_empty() -> Self {
4270            Self {
4271                id: fidl::new_empty!(u64, D),
4272                offset: fidl::new_empty!(u16, D),
4273                value: fidl::new_empty!(fidl::encoding::Vector<u8, 512>, D),
4274            }
4275        }
4276
4277        #[inline]
4278        unsafe fn decode(
4279            &mut self,
4280            decoder: &mut fidl::encoding::Decoder<'_, D>,
4281            offset: usize,
4282            _depth: fidl::encoding::Depth,
4283        ) -> fidl::Result<()> {
4284            decoder.debug_check_bounds::<Self>(offset);
4285            // Verify that padding bytes are zero.
4286            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
4287            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4288            let mask = 0xffffffffffff0000u64;
4289            let maskedval = padval & mask;
4290            if maskedval != 0 {
4291                return Err(fidl::Error::NonZeroPadding {
4292                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
4293                });
4294            }
4295            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
4296            fidl::decode!(u16, D, &mut self.offset, decoder, offset + 8, _depth)?;
4297            fidl::decode!(fidl::encoding::Vector<u8, 512>, D, &mut self.value, decoder, offset + 16, _depth)?;
4298            Ok(())
4299        }
4300    }
4301
4302    impl fidl::encoding::ValueTypeMarker for RemoteServiceWriteLongDescriptorResponse {
4303        type Borrowed<'a> = &'a Self;
4304        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4305            value
4306        }
4307    }
4308
4309    unsafe impl fidl::encoding::TypeMarker for RemoteServiceWriteLongDescriptorResponse {
4310        type Owned = Self;
4311
4312        #[inline(always)]
4313        fn inline_align(_context: fidl::encoding::Context) -> usize {
4314            8
4315        }
4316
4317        #[inline(always)]
4318        fn inline_size(_context: fidl::encoding::Context) -> usize {
4319            8
4320        }
4321    }
4322
4323    unsafe impl<D: fidl::encoding::ResourceDialect>
4324        fidl::encoding::Encode<RemoteServiceWriteLongDescriptorResponse, D>
4325        for &RemoteServiceWriteLongDescriptorResponse
4326    {
4327        #[inline]
4328        unsafe fn encode(
4329            self,
4330            encoder: &mut fidl::encoding::Encoder<'_, D>,
4331            offset: usize,
4332            _depth: fidl::encoding::Depth,
4333        ) -> fidl::Result<()> {
4334            encoder.debug_check_bounds::<RemoteServiceWriteLongDescriptorResponse>(offset);
4335            // Delegate to tuple encoding.
4336            fidl::encoding::Encode::<RemoteServiceWriteLongDescriptorResponse, D>::encode(
4337                (
4338                    <fidl_fuchsia_bluetooth__common::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
4339                ),
4340                encoder, offset, _depth
4341            )
4342        }
4343    }
4344    unsafe impl<
4345        D: fidl::encoding::ResourceDialect,
4346        T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth__common::Status, D>,
4347    > fidl::encoding::Encode<RemoteServiceWriteLongDescriptorResponse, D> for (T0,)
4348    {
4349        #[inline]
4350        unsafe fn encode(
4351            self,
4352            encoder: &mut fidl::encoding::Encoder<'_, D>,
4353            offset: usize,
4354            depth: fidl::encoding::Depth,
4355        ) -> fidl::Result<()> {
4356            encoder.debug_check_bounds::<RemoteServiceWriteLongDescriptorResponse>(offset);
4357            // Zero out padding regions. There's no need to apply masks
4358            // because the unmasked parts will be overwritten by fields.
4359            // Write the fields.
4360            self.0.encode(encoder, offset + 0, depth)?;
4361            Ok(())
4362        }
4363    }
4364
4365    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4366        for RemoteServiceWriteLongDescriptorResponse
4367    {
4368        #[inline(always)]
4369        fn new_empty() -> Self {
4370            Self { status: fidl::new_empty!(fidl_fuchsia_bluetooth__common::Status, D) }
4371        }
4372
4373        #[inline]
4374        unsafe fn decode(
4375            &mut self,
4376            decoder: &mut fidl::encoding::Decoder<'_, D>,
4377            offset: usize,
4378            _depth: fidl::encoding::Depth,
4379        ) -> fidl::Result<()> {
4380            decoder.debug_check_bounds::<Self>(offset);
4381            // Verify that padding bytes are zero.
4382            fidl::decode!(
4383                fidl_fuchsia_bluetooth__common::Status,
4384                D,
4385                &mut self.status,
4386                decoder,
4387                offset + 0,
4388                _depth
4389            )?;
4390            Ok(())
4391        }
4392    }
4393
4394    impl fidl::encoding::ValueTypeMarker for RemoteServiceReadByTypeResponse {
4395        type Borrowed<'a> = &'a Self;
4396        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4397            value
4398        }
4399    }
4400
4401    unsafe impl fidl::encoding::TypeMarker for RemoteServiceReadByTypeResponse {
4402        type Owned = Self;
4403
4404        #[inline(always)]
4405        fn inline_align(_context: fidl::encoding::Context) -> usize {
4406            8
4407        }
4408
4409        #[inline(always)]
4410        fn inline_size(_context: fidl::encoding::Context) -> usize {
4411            16
4412        }
4413    }
4414
4415    unsafe impl<D: fidl::encoding::ResourceDialect>
4416        fidl::encoding::Encode<RemoteServiceReadByTypeResponse, D>
4417        for &RemoteServiceReadByTypeResponse
4418    {
4419        #[inline]
4420        unsafe fn encode(
4421            self,
4422            encoder: &mut fidl::encoding::Encoder<'_, D>,
4423            offset: usize,
4424            _depth: fidl::encoding::Depth,
4425        ) -> fidl::Result<()> {
4426            encoder.debug_check_bounds::<RemoteServiceReadByTypeResponse>(offset);
4427            // Delegate to tuple encoding.
4428            fidl::encoding::Encode::<RemoteServiceReadByTypeResponse, D>::encode(
4429                (
4430                    <fidl::encoding::Vector<ReadByTypeResult, 189> as fidl::encoding::ValueTypeMarker>::borrow(&self.results),
4431                ),
4432                encoder, offset, _depth
4433            )
4434        }
4435    }
4436    unsafe impl<
4437        D: fidl::encoding::ResourceDialect,
4438        T0: fidl::encoding::Encode<fidl::encoding::Vector<ReadByTypeResult, 189>, D>,
4439    > fidl::encoding::Encode<RemoteServiceReadByTypeResponse, D> for (T0,)
4440    {
4441        #[inline]
4442        unsafe fn encode(
4443            self,
4444            encoder: &mut fidl::encoding::Encoder<'_, D>,
4445            offset: usize,
4446            depth: fidl::encoding::Depth,
4447        ) -> fidl::Result<()> {
4448            encoder.debug_check_bounds::<RemoteServiceReadByTypeResponse>(offset);
4449            // Zero out padding regions. There's no need to apply masks
4450            // because the unmasked parts will be overwritten by fields.
4451            // Write the fields.
4452            self.0.encode(encoder, offset + 0, depth)?;
4453            Ok(())
4454        }
4455    }
4456
4457    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4458        for RemoteServiceReadByTypeResponse
4459    {
4460        #[inline(always)]
4461        fn new_empty() -> Self {
4462            Self { results: fidl::new_empty!(fidl::encoding::Vector<ReadByTypeResult, 189>, D) }
4463        }
4464
4465        #[inline]
4466        unsafe fn decode(
4467            &mut self,
4468            decoder: &mut fidl::encoding::Decoder<'_, D>,
4469            offset: usize,
4470            _depth: fidl::encoding::Depth,
4471        ) -> fidl::Result<()> {
4472            decoder.debug_check_bounds::<Self>(offset);
4473            // Verify that padding bytes are zero.
4474            fidl::decode!(fidl::encoding::Vector<ReadByTypeResult, 189>, D, &mut self.results, decoder, offset + 0, _depth)?;
4475            Ok(())
4476        }
4477    }
4478
4479    impl fidl::encoding::ValueTypeMarker for SecurityRequirements {
4480        type Borrowed<'a> = &'a Self;
4481        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4482            value
4483        }
4484    }
4485
4486    unsafe impl fidl::encoding::TypeMarker for SecurityRequirements {
4487        type Owned = Self;
4488
4489        #[inline(always)]
4490        fn inline_align(_context: fidl::encoding::Context) -> usize {
4491            1
4492        }
4493
4494        #[inline(always)]
4495        fn inline_size(_context: fidl::encoding::Context) -> usize {
4496            3
4497        }
4498    }
4499
4500    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SecurityRequirements, D>
4501        for &SecurityRequirements
4502    {
4503        #[inline]
4504        unsafe fn encode(
4505            self,
4506            encoder: &mut fidl::encoding::Encoder<'_, D>,
4507            offset: usize,
4508            _depth: fidl::encoding::Depth,
4509        ) -> fidl::Result<()> {
4510            encoder.debug_check_bounds::<SecurityRequirements>(offset);
4511            // Delegate to tuple encoding.
4512            fidl::encoding::Encode::<SecurityRequirements, D>::encode(
4513                (
4514                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.encryption_required),
4515                    <bool as fidl::encoding::ValueTypeMarker>::borrow(
4516                        &self.authentication_required,
4517                    ),
4518                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.authorization_required),
4519                ),
4520                encoder,
4521                offset,
4522                _depth,
4523            )
4524        }
4525    }
4526    unsafe impl<
4527        D: fidl::encoding::ResourceDialect,
4528        T0: fidl::encoding::Encode<bool, D>,
4529        T1: fidl::encoding::Encode<bool, D>,
4530        T2: fidl::encoding::Encode<bool, D>,
4531    > fidl::encoding::Encode<SecurityRequirements, D> for (T0, T1, T2)
4532    {
4533        #[inline]
4534        unsafe fn encode(
4535            self,
4536            encoder: &mut fidl::encoding::Encoder<'_, D>,
4537            offset: usize,
4538            depth: fidl::encoding::Depth,
4539        ) -> fidl::Result<()> {
4540            encoder.debug_check_bounds::<SecurityRequirements>(offset);
4541            // Zero out padding regions. There's no need to apply masks
4542            // because the unmasked parts will be overwritten by fields.
4543            // Write the fields.
4544            self.0.encode(encoder, offset + 0, depth)?;
4545            self.1.encode(encoder, offset + 1, depth)?;
4546            self.2.encode(encoder, offset + 2, depth)?;
4547            Ok(())
4548        }
4549    }
4550
4551    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SecurityRequirements {
4552        #[inline(always)]
4553        fn new_empty() -> Self {
4554            Self {
4555                encryption_required: fidl::new_empty!(bool, D),
4556                authentication_required: fidl::new_empty!(bool, D),
4557                authorization_required: fidl::new_empty!(bool, D),
4558            }
4559        }
4560
4561        #[inline]
4562        unsafe fn decode(
4563            &mut self,
4564            decoder: &mut fidl::encoding::Decoder<'_, D>,
4565            offset: usize,
4566            _depth: fidl::encoding::Depth,
4567        ) -> fidl::Result<()> {
4568            decoder.debug_check_bounds::<Self>(offset);
4569            // Verify that padding bytes are zero.
4570            fidl::decode!(bool, D, &mut self.encryption_required, decoder, offset + 0, _depth)?;
4571            fidl::decode!(bool, D, &mut self.authentication_required, decoder, offset + 1, _depth)?;
4572            fidl::decode!(bool, D, &mut self.authorization_required, decoder, offset + 2, _depth)?;
4573            Ok(())
4574        }
4575    }
4576
4577    impl fidl::encoding::ValueTypeMarker for ServerPublishServiceResponse {
4578        type Borrowed<'a> = &'a Self;
4579        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4580            value
4581        }
4582    }
4583
4584    unsafe impl fidl::encoding::TypeMarker for ServerPublishServiceResponse {
4585        type Owned = Self;
4586
4587        #[inline(always)]
4588        fn inline_align(_context: fidl::encoding::Context) -> usize {
4589            8
4590        }
4591
4592        #[inline(always)]
4593        fn inline_size(_context: fidl::encoding::Context) -> usize {
4594            8
4595        }
4596    }
4597
4598    unsafe impl<D: fidl::encoding::ResourceDialect>
4599        fidl::encoding::Encode<ServerPublishServiceResponse, D> for &ServerPublishServiceResponse
4600    {
4601        #[inline]
4602        unsafe fn encode(
4603            self,
4604            encoder: &mut fidl::encoding::Encoder<'_, D>,
4605            offset: usize,
4606            _depth: fidl::encoding::Depth,
4607        ) -> fidl::Result<()> {
4608            encoder.debug_check_bounds::<ServerPublishServiceResponse>(offset);
4609            // Delegate to tuple encoding.
4610            fidl::encoding::Encode::<ServerPublishServiceResponse, D>::encode(
4611                (
4612                    <fidl_fuchsia_bluetooth__common::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
4613                ),
4614                encoder, offset, _depth
4615            )
4616        }
4617    }
4618    unsafe impl<
4619        D: fidl::encoding::ResourceDialect,
4620        T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth__common::Status, D>,
4621    > fidl::encoding::Encode<ServerPublishServiceResponse, D> for (T0,)
4622    {
4623        #[inline]
4624        unsafe fn encode(
4625            self,
4626            encoder: &mut fidl::encoding::Encoder<'_, D>,
4627            offset: usize,
4628            depth: fidl::encoding::Depth,
4629        ) -> fidl::Result<()> {
4630            encoder.debug_check_bounds::<ServerPublishServiceResponse>(offset);
4631            // Zero out padding regions. There's no need to apply masks
4632            // because the unmasked parts will be overwritten by fields.
4633            // Write the fields.
4634            self.0.encode(encoder, offset + 0, depth)?;
4635            Ok(())
4636        }
4637    }
4638
4639    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4640        for ServerPublishServiceResponse
4641    {
4642        #[inline(always)]
4643        fn new_empty() -> Self {
4644            Self { status: fidl::new_empty!(fidl_fuchsia_bluetooth__common::Status, D) }
4645        }
4646
4647        #[inline]
4648        unsafe fn decode(
4649            &mut self,
4650            decoder: &mut fidl::encoding::Decoder<'_, D>,
4651            offset: usize,
4652            _depth: fidl::encoding::Depth,
4653        ) -> fidl::Result<()> {
4654            decoder.debug_check_bounds::<Self>(offset);
4655            // Verify that padding bytes are zero.
4656            fidl::decode!(
4657                fidl_fuchsia_bluetooth__common::Status,
4658                D,
4659                &mut self.status,
4660                decoder,
4661                offset + 0,
4662                _depth
4663            )?;
4664            Ok(())
4665        }
4666    }
4667
4668    impl fidl::encoding::ValueTypeMarker for ServiceInfo {
4669        type Borrowed<'a> = &'a Self;
4670        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4671            value
4672        }
4673    }
4674
4675    unsafe impl fidl::encoding::TypeMarker for ServiceInfo {
4676        type Owned = Self;
4677
4678        #[inline(always)]
4679        fn inline_align(_context: fidl::encoding::Context) -> usize {
4680            8
4681        }
4682
4683        #[inline(always)]
4684        fn inline_size(_context: fidl::encoding::Context) -> usize {
4685            64
4686        }
4687    }
4688
4689    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ServiceInfo, D>
4690        for &ServiceInfo
4691    {
4692        #[inline]
4693        unsafe fn encode(
4694            self,
4695            encoder: &mut fidl::encoding::Encoder<'_, D>,
4696            offset: usize,
4697            _depth: fidl::encoding::Depth,
4698        ) -> fidl::Result<()> {
4699            encoder.debug_check_bounds::<ServiceInfo>(offset);
4700            // Delegate to tuple encoding.
4701            fidl::encoding::Encode::<ServiceInfo, D>::encode(
4702                (
4703                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
4704                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.primary),
4705                    <fidl::encoding::BoundedString<36> as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
4706                    <fidl::encoding::Optional<fidl::encoding::Vector<Characteristic, 32767>> as fidl::encoding::ValueTypeMarker>::borrow(&self.characteristics),
4707                    <fidl::encoding::Optional<fidl::encoding::Vector<u64, 65535>> as fidl::encoding::ValueTypeMarker>::borrow(&self.includes),
4708                ),
4709                encoder, offset, _depth
4710            )
4711        }
4712    }
4713    unsafe impl<
4714        D: fidl::encoding::ResourceDialect,
4715        T0: fidl::encoding::Encode<u64, D>,
4716        T1: fidl::encoding::Encode<bool, D>,
4717        T2: fidl::encoding::Encode<fidl::encoding::BoundedString<36>, D>,
4718        T3: fidl::encoding::Encode<
4719                fidl::encoding::Optional<fidl::encoding::Vector<Characteristic, 32767>>,
4720                D,
4721            >,
4722        T4: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::Vector<u64, 65535>>, D>,
4723    > fidl::encoding::Encode<ServiceInfo, D> for (T0, T1, T2, T3, T4)
4724    {
4725        #[inline]
4726        unsafe fn encode(
4727            self,
4728            encoder: &mut fidl::encoding::Encoder<'_, D>,
4729            offset: usize,
4730            depth: fidl::encoding::Depth,
4731        ) -> fidl::Result<()> {
4732            encoder.debug_check_bounds::<ServiceInfo>(offset);
4733            // Zero out padding regions. There's no need to apply masks
4734            // because the unmasked parts will be overwritten by fields.
4735            unsafe {
4736                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
4737                (ptr as *mut u64).write_unaligned(0);
4738            }
4739            // Write the fields.
4740            self.0.encode(encoder, offset + 0, depth)?;
4741            self.1.encode(encoder, offset + 8, depth)?;
4742            self.2.encode(encoder, offset + 16, depth)?;
4743            self.3.encode(encoder, offset + 32, depth)?;
4744            self.4.encode(encoder, offset + 48, depth)?;
4745            Ok(())
4746        }
4747    }
4748
4749    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ServiceInfo {
4750        #[inline(always)]
4751        fn new_empty() -> Self {
4752            Self {
4753                id: fidl::new_empty!(u64, D),
4754                primary: fidl::new_empty!(bool, D),
4755                type_: fidl::new_empty!(fidl::encoding::BoundedString<36>, D),
4756                characteristics: fidl::new_empty!(
4757                    fidl::encoding::Optional<fidl::encoding::Vector<Characteristic, 32767>>,
4758                    D
4759                ),
4760                includes: fidl::new_empty!(
4761                    fidl::encoding::Optional<fidl::encoding::Vector<u64, 65535>>,
4762                    D
4763                ),
4764            }
4765        }
4766
4767        #[inline]
4768        unsafe fn decode(
4769            &mut self,
4770            decoder: &mut fidl::encoding::Decoder<'_, D>,
4771            offset: usize,
4772            _depth: fidl::encoding::Depth,
4773        ) -> fidl::Result<()> {
4774            decoder.debug_check_bounds::<Self>(offset);
4775            // Verify that padding bytes are zero.
4776            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
4777            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4778            let mask = 0xffffffffffffff00u64;
4779            let maskedval = padval & mask;
4780            if maskedval != 0 {
4781                return Err(fidl::Error::NonZeroPadding {
4782                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
4783                });
4784            }
4785            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
4786            fidl::decode!(bool, D, &mut self.primary, decoder, offset + 8, _depth)?;
4787            fidl::decode!(
4788                fidl::encoding::BoundedString<36>,
4789                D,
4790                &mut self.type_,
4791                decoder,
4792                offset + 16,
4793                _depth
4794            )?;
4795            fidl::decode!(
4796                fidl::encoding::Optional<fidl::encoding::Vector<Characteristic, 32767>>,
4797                D,
4798                &mut self.characteristics,
4799                decoder,
4800                offset + 32,
4801                _depth
4802            )?;
4803            fidl::decode!(
4804                fidl::encoding::Optional<fidl::encoding::Vector<u64, 65535>>,
4805                D,
4806                &mut self.includes,
4807                decoder,
4808                offset + 48,
4809                _depth
4810            )?;
4811            Ok(())
4812        }
4813    }
4814
4815    impl ReadByTypeResult {
4816        #[inline(always)]
4817        fn max_ordinal_present(&self) -> u64 {
4818            if let Some(_) = self.error {
4819                return 3;
4820            }
4821            if let Some(_) = self.value {
4822                return 2;
4823            }
4824            if let Some(_) = self.id {
4825                return 1;
4826            }
4827            0
4828        }
4829    }
4830
4831    impl fidl::encoding::ValueTypeMarker for ReadByTypeResult {
4832        type Borrowed<'a> = &'a Self;
4833        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4834            value
4835        }
4836    }
4837
4838    unsafe impl fidl::encoding::TypeMarker for ReadByTypeResult {
4839        type Owned = Self;
4840
4841        #[inline(always)]
4842        fn inline_align(_context: fidl::encoding::Context) -> usize {
4843            8
4844        }
4845
4846        #[inline(always)]
4847        fn inline_size(_context: fidl::encoding::Context) -> usize {
4848            16
4849        }
4850    }
4851
4852    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ReadByTypeResult, D>
4853        for &ReadByTypeResult
4854    {
4855        unsafe fn encode(
4856            self,
4857            encoder: &mut fidl::encoding::Encoder<'_, D>,
4858            offset: usize,
4859            mut depth: fidl::encoding::Depth,
4860        ) -> fidl::Result<()> {
4861            encoder.debug_check_bounds::<ReadByTypeResult>(offset);
4862            // Vector header
4863            let max_ordinal: u64 = self.max_ordinal_present();
4864            encoder.write_num(max_ordinal, offset);
4865            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4866            // Calling encoder.out_of_line_offset(0) is not allowed.
4867            if max_ordinal == 0 {
4868                return Ok(());
4869            }
4870            depth.increment()?;
4871            let envelope_size = 8;
4872            let bytes_len = max_ordinal as usize * envelope_size;
4873            #[allow(unused_variables)]
4874            let offset = encoder.out_of_line_offset(bytes_len);
4875            let mut _prev_end_offset: usize = 0;
4876            if 1 > max_ordinal {
4877                return Ok(());
4878            }
4879
4880            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4881            // are envelope_size bytes.
4882            let cur_offset: usize = (1 - 1) * envelope_size;
4883
4884            // Zero reserved fields.
4885            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4886
4887            // Safety:
4888            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4889            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4890            //   envelope_size bytes, there is always sufficient room.
4891            fidl::encoding::encode_in_envelope_optional::<u64, D>(
4892                self.id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
4893                encoder,
4894                offset + cur_offset,
4895                depth,
4896            )?;
4897
4898            _prev_end_offset = cur_offset + envelope_size;
4899            if 2 > max_ordinal {
4900                return Ok(());
4901            }
4902
4903            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4904            // are envelope_size bytes.
4905            let cur_offset: usize = (2 - 1) * envelope_size;
4906
4907            // Zero reserved fields.
4908            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4909
4910            // Safety:
4911            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4912            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4913            //   envelope_size bytes, there is always sufficient room.
4914            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 253>, D>(
4915                self.value.as_ref().map(
4916                    <fidl::encoding::Vector<u8, 253> as fidl::encoding::ValueTypeMarker>::borrow,
4917                ),
4918                encoder,
4919                offset + cur_offset,
4920                depth,
4921            )?;
4922
4923            _prev_end_offset = cur_offset + envelope_size;
4924            if 3 > max_ordinal {
4925                return Ok(());
4926            }
4927
4928            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4929            // are envelope_size bytes.
4930            let cur_offset: usize = (3 - 1) * envelope_size;
4931
4932            // Zero reserved fields.
4933            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4934
4935            // Safety:
4936            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4937            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4938            //   envelope_size bytes, there is always sufficient room.
4939            fidl::encoding::encode_in_envelope_optional::<Error, D>(
4940                self.error.as_ref().map(<Error as fidl::encoding::ValueTypeMarker>::borrow),
4941                encoder,
4942                offset + cur_offset,
4943                depth,
4944            )?;
4945
4946            _prev_end_offset = cur_offset + envelope_size;
4947
4948            Ok(())
4949        }
4950    }
4951
4952    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ReadByTypeResult {
4953        #[inline(always)]
4954        fn new_empty() -> Self {
4955            Self::default()
4956        }
4957
4958        unsafe fn decode(
4959            &mut self,
4960            decoder: &mut fidl::encoding::Decoder<'_, D>,
4961            offset: usize,
4962            mut depth: fidl::encoding::Depth,
4963        ) -> fidl::Result<()> {
4964            decoder.debug_check_bounds::<Self>(offset);
4965            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4966                None => return Err(fidl::Error::NotNullable),
4967                Some(len) => len,
4968            };
4969            // Calling decoder.out_of_line_offset(0) is not allowed.
4970            if len == 0 {
4971                return Ok(());
4972            };
4973            depth.increment()?;
4974            let envelope_size = 8;
4975            let bytes_len = len * envelope_size;
4976            let offset = decoder.out_of_line_offset(bytes_len)?;
4977            // Decode the envelope for each type.
4978            let mut _next_ordinal_to_read = 0;
4979            let mut next_offset = offset;
4980            let end_offset = offset + bytes_len;
4981            _next_ordinal_to_read += 1;
4982            if next_offset >= end_offset {
4983                return Ok(());
4984            }
4985
4986            // Decode unknown envelopes for gaps in ordinals.
4987            while _next_ordinal_to_read < 1 {
4988                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4989                _next_ordinal_to_read += 1;
4990                next_offset += envelope_size;
4991            }
4992
4993            let next_out_of_line = decoder.next_out_of_line();
4994            let handles_before = decoder.remaining_handles();
4995            if let Some((inlined, num_bytes, num_handles)) =
4996                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4997            {
4998                let member_inline_size =
4999                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5000                if inlined != (member_inline_size <= 4) {
5001                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5002                }
5003                let inner_offset;
5004                let mut inner_depth = depth.clone();
5005                if inlined {
5006                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5007                    inner_offset = next_offset;
5008                } else {
5009                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5010                    inner_depth.increment()?;
5011                }
5012                let val_ref = self.id.get_or_insert_with(|| fidl::new_empty!(u64, D));
5013                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
5014                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5015                {
5016                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5017                }
5018                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5019                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5020                }
5021            }
5022
5023            next_offset += envelope_size;
5024            _next_ordinal_to_read += 1;
5025            if next_offset >= end_offset {
5026                return Ok(());
5027            }
5028
5029            // Decode unknown envelopes for gaps in ordinals.
5030            while _next_ordinal_to_read < 2 {
5031                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5032                _next_ordinal_to_read += 1;
5033                next_offset += envelope_size;
5034            }
5035
5036            let next_out_of_line = decoder.next_out_of_line();
5037            let handles_before = decoder.remaining_handles();
5038            if let Some((inlined, num_bytes, num_handles)) =
5039                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5040            {
5041                let member_inline_size =
5042                    <fidl::encoding::Vector<u8, 253> as fidl::encoding::TypeMarker>::inline_size(
5043                        decoder.context,
5044                    );
5045                if inlined != (member_inline_size <= 4) {
5046                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5047                }
5048                let inner_offset;
5049                let mut inner_depth = depth.clone();
5050                if inlined {
5051                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5052                    inner_offset = next_offset;
5053                } else {
5054                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5055                    inner_depth.increment()?;
5056                }
5057                let val_ref = self
5058                    .value
5059                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 253>, D));
5060                fidl::decode!(fidl::encoding::Vector<u8, 253>, D, val_ref, decoder, inner_offset, inner_depth)?;
5061                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5062                {
5063                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5064                }
5065                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5066                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5067                }
5068            }
5069
5070            next_offset += envelope_size;
5071            _next_ordinal_to_read += 1;
5072            if next_offset >= end_offset {
5073                return Ok(());
5074            }
5075
5076            // Decode unknown envelopes for gaps in ordinals.
5077            while _next_ordinal_to_read < 3 {
5078                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5079                _next_ordinal_to_read += 1;
5080                next_offset += envelope_size;
5081            }
5082
5083            let next_out_of_line = decoder.next_out_of_line();
5084            let handles_before = decoder.remaining_handles();
5085            if let Some((inlined, num_bytes, num_handles)) =
5086                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5087            {
5088                let member_inline_size =
5089                    <Error as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5090                if inlined != (member_inline_size <= 4) {
5091                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5092                }
5093                let inner_offset;
5094                let mut inner_depth = depth.clone();
5095                if inlined {
5096                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5097                    inner_offset = next_offset;
5098                } else {
5099                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5100                    inner_depth.increment()?;
5101                }
5102                let val_ref = self.error.get_or_insert_with(|| fidl::new_empty!(Error, D));
5103                fidl::decode!(Error, D, val_ref, decoder, inner_offset, inner_depth)?;
5104                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5105                {
5106                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5107                }
5108                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5109                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5110                }
5111            }
5112
5113            next_offset += envelope_size;
5114
5115            // Decode the remaining unknown envelopes.
5116            while next_offset < end_offset {
5117                _next_ordinal_to_read += 1;
5118                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5119                next_offset += envelope_size;
5120            }
5121
5122            Ok(())
5123        }
5124    }
5125
5126    impl WriteOptions {
5127        #[inline(always)]
5128        fn max_ordinal_present(&self) -> u64 {
5129            if let Some(_) = self.reliable_mode {
5130                return 1;
5131            }
5132            0
5133        }
5134    }
5135
5136    impl fidl::encoding::ValueTypeMarker for WriteOptions {
5137        type Borrowed<'a> = &'a Self;
5138        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5139            value
5140        }
5141    }
5142
5143    unsafe impl fidl::encoding::TypeMarker for WriteOptions {
5144        type Owned = Self;
5145
5146        #[inline(always)]
5147        fn inline_align(_context: fidl::encoding::Context) -> usize {
5148            8
5149        }
5150
5151        #[inline(always)]
5152        fn inline_size(_context: fidl::encoding::Context) -> usize {
5153            16
5154        }
5155    }
5156
5157    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WriteOptions, D>
5158        for &WriteOptions
5159    {
5160        unsafe fn encode(
5161            self,
5162            encoder: &mut fidl::encoding::Encoder<'_, D>,
5163            offset: usize,
5164            mut depth: fidl::encoding::Depth,
5165        ) -> fidl::Result<()> {
5166            encoder.debug_check_bounds::<WriteOptions>(offset);
5167            // Vector header
5168            let max_ordinal: u64 = self.max_ordinal_present();
5169            encoder.write_num(max_ordinal, offset);
5170            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5171            // Calling encoder.out_of_line_offset(0) is not allowed.
5172            if max_ordinal == 0 {
5173                return Ok(());
5174            }
5175            depth.increment()?;
5176            let envelope_size = 8;
5177            let bytes_len = max_ordinal as usize * envelope_size;
5178            #[allow(unused_variables)]
5179            let offset = encoder.out_of_line_offset(bytes_len);
5180            let mut _prev_end_offset: usize = 0;
5181            if 1 > max_ordinal {
5182                return Ok(());
5183            }
5184
5185            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5186            // are envelope_size bytes.
5187            let cur_offset: usize = (1 - 1) * envelope_size;
5188
5189            // Zero reserved fields.
5190            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5191
5192            // Safety:
5193            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5194            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5195            //   envelope_size bytes, there is always sufficient room.
5196            fidl::encoding::encode_in_envelope_optional::<ReliableMode, D>(
5197                self.reliable_mode
5198                    .as_ref()
5199                    .map(<ReliableMode as fidl::encoding::ValueTypeMarker>::borrow),
5200                encoder,
5201                offset + cur_offset,
5202                depth,
5203            )?;
5204
5205            _prev_end_offset = cur_offset + envelope_size;
5206
5207            Ok(())
5208        }
5209    }
5210
5211    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WriteOptions {
5212        #[inline(always)]
5213        fn new_empty() -> Self {
5214            Self::default()
5215        }
5216
5217        unsafe fn decode(
5218            &mut self,
5219            decoder: &mut fidl::encoding::Decoder<'_, D>,
5220            offset: usize,
5221            mut depth: fidl::encoding::Depth,
5222        ) -> fidl::Result<()> {
5223            decoder.debug_check_bounds::<Self>(offset);
5224            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5225                None => return Err(fidl::Error::NotNullable),
5226                Some(len) => len,
5227            };
5228            // Calling decoder.out_of_line_offset(0) is not allowed.
5229            if len == 0 {
5230                return Ok(());
5231            };
5232            depth.increment()?;
5233            let envelope_size = 8;
5234            let bytes_len = len * envelope_size;
5235            let offset = decoder.out_of_line_offset(bytes_len)?;
5236            // Decode the envelope for each type.
5237            let mut _next_ordinal_to_read = 0;
5238            let mut next_offset = offset;
5239            let end_offset = offset + bytes_len;
5240            _next_ordinal_to_read += 1;
5241            if next_offset >= end_offset {
5242                return Ok(());
5243            }
5244
5245            // Decode unknown envelopes for gaps in ordinals.
5246            while _next_ordinal_to_read < 1 {
5247                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5248                _next_ordinal_to_read += 1;
5249                next_offset += envelope_size;
5250            }
5251
5252            let next_out_of_line = decoder.next_out_of_line();
5253            let handles_before = decoder.remaining_handles();
5254            if let Some((inlined, num_bytes, num_handles)) =
5255                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5256            {
5257                let member_inline_size =
5258                    <ReliableMode as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5259                if inlined != (member_inline_size <= 4) {
5260                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5261                }
5262                let inner_offset;
5263                let mut inner_depth = depth.clone();
5264                if inlined {
5265                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5266                    inner_offset = next_offset;
5267                } else {
5268                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5269                    inner_depth.increment()?;
5270                }
5271                let val_ref =
5272                    self.reliable_mode.get_or_insert_with(|| fidl::new_empty!(ReliableMode, D));
5273                fidl::decode!(ReliableMode, D, val_ref, decoder, inner_offset, inner_depth)?;
5274                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5275                {
5276                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5277                }
5278                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5279                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5280                }
5281            }
5282
5283            next_offset += envelope_size;
5284
5285            // Decode the remaining unknown envelopes.
5286            while next_offset < end_offset {
5287                _next_ordinal_to_read += 1;
5288                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5289                next_offset += envelope_size;
5290            }
5291
5292            Ok(())
5293        }
5294    }
5295}