fidl_fuchsia_weave__common/
fidl_fuchsia_weave__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/// Bytes representing a wrapped private key. Since the size of the wrapping is
12/// implementation-defined, the bytes are only bounded by MAX. The bytes should
13/// be considered opaque, both in structure and in content, as the value is only
14/// meaningful to operations such as [`Provisioner.GenerateKeyPair`].
15pub type PrivateKey = Vec<u8>;
16
17/// An endpoint ID used for identifying which service endpoints are of interest when
18/// looking up endpoints in the Weave Service Directory.
19pub type ServiceEndpointId = u64;
20
21/// The maximum number of HostPorts that Weave can return in a HostPortList, as
22/// weave indexes HostPortLists by a uint8.
23pub const MAX_HOST_PORTS: u32 = 256;
24
25/// The maximum size for a public key produced when generating a key pair.
26pub const MAX_PUBLIC_KEY_SIZE: u32 = 65;
27
28/// The largest supported size of a QR code encoded in string format may be.
29pub const MAX_QR_CODE_SIZE: u32 = 256;
30
31/// The maximum size of a signature supported by Weave.
32///
33/// Currently, Weave only supports ECDSA signatures using the P224 curve,
34/// however, to allow this protocol to support future changes to supported
35/// Weave signatures the maximum size of the returned signature is set to
36/// 139 bytes which is the largest amount of space needed to return an
37/// encoded ECDSA P521 signature.
38pub const MAX_SIGNATURE_SIZE: u32 = 139;
39
40/// Reset all device configuration information.
41pub const RESET_CONFIG_ALL: u16 = 255;
42
43bitflags! {
44    /// ResetConfig flags.
45    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
46    pub struct ResetConfigFlags: u16 {
47        /// Reset network configuration information.
48        const NETWORK_CONFIG = 1;
49        /// Reset fabric configuration information.
50        const FABRIC_CONFIG = 2;
51        /// Reset service configuration information.
52        const SERVICE_CONFIG = 4;
53        /// Reset device operational credentials.
54        const OPERATIONAL_CREDENTIALS = 8;
55    }
56}
57
58impl ResetConfigFlags {}
59
60#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
61#[repr(u32)]
62pub enum ErrorCode {
63    /// Key/pairing code not found in storage.
64    FileNotFound = 1,
65    /// Error occurred during cryptographic operations.
66    CryptoError = 2,
67    /// An invalid argument was supplied.
68    InvalidArgument = 3,
69    /// Weave is in an invalid state to support the operation.
70    InvalidState = 4,
71    /// An unknown or non-specific error occurred.
72    UnspecifiedError = 2147483647,
73}
74
75impl ErrorCode {
76    #[inline]
77    pub fn from_primitive(prim: u32) -> Option<Self> {
78        match prim {
79            1 => Some(Self::FileNotFound),
80            2 => Some(Self::CryptoError),
81            3 => Some(Self::InvalidArgument),
82            4 => Some(Self::InvalidState),
83            2147483647 => Some(Self::UnspecifiedError),
84            _ => None,
85        }
86    }
87
88    #[inline]
89    pub const fn into_primitive(self) -> u32 {
90        self as u32
91    }
92}
93
94#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
95pub struct FactoryDataManagerGetPairingCodeResponse {
96    pub pairing_code: Vec<u8>,
97}
98
99impl fidl::Persistable for FactoryDataManagerGetPairingCodeResponse {}
100
101/// A tuple of host and port to represent a connectable endpoint.
102#[derive(Clone, Debug, PartialEq)]
103pub struct HostPort {
104    pub host: Host,
105    pub port: u16,
106}
107
108impl fidl::Persistable for HostPort {}
109
110#[derive(Clone, Debug, PartialEq)]
111pub struct PairingStateWatcherWatchPairingStateResponse {
112    pub state: PairingState,
113}
114
115impl fidl::Persistable for PairingStateWatcherWatchPairingStateResponse {}
116
117#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
118pub struct ProvisionerGenerateKeyPairResponse {
119    pub wrapped_private_key: Vec<u8>,
120    pub public_key: Vec<u8>,
121}
122
123impl fidl::Persistable for ProvisionerGenerateKeyPairResponse {}
124
125/// QR Code data for pairing.
126#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
127pub struct QrCode {
128    /// QR code data in string format, supplying this string in a QR
129    /// code should be sufficient for pairing.
130    pub data: String,
131}
132
133impl fidl::Persistable for QrCode {}
134
135#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
136pub struct SignerSignHashRequest {
137    pub hash: Vec<u8>,
138}
139
140impl fidl::Persistable for SignerSignHashRequest {}
141
142#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
143pub struct SignerSignHashWithPrivateKeyRequest {
144    pub hash: Vec<u8>,
145    pub wrapped_private_key: Vec<u8>,
146}
147
148impl fidl::Persistable for SignerSignHashWithPrivateKeyRequest {}
149
150#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
151pub struct SignerSignHashWithPrivateKeyResponse {
152    pub signature: Vec<u8>,
153}
154
155impl fidl::Persistable for SignerSignHashWithPrivateKeyResponse {}
156
157#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
158pub struct SignerSignHashResponse {
159    pub signature: Vec<u8>,
160}
161
162impl fidl::Persistable for SignerSignHashResponse {}
163
164#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
165pub struct StackResetConfigRequest {
166    pub flags: ResetConfigFlags,
167}
168
169impl fidl::Persistable for StackResetConfigRequest {}
170
171#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
172pub struct StackGetQrCodeResponse {
173    pub qr_code: QrCode,
174}
175
176impl fidl::Persistable for StackGetQrCodeResponse {}
177
178#[derive(Clone, Debug, PartialEq)]
179pub struct SvcDirectoryWatcherWatchServiceDirectoryResponse {
180    pub host_port_list: Vec<HostPort>,
181}
182
183impl fidl::Persistable for SvcDirectoryWatcherWatchServiceDirectoryResponse {}
184
185#[derive(Clone, Debug, PartialEq)]
186pub struct WlanNetworkConfigProviderWatchConnectedNetworkResponse {
187    pub network_config: fidl_fuchsia_wlan_policy__common::NetworkConfig,
188}
189
190impl fidl::Persistable for WlanNetworkConfigProviderWatchConnectedNetworkResponse {}
191
192/// Current state of pairing/provisioning. At the point of a completely unprovisioned
193/// or factory reset device, all states will be `false`. Outside of an explicit
194/// ResetConfig call or factory reset, the provisioning states will only transition
195/// from `false` to `true` as Weave profiles are provisioned.
196#[derive(Clone, Debug, Default, PartialEq)]
197pub struct PairingState {
198    /// Has Weave been fully provisioned? This implies that all provisioning
199    /// has been completed as expected as specified in the configuration.
200    pub is_weave_fully_provisioned: Option<bool>,
201    /// Has WiFi been provisioned? Defaults to false.
202    pub is_wlan_provisioned: Option<bool>,
203    /// Has Thread been provisioned? Defaults to false.
204    pub is_thread_provisioned: Option<bool>,
205    /// Has the fabric been provisioned? Defaults to false.
206    pub is_fabric_provisioned: Option<bool>,
207    /// Has the service been provisioned? Defaults to false.
208    pub is_service_provisioned: Option<bool>,
209    #[doc(hidden)]
210    pub __source_breaking: fidl::marker::SourceBreaking,
211}
212
213impl fidl::Persistable for PairingState {}
214
215/// Representation of a host either in the form of a hostname or IP address.
216#[derive(Clone, Debug, PartialEq)]
217pub enum Host {
218    Hostname(String),
219    IpAddress(fidl_fuchsia_net__common::IpAddress),
220}
221
222impl Host {
223    #[inline]
224    pub fn ordinal(&self) -> u64 {
225        match *self {
226            Self::Hostname(_) => 1,
227            Self::IpAddress(_) => 2,
228        }
229    }
230}
231
232impl fidl::Persistable for Host {}
233
234pub mod bootstrap_ordinals {
235    pub const IMPORT_WEAVE_CONFIG: u64 = 0x3cba680ade22f738;
236}
237
238pub mod factory_data_manager_ordinals {
239    pub const GET_PAIRING_CODE: u64 = 0x75630bcd80418a0f;
240    pub const GET_WEAVE_CERTIFICATE: u64 = 0x1b4feca8bc141380;
241}
242
243pub mod pairing_state_watcher_ordinals {
244    pub const WATCH_PAIRING_STATE: u64 = 0x1b3889b65cea014e;
245}
246
247pub mod provisioner_ordinals {
248    pub const GENERATE_KEY_PAIR: u64 = 0x9ba1ad04f47bd9f;
249}
250
251pub mod signer_ordinals {
252    pub const SIGN_HASH: u64 = 0x3bfb1667fc4fe864;
253    pub const SIGN_HASH_WITH_PRIVATE_KEY: u64 = 0x23e8ae3490affc11;
254}
255
256pub mod stack_ordinals {
257    pub const GET_PAIRING_STATE_WATCHER: u64 = 0x674bbfa106efdc8d;
258    pub const GET_SVC_DIRECTORY_WATCHER: u64 = 0x261fdbc7a8447180;
259    pub const GET_QR_CODE: u64 = 0x79e435f04eb8d342;
260    pub const RESET_CONFIG: u64 = 0x7a009a9b62d35c10;
261}
262
263pub mod stack_provider_ordinals {
264    pub const SET_WLAN_NETWORK_CONFIG_PROVIDER: u64 = 0x60f817738f6028b4;
265}
266
267pub mod svc_directory_watcher_ordinals {
268    pub const WATCH_SERVICE_DIRECTORY: u64 = 0x4c1000286a01a142;
269}
270
271pub mod wlan_network_config_provider_ordinals {
272    pub const WATCH_CONNECTED_NETWORK: u64 = 0x966c5bf4d6dfce1;
273}
274
275mod internal {
276    use super::*;
277    unsafe impl fidl::encoding::TypeMarker for ResetConfigFlags {
278        type Owned = Self;
279
280        #[inline(always)]
281        fn inline_align(_context: fidl::encoding::Context) -> usize {
282            2
283        }
284
285        #[inline(always)]
286        fn inline_size(_context: fidl::encoding::Context) -> usize {
287            2
288        }
289    }
290
291    impl fidl::encoding::ValueTypeMarker for ResetConfigFlags {
292        type Borrowed<'a> = Self;
293        #[inline(always)]
294        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
295            *value
296        }
297    }
298
299    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
300        for ResetConfigFlags
301    {
302        #[inline]
303        unsafe fn encode(
304            self,
305            encoder: &mut fidl::encoding::Encoder<'_, D>,
306            offset: usize,
307            _depth: fidl::encoding::Depth,
308        ) -> fidl::Result<()> {
309            encoder.debug_check_bounds::<Self>(offset);
310            if self.bits() & Self::all().bits() != self.bits() {
311                return Err(fidl::Error::InvalidBitsValue);
312            }
313            encoder.write_num(self.bits(), offset);
314            Ok(())
315        }
316    }
317
318    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ResetConfigFlags {
319        #[inline(always)]
320        fn new_empty() -> Self {
321            Self::empty()
322        }
323
324        #[inline]
325        unsafe fn decode(
326            &mut self,
327            decoder: &mut fidl::encoding::Decoder<'_, D>,
328            offset: usize,
329            _depth: fidl::encoding::Depth,
330        ) -> fidl::Result<()> {
331            decoder.debug_check_bounds::<Self>(offset);
332            let prim = decoder.read_num::<u16>(offset);
333            *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
334            Ok(())
335        }
336    }
337    unsafe impl fidl::encoding::TypeMarker for ErrorCode {
338        type Owned = Self;
339
340        #[inline(always)]
341        fn inline_align(_context: fidl::encoding::Context) -> usize {
342            std::mem::align_of::<u32>()
343        }
344
345        #[inline(always)]
346        fn inline_size(_context: fidl::encoding::Context) -> usize {
347            std::mem::size_of::<u32>()
348        }
349
350        #[inline(always)]
351        fn encode_is_copy() -> bool {
352            true
353        }
354
355        #[inline(always)]
356        fn decode_is_copy() -> bool {
357            false
358        }
359    }
360
361    impl fidl::encoding::ValueTypeMarker for ErrorCode {
362        type Borrowed<'a> = Self;
363        #[inline(always)]
364        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
365            *value
366        }
367    }
368
369    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ErrorCode {
370        #[inline]
371        unsafe fn encode(
372            self,
373            encoder: &mut fidl::encoding::Encoder<'_, D>,
374            offset: usize,
375            _depth: fidl::encoding::Depth,
376        ) -> fidl::Result<()> {
377            encoder.debug_check_bounds::<Self>(offset);
378            encoder.write_num(self.into_primitive(), offset);
379            Ok(())
380        }
381    }
382
383    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ErrorCode {
384        #[inline(always)]
385        fn new_empty() -> Self {
386            Self::FileNotFound
387        }
388
389        #[inline]
390        unsafe fn decode(
391            &mut self,
392            decoder: &mut fidl::encoding::Decoder<'_, D>,
393            offset: usize,
394            _depth: fidl::encoding::Depth,
395        ) -> fidl::Result<()> {
396            decoder.debug_check_bounds::<Self>(offset);
397            let prim = decoder.read_num::<u32>(offset);
398
399            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
400            Ok(())
401        }
402    }
403
404    impl fidl::encoding::ValueTypeMarker for FactoryDataManagerGetPairingCodeResponse {
405        type Borrowed<'a> = &'a Self;
406        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
407            value
408        }
409    }
410
411    unsafe impl fidl::encoding::TypeMarker for FactoryDataManagerGetPairingCodeResponse {
412        type Owned = Self;
413
414        #[inline(always)]
415        fn inline_align(_context: fidl::encoding::Context) -> usize {
416            8
417        }
418
419        #[inline(always)]
420        fn inline_size(_context: fidl::encoding::Context) -> usize {
421            16
422        }
423    }
424
425    unsafe impl<D: fidl::encoding::ResourceDialect>
426        fidl::encoding::Encode<FactoryDataManagerGetPairingCodeResponse, D>
427        for &FactoryDataManagerGetPairingCodeResponse
428    {
429        #[inline]
430        unsafe fn encode(
431            self,
432            encoder: &mut fidl::encoding::Encoder<'_, D>,
433            offset: usize,
434            _depth: fidl::encoding::Depth,
435        ) -> fidl::Result<()> {
436            encoder.debug_check_bounds::<FactoryDataManagerGetPairingCodeResponse>(offset);
437            // Delegate to tuple encoding.
438            fidl::encoding::Encode::<FactoryDataManagerGetPairingCodeResponse, D>::encode(
439                (<fidl::encoding::Vector<u8, 16> as fidl::encoding::ValueTypeMarker>::borrow(
440                    &self.pairing_code,
441                ),),
442                encoder,
443                offset,
444                _depth,
445            )
446        }
447    }
448    unsafe impl<
449        D: fidl::encoding::ResourceDialect,
450        T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 16>, D>,
451    > fidl::encoding::Encode<FactoryDataManagerGetPairingCodeResponse, D> for (T0,)
452    {
453        #[inline]
454        unsafe fn encode(
455            self,
456            encoder: &mut fidl::encoding::Encoder<'_, D>,
457            offset: usize,
458            depth: fidl::encoding::Depth,
459        ) -> fidl::Result<()> {
460            encoder.debug_check_bounds::<FactoryDataManagerGetPairingCodeResponse>(offset);
461            // Zero out padding regions. There's no need to apply masks
462            // because the unmasked parts will be overwritten by fields.
463            // Write the fields.
464            self.0.encode(encoder, offset + 0, depth)?;
465            Ok(())
466        }
467    }
468
469    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
470        for FactoryDataManagerGetPairingCodeResponse
471    {
472        #[inline(always)]
473        fn new_empty() -> Self {
474            Self { pairing_code: fidl::new_empty!(fidl::encoding::Vector<u8, 16>, D) }
475        }
476
477        #[inline]
478        unsafe fn decode(
479            &mut self,
480            decoder: &mut fidl::encoding::Decoder<'_, D>,
481            offset: usize,
482            _depth: fidl::encoding::Depth,
483        ) -> fidl::Result<()> {
484            decoder.debug_check_bounds::<Self>(offset);
485            // Verify that padding bytes are zero.
486            fidl::decode!(fidl::encoding::Vector<u8, 16>, D, &mut self.pairing_code, decoder, offset + 0, _depth)?;
487            Ok(())
488        }
489    }
490
491    impl fidl::encoding::ValueTypeMarker for HostPort {
492        type Borrowed<'a> = &'a Self;
493        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
494            value
495        }
496    }
497
498    unsafe impl fidl::encoding::TypeMarker for HostPort {
499        type Owned = Self;
500
501        #[inline(always)]
502        fn inline_align(_context: fidl::encoding::Context) -> usize {
503            8
504        }
505
506        #[inline(always)]
507        fn inline_size(_context: fidl::encoding::Context) -> usize {
508            24
509        }
510    }
511
512    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HostPort, D> for &HostPort {
513        #[inline]
514        unsafe fn encode(
515            self,
516            encoder: &mut fidl::encoding::Encoder<'_, D>,
517            offset: usize,
518            _depth: fidl::encoding::Depth,
519        ) -> fidl::Result<()> {
520            encoder.debug_check_bounds::<HostPort>(offset);
521            // Delegate to tuple encoding.
522            fidl::encoding::Encode::<HostPort, D>::encode(
523                (
524                    <Host as fidl::encoding::ValueTypeMarker>::borrow(&self.host),
525                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.port),
526                ),
527                encoder,
528                offset,
529                _depth,
530            )
531        }
532    }
533    unsafe impl<
534        D: fidl::encoding::ResourceDialect,
535        T0: fidl::encoding::Encode<Host, D>,
536        T1: fidl::encoding::Encode<u16, D>,
537    > fidl::encoding::Encode<HostPort, D> for (T0, T1)
538    {
539        #[inline]
540        unsafe fn encode(
541            self,
542            encoder: &mut fidl::encoding::Encoder<'_, D>,
543            offset: usize,
544            depth: fidl::encoding::Depth,
545        ) -> fidl::Result<()> {
546            encoder.debug_check_bounds::<HostPort>(offset);
547            // Zero out padding regions. There's no need to apply masks
548            // because the unmasked parts will be overwritten by fields.
549            unsafe {
550                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
551                (ptr as *mut u64).write_unaligned(0);
552            }
553            // Write the fields.
554            self.0.encode(encoder, offset + 0, depth)?;
555            self.1.encode(encoder, offset + 16, depth)?;
556            Ok(())
557        }
558    }
559
560    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HostPort {
561        #[inline(always)]
562        fn new_empty() -> Self {
563            Self { host: fidl::new_empty!(Host, D), port: fidl::new_empty!(u16, D) }
564        }
565
566        #[inline]
567        unsafe fn decode(
568            &mut self,
569            decoder: &mut fidl::encoding::Decoder<'_, D>,
570            offset: usize,
571            _depth: fidl::encoding::Depth,
572        ) -> fidl::Result<()> {
573            decoder.debug_check_bounds::<Self>(offset);
574            // Verify that padding bytes are zero.
575            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
576            let padval = unsafe { (ptr as *const u64).read_unaligned() };
577            let mask = 0xffffffffffff0000u64;
578            let maskedval = padval & mask;
579            if maskedval != 0 {
580                return Err(fidl::Error::NonZeroPadding {
581                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
582                });
583            }
584            fidl::decode!(Host, D, &mut self.host, decoder, offset + 0, _depth)?;
585            fidl::decode!(u16, D, &mut self.port, decoder, offset + 16, _depth)?;
586            Ok(())
587        }
588    }
589
590    impl fidl::encoding::ValueTypeMarker for PairingStateWatcherWatchPairingStateResponse {
591        type Borrowed<'a> = &'a Self;
592        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
593            value
594        }
595    }
596
597    unsafe impl fidl::encoding::TypeMarker for PairingStateWatcherWatchPairingStateResponse {
598        type Owned = Self;
599
600        #[inline(always)]
601        fn inline_align(_context: fidl::encoding::Context) -> usize {
602            8
603        }
604
605        #[inline(always)]
606        fn inline_size(_context: fidl::encoding::Context) -> usize {
607            16
608        }
609    }
610
611    unsafe impl<D: fidl::encoding::ResourceDialect>
612        fidl::encoding::Encode<PairingStateWatcherWatchPairingStateResponse, D>
613        for &PairingStateWatcherWatchPairingStateResponse
614    {
615        #[inline]
616        unsafe fn encode(
617            self,
618            encoder: &mut fidl::encoding::Encoder<'_, D>,
619            offset: usize,
620            _depth: fidl::encoding::Depth,
621        ) -> fidl::Result<()> {
622            encoder.debug_check_bounds::<PairingStateWatcherWatchPairingStateResponse>(offset);
623            // Delegate to tuple encoding.
624            fidl::encoding::Encode::<PairingStateWatcherWatchPairingStateResponse, D>::encode(
625                (<PairingState as fidl::encoding::ValueTypeMarker>::borrow(&self.state),),
626                encoder,
627                offset,
628                _depth,
629            )
630        }
631    }
632    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PairingState, D>>
633        fidl::encoding::Encode<PairingStateWatcherWatchPairingStateResponse, D> for (T0,)
634    {
635        #[inline]
636        unsafe fn encode(
637            self,
638            encoder: &mut fidl::encoding::Encoder<'_, D>,
639            offset: usize,
640            depth: fidl::encoding::Depth,
641        ) -> fidl::Result<()> {
642            encoder.debug_check_bounds::<PairingStateWatcherWatchPairingStateResponse>(offset);
643            // Zero out padding regions. There's no need to apply masks
644            // because the unmasked parts will be overwritten by fields.
645            // Write the fields.
646            self.0.encode(encoder, offset + 0, depth)?;
647            Ok(())
648        }
649    }
650
651    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
652        for PairingStateWatcherWatchPairingStateResponse
653    {
654        #[inline(always)]
655        fn new_empty() -> Self {
656            Self { state: fidl::new_empty!(PairingState, D) }
657        }
658
659        #[inline]
660        unsafe fn decode(
661            &mut self,
662            decoder: &mut fidl::encoding::Decoder<'_, D>,
663            offset: usize,
664            _depth: fidl::encoding::Depth,
665        ) -> fidl::Result<()> {
666            decoder.debug_check_bounds::<Self>(offset);
667            // Verify that padding bytes are zero.
668            fidl::decode!(PairingState, D, &mut self.state, decoder, offset + 0, _depth)?;
669            Ok(())
670        }
671    }
672
673    impl fidl::encoding::ValueTypeMarker for ProvisionerGenerateKeyPairResponse {
674        type Borrowed<'a> = &'a Self;
675        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
676            value
677        }
678    }
679
680    unsafe impl fidl::encoding::TypeMarker for ProvisionerGenerateKeyPairResponse {
681        type Owned = Self;
682
683        #[inline(always)]
684        fn inline_align(_context: fidl::encoding::Context) -> usize {
685            8
686        }
687
688        #[inline(always)]
689        fn inline_size(_context: fidl::encoding::Context) -> usize {
690            32
691        }
692    }
693
694    unsafe impl<D: fidl::encoding::ResourceDialect>
695        fidl::encoding::Encode<ProvisionerGenerateKeyPairResponse, D>
696        for &ProvisionerGenerateKeyPairResponse
697    {
698        #[inline]
699        unsafe fn encode(
700            self,
701            encoder: &mut fidl::encoding::Encoder<'_, D>,
702            offset: usize,
703            _depth: fidl::encoding::Depth,
704        ) -> fidl::Result<()> {
705            encoder.debug_check_bounds::<ProvisionerGenerateKeyPairResponse>(offset);
706            // Delegate to tuple encoding.
707            fidl::encoding::Encode::<ProvisionerGenerateKeyPairResponse, D>::encode(
708                (
709                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.wrapped_private_key),
710                    <fidl::encoding::Vector<u8, 65> as fidl::encoding::ValueTypeMarker>::borrow(&self.public_key),
711                ),
712                encoder, offset, _depth
713            )
714        }
715    }
716    unsafe impl<
717        D: fidl::encoding::ResourceDialect,
718        T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
719        T1: fidl::encoding::Encode<fidl::encoding::Vector<u8, 65>, D>,
720    > fidl::encoding::Encode<ProvisionerGenerateKeyPairResponse, D> for (T0, T1)
721    {
722        #[inline]
723        unsafe fn encode(
724            self,
725            encoder: &mut fidl::encoding::Encoder<'_, D>,
726            offset: usize,
727            depth: fidl::encoding::Depth,
728        ) -> fidl::Result<()> {
729            encoder.debug_check_bounds::<ProvisionerGenerateKeyPairResponse>(offset);
730            // Zero out padding regions. There's no need to apply masks
731            // because the unmasked parts will be overwritten by fields.
732            // Write the fields.
733            self.0.encode(encoder, offset + 0, depth)?;
734            self.1.encode(encoder, offset + 16, depth)?;
735            Ok(())
736        }
737    }
738
739    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
740        for ProvisionerGenerateKeyPairResponse
741    {
742        #[inline(always)]
743        fn new_empty() -> Self {
744            Self {
745                wrapped_private_key: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
746                public_key: fidl::new_empty!(fidl::encoding::Vector<u8, 65>, D),
747            }
748        }
749
750        #[inline]
751        unsafe fn decode(
752            &mut self,
753            decoder: &mut fidl::encoding::Decoder<'_, D>,
754            offset: usize,
755            _depth: fidl::encoding::Depth,
756        ) -> fidl::Result<()> {
757            decoder.debug_check_bounds::<Self>(offset);
758            // Verify that padding bytes are zero.
759            fidl::decode!(
760                fidl::encoding::UnboundedVector<u8>,
761                D,
762                &mut self.wrapped_private_key,
763                decoder,
764                offset + 0,
765                _depth
766            )?;
767            fidl::decode!(fidl::encoding::Vector<u8, 65>, D, &mut self.public_key, decoder, offset + 16, _depth)?;
768            Ok(())
769        }
770    }
771
772    impl fidl::encoding::ValueTypeMarker for QrCode {
773        type Borrowed<'a> = &'a Self;
774        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
775            value
776        }
777    }
778
779    unsafe impl fidl::encoding::TypeMarker for QrCode {
780        type Owned = Self;
781
782        #[inline(always)]
783        fn inline_align(_context: fidl::encoding::Context) -> usize {
784            8
785        }
786
787        #[inline(always)]
788        fn inline_size(_context: fidl::encoding::Context) -> usize {
789            16
790        }
791    }
792
793    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<QrCode, D> for &QrCode {
794        #[inline]
795        unsafe fn encode(
796            self,
797            encoder: &mut fidl::encoding::Encoder<'_, D>,
798            offset: usize,
799            _depth: fidl::encoding::Depth,
800        ) -> fidl::Result<()> {
801            encoder.debug_check_bounds::<QrCode>(offset);
802            // Delegate to tuple encoding.
803            fidl::encoding::Encode::<QrCode, D>::encode(
804                (<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
805                    &self.data,
806                ),),
807                encoder,
808                offset,
809                _depth,
810            )
811        }
812    }
813    unsafe impl<
814        D: fidl::encoding::ResourceDialect,
815        T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
816    > fidl::encoding::Encode<QrCode, D> for (T0,)
817    {
818        #[inline]
819        unsafe fn encode(
820            self,
821            encoder: &mut fidl::encoding::Encoder<'_, D>,
822            offset: usize,
823            depth: fidl::encoding::Depth,
824        ) -> fidl::Result<()> {
825            encoder.debug_check_bounds::<QrCode>(offset);
826            // Zero out padding regions. There's no need to apply masks
827            // because the unmasked parts will be overwritten by fields.
828            // Write the fields.
829            self.0.encode(encoder, offset + 0, depth)?;
830            Ok(())
831        }
832    }
833
834    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for QrCode {
835        #[inline(always)]
836        fn new_empty() -> Self {
837            Self { data: fidl::new_empty!(fidl::encoding::BoundedString<256>, D) }
838        }
839
840        #[inline]
841        unsafe fn decode(
842            &mut self,
843            decoder: &mut fidl::encoding::Decoder<'_, D>,
844            offset: usize,
845            _depth: fidl::encoding::Depth,
846        ) -> fidl::Result<()> {
847            decoder.debug_check_bounds::<Self>(offset);
848            // Verify that padding bytes are zero.
849            fidl::decode!(
850                fidl::encoding::BoundedString<256>,
851                D,
852                &mut self.data,
853                decoder,
854                offset + 0,
855                _depth
856            )?;
857            Ok(())
858        }
859    }
860
861    impl fidl::encoding::ValueTypeMarker for SignerSignHashRequest {
862        type Borrowed<'a> = &'a Self;
863        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
864            value
865        }
866    }
867
868    unsafe impl fidl::encoding::TypeMarker for SignerSignHashRequest {
869        type Owned = Self;
870
871        #[inline(always)]
872        fn inline_align(_context: fidl::encoding::Context) -> usize {
873            8
874        }
875
876        #[inline(always)]
877        fn inline_size(_context: fidl::encoding::Context) -> usize {
878            16
879        }
880    }
881
882    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SignerSignHashRequest, D>
883        for &SignerSignHashRequest
884    {
885        #[inline]
886        unsafe fn encode(
887            self,
888            encoder: &mut fidl::encoding::Encoder<'_, D>,
889            offset: usize,
890            _depth: fidl::encoding::Depth,
891        ) -> fidl::Result<()> {
892            encoder.debug_check_bounds::<SignerSignHashRequest>(offset);
893            // Delegate to tuple encoding.
894            fidl::encoding::Encode::<SignerSignHashRequest, D>::encode(
895                (<fidl::encoding::Vector<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow(
896                    &self.hash,
897                ),),
898                encoder,
899                offset,
900                _depth,
901            )
902        }
903    }
904    unsafe impl<
905        D: fidl::encoding::ResourceDialect,
906        T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 32>, D>,
907    > fidl::encoding::Encode<SignerSignHashRequest, D> for (T0,)
908    {
909        #[inline]
910        unsafe fn encode(
911            self,
912            encoder: &mut fidl::encoding::Encoder<'_, D>,
913            offset: usize,
914            depth: fidl::encoding::Depth,
915        ) -> fidl::Result<()> {
916            encoder.debug_check_bounds::<SignerSignHashRequest>(offset);
917            // Zero out padding regions. There's no need to apply masks
918            // because the unmasked parts will be overwritten by fields.
919            // Write the fields.
920            self.0.encode(encoder, offset + 0, depth)?;
921            Ok(())
922        }
923    }
924
925    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SignerSignHashRequest {
926        #[inline(always)]
927        fn new_empty() -> Self {
928            Self { hash: fidl::new_empty!(fidl::encoding::Vector<u8, 32>, D) }
929        }
930
931        #[inline]
932        unsafe fn decode(
933            &mut self,
934            decoder: &mut fidl::encoding::Decoder<'_, D>,
935            offset: usize,
936            _depth: fidl::encoding::Depth,
937        ) -> fidl::Result<()> {
938            decoder.debug_check_bounds::<Self>(offset);
939            // Verify that padding bytes are zero.
940            fidl::decode!(fidl::encoding::Vector<u8, 32>, D, &mut self.hash, decoder, offset + 0, _depth)?;
941            Ok(())
942        }
943    }
944
945    impl fidl::encoding::ValueTypeMarker for SignerSignHashWithPrivateKeyRequest {
946        type Borrowed<'a> = &'a Self;
947        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
948            value
949        }
950    }
951
952    unsafe impl fidl::encoding::TypeMarker for SignerSignHashWithPrivateKeyRequest {
953        type Owned = Self;
954
955        #[inline(always)]
956        fn inline_align(_context: fidl::encoding::Context) -> usize {
957            8
958        }
959
960        #[inline(always)]
961        fn inline_size(_context: fidl::encoding::Context) -> usize {
962            32
963        }
964    }
965
966    unsafe impl<D: fidl::encoding::ResourceDialect>
967        fidl::encoding::Encode<SignerSignHashWithPrivateKeyRequest, D>
968        for &SignerSignHashWithPrivateKeyRequest
969    {
970        #[inline]
971        unsafe fn encode(
972            self,
973            encoder: &mut fidl::encoding::Encoder<'_, D>,
974            offset: usize,
975            _depth: fidl::encoding::Depth,
976        ) -> fidl::Result<()> {
977            encoder.debug_check_bounds::<SignerSignHashWithPrivateKeyRequest>(offset);
978            // Delegate to tuple encoding.
979            fidl::encoding::Encode::<SignerSignHashWithPrivateKeyRequest, D>::encode(
980                (
981                    <fidl::encoding::Vector<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow(&self.hash),
982                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.wrapped_private_key),
983                ),
984                encoder, offset, _depth
985            )
986        }
987    }
988    unsafe impl<
989        D: fidl::encoding::ResourceDialect,
990        T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 32>, D>,
991        T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
992    > fidl::encoding::Encode<SignerSignHashWithPrivateKeyRequest, D> for (T0, T1)
993    {
994        #[inline]
995        unsafe fn encode(
996            self,
997            encoder: &mut fidl::encoding::Encoder<'_, D>,
998            offset: usize,
999            depth: fidl::encoding::Depth,
1000        ) -> fidl::Result<()> {
1001            encoder.debug_check_bounds::<SignerSignHashWithPrivateKeyRequest>(offset);
1002            // Zero out padding regions. There's no need to apply masks
1003            // because the unmasked parts will be overwritten by fields.
1004            // Write the fields.
1005            self.0.encode(encoder, offset + 0, depth)?;
1006            self.1.encode(encoder, offset + 16, depth)?;
1007            Ok(())
1008        }
1009    }
1010
1011    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1012        for SignerSignHashWithPrivateKeyRequest
1013    {
1014        #[inline(always)]
1015        fn new_empty() -> Self {
1016            Self {
1017                hash: fidl::new_empty!(fidl::encoding::Vector<u8, 32>, D),
1018                wrapped_private_key: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
1019            }
1020        }
1021
1022        #[inline]
1023        unsafe fn decode(
1024            &mut self,
1025            decoder: &mut fidl::encoding::Decoder<'_, D>,
1026            offset: usize,
1027            _depth: fidl::encoding::Depth,
1028        ) -> fidl::Result<()> {
1029            decoder.debug_check_bounds::<Self>(offset);
1030            // Verify that padding bytes are zero.
1031            fidl::decode!(fidl::encoding::Vector<u8, 32>, D, &mut self.hash, decoder, offset + 0, _depth)?;
1032            fidl::decode!(
1033                fidl::encoding::UnboundedVector<u8>,
1034                D,
1035                &mut self.wrapped_private_key,
1036                decoder,
1037                offset + 16,
1038                _depth
1039            )?;
1040            Ok(())
1041        }
1042    }
1043
1044    impl fidl::encoding::ValueTypeMarker for SignerSignHashWithPrivateKeyResponse {
1045        type Borrowed<'a> = &'a Self;
1046        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1047            value
1048        }
1049    }
1050
1051    unsafe impl fidl::encoding::TypeMarker for SignerSignHashWithPrivateKeyResponse {
1052        type Owned = Self;
1053
1054        #[inline(always)]
1055        fn inline_align(_context: fidl::encoding::Context) -> usize {
1056            8
1057        }
1058
1059        #[inline(always)]
1060        fn inline_size(_context: fidl::encoding::Context) -> usize {
1061            16
1062        }
1063    }
1064
1065    unsafe impl<D: fidl::encoding::ResourceDialect>
1066        fidl::encoding::Encode<SignerSignHashWithPrivateKeyResponse, D>
1067        for &SignerSignHashWithPrivateKeyResponse
1068    {
1069        #[inline]
1070        unsafe fn encode(
1071            self,
1072            encoder: &mut fidl::encoding::Encoder<'_, D>,
1073            offset: usize,
1074            _depth: fidl::encoding::Depth,
1075        ) -> fidl::Result<()> {
1076            encoder.debug_check_bounds::<SignerSignHashWithPrivateKeyResponse>(offset);
1077            // Delegate to tuple encoding.
1078            fidl::encoding::Encode::<SignerSignHashWithPrivateKeyResponse, D>::encode(
1079                (<fidl::encoding::Vector<u8, 139> as fidl::encoding::ValueTypeMarker>::borrow(
1080                    &self.signature,
1081                ),),
1082                encoder,
1083                offset,
1084                _depth,
1085            )
1086        }
1087    }
1088    unsafe impl<
1089        D: fidl::encoding::ResourceDialect,
1090        T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 139>, D>,
1091    > fidl::encoding::Encode<SignerSignHashWithPrivateKeyResponse, D> for (T0,)
1092    {
1093        #[inline]
1094        unsafe fn encode(
1095            self,
1096            encoder: &mut fidl::encoding::Encoder<'_, D>,
1097            offset: usize,
1098            depth: fidl::encoding::Depth,
1099        ) -> fidl::Result<()> {
1100            encoder.debug_check_bounds::<SignerSignHashWithPrivateKeyResponse>(offset);
1101            // Zero out padding regions. There's no need to apply masks
1102            // because the unmasked parts will be overwritten by fields.
1103            // Write the fields.
1104            self.0.encode(encoder, offset + 0, depth)?;
1105            Ok(())
1106        }
1107    }
1108
1109    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1110        for SignerSignHashWithPrivateKeyResponse
1111    {
1112        #[inline(always)]
1113        fn new_empty() -> Self {
1114            Self { signature: fidl::new_empty!(fidl::encoding::Vector<u8, 139>, D) }
1115        }
1116
1117        #[inline]
1118        unsafe fn decode(
1119            &mut self,
1120            decoder: &mut fidl::encoding::Decoder<'_, D>,
1121            offset: usize,
1122            _depth: fidl::encoding::Depth,
1123        ) -> fidl::Result<()> {
1124            decoder.debug_check_bounds::<Self>(offset);
1125            // Verify that padding bytes are zero.
1126            fidl::decode!(fidl::encoding::Vector<u8, 139>, D, &mut self.signature, decoder, offset + 0, _depth)?;
1127            Ok(())
1128        }
1129    }
1130
1131    impl fidl::encoding::ValueTypeMarker for SignerSignHashResponse {
1132        type Borrowed<'a> = &'a Self;
1133        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1134            value
1135        }
1136    }
1137
1138    unsafe impl fidl::encoding::TypeMarker for SignerSignHashResponse {
1139        type Owned = Self;
1140
1141        #[inline(always)]
1142        fn inline_align(_context: fidl::encoding::Context) -> usize {
1143            8
1144        }
1145
1146        #[inline(always)]
1147        fn inline_size(_context: fidl::encoding::Context) -> usize {
1148            16
1149        }
1150    }
1151
1152    unsafe impl<D: fidl::encoding::ResourceDialect>
1153        fidl::encoding::Encode<SignerSignHashResponse, D> for &SignerSignHashResponse
1154    {
1155        #[inline]
1156        unsafe fn encode(
1157            self,
1158            encoder: &mut fidl::encoding::Encoder<'_, D>,
1159            offset: usize,
1160            _depth: fidl::encoding::Depth,
1161        ) -> fidl::Result<()> {
1162            encoder.debug_check_bounds::<SignerSignHashResponse>(offset);
1163            // Delegate to tuple encoding.
1164            fidl::encoding::Encode::<SignerSignHashResponse, D>::encode(
1165                (<fidl::encoding::Vector<u8, 139> as fidl::encoding::ValueTypeMarker>::borrow(
1166                    &self.signature,
1167                ),),
1168                encoder,
1169                offset,
1170                _depth,
1171            )
1172        }
1173    }
1174    unsafe impl<
1175        D: fidl::encoding::ResourceDialect,
1176        T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 139>, D>,
1177    > fidl::encoding::Encode<SignerSignHashResponse, D> for (T0,)
1178    {
1179        #[inline]
1180        unsafe fn encode(
1181            self,
1182            encoder: &mut fidl::encoding::Encoder<'_, D>,
1183            offset: usize,
1184            depth: fidl::encoding::Depth,
1185        ) -> fidl::Result<()> {
1186            encoder.debug_check_bounds::<SignerSignHashResponse>(offset);
1187            // Zero out padding regions. There's no need to apply masks
1188            // because the unmasked parts will be overwritten by fields.
1189            // Write the fields.
1190            self.0.encode(encoder, offset + 0, depth)?;
1191            Ok(())
1192        }
1193    }
1194
1195    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1196        for SignerSignHashResponse
1197    {
1198        #[inline(always)]
1199        fn new_empty() -> Self {
1200            Self { signature: fidl::new_empty!(fidl::encoding::Vector<u8, 139>, D) }
1201        }
1202
1203        #[inline]
1204        unsafe fn decode(
1205            &mut self,
1206            decoder: &mut fidl::encoding::Decoder<'_, D>,
1207            offset: usize,
1208            _depth: fidl::encoding::Depth,
1209        ) -> fidl::Result<()> {
1210            decoder.debug_check_bounds::<Self>(offset);
1211            // Verify that padding bytes are zero.
1212            fidl::decode!(fidl::encoding::Vector<u8, 139>, D, &mut self.signature, decoder, offset + 0, _depth)?;
1213            Ok(())
1214        }
1215    }
1216
1217    impl fidl::encoding::ValueTypeMarker for StackResetConfigRequest {
1218        type Borrowed<'a> = &'a Self;
1219        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1220            value
1221        }
1222    }
1223
1224    unsafe impl fidl::encoding::TypeMarker for StackResetConfigRequest {
1225        type Owned = Self;
1226
1227        #[inline(always)]
1228        fn inline_align(_context: fidl::encoding::Context) -> usize {
1229            2
1230        }
1231
1232        #[inline(always)]
1233        fn inline_size(_context: fidl::encoding::Context) -> usize {
1234            2
1235        }
1236    }
1237
1238    unsafe impl<D: fidl::encoding::ResourceDialect>
1239        fidl::encoding::Encode<StackResetConfigRequest, D> for &StackResetConfigRequest
1240    {
1241        #[inline]
1242        unsafe fn encode(
1243            self,
1244            encoder: &mut fidl::encoding::Encoder<'_, D>,
1245            offset: usize,
1246            _depth: fidl::encoding::Depth,
1247        ) -> fidl::Result<()> {
1248            encoder.debug_check_bounds::<StackResetConfigRequest>(offset);
1249            // Delegate to tuple encoding.
1250            fidl::encoding::Encode::<StackResetConfigRequest, D>::encode(
1251                (<ResetConfigFlags as fidl::encoding::ValueTypeMarker>::borrow(&self.flags),),
1252                encoder,
1253                offset,
1254                _depth,
1255            )
1256        }
1257    }
1258    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<ResetConfigFlags, D>>
1259        fidl::encoding::Encode<StackResetConfigRequest, D> for (T0,)
1260    {
1261        #[inline]
1262        unsafe fn encode(
1263            self,
1264            encoder: &mut fidl::encoding::Encoder<'_, D>,
1265            offset: usize,
1266            depth: fidl::encoding::Depth,
1267        ) -> fidl::Result<()> {
1268            encoder.debug_check_bounds::<StackResetConfigRequest>(offset);
1269            // Zero out padding regions. There's no need to apply masks
1270            // because the unmasked parts will be overwritten by fields.
1271            // Write the fields.
1272            self.0.encode(encoder, offset + 0, depth)?;
1273            Ok(())
1274        }
1275    }
1276
1277    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1278        for StackResetConfigRequest
1279    {
1280        #[inline(always)]
1281        fn new_empty() -> Self {
1282            Self { flags: fidl::new_empty!(ResetConfigFlags, D) }
1283        }
1284
1285        #[inline]
1286        unsafe fn decode(
1287            &mut self,
1288            decoder: &mut fidl::encoding::Decoder<'_, D>,
1289            offset: usize,
1290            _depth: fidl::encoding::Depth,
1291        ) -> fidl::Result<()> {
1292            decoder.debug_check_bounds::<Self>(offset);
1293            // Verify that padding bytes are zero.
1294            fidl::decode!(ResetConfigFlags, D, &mut self.flags, decoder, offset + 0, _depth)?;
1295            Ok(())
1296        }
1297    }
1298
1299    impl fidl::encoding::ValueTypeMarker for StackGetQrCodeResponse {
1300        type Borrowed<'a> = &'a Self;
1301        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1302            value
1303        }
1304    }
1305
1306    unsafe impl fidl::encoding::TypeMarker for StackGetQrCodeResponse {
1307        type Owned = Self;
1308
1309        #[inline(always)]
1310        fn inline_align(_context: fidl::encoding::Context) -> usize {
1311            8
1312        }
1313
1314        #[inline(always)]
1315        fn inline_size(_context: fidl::encoding::Context) -> usize {
1316            16
1317        }
1318    }
1319
1320    unsafe impl<D: fidl::encoding::ResourceDialect>
1321        fidl::encoding::Encode<StackGetQrCodeResponse, D> for &StackGetQrCodeResponse
1322    {
1323        #[inline]
1324        unsafe fn encode(
1325            self,
1326            encoder: &mut fidl::encoding::Encoder<'_, D>,
1327            offset: usize,
1328            _depth: fidl::encoding::Depth,
1329        ) -> fidl::Result<()> {
1330            encoder.debug_check_bounds::<StackGetQrCodeResponse>(offset);
1331            // Delegate to tuple encoding.
1332            fidl::encoding::Encode::<StackGetQrCodeResponse, D>::encode(
1333                (<QrCode as fidl::encoding::ValueTypeMarker>::borrow(&self.qr_code),),
1334                encoder,
1335                offset,
1336                _depth,
1337            )
1338        }
1339    }
1340    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<QrCode, D>>
1341        fidl::encoding::Encode<StackGetQrCodeResponse, D> for (T0,)
1342    {
1343        #[inline]
1344        unsafe fn encode(
1345            self,
1346            encoder: &mut fidl::encoding::Encoder<'_, D>,
1347            offset: usize,
1348            depth: fidl::encoding::Depth,
1349        ) -> fidl::Result<()> {
1350            encoder.debug_check_bounds::<StackGetQrCodeResponse>(offset);
1351            // Zero out padding regions. There's no need to apply masks
1352            // because the unmasked parts will be overwritten by fields.
1353            // Write the fields.
1354            self.0.encode(encoder, offset + 0, depth)?;
1355            Ok(())
1356        }
1357    }
1358
1359    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1360        for StackGetQrCodeResponse
1361    {
1362        #[inline(always)]
1363        fn new_empty() -> Self {
1364            Self { qr_code: fidl::new_empty!(QrCode, D) }
1365        }
1366
1367        #[inline]
1368        unsafe fn decode(
1369            &mut self,
1370            decoder: &mut fidl::encoding::Decoder<'_, D>,
1371            offset: usize,
1372            _depth: fidl::encoding::Depth,
1373        ) -> fidl::Result<()> {
1374            decoder.debug_check_bounds::<Self>(offset);
1375            // Verify that padding bytes are zero.
1376            fidl::decode!(QrCode, D, &mut self.qr_code, decoder, offset + 0, _depth)?;
1377            Ok(())
1378        }
1379    }
1380
1381    impl fidl::encoding::ValueTypeMarker for SvcDirectoryWatcherWatchServiceDirectoryResponse {
1382        type Borrowed<'a> = &'a Self;
1383        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1384            value
1385        }
1386    }
1387
1388    unsafe impl fidl::encoding::TypeMarker for SvcDirectoryWatcherWatchServiceDirectoryResponse {
1389        type Owned = Self;
1390
1391        #[inline(always)]
1392        fn inline_align(_context: fidl::encoding::Context) -> usize {
1393            8
1394        }
1395
1396        #[inline(always)]
1397        fn inline_size(_context: fidl::encoding::Context) -> usize {
1398            16
1399        }
1400    }
1401
1402    unsafe impl<D: fidl::encoding::ResourceDialect>
1403        fidl::encoding::Encode<SvcDirectoryWatcherWatchServiceDirectoryResponse, D>
1404        for &SvcDirectoryWatcherWatchServiceDirectoryResponse
1405    {
1406        #[inline]
1407        unsafe fn encode(
1408            self,
1409            encoder: &mut fidl::encoding::Encoder<'_, D>,
1410            offset: usize,
1411            _depth: fidl::encoding::Depth,
1412        ) -> fidl::Result<()> {
1413            encoder.debug_check_bounds::<SvcDirectoryWatcherWatchServiceDirectoryResponse>(offset);
1414            // Delegate to tuple encoding.
1415            fidl::encoding::Encode::<SvcDirectoryWatcherWatchServiceDirectoryResponse, D>::encode(
1416                (
1417                    <fidl::encoding::Vector<HostPort, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.host_port_list),
1418                ),
1419                encoder, offset, _depth
1420            )
1421        }
1422    }
1423    unsafe impl<
1424        D: fidl::encoding::ResourceDialect,
1425        T0: fidl::encoding::Encode<fidl::encoding::Vector<HostPort, 256>, D>,
1426    > fidl::encoding::Encode<SvcDirectoryWatcherWatchServiceDirectoryResponse, D> for (T0,)
1427    {
1428        #[inline]
1429        unsafe fn encode(
1430            self,
1431            encoder: &mut fidl::encoding::Encoder<'_, D>,
1432            offset: usize,
1433            depth: fidl::encoding::Depth,
1434        ) -> fidl::Result<()> {
1435            encoder.debug_check_bounds::<SvcDirectoryWatcherWatchServiceDirectoryResponse>(offset);
1436            // Zero out padding regions. There's no need to apply masks
1437            // because the unmasked parts will be overwritten by fields.
1438            // Write the fields.
1439            self.0.encode(encoder, offset + 0, depth)?;
1440            Ok(())
1441        }
1442    }
1443
1444    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1445        for SvcDirectoryWatcherWatchServiceDirectoryResponse
1446    {
1447        #[inline(always)]
1448        fn new_empty() -> Self {
1449            Self { host_port_list: fidl::new_empty!(fidl::encoding::Vector<HostPort, 256>, D) }
1450        }
1451
1452        #[inline]
1453        unsafe fn decode(
1454            &mut self,
1455            decoder: &mut fidl::encoding::Decoder<'_, D>,
1456            offset: usize,
1457            _depth: fidl::encoding::Depth,
1458        ) -> fidl::Result<()> {
1459            decoder.debug_check_bounds::<Self>(offset);
1460            // Verify that padding bytes are zero.
1461            fidl::decode!(fidl::encoding::Vector<HostPort, 256>, D, &mut self.host_port_list, decoder, offset + 0, _depth)?;
1462            Ok(())
1463        }
1464    }
1465
1466    impl fidl::encoding::ValueTypeMarker for WlanNetworkConfigProviderWatchConnectedNetworkResponse {
1467        type Borrowed<'a> = &'a Self;
1468        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1469            value
1470        }
1471    }
1472
1473    unsafe impl fidl::encoding::TypeMarker for WlanNetworkConfigProviderWatchConnectedNetworkResponse {
1474        type Owned = Self;
1475
1476        #[inline(always)]
1477        fn inline_align(_context: fidl::encoding::Context) -> usize {
1478            8
1479        }
1480
1481        #[inline(always)]
1482        fn inline_size(_context: fidl::encoding::Context) -> usize {
1483            16
1484        }
1485    }
1486
1487    unsafe impl<D: fidl::encoding::ResourceDialect>
1488        fidl::encoding::Encode<WlanNetworkConfigProviderWatchConnectedNetworkResponse, D>
1489        for &WlanNetworkConfigProviderWatchConnectedNetworkResponse
1490    {
1491        #[inline]
1492        unsafe fn encode(
1493            self,
1494            encoder: &mut fidl::encoding::Encoder<'_, D>,
1495            offset: usize,
1496            _depth: fidl::encoding::Depth,
1497        ) -> fidl::Result<()> {
1498            encoder.debug_check_bounds::<WlanNetworkConfigProviderWatchConnectedNetworkResponse>(
1499                offset,
1500            );
1501            // Delegate to tuple encoding.
1502            fidl::encoding::Encode::<WlanNetworkConfigProviderWatchConnectedNetworkResponse, D>::encode(
1503                (
1504                    <fidl_fuchsia_wlan_policy__common::NetworkConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.network_config),
1505                ),
1506                encoder, offset, _depth
1507            )
1508        }
1509    }
1510    unsafe impl<
1511        D: fidl::encoding::ResourceDialect,
1512        T0: fidl::encoding::Encode<fidl_fuchsia_wlan_policy__common::NetworkConfig, D>,
1513    > fidl::encoding::Encode<WlanNetworkConfigProviderWatchConnectedNetworkResponse, D> for (T0,)
1514    {
1515        #[inline]
1516        unsafe fn encode(
1517            self,
1518            encoder: &mut fidl::encoding::Encoder<'_, D>,
1519            offset: usize,
1520            depth: fidl::encoding::Depth,
1521        ) -> fidl::Result<()> {
1522            encoder.debug_check_bounds::<WlanNetworkConfigProviderWatchConnectedNetworkResponse>(
1523                offset,
1524            );
1525            // Zero out padding regions. There's no need to apply masks
1526            // because the unmasked parts will be overwritten by fields.
1527            // Write the fields.
1528            self.0.encode(encoder, offset + 0, depth)?;
1529            Ok(())
1530        }
1531    }
1532
1533    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1534        for WlanNetworkConfigProviderWatchConnectedNetworkResponse
1535    {
1536        #[inline(always)]
1537        fn new_empty() -> Self {
1538            Self {
1539                network_config: fidl::new_empty!(
1540                    fidl_fuchsia_wlan_policy__common::NetworkConfig,
1541                    D
1542                ),
1543            }
1544        }
1545
1546        #[inline]
1547        unsafe fn decode(
1548            &mut self,
1549            decoder: &mut fidl::encoding::Decoder<'_, D>,
1550            offset: usize,
1551            _depth: fidl::encoding::Depth,
1552        ) -> fidl::Result<()> {
1553            decoder.debug_check_bounds::<Self>(offset);
1554            // Verify that padding bytes are zero.
1555            fidl::decode!(
1556                fidl_fuchsia_wlan_policy__common::NetworkConfig,
1557                D,
1558                &mut self.network_config,
1559                decoder,
1560                offset + 0,
1561                _depth
1562            )?;
1563            Ok(())
1564        }
1565    }
1566
1567    impl PairingState {
1568        #[inline(always)]
1569        fn max_ordinal_present(&self) -> u64 {
1570            if let Some(_) = self.is_service_provisioned {
1571                return 5;
1572            }
1573            if let Some(_) = self.is_fabric_provisioned {
1574                return 4;
1575            }
1576            if let Some(_) = self.is_thread_provisioned {
1577                return 3;
1578            }
1579            if let Some(_) = self.is_wlan_provisioned {
1580                return 2;
1581            }
1582            if let Some(_) = self.is_weave_fully_provisioned {
1583                return 1;
1584            }
1585            0
1586        }
1587    }
1588
1589    impl fidl::encoding::ValueTypeMarker for PairingState {
1590        type Borrowed<'a> = &'a Self;
1591        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1592            value
1593        }
1594    }
1595
1596    unsafe impl fidl::encoding::TypeMarker for PairingState {
1597        type Owned = Self;
1598
1599        #[inline(always)]
1600        fn inline_align(_context: fidl::encoding::Context) -> usize {
1601            8
1602        }
1603
1604        #[inline(always)]
1605        fn inline_size(_context: fidl::encoding::Context) -> usize {
1606            16
1607        }
1608    }
1609
1610    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PairingState, D>
1611        for &PairingState
1612    {
1613        unsafe fn encode(
1614            self,
1615            encoder: &mut fidl::encoding::Encoder<'_, D>,
1616            offset: usize,
1617            mut depth: fidl::encoding::Depth,
1618        ) -> fidl::Result<()> {
1619            encoder.debug_check_bounds::<PairingState>(offset);
1620            // Vector header
1621            let max_ordinal: u64 = self.max_ordinal_present();
1622            encoder.write_num(max_ordinal, offset);
1623            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1624            // Calling encoder.out_of_line_offset(0) is not allowed.
1625            if max_ordinal == 0 {
1626                return Ok(());
1627            }
1628            depth.increment()?;
1629            let envelope_size = 8;
1630            let bytes_len = max_ordinal as usize * envelope_size;
1631            #[allow(unused_variables)]
1632            let offset = encoder.out_of_line_offset(bytes_len);
1633            let mut _prev_end_offset: usize = 0;
1634            if 1 > max_ordinal {
1635                return Ok(());
1636            }
1637
1638            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1639            // are envelope_size bytes.
1640            let cur_offset: usize = (1 - 1) * envelope_size;
1641
1642            // Zero reserved fields.
1643            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1644
1645            // Safety:
1646            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1647            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1648            //   envelope_size bytes, there is always sufficient room.
1649            fidl::encoding::encode_in_envelope_optional::<bool, D>(
1650                self.is_weave_fully_provisioned
1651                    .as_ref()
1652                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1653                encoder,
1654                offset + cur_offset,
1655                depth,
1656            )?;
1657
1658            _prev_end_offset = cur_offset + envelope_size;
1659            if 2 > max_ordinal {
1660                return Ok(());
1661            }
1662
1663            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1664            // are envelope_size bytes.
1665            let cur_offset: usize = (2 - 1) * envelope_size;
1666
1667            // Zero reserved fields.
1668            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1669
1670            // Safety:
1671            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1672            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1673            //   envelope_size bytes, there is always sufficient room.
1674            fidl::encoding::encode_in_envelope_optional::<bool, D>(
1675                self.is_wlan_provisioned
1676                    .as_ref()
1677                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1678                encoder,
1679                offset + cur_offset,
1680                depth,
1681            )?;
1682
1683            _prev_end_offset = cur_offset + envelope_size;
1684            if 3 > max_ordinal {
1685                return Ok(());
1686            }
1687
1688            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1689            // are envelope_size bytes.
1690            let cur_offset: usize = (3 - 1) * envelope_size;
1691
1692            // Zero reserved fields.
1693            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1694
1695            // Safety:
1696            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1697            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1698            //   envelope_size bytes, there is always sufficient room.
1699            fidl::encoding::encode_in_envelope_optional::<bool, D>(
1700                self.is_thread_provisioned
1701                    .as_ref()
1702                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1703                encoder,
1704                offset + cur_offset,
1705                depth,
1706            )?;
1707
1708            _prev_end_offset = cur_offset + envelope_size;
1709            if 4 > max_ordinal {
1710                return Ok(());
1711            }
1712
1713            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1714            // are envelope_size bytes.
1715            let cur_offset: usize = (4 - 1) * envelope_size;
1716
1717            // Zero reserved fields.
1718            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1719
1720            // Safety:
1721            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1722            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1723            //   envelope_size bytes, there is always sufficient room.
1724            fidl::encoding::encode_in_envelope_optional::<bool, D>(
1725                self.is_fabric_provisioned
1726                    .as_ref()
1727                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1728                encoder,
1729                offset + cur_offset,
1730                depth,
1731            )?;
1732
1733            _prev_end_offset = cur_offset + envelope_size;
1734            if 5 > max_ordinal {
1735                return Ok(());
1736            }
1737
1738            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1739            // are envelope_size bytes.
1740            let cur_offset: usize = (5 - 1) * envelope_size;
1741
1742            // Zero reserved fields.
1743            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1744
1745            // Safety:
1746            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1747            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1748            //   envelope_size bytes, there is always sufficient room.
1749            fidl::encoding::encode_in_envelope_optional::<bool, D>(
1750                self.is_service_provisioned
1751                    .as_ref()
1752                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1753                encoder,
1754                offset + cur_offset,
1755                depth,
1756            )?;
1757
1758            _prev_end_offset = cur_offset + envelope_size;
1759
1760            Ok(())
1761        }
1762    }
1763
1764    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PairingState {
1765        #[inline(always)]
1766        fn new_empty() -> Self {
1767            Self::default()
1768        }
1769
1770        unsafe fn decode(
1771            &mut self,
1772            decoder: &mut fidl::encoding::Decoder<'_, D>,
1773            offset: usize,
1774            mut depth: fidl::encoding::Depth,
1775        ) -> fidl::Result<()> {
1776            decoder.debug_check_bounds::<Self>(offset);
1777            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1778                None => return Err(fidl::Error::NotNullable),
1779                Some(len) => len,
1780            };
1781            // Calling decoder.out_of_line_offset(0) is not allowed.
1782            if len == 0 {
1783                return Ok(());
1784            };
1785            depth.increment()?;
1786            let envelope_size = 8;
1787            let bytes_len = len * envelope_size;
1788            let offset = decoder.out_of_line_offset(bytes_len)?;
1789            // Decode the envelope for each type.
1790            let mut _next_ordinal_to_read = 0;
1791            let mut next_offset = offset;
1792            let end_offset = offset + bytes_len;
1793            _next_ordinal_to_read += 1;
1794            if next_offset >= end_offset {
1795                return Ok(());
1796            }
1797
1798            // Decode unknown envelopes for gaps in ordinals.
1799            while _next_ordinal_to_read < 1 {
1800                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1801                _next_ordinal_to_read += 1;
1802                next_offset += envelope_size;
1803            }
1804
1805            let next_out_of_line = decoder.next_out_of_line();
1806            let handles_before = decoder.remaining_handles();
1807            if let Some((inlined, num_bytes, num_handles)) =
1808                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1809            {
1810                let member_inline_size =
1811                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1812                if inlined != (member_inline_size <= 4) {
1813                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1814                }
1815                let inner_offset;
1816                let mut inner_depth = depth.clone();
1817                if inlined {
1818                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1819                    inner_offset = next_offset;
1820                } else {
1821                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1822                    inner_depth.increment()?;
1823                }
1824                let val_ref = self
1825                    .is_weave_fully_provisioned
1826                    .get_or_insert_with(|| fidl::new_empty!(bool, D));
1827                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
1828                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1829                {
1830                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1831                }
1832                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1833                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1834                }
1835            }
1836
1837            next_offset += envelope_size;
1838            _next_ordinal_to_read += 1;
1839            if next_offset >= end_offset {
1840                return Ok(());
1841            }
1842
1843            // Decode unknown envelopes for gaps in ordinals.
1844            while _next_ordinal_to_read < 2 {
1845                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1846                _next_ordinal_to_read += 1;
1847                next_offset += envelope_size;
1848            }
1849
1850            let next_out_of_line = decoder.next_out_of_line();
1851            let handles_before = decoder.remaining_handles();
1852            if let Some((inlined, num_bytes, num_handles)) =
1853                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1854            {
1855                let member_inline_size =
1856                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1857                if inlined != (member_inline_size <= 4) {
1858                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1859                }
1860                let inner_offset;
1861                let mut inner_depth = depth.clone();
1862                if inlined {
1863                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1864                    inner_offset = next_offset;
1865                } else {
1866                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1867                    inner_depth.increment()?;
1868                }
1869                let val_ref =
1870                    self.is_wlan_provisioned.get_or_insert_with(|| fidl::new_empty!(bool, D));
1871                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
1872                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1873                {
1874                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1875                }
1876                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1877                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1878                }
1879            }
1880
1881            next_offset += envelope_size;
1882            _next_ordinal_to_read += 1;
1883            if next_offset >= end_offset {
1884                return Ok(());
1885            }
1886
1887            // Decode unknown envelopes for gaps in ordinals.
1888            while _next_ordinal_to_read < 3 {
1889                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1890                _next_ordinal_to_read += 1;
1891                next_offset += envelope_size;
1892            }
1893
1894            let next_out_of_line = decoder.next_out_of_line();
1895            let handles_before = decoder.remaining_handles();
1896            if let Some((inlined, num_bytes, num_handles)) =
1897                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1898            {
1899                let member_inline_size =
1900                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1901                if inlined != (member_inline_size <= 4) {
1902                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1903                }
1904                let inner_offset;
1905                let mut inner_depth = depth.clone();
1906                if inlined {
1907                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1908                    inner_offset = next_offset;
1909                } else {
1910                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1911                    inner_depth.increment()?;
1912                }
1913                let val_ref =
1914                    self.is_thread_provisioned.get_or_insert_with(|| fidl::new_empty!(bool, D));
1915                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
1916                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1917                {
1918                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1919                }
1920                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1921                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1922                }
1923            }
1924
1925            next_offset += envelope_size;
1926            _next_ordinal_to_read += 1;
1927            if next_offset >= end_offset {
1928                return Ok(());
1929            }
1930
1931            // Decode unknown envelopes for gaps in ordinals.
1932            while _next_ordinal_to_read < 4 {
1933                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1934                _next_ordinal_to_read += 1;
1935                next_offset += envelope_size;
1936            }
1937
1938            let next_out_of_line = decoder.next_out_of_line();
1939            let handles_before = decoder.remaining_handles();
1940            if let Some((inlined, num_bytes, num_handles)) =
1941                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1942            {
1943                let member_inline_size =
1944                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1945                if inlined != (member_inline_size <= 4) {
1946                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1947                }
1948                let inner_offset;
1949                let mut inner_depth = depth.clone();
1950                if inlined {
1951                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1952                    inner_offset = next_offset;
1953                } else {
1954                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1955                    inner_depth.increment()?;
1956                }
1957                let val_ref =
1958                    self.is_fabric_provisioned.get_or_insert_with(|| fidl::new_empty!(bool, D));
1959                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
1960                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1961                {
1962                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1963                }
1964                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1965                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1966                }
1967            }
1968
1969            next_offset += envelope_size;
1970            _next_ordinal_to_read += 1;
1971            if next_offset >= end_offset {
1972                return Ok(());
1973            }
1974
1975            // Decode unknown envelopes for gaps in ordinals.
1976            while _next_ordinal_to_read < 5 {
1977                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1978                _next_ordinal_to_read += 1;
1979                next_offset += envelope_size;
1980            }
1981
1982            let next_out_of_line = decoder.next_out_of_line();
1983            let handles_before = decoder.remaining_handles();
1984            if let Some((inlined, num_bytes, num_handles)) =
1985                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1986            {
1987                let member_inline_size =
1988                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1989                if inlined != (member_inline_size <= 4) {
1990                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1991                }
1992                let inner_offset;
1993                let mut inner_depth = depth.clone();
1994                if inlined {
1995                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1996                    inner_offset = next_offset;
1997                } else {
1998                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1999                    inner_depth.increment()?;
2000                }
2001                let val_ref =
2002                    self.is_service_provisioned.get_or_insert_with(|| fidl::new_empty!(bool, D));
2003                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2004                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2005                {
2006                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2007                }
2008                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2009                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2010                }
2011            }
2012
2013            next_offset += envelope_size;
2014
2015            // Decode the remaining unknown envelopes.
2016            while next_offset < end_offset {
2017                _next_ordinal_to_read += 1;
2018                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2019                next_offset += envelope_size;
2020            }
2021
2022            Ok(())
2023        }
2024    }
2025
2026    impl fidl::encoding::ValueTypeMarker for Host {
2027        type Borrowed<'a> = &'a Self;
2028        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2029            value
2030        }
2031    }
2032
2033    unsafe impl fidl::encoding::TypeMarker for Host {
2034        type Owned = Self;
2035
2036        #[inline(always)]
2037        fn inline_align(_context: fidl::encoding::Context) -> usize {
2038            8
2039        }
2040
2041        #[inline(always)]
2042        fn inline_size(_context: fidl::encoding::Context) -> usize {
2043            16
2044        }
2045    }
2046
2047    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Host, D> for &Host {
2048        #[inline]
2049        unsafe fn encode(
2050            self,
2051            encoder: &mut fidl::encoding::Encoder<'_, D>,
2052            offset: usize,
2053            _depth: fidl::encoding::Depth,
2054        ) -> fidl::Result<()> {
2055            encoder.debug_check_bounds::<Host>(offset);
2056            encoder.write_num::<u64>(self.ordinal(), offset);
2057            match self {
2058            Host::Hostname(ref val) => {
2059                fidl::encoding::encode_in_envelope::<fidl::encoding::BoundedString<255>, D>(
2060                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(val),
2061                    encoder, offset + 8, _depth
2062                )
2063            }
2064            Host::IpAddress(ref val) => {
2065                fidl::encoding::encode_in_envelope::<fidl_fuchsia_net__common::IpAddress, D>(
2066                    <fidl_fuchsia_net__common::IpAddress as fidl::encoding::ValueTypeMarker>::borrow(val),
2067                    encoder, offset + 8, _depth
2068                )
2069            }
2070        }
2071        }
2072    }
2073
2074    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Host {
2075        #[inline(always)]
2076        fn new_empty() -> Self {
2077            Self::Hostname(fidl::new_empty!(fidl::encoding::BoundedString<255>, D))
2078        }
2079
2080        #[inline]
2081        unsafe fn decode(
2082            &mut self,
2083            decoder: &mut fidl::encoding::Decoder<'_, D>,
2084            offset: usize,
2085            mut depth: fidl::encoding::Depth,
2086        ) -> fidl::Result<()> {
2087            decoder.debug_check_bounds::<Self>(offset);
2088            #[allow(unused_variables)]
2089            let next_out_of_line = decoder.next_out_of_line();
2090            let handles_before = decoder.remaining_handles();
2091            let (ordinal, inlined, num_bytes, num_handles) =
2092                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2093
2094            let member_inline_size = match ordinal {
2095                1 => {
2096                    <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
2097                        decoder.context,
2098                    )
2099                }
2100                2 => {
2101                    <fidl_fuchsia_net__common::IpAddress as fidl::encoding::TypeMarker>::inline_size(
2102                        decoder.context,
2103                    )
2104                }
2105                _ => return Err(fidl::Error::UnknownUnionTag),
2106            };
2107
2108            if inlined != (member_inline_size <= 4) {
2109                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2110            }
2111            let _inner_offset;
2112            if inlined {
2113                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2114                _inner_offset = offset + 8;
2115            } else {
2116                depth.increment()?;
2117                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2118            }
2119            match ordinal {
2120                1 => {
2121                    #[allow(irrefutable_let_patterns)]
2122                    if let Host::Hostname(_) = self {
2123                        // Do nothing, read the value into the object
2124                    } else {
2125                        // Initialize `self` to the right variant
2126                        *self =
2127                            Host::Hostname(fidl::new_empty!(fidl::encoding::BoundedString<255>, D));
2128                    }
2129                    #[allow(irrefutable_let_patterns)]
2130                    if let Host::Hostname(ref mut val) = self {
2131                        fidl::decode!(
2132                            fidl::encoding::BoundedString<255>,
2133                            D,
2134                            val,
2135                            decoder,
2136                            _inner_offset,
2137                            depth
2138                        )?;
2139                    } else {
2140                        unreachable!()
2141                    }
2142                }
2143                2 => {
2144                    #[allow(irrefutable_let_patterns)]
2145                    if let Host::IpAddress(_) = self {
2146                        // Do nothing, read the value into the object
2147                    } else {
2148                        // Initialize `self` to the right variant
2149                        *self = Host::IpAddress(fidl::new_empty!(
2150                            fidl_fuchsia_net__common::IpAddress,
2151                            D
2152                        ));
2153                    }
2154                    #[allow(irrefutable_let_patterns)]
2155                    if let Host::IpAddress(ref mut val) = self {
2156                        fidl::decode!(
2157                            fidl_fuchsia_net__common::IpAddress,
2158                            D,
2159                            val,
2160                            decoder,
2161                            _inner_offset,
2162                            depth
2163                        )?;
2164                    } else {
2165                        unreachable!()
2166                    }
2167                }
2168                ordinal => panic!("unexpected ordinal {:?}", ordinal),
2169            }
2170            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2171                return Err(fidl::Error::InvalidNumBytesInEnvelope);
2172            }
2173            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2174                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2175            }
2176            Ok(())
2177        }
2178    }
2179}