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>
1514 for (T0,)
1515 {
1516 #[inline]
1517 unsafe fn encode(
1518 self,
1519 encoder: &mut fidl::encoding::Encoder<'_, D>,
1520 offset: usize,
1521 depth: fidl::encoding::Depth,
1522 ) -> fidl::Result<()> {
1523 encoder.debug_check_bounds::<WlanNetworkConfigProviderWatchConnectedNetworkResponse>(
1524 offset,
1525 );
1526 self.0.encode(encoder, offset + 0, depth)?;
1530 Ok(())
1531 }
1532 }
1533
1534 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1535 for WlanNetworkConfigProviderWatchConnectedNetworkResponse
1536 {
1537 #[inline(always)]
1538 fn new_empty() -> Self {
1539 Self {
1540 network_config: fidl::new_empty!(
1541 fidl_fuchsia_wlan_policy__common::NetworkConfig,
1542 D
1543 ),
1544 }
1545 }
1546
1547 #[inline]
1548 unsafe fn decode(
1549 &mut self,
1550 decoder: &mut fidl::encoding::Decoder<'_, D>,
1551 offset: usize,
1552 _depth: fidl::encoding::Depth,
1553 ) -> fidl::Result<()> {
1554 decoder.debug_check_bounds::<Self>(offset);
1555 fidl::decode!(
1557 fidl_fuchsia_wlan_policy__common::NetworkConfig,
1558 D,
1559 &mut self.network_config,
1560 decoder,
1561 offset + 0,
1562 _depth
1563 )?;
1564 Ok(())
1565 }
1566 }
1567
1568 impl PairingState {
1569 #[inline(always)]
1570 fn max_ordinal_present(&self) -> u64 {
1571 if let Some(_) = self.is_service_provisioned {
1572 return 5;
1573 }
1574 if let Some(_) = self.is_fabric_provisioned {
1575 return 4;
1576 }
1577 if let Some(_) = self.is_thread_provisioned {
1578 return 3;
1579 }
1580 if let Some(_) = self.is_wlan_provisioned {
1581 return 2;
1582 }
1583 if let Some(_) = self.is_weave_fully_provisioned {
1584 return 1;
1585 }
1586 0
1587 }
1588 }
1589
1590 impl fidl::encoding::ValueTypeMarker for PairingState {
1591 type Borrowed<'a> = &'a Self;
1592 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1593 value
1594 }
1595 }
1596
1597 unsafe impl fidl::encoding::TypeMarker for PairingState {
1598 type Owned = Self;
1599
1600 #[inline(always)]
1601 fn inline_align(_context: fidl::encoding::Context) -> usize {
1602 8
1603 }
1604
1605 #[inline(always)]
1606 fn inline_size(_context: fidl::encoding::Context) -> usize {
1607 16
1608 }
1609 }
1610
1611 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PairingState, D>
1612 for &PairingState
1613 {
1614 unsafe fn encode(
1615 self,
1616 encoder: &mut fidl::encoding::Encoder<'_, D>,
1617 offset: usize,
1618 mut depth: fidl::encoding::Depth,
1619 ) -> fidl::Result<()> {
1620 encoder.debug_check_bounds::<PairingState>(offset);
1621 let max_ordinal: u64 = self.max_ordinal_present();
1623 encoder.write_num(max_ordinal, offset);
1624 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1625 if max_ordinal == 0 {
1627 return Ok(());
1628 }
1629 depth.increment()?;
1630 let envelope_size = 8;
1631 let bytes_len = max_ordinal as usize * envelope_size;
1632 #[allow(unused_variables)]
1633 let offset = encoder.out_of_line_offset(bytes_len);
1634 let mut _prev_end_offset: usize = 0;
1635 if 1 > max_ordinal {
1636 return Ok(());
1637 }
1638
1639 let cur_offset: usize = (1 - 1) * envelope_size;
1642
1643 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1645
1646 fidl::encoding::encode_in_envelope_optional::<bool, D>(
1651 self.is_weave_fully_provisioned
1652 .as_ref()
1653 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1654 encoder,
1655 offset + cur_offset,
1656 depth,
1657 )?;
1658
1659 _prev_end_offset = cur_offset + envelope_size;
1660 if 2 > max_ordinal {
1661 return Ok(());
1662 }
1663
1664 let cur_offset: usize = (2 - 1) * envelope_size;
1667
1668 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1670
1671 fidl::encoding::encode_in_envelope_optional::<bool, D>(
1676 self.is_wlan_provisioned
1677 .as_ref()
1678 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1679 encoder,
1680 offset + cur_offset,
1681 depth,
1682 )?;
1683
1684 _prev_end_offset = cur_offset + envelope_size;
1685 if 3 > max_ordinal {
1686 return Ok(());
1687 }
1688
1689 let cur_offset: usize = (3 - 1) * envelope_size;
1692
1693 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1695
1696 fidl::encoding::encode_in_envelope_optional::<bool, D>(
1701 self.is_thread_provisioned
1702 .as_ref()
1703 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1704 encoder,
1705 offset + cur_offset,
1706 depth,
1707 )?;
1708
1709 _prev_end_offset = cur_offset + envelope_size;
1710 if 4 > max_ordinal {
1711 return Ok(());
1712 }
1713
1714 let cur_offset: usize = (4 - 1) * envelope_size;
1717
1718 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1720
1721 fidl::encoding::encode_in_envelope_optional::<bool, D>(
1726 self.is_fabric_provisioned
1727 .as_ref()
1728 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1729 encoder,
1730 offset + cur_offset,
1731 depth,
1732 )?;
1733
1734 _prev_end_offset = cur_offset + envelope_size;
1735 if 5 > max_ordinal {
1736 return Ok(());
1737 }
1738
1739 let cur_offset: usize = (5 - 1) * envelope_size;
1742
1743 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1745
1746 fidl::encoding::encode_in_envelope_optional::<bool, D>(
1751 self.is_service_provisioned
1752 .as_ref()
1753 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1754 encoder,
1755 offset + cur_offset,
1756 depth,
1757 )?;
1758
1759 _prev_end_offset = cur_offset + envelope_size;
1760
1761 Ok(())
1762 }
1763 }
1764
1765 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PairingState {
1766 #[inline(always)]
1767 fn new_empty() -> Self {
1768 Self::default()
1769 }
1770
1771 unsafe fn decode(
1772 &mut self,
1773 decoder: &mut fidl::encoding::Decoder<'_, D>,
1774 offset: usize,
1775 mut depth: fidl::encoding::Depth,
1776 ) -> fidl::Result<()> {
1777 decoder.debug_check_bounds::<Self>(offset);
1778 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1779 None => return Err(fidl::Error::NotNullable),
1780 Some(len) => len,
1781 };
1782 if len == 0 {
1784 return Ok(());
1785 };
1786 depth.increment()?;
1787 let envelope_size = 8;
1788 let bytes_len = len * envelope_size;
1789 let offset = decoder.out_of_line_offset(bytes_len)?;
1790 let mut _next_ordinal_to_read = 0;
1792 let mut next_offset = offset;
1793 let end_offset = offset + bytes_len;
1794 _next_ordinal_to_read += 1;
1795 if next_offset >= end_offset {
1796 return Ok(());
1797 }
1798
1799 while _next_ordinal_to_read < 1 {
1801 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1802 _next_ordinal_to_read += 1;
1803 next_offset += envelope_size;
1804 }
1805
1806 let next_out_of_line = decoder.next_out_of_line();
1807 let handles_before = decoder.remaining_handles();
1808 if let Some((inlined, num_bytes, num_handles)) =
1809 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1810 {
1811 let member_inline_size =
1812 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1813 if inlined != (member_inline_size <= 4) {
1814 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1815 }
1816 let inner_offset;
1817 let mut inner_depth = depth.clone();
1818 if inlined {
1819 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1820 inner_offset = next_offset;
1821 } else {
1822 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1823 inner_depth.increment()?;
1824 }
1825 let val_ref = self
1826 .is_weave_fully_provisioned
1827 .get_or_insert_with(|| fidl::new_empty!(bool, D));
1828 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
1829 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1830 {
1831 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1832 }
1833 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1834 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1835 }
1836 }
1837
1838 next_offset += envelope_size;
1839 _next_ordinal_to_read += 1;
1840 if next_offset >= end_offset {
1841 return Ok(());
1842 }
1843
1844 while _next_ordinal_to_read < 2 {
1846 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1847 _next_ordinal_to_read += 1;
1848 next_offset += envelope_size;
1849 }
1850
1851 let next_out_of_line = decoder.next_out_of_line();
1852 let handles_before = decoder.remaining_handles();
1853 if let Some((inlined, num_bytes, num_handles)) =
1854 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1855 {
1856 let member_inline_size =
1857 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1858 if inlined != (member_inline_size <= 4) {
1859 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1860 }
1861 let inner_offset;
1862 let mut inner_depth = depth.clone();
1863 if inlined {
1864 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1865 inner_offset = next_offset;
1866 } else {
1867 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1868 inner_depth.increment()?;
1869 }
1870 let val_ref =
1871 self.is_wlan_provisioned.get_or_insert_with(|| fidl::new_empty!(bool, D));
1872 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
1873 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1874 {
1875 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1876 }
1877 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1878 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1879 }
1880 }
1881
1882 next_offset += envelope_size;
1883 _next_ordinal_to_read += 1;
1884 if next_offset >= end_offset {
1885 return Ok(());
1886 }
1887
1888 while _next_ordinal_to_read < 3 {
1890 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1891 _next_ordinal_to_read += 1;
1892 next_offset += envelope_size;
1893 }
1894
1895 let next_out_of_line = decoder.next_out_of_line();
1896 let handles_before = decoder.remaining_handles();
1897 if let Some((inlined, num_bytes, num_handles)) =
1898 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1899 {
1900 let member_inline_size =
1901 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1902 if inlined != (member_inline_size <= 4) {
1903 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1904 }
1905 let inner_offset;
1906 let mut inner_depth = depth.clone();
1907 if inlined {
1908 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1909 inner_offset = next_offset;
1910 } else {
1911 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1912 inner_depth.increment()?;
1913 }
1914 let val_ref =
1915 self.is_thread_provisioned.get_or_insert_with(|| fidl::new_empty!(bool, D));
1916 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
1917 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1918 {
1919 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1920 }
1921 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1922 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1923 }
1924 }
1925
1926 next_offset += envelope_size;
1927 _next_ordinal_to_read += 1;
1928 if next_offset >= end_offset {
1929 return Ok(());
1930 }
1931
1932 while _next_ordinal_to_read < 4 {
1934 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1935 _next_ordinal_to_read += 1;
1936 next_offset += envelope_size;
1937 }
1938
1939 let next_out_of_line = decoder.next_out_of_line();
1940 let handles_before = decoder.remaining_handles();
1941 if let Some((inlined, num_bytes, num_handles)) =
1942 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1943 {
1944 let member_inline_size =
1945 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1946 if inlined != (member_inline_size <= 4) {
1947 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1948 }
1949 let inner_offset;
1950 let mut inner_depth = depth.clone();
1951 if inlined {
1952 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1953 inner_offset = next_offset;
1954 } else {
1955 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1956 inner_depth.increment()?;
1957 }
1958 let val_ref =
1959 self.is_fabric_provisioned.get_or_insert_with(|| fidl::new_empty!(bool, D));
1960 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
1961 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1962 {
1963 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1964 }
1965 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1966 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1967 }
1968 }
1969
1970 next_offset += envelope_size;
1971 _next_ordinal_to_read += 1;
1972 if next_offset >= end_offset {
1973 return Ok(());
1974 }
1975
1976 while _next_ordinal_to_read < 5 {
1978 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1979 _next_ordinal_to_read += 1;
1980 next_offset += envelope_size;
1981 }
1982
1983 let next_out_of_line = decoder.next_out_of_line();
1984 let handles_before = decoder.remaining_handles();
1985 if let Some((inlined, num_bytes, num_handles)) =
1986 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1987 {
1988 let member_inline_size =
1989 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1990 if inlined != (member_inline_size <= 4) {
1991 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1992 }
1993 let inner_offset;
1994 let mut inner_depth = depth.clone();
1995 if inlined {
1996 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1997 inner_offset = next_offset;
1998 } else {
1999 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2000 inner_depth.increment()?;
2001 }
2002 let val_ref =
2003 self.is_service_provisioned.get_or_insert_with(|| fidl::new_empty!(bool, D));
2004 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2005 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2006 {
2007 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2008 }
2009 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2010 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2011 }
2012 }
2013
2014 next_offset += envelope_size;
2015
2016 while next_offset < end_offset {
2018 _next_ordinal_to_read += 1;
2019 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2020 next_offset += envelope_size;
2021 }
2022
2023 Ok(())
2024 }
2025 }
2026
2027 impl fidl::encoding::ValueTypeMarker for Host {
2028 type Borrowed<'a> = &'a Self;
2029 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2030 value
2031 }
2032 }
2033
2034 unsafe impl fidl::encoding::TypeMarker for Host {
2035 type Owned = Self;
2036
2037 #[inline(always)]
2038 fn inline_align(_context: fidl::encoding::Context) -> usize {
2039 8
2040 }
2041
2042 #[inline(always)]
2043 fn inline_size(_context: fidl::encoding::Context) -> usize {
2044 16
2045 }
2046 }
2047
2048 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Host, D> for &Host {
2049 #[inline]
2050 unsafe fn encode(
2051 self,
2052 encoder: &mut fidl::encoding::Encoder<'_, D>,
2053 offset: usize,
2054 _depth: fidl::encoding::Depth,
2055 ) -> fidl::Result<()> {
2056 encoder.debug_check_bounds::<Host>(offset);
2057 encoder.write_num::<u64>(self.ordinal(), offset);
2058 match self {
2059 Host::Hostname(ref val) => {
2060 fidl::encoding::encode_in_envelope::<fidl::encoding::BoundedString<255>, D>(
2061 <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(val),
2062 encoder, offset + 8, _depth
2063 )
2064 }
2065 Host::IpAddress(ref val) => {
2066 fidl::encoding::encode_in_envelope::<fidl_fuchsia_net__common::IpAddress, D>(
2067 <fidl_fuchsia_net__common::IpAddress as fidl::encoding::ValueTypeMarker>::borrow(val),
2068 encoder, offset + 8, _depth
2069 )
2070 }
2071 }
2072 }
2073 }
2074
2075 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Host {
2076 #[inline(always)]
2077 fn new_empty() -> Self {
2078 Self::Hostname(fidl::new_empty!(fidl::encoding::BoundedString<255>, D))
2079 }
2080
2081 #[inline]
2082 unsafe fn decode(
2083 &mut self,
2084 decoder: &mut fidl::encoding::Decoder<'_, D>,
2085 offset: usize,
2086 mut depth: fidl::encoding::Depth,
2087 ) -> fidl::Result<()> {
2088 decoder.debug_check_bounds::<Self>(offset);
2089 #[allow(unused_variables)]
2090 let next_out_of_line = decoder.next_out_of_line();
2091 let handles_before = decoder.remaining_handles();
2092 let (ordinal, inlined, num_bytes, num_handles) =
2093 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2094
2095 let member_inline_size = match ordinal {
2096 1 => {
2097 <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
2098 decoder.context,
2099 )
2100 }
2101 2 => {
2102 <fidl_fuchsia_net__common::IpAddress as fidl::encoding::TypeMarker>::inline_size(
2103 decoder.context,
2104 )
2105 }
2106 _ => return Err(fidl::Error::UnknownUnionTag),
2107 };
2108
2109 if inlined != (member_inline_size <= 4) {
2110 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2111 }
2112 let _inner_offset;
2113 if inlined {
2114 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2115 _inner_offset = offset + 8;
2116 } else {
2117 depth.increment()?;
2118 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2119 }
2120 match ordinal {
2121 1 => {
2122 #[allow(irrefutable_let_patterns)]
2123 if let Host::Hostname(_) = self {
2124 } else {
2126 *self =
2128 Host::Hostname(fidl::new_empty!(fidl::encoding::BoundedString<255>, D));
2129 }
2130 #[allow(irrefutable_let_patterns)]
2131 if let Host::Hostname(ref mut val) = self {
2132 fidl::decode!(
2133 fidl::encoding::BoundedString<255>,
2134 D,
2135 val,
2136 decoder,
2137 _inner_offset,
2138 depth
2139 )?;
2140 } else {
2141 unreachable!()
2142 }
2143 }
2144 2 => {
2145 #[allow(irrefutable_let_patterns)]
2146 if let Host::IpAddress(_) = self {
2147 } else {
2149 *self = Host::IpAddress(fidl::new_empty!(
2151 fidl_fuchsia_net__common::IpAddress,
2152 D
2153 ));
2154 }
2155 #[allow(irrefutable_let_patterns)]
2156 if let Host::IpAddress(ref mut val) = self {
2157 fidl::decode!(
2158 fidl_fuchsia_net__common::IpAddress,
2159 D,
2160 val,
2161 decoder,
2162 _inner_offset,
2163 depth
2164 )?;
2165 } else {
2166 unreachable!()
2167 }
2168 }
2169 ordinal => panic!("unexpected ordinal {:?}", ordinal),
2170 }
2171 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2172 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2173 }
2174 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2175 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2176 }
2177 Ok(())
2178 }
2179 }
2180}