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