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