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