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