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