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