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 NodeName = String;
12
13pub type NodeOffersVector = Vec<Offer>;
14
15pub type NodeProperties = Vec<NodeProperty2>;
16
17pub type NodePropertyDictionary = Vec<NodePropertyEntry>;
18
19pub type NodePropertyDictionary2 = Vec<NodePropertyEntry2>;
20
21pub type NodePropertyKeyString = String;
22
23pub type NodePropertyKeyUint = u32;
24
25pub type NodePropertyValueBool = bool;
26
27pub type NodePropertyValueEnum = String;
28
29pub type NodePropertyValueString = String;
30
31pub type NodePropertyValueUint = u32;
32
33pub type NodePropertyVector = Vec<NodeProperty>;
34
35pub const MAX_DEVICE_ADDRESS_ARRAY_LEN: u32 = 10;
36
37pub const MAX_DEVICE_ADDRESS_STR_LEN: u32 = 32;
38
39pub const MAX_MODULE_NAME_LENGTH: u8 = 128;
40
41pub const MAX_NAMESPACE_COUNT: u32 = fidl_fuchsia_component_runner::MAX_NAMESPACE_COUNT as u32;
42
43pub const MAX_NODE_NAME_LENGTH: u8 = 128;
44
45pub const MAX_OFFER_COUNT: u32 = fidl_fuchsia_component::MAX_DYNAMIC_OFFER_COUNT as u32;
46
47pub const MAX_PROPERTY_COUNT: u8 = 64;
48
49pub const MAX_RESOURCE_NAME_LENGTH: u8 = 128;
50
51pub const MAX_SYMBOL_COUNT: u8 = 64;
52
53pub const MAX_SYMBOL_NAME_LENGTH: u8 = 128;
54
55#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
56pub enum BusType {
57 Platform,
58 Acpi,
59 DeviceTree,
60 Pci,
61 Usb,
62 Gpio,
63 I2C,
64 Spi,
65 Sdio,
66 Uart,
67 Spmi,
68 #[doc(hidden)]
69 __SourceBreaking {
70 unknown_ordinal: u32,
71 },
72}
73
74#[macro_export]
76macro_rules! BusTypeUnknown {
77 () => {
78 _
79 };
80}
81
82impl BusType {
83 #[inline]
84 pub fn from_primitive(prim: u32) -> Option<Self> {
85 match prim {
86 1 => Some(Self::Platform),
87 2 => Some(Self::Acpi),
88 3 => Some(Self::DeviceTree),
89 4 => Some(Self::Pci),
90 5 => Some(Self::Usb),
91 6 => Some(Self::Gpio),
92 7 => Some(Self::I2C),
93 8 => Some(Self::Spi),
94 9 => Some(Self::Sdio),
95 10 => Some(Self::Uart),
96 11 => Some(Self::Spmi),
97 _ => None,
98 }
99 }
100
101 #[inline]
102 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
103 match prim {
104 1 => Self::Platform,
105 2 => Self::Acpi,
106 3 => Self::DeviceTree,
107 4 => Self::Pci,
108 5 => Self::Usb,
109 6 => Self::Gpio,
110 7 => Self::I2C,
111 8 => Self::Spi,
112 9 => Self::Sdio,
113 10 => Self::Uart,
114 11 => Self::Spmi,
115 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
116 }
117 }
118
119 #[inline]
120 pub fn unknown() -> Self {
121 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
122 }
123
124 #[inline]
125 pub const fn into_primitive(self) -> u32 {
126 match self {
127 Self::Platform => 1,
128 Self::Acpi => 2,
129 Self::DeviceTree => 3,
130 Self::Pci => 4,
131 Self::Usb => 5,
132 Self::Gpio => 6,
133 Self::I2C => 7,
134 Self::Spi => 8,
135 Self::Sdio => 9,
136 Self::Uart => 10,
137 Self::Spmi => 11,
138 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
139 }
140 }
141
142 #[inline]
143 pub fn is_unknown(&self) -> bool {
144 match self {
145 Self::__SourceBreaking { unknown_ordinal: _ } => true,
146 _ => false,
147 }
148 }
149}
150
151#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
153pub enum CompositeNodeSpecError {
154 MissingArgs,
156 EmptyNodes,
158 AlreadyExists,
161 DriverIndexFailure,
163 #[doc(hidden)]
164 __SourceBreaking { unknown_ordinal: u32 },
165}
166
167#[macro_export]
169macro_rules! CompositeNodeSpecErrorUnknown {
170 () => {
171 _
172 };
173}
174
175impl CompositeNodeSpecError {
176 #[inline]
177 pub fn from_primitive(prim: u32) -> Option<Self> {
178 match prim {
179 1 => Some(Self::MissingArgs),
180 2 => Some(Self::EmptyNodes),
181 3 => Some(Self::AlreadyExists),
182 4 => Some(Self::DriverIndexFailure),
183 _ => None,
184 }
185 }
186
187 #[inline]
188 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
189 match prim {
190 1 => Self::MissingArgs,
191 2 => Self::EmptyNodes,
192 3 => Self::AlreadyExists,
193 4 => Self::DriverIndexFailure,
194 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
195 }
196 }
197
198 #[inline]
199 pub fn unknown() -> Self {
200 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
201 }
202
203 #[inline]
204 pub const fn into_primitive(self) -> u32 {
205 match self {
206 Self::MissingArgs => 1,
207 Self::EmptyNodes => 2,
208 Self::AlreadyExists => 3,
209 Self::DriverIndexFailure => 4,
210 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
211 }
212 }
213
214 #[inline]
215 pub fn is_unknown(&self) -> bool {
216 match self {
217 Self::__SourceBreaking { unknown_ordinal: _ } => true,
218 _ => false,
219 }
220 }
221}
222
223#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
225#[repr(u32)]
226pub enum Condition {
227 Unknown = 0,
228 Accept = 1,
229 Reject = 2,
230}
231
232impl Condition {
233 #[inline]
234 pub fn from_primitive(prim: u32) -> Option<Self> {
235 match prim {
236 0 => Some(Self::Unknown),
237 1 => Some(Self::Accept),
238 2 => Some(Self::Reject),
239 _ => None,
240 }
241 }
242
243 #[inline]
244 pub const fn into_primitive(self) -> u32 {
245 self as u32
246 }
247
248 #[deprecated = "Strict enums should not use `is_unknown`"]
249 #[inline]
250 pub fn is_unknown(&self) -> bool {
251 false
252 }
253}
254
255#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
256pub enum DeviceAddressStability {
257 UnstableBetweenDriverRestart,
259 UnstableBetweenBoot,
261 UnstableBetweenSoftwareUpdate,
263 Stable,
265 #[doc(hidden)]
266 __SourceBreaking { unknown_ordinal: u32 },
267}
268
269#[macro_export]
271macro_rules! DeviceAddressStabilityUnknown {
272 () => {
273 _
274 };
275}
276
277impl DeviceAddressStability {
278 #[inline]
279 pub fn from_primitive(prim: u32) -> Option<Self> {
280 match prim {
281 0 => Some(Self::UnstableBetweenDriverRestart),
282 1 => Some(Self::UnstableBetweenBoot),
283 2 => Some(Self::UnstableBetweenSoftwareUpdate),
284 3 => Some(Self::Stable),
285 _ => None,
286 }
287 }
288
289 #[inline]
290 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
291 match prim {
292 0 => Self::UnstableBetweenDriverRestart,
293 1 => Self::UnstableBetweenBoot,
294 2 => Self::UnstableBetweenSoftwareUpdate,
295 3 => Self::Stable,
296 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
297 }
298 }
299
300 #[inline]
301 pub fn unknown() -> Self {
302 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
303 }
304
305 #[inline]
306 pub const fn into_primitive(self) -> u32 {
307 match self {
308 Self::UnstableBetweenDriverRestart => 0,
309 Self::UnstableBetweenBoot => 1,
310 Self::UnstableBetweenSoftwareUpdate => 2,
311 Self::Stable => 3,
312 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
313 }
314 }
315
316 #[inline]
317 pub fn is_unknown(&self) -> bool {
318 match self {
319 Self::__SourceBreaking { unknown_ordinal: _ } => true,
320 _ => false,
321 }
322 }
323}
324
325#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
329pub enum DriverPackageType {
330 Boot,
332 Base,
334 Cached,
337 Universe,
339 #[doc(hidden)]
340 __SourceBreaking { unknown_ordinal: u8 },
341}
342
343#[macro_export]
345macro_rules! DriverPackageTypeUnknown {
346 () => {
347 _
348 };
349}
350
351impl DriverPackageType {
352 #[inline]
353 pub fn from_primitive(prim: u8) -> Option<Self> {
354 match prim {
355 0 => Some(Self::Boot),
356 1 => Some(Self::Base),
357 2 => Some(Self::Cached),
358 3 => Some(Self::Universe),
359 _ => None,
360 }
361 }
362
363 #[inline]
364 pub fn from_primitive_allow_unknown(prim: u8) -> Self {
365 match prim {
366 0 => Self::Boot,
367 1 => Self::Base,
368 2 => Self::Cached,
369 3 => Self::Universe,
370 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
371 }
372 }
373
374 #[inline]
375 pub fn unknown() -> Self {
376 Self::__SourceBreaking { unknown_ordinal: 0xff }
377 }
378
379 #[inline]
380 pub const fn into_primitive(self) -> u8 {
381 match self {
382 Self::Boot => 0,
383 Self::Base => 1,
384 Self::Cached => 2,
385 Self::Universe => 3,
386 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
387 }
388 }
389
390 #[inline]
391 pub fn is_unknown(&self) -> bool {
392 match self {
393 Self::__SourceBreaking { unknown_ordinal: _ } => true,
394 _ => false,
395 }
396 }
397}
398
399#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
401pub enum NodeError {
402 Internal,
403 NodeRemoved,
404 NameMissing,
405 NameInvalid,
408 NameAlreadyExists,
410 OfferSourceNameMissing,
412 OfferRefExists,
414 SymbolNameMissing,
416 SymbolAddressMissing,
418 SymbolAlreadyExists,
420 UnbindChildrenInProgress,
422 UnsupportedArgs,
424 #[doc(hidden)]
425 __SourceBreaking {
426 unknown_ordinal: u32,
427 },
428}
429
430#[macro_export]
432macro_rules! NodeErrorUnknown {
433 () => {
434 _
435 };
436}
437
438impl NodeError {
439 #[inline]
440 pub fn from_primitive(prim: u32) -> Option<Self> {
441 match prim {
442 1 => Some(Self::Internal),
443 2 => Some(Self::NodeRemoved),
444 3 => Some(Self::NameMissing),
445 4 => Some(Self::NameInvalid),
446 5 => Some(Self::NameAlreadyExists),
447 6 => Some(Self::OfferSourceNameMissing),
448 7 => Some(Self::OfferRefExists),
449 8 => Some(Self::SymbolNameMissing),
450 9 => Some(Self::SymbolAddressMissing),
451 10 => Some(Self::SymbolAlreadyExists),
452 11 => Some(Self::UnbindChildrenInProgress),
453 12 => Some(Self::UnsupportedArgs),
454 _ => None,
455 }
456 }
457
458 #[inline]
459 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
460 match prim {
461 1 => Self::Internal,
462 2 => Self::NodeRemoved,
463 3 => Self::NameMissing,
464 4 => Self::NameInvalid,
465 5 => Self::NameAlreadyExists,
466 6 => Self::OfferSourceNameMissing,
467 7 => Self::OfferRefExists,
468 8 => Self::SymbolNameMissing,
469 9 => Self::SymbolAddressMissing,
470 10 => Self::SymbolAlreadyExists,
471 11 => Self::UnbindChildrenInProgress,
472 12 => Self::UnsupportedArgs,
473 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
474 }
475 }
476
477 #[inline]
478 pub fn unknown() -> Self {
479 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
480 }
481
482 #[inline]
483 pub const fn into_primitive(self) -> u32 {
484 match self {
485 Self::Internal => 1,
486 Self::NodeRemoved => 2,
487 Self::NameMissing => 3,
488 Self::NameInvalid => 4,
489 Self::NameAlreadyExists => 5,
490 Self::OfferSourceNameMissing => 6,
491 Self::OfferRefExists => 7,
492 Self::SymbolNameMissing => 8,
493 Self::SymbolAddressMissing => 9,
494 Self::SymbolAlreadyExists => 10,
495 Self::UnbindChildrenInProgress => 11,
496 Self::UnsupportedArgs => 12,
497 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
498 }
499 }
500
501 #[inline]
502 pub fn is_unknown(&self) -> bool {
503 match self {
504 Self::__SourceBreaking { unknown_ordinal: _ } => true,
505 _ => false,
506 }
507 }
508}
509
510#[derive(Clone, Debug, PartialEq)]
512pub struct BindRule {
513 pub key: NodePropertyKey,
515 pub condition: Condition,
519 pub values: Vec<NodePropertyValue>,
522}
523
524impl fidl::Persistable for BindRule {}
525
526#[derive(Clone, Debug, PartialEq)]
529pub struct NodeProperty {
530 pub key: NodePropertyKey,
533 pub value: NodePropertyValue,
535}
536
537impl fidl::Persistable for NodeProperty {}
538
539#[derive(Clone, Debug, PartialEq)]
540pub struct NodeProperty2 {
541 pub key: String,
543 pub value: NodePropertyValue,
545}
546
547impl fidl::Persistable for NodeProperty2 {}
548
549#[derive(Clone, Debug, PartialEq)]
551pub struct NodePropertyEntry {
552 pub name: String,
554 pub properties: Vec<NodeProperty>,
558}
559
560impl fidl::Persistable for NodePropertyEntry {}
561
562#[derive(Clone, Debug, PartialEq)]
564pub struct NodePropertyEntry2 {
565 pub name: String,
567 pub properties: Vec<NodeProperty2>,
571}
572
573impl fidl::Persistable for NodePropertyEntry2 {}
574
575#[derive(Clone, Debug, PartialEq)]
578pub struct ParentSpec {
579 pub bind_rules: Vec<BindRule>,
581 pub properties: Vec<NodeProperty>,
584}
585
586impl fidl::Persistable for ParentSpec {}
587
588#[derive(Clone, Debug, Default, PartialEq)]
589pub struct BusInfo {
590 pub bus: Option<BusType>,
592 pub address: Option<DeviceAddress>,
594 pub address_stability: Option<DeviceAddressStability>,
596 #[doc(hidden)]
597 pub __source_breaking: fidl::marker::SourceBreaking,
598}
599
600impl fidl::Persistable for BusInfo {}
601
602#[derive(Clone, Debug, Default, PartialEq)]
604pub struct CompositeDriverInfo {
605 pub composite_name: Option<String>,
607 pub driver_info: Option<DriverInfo>,
609 #[doc(hidden)]
610 pub __source_breaking: fidl::marker::SourceBreaking,
611}
612
613impl fidl::Persistable for CompositeDriverInfo {}
614
615#[derive(Clone, Debug, Default, PartialEq)]
617pub struct CompositeDriverMatch {
618 pub composite_driver: Option<CompositeDriverInfo>,
620 pub parent_names: Option<Vec<String>>,
623 pub primary_parent_index: Option<u32>,
626 #[doc(hidden)]
627 pub __source_breaking: fidl::marker::SourceBreaking,
628}
629
630impl fidl::Persistable for CompositeDriverMatch {}
631
632#[derive(Clone, Debug, Default, PartialEq)]
634pub struct CompositeInfo {
635 pub spec: Option<CompositeNodeSpec>,
637 pub matched_driver: Option<CompositeDriverMatch>,
640 #[doc(hidden)]
641 pub __source_breaking: fidl::marker::SourceBreaking,
642}
643
644impl fidl::Persistable for CompositeInfo {}
645
646#[derive(Clone, Debug, Default, PartialEq)]
648pub struct CompositeNodeSpec {
649 pub name: Option<String>,
651 pub parents: Option<Vec<ParentSpec>>,
654 #[doc(hidden)]
655 pub __source_breaking: fidl::marker::SourceBreaking,
656}
657
658impl fidl::Persistable for CompositeNodeSpec {}
659
660#[derive(Clone, Debug, Default, PartialEq)]
662pub struct CompositeParent {
663 pub composite: Option<CompositeInfo>,
665 pub index: Option<u32>,
667 #[doc(hidden)]
668 pub __source_breaking: fidl::marker::SourceBreaking,
669}
670
671impl fidl::Persistable for CompositeParent {}
672
673#[derive(Clone, Debug, Default, PartialEq)]
675pub struct DeviceCategory {
676 pub category: Option<String>,
677 pub subcategory: Option<String>,
678 #[doc(hidden)]
679 pub __source_breaking: fidl::marker::SourceBreaking,
680}
681
682impl fidl::Persistable for DeviceCategory {}
683
684#[derive(Clone, Debug, Default, PartialEq)]
686pub struct DriverInfo {
687 pub url: Option<String>,
689 pub name: Option<String>,
692 pub colocate: Option<bool>,
694 pub package_type: Option<DriverPackageType>,
696 pub is_fallback: Option<bool>,
700 pub device_categories: Option<Vec<DeviceCategory>>,
702 pub bind_rules_bytecode: Option<Vec<u8>>,
706 pub driver_framework_version: Option<u8>,
710 pub is_disabled: Option<bool>,
712 #[doc(hidden)]
713 pub __source_breaking: fidl::marker::SourceBreaking,
714}
715
716impl fidl::Persistable for DriverInfo {}
717
718#[derive(Clone, Debug, Default, PartialEq)]
719pub struct NodeControllerRequestBindRequest {
720 pub force_rebind: Option<bool>,
723 pub driver_url_suffix: Option<String>,
727 #[doc(hidden)]
728 pub __source_breaking: fidl::marker::SourceBreaking,
729}
730
731impl fidl::Persistable for NodeControllerRequestBindRequest {}
732
733#[derive(Clone, Debug, Default, PartialEq)]
736pub struct NodeSymbol {
737 pub name: Option<String>,
739 pub address: Option<u64>,
741 pub module_name: Option<String>,
744 #[doc(hidden)]
745 pub __source_breaking: fidl::marker::SourceBreaking,
746}
747
748impl fidl::Persistable for NodeSymbol {}
749
750#[derive(Clone, Debug)]
751pub enum DeviceAddress {
752 IntValue(u8),
754 ArrayIntValue(Vec<u8>),
756 CharIntValue(String),
758 ArrayCharIntValue(Vec<String>),
760 StringValue(String),
762 #[doc(hidden)]
763 __SourceBreaking { unknown_ordinal: u64 },
764}
765
766#[macro_export]
768macro_rules! DeviceAddressUnknown {
769 () => {
770 _
771 };
772}
773
774impl PartialEq for DeviceAddress {
776 fn eq(&self, other: &Self) -> bool {
777 match (self, other) {
778 (Self::IntValue(x), Self::IntValue(y)) => *x == *y,
779 (Self::ArrayIntValue(x), Self::ArrayIntValue(y)) => *x == *y,
780 (Self::CharIntValue(x), Self::CharIntValue(y)) => *x == *y,
781 (Self::ArrayCharIntValue(x), Self::ArrayCharIntValue(y)) => *x == *y,
782 (Self::StringValue(x), Self::StringValue(y)) => *x == *y,
783 _ => false,
784 }
785 }
786}
787
788impl DeviceAddress {
789 #[inline]
790 pub fn ordinal(&self) -> u64 {
791 match *self {
792 Self::IntValue(_) => 1,
793 Self::ArrayIntValue(_) => 2,
794 Self::CharIntValue(_) => 3,
795 Self::ArrayCharIntValue(_) => 4,
796 Self::StringValue(_) => 5,
797 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
798 }
799 }
800
801 #[inline]
802 pub fn unknown_variant_for_testing() -> Self {
803 Self::__SourceBreaking { unknown_ordinal: 0 }
804 }
805
806 #[inline]
807 pub fn is_unknown(&self) -> bool {
808 match self {
809 Self::__SourceBreaking { .. } => true,
810 _ => false,
811 }
812 }
813}
814
815impl fidl::Persistable for DeviceAddress {}
816
817#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
818pub enum NodePropertyKey {
819 IntValue(u32),
821 StringValue(String),
822}
823
824impl NodePropertyKey {
825 #[inline]
826 pub fn ordinal(&self) -> u64 {
827 match *self {
828 Self::IntValue(_) => 1,
829 Self::StringValue(_) => 2,
830 }
831 }
832
833 #[deprecated = "Strict unions should not use `is_unknown`"]
834 #[inline]
835 pub fn is_unknown(&self) -> bool {
836 false
837 }
838}
839
840impl fidl::Persistable for NodePropertyKey {}
841
842#[derive(Clone, Debug)]
843pub enum NodePropertyValue {
844 IntValue(u32),
845 StringValue(String),
846 BoolValue(bool),
847 EnumValue(String),
848 #[doc(hidden)]
849 __SourceBreaking {
850 unknown_ordinal: u64,
851 },
852}
853
854#[macro_export]
856macro_rules! NodePropertyValueUnknown {
857 () => {
858 _
859 };
860}
861
862impl PartialEq for NodePropertyValue {
864 fn eq(&self, other: &Self) -> bool {
865 match (self, other) {
866 (Self::IntValue(x), Self::IntValue(y)) => *x == *y,
867 (Self::StringValue(x), Self::StringValue(y)) => *x == *y,
868 (Self::BoolValue(x), Self::BoolValue(y)) => *x == *y,
869 (Self::EnumValue(x), Self::EnumValue(y)) => *x == *y,
870 _ => false,
871 }
872 }
873}
874
875impl NodePropertyValue {
876 #[inline]
877 pub fn ordinal(&self) -> u64 {
878 match *self {
879 Self::IntValue(_) => 1,
880 Self::StringValue(_) => 2,
881 Self::BoolValue(_) => 3,
882 Self::EnumValue(_) => 4,
883 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
884 }
885 }
886
887 #[inline]
888 pub fn unknown_variant_for_testing() -> Self {
889 Self::__SourceBreaking { unknown_ordinal: 0 }
890 }
891
892 #[inline]
893 pub fn is_unknown(&self) -> bool {
894 match self {
895 Self::__SourceBreaking { .. } => true,
896 _ => false,
897 }
898 }
899}
900
901impl fidl::Persistable for NodePropertyValue {}
902
903#[derive(Clone, Debug)]
904pub enum Offer {
905 ZirconTransport(fidl_fuchsia_component_decl::Offer),
906 DriverTransport(fidl_fuchsia_component_decl::Offer),
907 #[doc(hidden)]
908 __SourceBreaking {
909 unknown_ordinal: u64,
910 },
911}
912
913#[macro_export]
915macro_rules! OfferUnknown {
916 () => {
917 _
918 };
919}
920
921impl PartialEq for Offer {
923 fn eq(&self, other: &Self) -> bool {
924 match (self, other) {
925 (Self::ZirconTransport(x), Self::ZirconTransport(y)) => *x == *y,
926 (Self::DriverTransport(x), Self::DriverTransport(y)) => *x == *y,
927 _ => false,
928 }
929 }
930}
931
932impl Offer {
933 #[inline]
934 pub fn ordinal(&self) -> u64 {
935 match *self {
936 Self::ZirconTransport(_) => 1,
937 Self::DriverTransport(_) => 2,
938 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
939 }
940 }
941
942 #[inline]
943 pub fn unknown_variant_for_testing() -> Self {
944 Self::__SourceBreaking { unknown_ordinal: 0 }
945 }
946
947 #[inline]
948 pub fn is_unknown(&self) -> bool {
949 match self {
950 Self::__SourceBreaking { .. } => true,
951 _ => false,
952 }
953 }
954}
955
956impl fidl::Persistable for Offer {}
957
958mod internal {
959 use super::*;
960 unsafe impl fidl::encoding::TypeMarker for BusType {
961 type Owned = Self;
962
963 #[inline(always)]
964 fn inline_align(_context: fidl::encoding::Context) -> usize {
965 std::mem::align_of::<u32>()
966 }
967
968 #[inline(always)]
969 fn inline_size(_context: fidl::encoding::Context) -> usize {
970 std::mem::size_of::<u32>()
971 }
972
973 #[inline(always)]
974 fn encode_is_copy() -> bool {
975 false
976 }
977
978 #[inline(always)]
979 fn decode_is_copy() -> bool {
980 false
981 }
982 }
983
984 impl fidl::encoding::ValueTypeMarker for BusType {
985 type Borrowed<'a> = Self;
986 #[inline(always)]
987 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
988 *value
989 }
990 }
991
992 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for BusType {
993 #[inline]
994 unsafe fn encode(
995 self,
996 encoder: &mut fidl::encoding::Encoder<'_, D>,
997 offset: usize,
998 _depth: fidl::encoding::Depth,
999 ) -> fidl::Result<()> {
1000 encoder.debug_check_bounds::<Self>(offset);
1001 encoder.write_num(self.into_primitive(), offset);
1002 Ok(())
1003 }
1004 }
1005
1006 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BusType {
1007 #[inline(always)]
1008 fn new_empty() -> Self {
1009 Self::unknown()
1010 }
1011
1012 #[inline]
1013 unsafe fn decode(
1014 &mut self,
1015 decoder: &mut fidl::encoding::Decoder<'_, D>,
1016 offset: usize,
1017 _depth: fidl::encoding::Depth,
1018 ) -> fidl::Result<()> {
1019 decoder.debug_check_bounds::<Self>(offset);
1020 let prim = decoder.read_num::<u32>(offset);
1021
1022 *self = Self::from_primitive_allow_unknown(prim);
1023 Ok(())
1024 }
1025 }
1026 unsafe impl fidl::encoding::TypeMarker for CompositeNodeSpecError {
1027 type Owned = Self;
1028
1029 #[inline(always)]
1030 fn inline_align(_context: fidl::encoding::Context) -> usize {
1031 std::mem::align_of::<u32>()
1032 }
1033
1034 #[inline(always)]
1035 fn inline_size(_context: fidl::encoding::Context) -> usize {
1036 std::mem::size_of::<u32>()
1037 }
1038
1039 #[inline(always)]
1040 fn encode_is_copy() -> bool {
1041 false
1042 }
1043
1044 #[inline(always)]
1045 fn decode_is_copy() -> bool {
1046 false
1047 }
1048 }
1049
1050 impl fidl::encoding::ValueTypeMarker for CompositeNodeSpecError {
1051 type Borrowed<'a> = Self;
1052 #[inline(always)]
1053 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1054 *value
1055 }
1056 }
1057
1058 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1059 for CompositeNodeSpecError
1060 {
1061 #[inline]
1062 unsafe fn encode(
1063 self,
1064 encoder: &mut fidl::encoding::Encoder<'_, D>,
1065 offset: usize,
1066 _depth: fidl::encoding::Depth,
1067 ) -> fidl::Result<()> {
1068 encoder.debug_check_bounds::<Self>(offset);
1069 encoder.write_num(self.into_primitive(), offset);
1070 Ok(())
1071 }
1072 }
1073
1074 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1075 for CompositeNodeSpecError
1076 {
1077 #[inline(always)]
1078 fn new_empty() -> Self {
1079 Self::unknown()
1080 }
1081
1082 #[inline]
1083 unsafe fn decode(
1084 &mut self,
1085 decoder: &mut fidl::encoding::Decoder<'_, D>,
1086 offset: usize,
1087 _depth: fidl::encoding::Depth,
1088 ) -> fidl::Result<()> {
1089 decoder.debug_check_bounds::<Self>(offset);
1090 let prim = decoder.read_num::<u32>(offset);
1091
1092 *self = Self::from_primitive_allow_unknown(prim);
1093 Ok(())
1094 }
1095 }
1096 unsafe impl fidl::encoding::TypeMarker for Condition {
1097 type Owned = Self;
1098
1099 #[inline(always)]
1100 fn inline_align(_context: fidl::encoding::Context) -> usize {
1101 std::mem::align_of::<u32>()
1102 }
1103
1104 #[inline(always)]
1105 fn inline_size(_context: fidl::encoding::Context) -> usize {
1106 std::mem::size_of::<u32>()
1107 }
1108
1109 #[inline(always)]
1110 fn encode_is_copy() -> bool {
1111 true
1112 }
1113
1114 #[inline(always)]
1115 fn decode_is_copy() -> bool {
1116 false
1117 }
1118 }
1119
1120 impl fidl::encoding::ValueTypeMarker for Condition {
1121 type Borrowed<'a> = Self;
1122 #[inline(always)]
1123 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1124 *value
1125 }
1126 }
1127
1128 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Condition {
1129 #[inline]
1130 unsafe fn encode(
1131 self,
1132 encoder: &mut fidl::encoding::Encoder<'_, D>,
1133 offset: usize,
1134 _depth: fidl::encoding::Depth,
1135 ) -> fidl::Result<()> {
1136 encoder.debug_check_bounds::<Self>(offset);
1137 encoder.write_num(self.into_primitive(), offset);
1138 Ok(())
1139 }
1140 }
1141
1142 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Condition {
1143 #[inline(always)]
1144 fn new_empty() -> Self {
1145 Self::Unknown
1146 }
1147
1148 #[inline]
1149 unsafe fn decode(
1150 &mut self,
1151 decoder: &mut fidl::encoding::Decoder<'_, D>,
1152 offset: usize,
1153 _depth: fidl::encoding::Depth,
1154 ) -> fidl::Result<()> {
1155 decoder.debug_check_bounds::<Self>(offset);
1156 let prim = decoder.read_num::<u32>(offset);
1157
1158 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1159 Ok(())
1160 }
1161 }
1162 unsafe impl fidl::encoding::TypeMarker for DeviceAddressStability {
1163 type Owned = Self;
1164
1165 #[inline(always)]
1166 fn inline_align(_context: fidl::encoding::Context) -> usize {
1167 std::mem::align_of::<u32>()
1168 }
1169
1170 #[inline(always)]
1171 fn inline_size(_context: fidl::encoding::Context) -> usize {
1172 std::mem::size_of::<u32>()
1173 }
1174
1175 #[inline(always)]
1176 fn encode_is_copy() -> bool {
1177 false
1178 }
1179
1180 #[inline(always)]
1181 fn decode_is_copy() -> bool {
1182 false
1183 }
1184 }
1185
1186 impl fidl::encoding::ValueTypeMarker for DeviceAddressStability {
1187 type Borrowed<'a> = Self;
1188 #[inline(always)]
1189 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1190 *value
1191 }
1192 }
1193
1194 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1195 for DeviceAddressStability
1196 {
1197 #[inline]
1198 unsafe fn encode(
1199 self,
1200 encoder: &mut fidl::encoding::Encoder<'_, D>,
1201 offset: usize,
1202 _depth: fidl::encoding::Depth,
1203 ) -> fidl::Result<()> {
1204 encoder.debug_check_bounds::<Self>(offset);
1205 encoder.write_num(self.into_primitive(), offset);
1206 Ok(())
1207 }
1208 }
1209
1210 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1211 for DeviceAddressStability
1212 {
1213 #[inline(always)]
1214 fn new_empty() -> Self {
1215 Self::unknown()
1216 }
1217
1218 #[inline]
1219 unsafe fn decode(
1220 &mut self,
1221 decoder: &mut fidl::encoding::Decoder<'_, D>,
1222 offset: usize,
1223 _depth: fidl::encoding::Depth,
1224 ) -> fidl::Result<()> {
1225 decoder.debug_check_bounds::<Self>(offset);
1226 let prim = decoder.read_num::<u32>(offset);
1227
1228 *self = Self::from_primitive_allow_unknown(prim);
1229 Ok(())
1230 }
1231 }
1232 unsafe impl fidl::encoding::TypeMarker for DriverPackageType {
1233 type Owned = Self;
1234
1235 #[inline(always)]
1236 fn inline_align(_context: fidl::encoding::Context) -> usize {
1237 std::mem::align_of::<u8>()
1238 }
1239
1240 #[inline(always)]
1241 fn inline_size(_context: fidl::encoding::Context) -> usize {
1242 std::mem::size_of::<u8>()
1243 }
1244
1245 #[inline(always)]
1246 fn encode_is_copy() -> bool {
1247 false
1248 }
1249
1250 #[inline(always)]
1251 fn decode_is_copy() -> bool {
1252 false
1253 }
1254 }
1255
1256 impl fidl::encoding::ValueTypeMarker for DriverPackageType {
1257 type Borrowed<'a> = Self;
1258 #[inline(always)]
1259 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1260 *value
1261 }
1262 }
1263
1264 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1265 for DriverPackageType
1266 {
1267 #[inline]
1268 unsafe fn encode(
1269 self,
1270 encoder: &mut fidl::encoding::Encoder<'_, D>,
1271 offset: usize,
1272 _depth: fidl::encoding::Depth,
1273 ) -> fidl::Result<()> {
1274 encoder.debug_check_bounds::<Self>(offset);
1275 encoder.write_num(self.into_primitive(), offset);
1276 Ok(())
1277 }
1278 }
1279
1280 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DriverPackageType {
1281 #[inline(always)]
1282 fn new_empty() -> Self {
1283 Self::unknown()
1284 }
1285
1286 #[inline]
1287 unsafe fn decode(
1288 &mut self,
1289 decoder: &mut fidl::encoding::Decoder<'_, D>,
1290 offset: usize,
1291 _depth: fidl::encoding::Depth,
1292 ) -> fidl::Result<()> {
1293 decoder.debug_check_bounds::<Self>(offset);
1294 let prim = decoder.read_num::<u8>(offset);
1295
1296 *self = Self::from_primitive_allow_unknown(prim);
1297 Ok(())
1298 }
1299 }
1300 unsafe impl fidl::encoding::TypeMarker for NodeError {
1301 type Owned = Self;
1302
1303 #[inline(always)]
1304 fn inline_align(_context: fidl::encoding::Context) -> usize {
1305 std::mem::align_of::<u32>()
1306 }
1307
1308 #[inline(always)]
1309 fn inline_size(_context: fidl::encoding::Context) -> usize {
1310 std::mem::size_of::<u32>()
1311 }
1312
1313 #[inline(always)]
1314 fn encode_is_copy() -> bool {
1315 false
1316 }
1317
1318 #[inline(always)]
1319 fn decode_is_copy() -> bool {
1320 false
1321 }
1322 }
1323
1324 impl fidl::encoding::ValueTypeMarker for NodeError {
1325 type Borrowed<'a> = Self;
1326 #[inline(always)]
1327 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1328 *value
1329 }
1330 }
1331
1332 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for NodeError {
1333 #[inline]
1334 unsafe fn encode(
1335 self,
1336 encoder: &mut fidl::encoding::Encoder<'_, D>,
1337 offset: usize,
1338 _depth: fidl::encoding::Depth,
1339 ) -> fidl::Result<()> {
1340 encoder.debug_check_bounds::<Self>(offset);
1341 encoder.write_num(self.into_primitive(), offset);
1342 Ok(())
1343 }
1344 }
1345
1346 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NodeError {
1347 #[inline(always)]
1348 fn new_empty() -> Self {
1349 Self::unknown()
1350 }
1351
1352 #[inline]
1353 unsafe fn decode(
1354 &mut self,
1355 decoder: &mut fidl::encoding::Decoder<'_, D>,
1356 offset: usize,
1357 _depth: fidl::encoding::Depth,
1358 ) -> fidl::Result<()> {
1359 decoder.debug_check_bounds::<Self>(offset);
1360 let prim = decoder.read_num::<u32>(offset);
1361
1362 *self = Self::from_primitive_allow_unknown(prim);
1363 Ok(())
1364 }
1365 }
1366
1367 impl fidl::encoding::ValueTypeMarker for BindRule {
1368 type Borrowed<'a> = &'a Self;
1369 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1370 value
1371 }
1372 }
1373
1374 unsafe impl fidl::encoding::TypeMarker for BindRule {
1375 type Owned = Self;
1376
1377 #[inline(always)]
1378 fn inline_align(_context: fidl::encoding::Context) -> usize {
1379 8
1380 }
1381
1382 #[inline(always)]
1383 fn inline_size(_context: fidl::encoding::Context) -> usize {
1384 40
1385 }
1386 }
1387
1388 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BindRule, D> for &BindRule {
1389 #[inline]
1390 unsafe fn encode(
1391 self,
1392 encoder: &mut fidl::encoding::Encoder<'_, D>,
1393 offset: usize,
1394 _depth: fidl::encoding::Depth,
1395 ) -> fidl::Result<()> {
1396 encoder.debug_check_bounds::<BindRule>(offset);
1397 fidl::encoding::Encode::<BindRule, D>::encode(
1399 (
1400 <NodePropertyKey as fidl::encoding::ValueTypeMarker>::borrow(&self.key),
1401 <Condition as fidl::encoding::ValueTypeMarker>::borrow(&self.condition),
1402 <fidl::encoding::Vector<NodePropertyValue, 64> as fidl::encoding::ValueTypeMarker>::borrow(&self.values),
1403 ),
1404 encoder, offset, _depth
1405 )
1406 }
1407 }
1408 unsafe impl<
1409 D: fidl::encoding::ResourceDialect,
1410 T0: fidl::encoding::Encode<NodePropertyKey, D>,
1411 T1: fidl::encoding::Encode<Condition, D>,
1412 T2: fidl::encoding::Encode<fidl::encoding::Vector<NodePropertyValue, 64>, D>,
1413 > fidl::encoding::Encode<BindRule, D> for (T0, T1, T2)
1414 {
1415 #[inline]
1416 unsafe fn encode(
1417 self,
1418 encoder: &mut fidl::encoding::Encoder<'_, D>,
1419 offset: usize,
1420 depth: fidl::encoding::Depth,
1421 ) -> fidl::Result<()> {
1422 encoder.debug_check_bounds::<BindRule>(offset);
1423 unsafe {
1426 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1427 (ptr as *mut u64).write_unaligned(0);
1428 }
1429 self.0.encode(encoder, offset + 0, depth)?;
1431 self.1.encode(encoder, offset + 16, depth)?;
1432 self.2.encode(encoder, offset + 24, depth)?;
1433 Ok(())
1434 }
1435 }
1436
1437 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BindRule {
1438 #[inline(always)]
1439 fn new_empty() -> Self {
1440 Self {
1441 key: fidl::new_empty!(NodePropertyKey, D),
1442 condition: fidl::new_empty!(Condition, D),
1443 values: fidl::new_empty!(fidl::encoding::Vector<NodePropertyValue, 64>, D),
1444 }
1445 }
1446
1447 #[inline]
1448 unsafe fn decode(
1449 &mut self,
1450 decoder: &mut fidl::encoding::Decoder<'_, D>,
1451 offset: usize,
1452 _depth: fidl::encoding::Depth,
1453 ) -> fidl::Result<()> {
1454 decoder.debug_check_bounds::<Self>(offset);
1455 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1457 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1458 let mask = 0xffffffff00000000u64;
1459 let maskedval = padval & mask;
1460 if maskedval != 0 {
1461 return Err(fidl::Error::NonZeroPadding {
1462 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1463 });
1464 }
1465 fidl::decode!(NodePropertyKey, D, &mut self.key, decoder, offset + 0, _depth)?;
1466 fidl::decode!(Condition, D, &mut self.condition, decoder, offset + 16, _depth)?;
1467 fidl::decode!(fidl::encoding::Vector<NodePropertyValue, 64>, D, &mut self.values, decoder, offset + 24, _depth)?;
1468 Ok(())
1469 }
1470 }
1471
1472 impl fidl::encoding::ValueTypeMarker for NodeProperty {
1473 type Borrowed<'a> = &'a Self;
1474 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1475 value
1476 }
1477 }
1478
1479 unsafe impl fidl::encoding::TypeMarker for NodeProperty {
1480 type Owned = Self;
1481
1482 #[inline(always)]
1483 fn inline_align(_context: fidl::encoding::Context) -> usize {
1484 8
1485 }
1486
1487 #[inline(always)]
1488 fn inline_size(_context: fidl::encoding::Context) -> usize {
1489 32
1490 }
1491 }
1492
1493 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NodeProperty, D>
1494 for &NodeProperty
1495 {
1496 #[inline]
1497 unsafe fn encode(
1498 self,
1499 encoder: &mut fidl::encoding::Encoder<'_, D>,
1500 offset: usize,
1501 _depth: fidl::encoding::Depth,
1502 ) -> fidl::Result<()> {
1503 encoder.debug_check_bounds::<NodeProperty>(offset);
1504 fidl::encoding::Encode::<NodeProperty, D>::encode(
1506 (
1507 <NodePropertyKey as fidl::encoding::ValueTypeMarker>::borrow(&self.key),
1508 <NodePropertyValue as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
1509 ),
1510 encoder,
1511 offset,
1512 _depth,
1513 )
1514 }
1515 }
1516 unsafe impl<
1517 D: fidl::encoding::ResourceDialect,
1518 T0: fidl::encoding::Encode<NodePropertyKey, D>,
1519 T1: fidl::encoding::Encode<NodePropertyValue, D>,
1520 > fidl::encoding::Encode<NodeProperty, D> for (T0, T1)
1521 {
1522 #[inline]
1523 unsafe fn encode(
1524 self,
1525 encoder: &mut fidl::encoding::Encoder<'_, D>,
1526 offset: usize,
1527 depth: fidl::encoding::Depth,
1528 ) -> fidl::Result<()> {
1529 encoder.debug_check_bounds::<NodeProperty>(offset);
1530 self.0.encode(encoder, offset + 0, depth)?;
1534 self.1.encode(encoder, offset + 16, depth)?;
1535 Ok(())
1536 }
1537 }
1538
1539 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NodeProperty {
1540 #[inline(always)]
1541 fn new_empty() -> Self {
1542 Self {
1543 key: fidl::new_empty!(NodePropertyKey, D),
1544 value: fidl::new_empty!(NodePropertyValue, D),
1545 }
1546 }
1547
1548 #[inline]
1549 unsafe fn decode(
1550 &mut self,
1551 decoder: &mut fidl::encoding::Decoder<'_, D>,
1552 offset: usize,
1553 _depth: fidl::encoding::Depth,
1554 ) -> fidl::Result<()> {
1555 decoder.debug_check_bounds::<Self>(offset);
1556 fidl::decode!(NodePropertyKey, D, &mut self.key, decoder, offset + 0, _depth)?;
1558 fidl::decode!(NodePropertyValue, D, &mut self.value, decoder, offset + 16, _depth)?;
1559 Ok(())
1560 }
1561 }
1562
1563 impl fidl::encoding::ValueTypeMarker for NodeProperty2 {
1564 type Borrowed<'a> = &'a Self;
1565 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1566 value
1567 }
1568 }
1569
1570 unsafe impl fidl::encoding::TypeMarker for NodeProperty2 {
1571 type Owned = Self;
1572
1573 #[inline(always)]
1574 fn inline_align(_context: fidl::encoding::Context) -> usize {
1575 8
1576 }
1577
1578 #[inline(always)]
1579 fn inline_size(_context: fidl::encoding::Context) -> usize {
1580 32
1581 }
1582 }
1583
1584 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NodeProperty2, D>
1585 for &NodeProperty2
1586 {
1587 #[inline]
1588 unsafe fn encode(
1589 self,
1590 encoder: &mut fidl::encoding::Encoder<'_, D>,
1591 offset: usize,
1592 _depth: fidl::encoding::Depth,
1593 ) -> fidl::Result<()> {
1594 encoder.debug_check_bounds::<NodeProperty2>(offset);
1595 fidl::encoding::Encode::<NodeProperty2, D>::encode(
1597 (
1598 <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
1599 &self.key,
1600 ),
1601 <NodePropertyValue as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
1602 ),
1603 encoder,
1604 offset,
1605 _depth,
1606 )
1607 }
1608 }
1609 unsafe impl<
1610 D: fidl::encoding::ResourceDialect,
1611 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
1612 T1: fidl::encoding::Encode<NodePropertyValue, D>,
1613 > fidl::encoding::Encode<NodeProperty2, D> for (T0, T1)
1614 {
1615 #[inline]
1616 unsafe fn encode(
1617 self,
1618 encoder: &mut fidl::encoding::Encoder<'_, D>,
1619 offset: usize,
1620 depth: fidl::encoding::Depth,
1621 ) -> fidl::Result<()> {
1622 encoder.debug_check_bounds::<NodeProperty2>(offset);
1623 self.0.encode(encoder, offset + 0, depth)?;
1627 self.1.encode(encoder, offset + 16, depth)?;
1628 Ok(())
1629 }
1630 }
1631
1632 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NodeProperty2 {
1633 #[inline(always)]
1634 fn new_empty() -> Self {
1635 Self {
1636 key: fidl::new_empty!(fidl::encoding::BoundedString<256>, D),
1637 value: fidl::new_empty!(NodePropertyValue, D),
1638 }
1639 }
1640
1641 #[inline]
1642 unsafe fn decode(
1643 &mut self,
1644 decoder: &mut fidl::encoding::Decoder<'_, D>,
1645 offset: usize,
1646 _depth: fidl::encoding::Depth,
1647 ) -> fidl::Result<()> {
1648 decoder.debug_check_bounds::<Self>(offset);
1649 fidl::decode!(
1651 fidl::encoding::BoundedString<256>,
1652 D,
1653 &mut self.key,
1654 decoder,
1655 offset + 0,
1656 _depth
1657 )?;
1658 fidl::decode!(NodePropertyValue, D, &mut self.value, decoder, offset + 16, _depth)?;
1659 Ok(())
1660 }
1661 }
1662
1663 impl fidl::encoding::ValueTypeMarker for NodePropertyEntry {
1664 type Borrowed<'a> = &'a Self;
1665 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1666 value
1667 }
1668 }
1669
1670 unsafe impl fidl::encoding::TypeMarker for NodePropertyEntry {
1671 type Owned = Self;
1672
1673 #[inline(always)]
1674 fn inline_align(_context: fidl::encoding::Context) -> usize {
1675 8
1676 }
1677
1678 #[inline(always)]
1679 fn inline_size(_context: fidl::encoding::Context) -> usize {
1680 32
1681 }
1682 }
1683
1684 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NodePropertyEntry, D>
1685 for &NodePropertyEntry
1686 {
1687 #[inline]
1688 unsafe fn encode(
1689 self,
1690 encoder: &mut fidl::encoding::Encoder<'_, D>,
1691 offset: usize,
1692 _depth: fidl::encoding::Depth,
1693 ) -> fidl::Result<()> {
1694 encoder.debug_check_bounds::<NodePropertyEntry>(offset);
1695 fidl::encoding::Encode::<NodePropertyEntry, D>::encode(
1697 (
1698 <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
1699 <fidl::encoding::Vector<NodeProperty, 64> as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),
1700 ),
1701 encoder, offset, _depth
1702 )
1703 }
1704 }
1705 unsafe impl<
1706 D: fidl::encoding::ResourceDialect,
1707 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<128>, D>,
1708 T1: fidl::encoding::Encode<fidl::encoding::Vector<NodeProperty, 64>, D>,
1709 > fidl::encoding::Encode<NodePropertyEntry, D> for (T0, T1)
1710 {
1711 #[inline]
1712 unsafe fn encode(
1713 self,
1714 encoder: &mut fidl::encoding::Encoder<'_, D>,
1715 offset: usize,
1716 depth: fidl::encoding::Depth,
1717 ) -> fidl::Result<()> {
1718 encoder.debug_check_bounds::<NodePropertyEntry>(offset);
1719 self.0.encode(encoder, offset + 0, depth)?;
1723 self.1.encode(encoder, offset + 16, depth)?;
1724 Ok(())
1725 }
1726 }
1727
1728 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NodePropertyEntry {
1729 #[inline(always)]
1730 fn new_empty() -> Self {
1731 Self {
1732 name: fidl::new_empty!(fidl::encoding::BoundedString<128>, D),
1733 properties: fidl::new_empty!(fidl::encoding::Vector<NodeProperty, 64>, D),
1734 }
1735 }
1736
1737 #[inline]
1738 unsafe fn decode(
1739 &mut self,
1740 decoder: &mut fidl::encoding::Decoder<'_, D>,
1741 offset: usize,
1742 _depth: fidl::encoding::Depth,
1743 ) -> fidl::Result<()> {
1744 decoder.debug_check_bounds::<Self>(offset);
1745 fidl::decode!(
1747 fidl::encoding::BoundedString<128>,
1748 D,
1749 &mut self.name,
1750 decoder,
1751 offset + 0,
1752 _depth
1753 )?;
1754 fidl::decode!(fidl::encoding::Vector<NodeProperty, 64>, D, &mut self.properties, decoder, offset + 16, _depth)?;
1755 Ok(())
1756 }
1757 }
1758
1759 impl fidl::encoding::ValueTypeMarker for NodePropertyEntry2 {
1760 type Borrowed<'a> = &'a Self;
1761 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1762 value
1763 }
1764 }
1765
1766 unsafe impl fidl::encoding::TypeMarker for NodePropertyEntry2 {
1767 type Owned = Self;
1768
1769 #[inline(always)]
1770 fn inline_align(_context: fidl::encoding::Context) -> usize {
1771 8
1772 }
1773
1774 #[inline(always)]
1775 fn inline_size(_context: fidl::encoding::Context) -> usize {
1776 32
1777 }
1778 }
1779
1780 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NodePropertyEntry2, D>
1781 for &NodePropertyEntry2
1782 {
1783 #[inline]
1784 unsafe fn encode(
1785 self,
1786 encoder: &mut fidl::encoding::Encoder<'_, D>,
1787 offset: usize,
1788 _depth: fidl::encoding::Depth,
1789 ) -> fidl::Result<()> {
1790 encoder.debug_check_bounds::<NodePropertyEntry2>(offset);
1791 fidl::encoding::Encode::<NodePropertyEntry2, D>::encode(
1793 (
1794 <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
1795 <fidl::encoding::Vector<NodeProperty2, 64> as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),
1796 ),
1797 encoder, offset, _depth
1798 )
1799 }
1800 }
1801 unsafe impl<
1802 D: fidl::encoding::ResourceDialect,
1803 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<128>, D>,
1804 T1: fidl::encoding::Encode<fidl::encoding::Vector<NodeProperty2, 64>, D>,
1805 > fidl::encoding::Encode<NodePropertyEntry2, D> for (T0, T1)
1806 {
1807 #[inline]
1808 unsafe fn encode(
1809 self,
1810 encoder: &mut fidl::encoding::Encoder<'_, D>,
1811 offset: usize,
1812 depth: fidl::encoding::Depth,
1813 ) -> fidl::Result<()> {
1814 encoder.debug_check_bounds::<NodePropertyEntry2>(offset);
1815 self.0.encode(encoder, offset + 0, depth)?;
1819 self.1.encode(encoder, offset + 16, depth)?;
1820 Ok(())
1821 }
1822 }
1823
1824 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NodePropertyEntry2 {
1825 #[inline(always)]
1826 fn new_empty() -> Self {
1827 Self {
1828 name: fidl::new_empty!(fidl::encoding::BoundedString<128>, D),
1829 properties: fidl::new_empty!(fidl::encoding::Vector<NodeProperty2, 64>, D),
1830 }
1831 }
1832
1833 #[inline]
1834 unsafe fn decode(
1835 &mut self,
1836 decoder: &mut fidl::encoding::Decoder<'_, D>,
1837 offset: usize,
1838 _depth: fidl::encoding::Depth,
1839 ) -> fidl::Result<()> {
1840 decoder.debug_check_bounds::<Self>(offset);
1841 fidl::decode!(
1843 fidl::encoding::BoundedString<128>,
1844 D,
1845 &mut self.name,
1846 decoder,
1847 offset + 0,
1848 _depth
1849 )?;
1850 fidl::decode!(fidl::encoding::Vector<NodeProperty2, 64>, D, &mut self.properties, decoder, offset + 16, _depth)?;
1851 Ok(())
1852 }
1853 }
1854
1855 impl fidl::encoding::ValueTypeMarker for ParentSpec {
1856 type Borrowed<'a> = &'a Self;
1857 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1858 value
1859 }
1860 }
1861
1862 unsafe impl fidl::encoding::TypeMarker for ParentSpec {
1863 type Owned = Self;
1864
1865 #[inline(always)]
1866 fn inline_align(_context: fidl::encoding::Context) -> usize {
1867 8
1868 }
1869
1870 #[inline(always)]
1871 fn inline_size(_context: fidl::encoding::Context) -> usize {
1872 32
1873 }
1874 }
1875
1876 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ParentSpec, D>
1877 for &ParentSpec
1878 {
1879 #[inline]
1880 unsafe fn encode(
1881 self,
1882 encoder: &mut fidl::encoding::Encoder<'_, D>,
1883 offset: usize,
1884 _depth: fidl::encoding::Depth,
1885 ) -> fidl::Result<()> {
1886 encoder.debug_check_bounds::<ParentSpec>(offset);
1887 fidl::encoding::Encode::<ParentSpec, D>::encode(
1889 (
1890 <fidl::encoding::Vector<BindRule, 64> as fidl::encoding::ValueTypeMarker>::borrow(&self.bind_rules),
1891 <fidl::encoding::Vector<NodeProperty, 64> as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),
1892 ),
1893 encoder, offset, _depth
1894 )
1895 }
1896 }
1897 unsafe impl<
1898 D: fidl::encoding::ResourceDialect,
1899 T0: fidl::encoding::Encode<fidl::encoding::Vector<BindRule, 64>, D>,
1900 T1: fidl::encoding::Encode<fidl::encoding::Vector<NodeProperty, 64>, D>,
1901 > fidl::encoding::Encode<ParentSpec, D> for (T0, T1)
1902 {
1903 #[inline]
1904 unsafe fn encode(
1905 self,
1906 encoder: &mut fidl::encoding::Encoder<'_, D>,
1907 offset: usize,
1908 depth: fidl::encoding::Depth,
1909 ) -> fidl::Result<()> {
1910 encoder.debug_check_bounds::<ParentSpec>(offset);
1911 self.0.encode(encoder, offset + 0, depth)?;
1915 self.1.encode(encoder, offset + 16, depth)?;
1916 Ok(())
1917 }
1918 }
1919
1920 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ParentSpec {
1921 #[inline(always)]
1922 fn new_empty() -> Self {
1923 Self {
1924 bind_rules: fidl::new_empty!(fidl::encoding::Vector<BindRule, 64>, D),
1925 properties: fidl::new_empty!(fidl::encoding::Vector<NodeProperty, 64>, D),
1926 }
1927 }
1928
1929 #[inline]
1930 unsafe fn decode(
1931 &mut self,
1932 decoder: &mut fidl::encoding::Decoder<'_, D>,
1933 offset: usize,
1934 _depth: fidl::encoding::Depth,
1935 ) -> fidl::Result<()> {
1936 decoder.debug_check_bounds::<Self>(offset);
1937 fidl::decode!(fidl::encoding::Vector<BindRule, 64>, D, &mut self.bind_rules, decoder, offset + 0, _depth)?;
1939 fidl::decode!(fidl::encoding::Vector<NodeProperty, 64>, D, &mut self.properties, decoder, offset + 16, _depth)?;
1940 Ok(())
1941 }
1942 }
1943
1944 impl BusInfo {
1945 #[inline(always)]
1946 fn max_ordinal_present(&self) -> u64 {
1947 if let Some(_) = self.address_stability {
1948 return 3;
1949 }
1950 if let Some(_) = self.address {
1951 return 2;
1952 }
1953 if let Some(_) = self.bus {
1954 return 1;
1955 }
1956 0
1957 }
1958 }
1959
1960 impl fidl::encoding::ValueTypeMarker for BusInfo {
1961 type Borrowed<'a> = &'a Self;
1962 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1963 value
1964 }
1965 }
1966
1967 unsafe impl fidl::encoding::TypeMarker for BusInfo {
1968 type Owned = Self;
1969
1970 #[inline(always)]
1971 fn inline_align(_context: fidl::encoding::Context) -> usize {
1972 8
1973 }
1974
1975 #[inline(always)]
1976 fn inline_size(_context: fidl::encoding::Context) -> usize {
1977 16
1978 }
1979 }
1980
1981 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BusInfo, D> for &BusInfo {
1982 unsafe fn encode(
1983 self,
1984 encoder: &mut fidl::encoding::Encoder<'_, D>,
1985 offset: usize,
1986 mut depth: fidl::encoding::Depth,
1987 ) -> fidl::Result<()> {
1988 encoder.debug_check_bounds::<BusInfo>(offset);
1989 let max_ordinal: u64 = self.max_ordinal_present();
1991 encoder.write_num(max_ordinal, offset);
1992 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1993 if max_ordinal == 0 {
1995 return Ok(());
1996 }
1997 depth.increment()?;
1998 let envelope_size = 8;
1999 let bytes_len = max_ordinal as usize * envelope_size;
2000 #[allow(unused_variables)]
2001 let offset = encoder.out_of_line_offset(bytes_len);
2002 let mut _prev_end_offset: usize = 0;
2003 if 1 > max_ordinal {
2004 return Ok(());
2005 }
2006
2007 let cur_offset: usize = (1 - 1) * envelope_size;
2010
2011 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2013
2014 fidl::encoding::encode_in_envelope_optional::<BusType, D>(
2019 self.bus.as_ref().map(<BusType as fidl::encoding::ValueTypeMarker>::borrow),
2020 encoder,
2021 offset + cur_offset,
2022 depth,
2023 )?;
2024
2025 _prev_end_offset = cur_offset + envelope_size;
2026 if 2 > max_ordinal {
2027 return Ok(());
2028 }
2029
2030 let cur_offset: usize = (2 - 1) * envelope_size;
2033
2034 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2036
2037 fidl::encoding::encode_in_envelope_optional::<DeviceAddress, D>(
2042 self.address
2043 .as_ref()
2044 .map(<DeviceAddress as fidl::encoding::ValueTypeMarker>::borrow),
2045 encoder,
2046 offset + cur_offset,
2047 depth,
2048 )?;
2049
2050 _prev_end_offset = cur_offset + envelope_size;
2051 if 3 > max_ordinal {
2052 return Ok(());
2053 }
2054
2055 let cur_offset: usize = (3 - 1) * envelope_size;
2058
2059 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2061
2062 fidl::encoding::encode_in_envelope_optional::<DeviceAddressStability, D>(
2067 self.address_stability
2068 .as_ref()
2069 .map(<DeviceAddressStability as fidl::encoding::ValueTypeMarker>::borrow),
2070 encoder,
2071 offset + cur_offset,
2072 depth,
2073 )?;
2074
2075 _prev_end_offset = cur_offset + envelope_size;
2076
2077 Ok(())
2078 }
2079 }
2080
2081 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BusInfo {
2082 #[inline(always)]
2083 fn new_empty() -> Self {
2084 Self::default()
2085 }
2086
2087 unsafe fn decode(
2088 &mut self,
2089 decoder: &mut fidl::encoding::Decoder<'_, D>,
2090 offset: usize,
2091 mut depth: fidl::encoding::Depth,
2092 ) -> fidl::Result<()> {
2093 decoder.debug_check_bounds::<Self>(offset);
2094 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2095 None => return Err(fidl::Error::NotNullable),
2096 Some(len) => len,
2097 };
2098 if len == 0 {
2100 return Ok(());
2101 };
2102 depth.increment()?;
2103 let envelope_size = 8;
2104 let bytes_len = len * envelope_size;
2105 let offset = decoder.out_of_line_offset(bytes_len)?;
2106 let mut _next_ordinal_to_read = 0;
2108 let mut next_offset = offset;
2109 let end_offset = offset + bytes_len;
2110 _next_ordinal_to_read += 1;
2111 if next_offset >= end_offset {
2112 return Ok(());
2113 }
2114
2115 while _next_ordinal_to_read < 1 {
2117 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2118 _next_ordinal_to_read += 1;
2119 next_offset += envelope_size;
2120 }
2121
2122 let next_out_of_line = decoder.next_out_of_line();
2123 let handles_before = decoder.remaining_handles();
2124 if let Some((inlined, num_bytes, num_handles)) =
2125 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2126 {
2127 let member_inline_size =
2128 <BusType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2129 if inlined != (member_inline_size <= 4) {
2130 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2131 }
2132 let inner_offset;
2133 let mut inner_depth = depth.clone();
2134 if inlined {
2135 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2136 inner_offset = next_offset;
2137 } else {
2138 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2139 inner_depth.increment()?;
2140 }
2141 let val_ref = self.bus.get_or_insert_with(|| fidl::new_empty!(BusType, D));
2142 fidl::decode!(BusType, D, val_ref, decoder, inner_offset, inner_depth)?;
2143 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2144 {
2145 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2146 }
2147 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2148 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2149 }
2150 }
2151
2152 next_offset += envelope_size;
2153 _next_ordinal_to_read += 1;
2154 if next_offset >= end_offset {
2155 return Ok(());
2156 }
2157
2158 while _next_ordinal_to_read < 2 {
2160 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2161 _next_ordinal_to_read += 1;
2162 next_offset += envelope_size;
2163 }
2164
2165 let next_out_of_line = decoder.next_out_of_line();
2166 let handles_before = decoder.remaining_handles();
2167 if let Some((inlined, num_bytes, num_handles)) =
2168 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2169 {
2170 let member_inline_size =
2171 <DeviceAddress as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2172 if inlined != (member_inline_size <= 4) {
2173 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2174 }
2175 let inner_offset;
2176 let mut inner_depth = depth.clone();
2177 if inlined {
2178 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2179 inner_offset = next_offset;
2180 } else {
2181 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2182 inner_depth.increment()?;
2183 }
2184 let val_ref =
2185 self.address.get_or_insert_with(|| fidl::new_empty!(DeviceAddress, D));
2186 fidl::decode!(DeviceAddress, D, val_ref, decoder, inner_offset, inner_depth)?;
2187 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2188 {
2189 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2190 }
2191 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2192 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2193 }
2194 }
2195
2196 next_offset += envelope_size;
2197 _next_ordinal_to_read += 1;
2198 if next_offset >= end_offset {
2199 return Ok(());
2200 }
2201
2202 while _next_ordinal_to_read < 3 {
2204 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2205 _next_ordinal_to_read += 1;
2206 next_offset += envelope_size;
2207 }
2208
2209 let next_out_of_line = decoder.next_out_of_line();
2210 let handles_before = decoder.remaining_handles();
2211 if let Some((inlined, num_bytes, num_handles)) =
2212 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2213 {
2214 let member_inline_size =
2215 <DeviceAddressStability as fidl::encoding::TypeMarker>::inline_size(
2216 decoder.context,
2217 );
2218 if inlined != (member_inline_size <= 4) {
2219 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2220 }
2221 let inner_offset;
2222 let mut inner_depth = depth.clone();
2223 if inlined {
2224 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2225 inner_offset = next_offset;
2226 } else {
2227 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2228 inner_depth.increment()?;
2229 }
2230 let val_ref = self
2231 .address_stability
2232 .get_or_insert_with(|| fidl::new_empty!(DeviceAddressStability, D));
2233 fidl::decode!(
2234 DeviceAddressStability,
2235 D,
2236 val_ref,
2237 decoder,
2238 inner_offset,
2239 inner_depth
2240 )?;
2241 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2242 {
2243 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2244 }
2245 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2246 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2247 }
2248 }
2249
2250 next_offset += envelope_size;
2251
2252 while next_offset < end_offset {
2254 _next_ordinal_to_read += 1;
2255 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2256 next_offset += envelope_size;
2257 }
2258
2259 Ok(())
2260 }
2261 }
2262
2263 impl CompositeDriverInfo {
2264 #[inline(always)]
2265 fn max_ordinal_present(&self) -> u64 {
2266 if let Some(_) = self.driver_info {
2267 return 2;
2268 }
2269 if let Some(_) = self.composite_name {
2270 return 1;
2271 }
2272 0
2273 }
2274 }
2275
2276 impl fidl::encoding::ValueTypeMarker for CompositeDriverInfo {
2277 type Borrowed<'a> = &'a Self;
2278 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2279 value
2280 }
2281 }
2282
2283 unsafe impl fidl::encoding::TypeMarker for CompositeDriverInfo {
2284 type Owned = Self;
2285
2286 #[inline(always)]
2287 fn inline_align(_context: fidl::encoding::Context) -> usize {
2288 8
2289 }
2290
2291 #[inline(always)]
2292 fn inline_size(_context: fidl::encoding::Context) -> usize {
2293 16
2294 }
2295 }
2296
2297 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CompositeDriverInfo, D>
2298 for &CompositeDriverInfo
2299 {
2300 unsafe fn encode(
2301 self,
2302 encoder: &mut fidl::encoding::Encoder<'_, D>,
2303 offset: usize,
2304 mut depth: fidl::encoding::Depth,
2305 ) -> fidl::Result<()> {
2306 encoder.debug_check_bounds::<CompositeDriverInfo>(offset);
2307 let max_ordinal: u64 = self.max_ordinal_present();
2309 encoder.write_num(max_ordinal, offset);
2310 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2311 if max_ordinal == 0 {
2313 return Ok(());
2314 }
2315 depth.increment()?;
2316 let envelope_size = 8;
2317 let bytes_len = max_ordinal as usize * envelope_size;
2318 #[allow(unused_variables)]
2319 let offset = encoder.out_of_line_offset(bytes_len);
2320 let mut _prev_end_offset: usize = 0;
2321 if 1 > max_ordinal {
2322 return Ok(());
2323 }
2324
2325 let cur_offset: usize = (1 - 1) * envelope_size;
2328
2329 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2331
2332 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedString, D>(
2337 self.composite_name.as_ref().map(
2338 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
2339 ),
2340 encoder,
2341 offset + cur_offset,
2342 depth,
2343 )?;
2344
2345 _prev_end_offset = cur_offset + envelope_size;
2346 if 2 > max_ordinal {
2347 return Ok(());
2348 }
2349
2350 let cur_offset: usize = (2 - 1) * envelope_size;
2353
2354 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2356
2357 fidl::encoding::encode_in_envelope_optional::<DriverInfo, D>(
2362 self.driver_info
2363 .as_ref()
2364 .map(<DriverInfo as fidl::encoding::ValueTypeMarker>::borrow),
2365 encoder,
2366 offset + cur_offset,
2367 depth,
2368 )?;
2369
2370 _prev_end_offset = cur_offset + envelope_size;
2371
2372 Ok(())
2373 }
2374 }
2375
2376 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CompositeDriverInfo {
2377 #[inline(always)]
2378 fn new_empty() -> Self {
2379 Self::default()
2380 }
2381
2382 unsafe fn decode(
2383 &mut self,
2384 decoder: &mut fidl::encoding::Decoder<'_, D>,
2385 offset: usize,
2386 mut depth: fidl::encoding::Depth,
2387 ) -> fidl::Result<()> {
2388 decoder.debug_check_bounds::<Self>(offset);
2389 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2390 None => return Err(fidl::Error::NotNullable),
2391 Some(len) => len,
2392 };
2393 if len == 0 {
2395 return Ok(());
2396 };
2397 depth.increment()?;
2398 let envelope_size = 8;
2399 let bytes_len = len * envelope_size;
2400 let offset = decoder.out_of_line_offset(bytes_len)?;
2401 let mut _next_ordinal_to_read = 0;
2403 let mut next_offset = offset;
2404 let end_offset = offset + bytes_len;
2405 _next_ordinal_to_read += 1;
2406 if next_offset >= end_offset {
2407 return Ok(());
2408 }
2409
2410 while _next_ordinal_to_read < 1 {
2412 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2413 _next_ordinal_to_read += 1;
2414 next_offset += envelope_size;
2415 }
2416
2417 let next_out_of_line = decoder.next_out_of_line();
2418 let handles_before = decoder.remaining_handles();
2419 if let Some((inlined, num_bytes, num_handles)) =
2420 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2421 {
2422 let member_inline_size =
2423 <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
2424 decoder.context,
2425 );
2426 if inlined != (member_inline_size <= 4) {
2427 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2428 }
2429 let inner_offset;
2430 let mut inner_depth = depth.clone();
2431 if inlined {
2432 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2433 inner_offset = next_offset;
2434 } else {
2435 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2436 inner_depth.increment()?;
2437 }
2438 let val_ref = self
2439 .composite_name
2440 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::UnboundedString, D));
2441 fidl::decode!(
2442 fidl::encoding::UnboundedString,
2443 D,
2444 val_ref,
2445 decoder,
2446 inner_offset,
2447 inner_depth
2448 )?;
2449 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2450 {
2451 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2452 }
2453 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2454 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2455 }
2456 }
2457
2458 next_offset += envelope_size;
2459 _next_ordinal_to_read += 1;
2460 if next_offset >= end_offset {
2461 return Ok(());
2462 }
2463
2464 while _next_ordinal_to_read < 2 {
2466 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2467 _next_ordinal_to_read += 1;
2468 next_offset += envelope_size;
2469 }
2470
2471 let next_out_of_line = decoder.next_out_of_line();
2472 let handles_before = decoder.remaining_handles();
2473 if let Some((inlined, num_bytes, num_handles)) =
2474 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2475 {
2476 let member_inline_size =
2477 <DriverInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2478 if inlined != (member_inline_size <= 4) {
2479 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2480 }
2481 let inner_offset;
2482 let mut inner_depth = depth.clone();
2483 if inlined {
2484 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2485 inner_offset = next_offset;
2486 } else {
2487 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2488 inner_depth.increment()?;
2489 }
2490 let val_ref =
2491 self.driver_info.get_or_insert_with(|| fidl::new_empty!(DriverInfo, D));
2492 fidl::decode!(DriverInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
2493 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2494 {
2495 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2496 }
2497 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2498 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2499 }
2500 }
2501
2502 next_offset += envelope_size;
2503
2504 while next_offset < end_offset {
2506 _next_ordinal_to_read += 1;
2507 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2508 next_offset += envelope_size;
2509 }
2510
2511 Ok(())
2512 }
2513 }
2514
2515 impl CompositeDriverMatch {
2516 #[inline(always)]
2517 fn max_ordinal_present(&self) -> u64 {
2518 if let Some(_) = self.primary_parent_index {
2519 return 3;
2520 }
2521 if let Some(_) = self.parent_names {
2522 return 2;
2523 }
2524 if let Some(_) = self.composite_driver {
2525 return 1;
2526 }
2527 0
2528 }
2529 }
2530
2531 impl fidl::encoding::ValueTypeMarker for CompositeDriverMatch {
2532 type Borrowed<'a> = &'a Self;
2533 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2534 value
2535 }
2536 }
2537
2538 unsafe impl fidl::encoding::TypeMarker for CompositeDriverMatch {
2539 type Owned = Self;
2540
2541 #[inline(always)]
2542 fn inline_align(_context: fidl::encoding::Context) -> usize {
2543 8
2544 }
2545
2546 #[inline(always)]
2547 fn inline_size(_context: fidl::encoding::Context) -> usize {
2548 16
2549 }
2550 }
2551
2552 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CompositeDriverMatch, D>
2553 for &CompositeDriverMatch
2554 {
2555 unsafe fn encode(
2556 self,
2557 encoder: &mut fidl::encoding::Encoder<'_, D>,
2558 offset: usize,
2559 mut depth: fidl::encoding::Depth,
2560 ) -> fidl::Result<()> {
2561 encoder.debug_check_bounds::<CompositeDriverMatch>(offset);
2562 let max_ordinal: u64 = self.max_ordinal_present();
2564 encoder.write_num(max_ordinal, offset);
2565 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2566 if max_ordinal == 0 {
2568 return Ok(());
2569 }
2570 depth.increment()?;
2571 let envelope_size = 8;
2572 let bytes_len = max_ordinal as usize * envelope_size;
2573 #[allow(unused_variables)]
2574 let offset = encoder.out_of_line_offset(bytes_len);
2575 let mut _prev_end_offset: usize = 0;
2576 if 1 > max_ordinal {
2577 return Ok(());
2578 }
2579
2580 let cur_offset: usize = (1 - 1) * envelope_size;
2583
2584 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2586
2587 fidl::encoding::encode_in_envelope_optional::<CompositeDriverInfo, D>(
2592 self.composite_driver
2593 .as_ref()
2594 .map(<CompositeDriverInfo as fidl::encoding::ValueTypeMarker>::borrow),
2595 encoder,
2596 offset + cur_offset,
2597 depth,
2598 )?;
2599
2600 _prev_end_offset = cur_offset + envelope_size;
2601 if 2 > max_ordinal {
2602 return Ok(());
2603 }
2604
2605 let cur_offset: usize = (2 - 1) * envelope_size;
2608
2609 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2611
2612 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>, D>(
2617 self.parent_names.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow),
2618 encoder, offset + cur_offset, depth
2619 )?;
2620
2621 _prev_end_offset = cur_offset + envelope_size;
2622 if 3 > max_ordinal {
2623 return Ok(());
2624 }
2625
2626 let cur_offset: usize = (3 - 1) * envelope_size;
2629
2630 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2632
2633 fidl::encoding::encode_in_envelope_optional::<u32, D>(
2638 self.primary_parent_index
2639 .as_ref()
2640 .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
2641 encoder,
2642 offset + cur_offset,
2643 depth,
2644 )?;
2645
2646 _prev_end_offset = cur_offset + envelope_size;
2647
2648 Ok(())
2649 }
2650 }
2651
2652 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CompositeDriverMatch {
2653 #[inline(always)]
2654 fn new_empty() -> Self {
2655 Self::default()
2656 }
2657
2658 unsafe fn decode(
2659 &mut self,
2660 decoder: &mut fidl::encoding::Decoder<'_, D>,
2661 offset: usize,
2662 mut depth: fidl::encoding::Depth,
2663 ) -> fidl::Result<()> {
2664 decoder.debug_check_bounds::<Self>(offset);
2665 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2666 None => return Err(fidl::Error::NotNullable),
2667 Some(len) => len,
2668 };
2669 if len == 0 {
2671 return Ok(());
2672 };
2673 depth.increment()?;
2674 let envelope_size = 8;
2675 let bytes_len = len * envelope_size;
2676 let offset = decoder.out_of_line_offset(bytes_len)?;
2677 let mut _next_ordinal_to_read = 0;
2679 let mut next_offset = offset;
2680 let end_offset = offset + bytes_len;
2681 _next_ordinal_to_read += 1;
2682 if next_offset >= end_offset {
2683 return Ok(());
2684 }
2685
2686 while _next_ordinal_to_read < 1 {
2688 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2689 _next_ordinal_to_read += 1;
2690 next_offset += envelope_size;
2691 }
2692
2693 let next_out_of_line = decoder.next_out_of_line();
2694 let handles_before = decoder.remaining_handles();
2695 if let Some((inlined, num_bytes, num_handles)) =
2696 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2697 {
2698 let member_inline_size =
2699 <CompositeDriverInfo as fidl::encoding::TypeMarker>::inline_size(
2700 decoder.context,
2701 );
2702 if inlined != (member_inline_size <= 4) {
2703 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2704 }
2705 let inner_offset;
2706 let mut inner_depth = depth.clone();
2707 if inlined {
2708 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2709 inner_offset = next_offset;
2710 } else {
2711 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2712 inner_depth.increment()?;
2713 }
2714 let val_ref = self
2715 .composite_driver
2716 .get_or_insert_with(|| fidl::new_empty!(CompositeDriverInfo, D));
2717 fidl::decode!(CompositeDriverInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
2718 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2719 {
2720 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2721 }
2722 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2723 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2724 }
2725 }
2726
2727 next_offset += envelope_size;
2728 _next_ordinal_to_read += 1;
2729 if next_offset >= end_offset {
2730 return Ok(());
2731 }
2732
2733 while _next_ordinal_to_read < 2 {
2735 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2736 _next_ordinal_to_read += 1;
2737 next_offset += envelope_size;
2738 }
2739
2740 let next_out_of_line = decoder.next_out_of_line();
2741 let handles_before = decoder.remaining_handles();
2742 if let Some((inlined, num_bytes, num_handles)) =
2743 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2744 {
2745 let member_inline_size = <fidl::encoding::UnboundedVector<
2746 fidl::encoding::UnboundedString,
2747 > as fidl::encoding::TypeMarker>::inline_size(
2748 decoder.context
2749 );
2750 if inlined != (member_inline_size <= 4) {
2751 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2752 }
2753 let inner_offset;
2754 let mut inner_depth = depth.clone();
2755 if inlined {
2756 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2757 inner_offset = next_offset;
2758 } else {
2759 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2760 inner_depth.increment()?;
2761 }
2762 let val_ref = self.parent_names.get_or_insert_with(|| {
2763 fidl::new_empty!(
2764 fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
2765 D
2766 )
2767 });
2768 fidl::decode!(
2769 fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
2770 D,
2771 val_ref,
2772 decoder,
2773 inner_offset,
2774 inner_depth
2775 )?;
2776 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2777 {
2778 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2779 }
2780 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2781 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2782 }
2783 }
2784
2785 next_offset += envelope_size;
2786 _next_ordinal_to_read += 1;
2787 if next_offset >= end_offset {
2788 return Ok(());
2789 }
2790
2791 while _next_ordinal_to_read < 3 {
2793 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2794 _next_ordinal_to_read += 1;
2795 next_offset += envelope_size;
2796 }
2797
2798 let next_out_of_line = decoder.next_out_of_line();
2799 let handles_before = decoder.remaining_handles();
2800 if let Some((inlined, num_bytes, num_handles)) =
2801 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2802 {
2803 let member_inline_size =
2804 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2805 if inlined != (member_inline_size <= 4) {
2806 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2807 }
2808 let inner_offset;
2809 let mut inner_depth = depth.clone();
2810 if inlined {
2811 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2812 inner_offset = next_offset;
2813 } else {
2814 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2815 inner_depth.increment()?;
2816 }
2817 let val_ref =
2818 self.primary_parent_index.get_or_insert_with(|| fidl::new_empty!(u32, D));
2819 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
2820 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2821 {
2822 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2823 }
2824 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2825 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2826 }
2827 }
2828
2829 next_offset += envelope_size;
2830
2831 while next_offset < end_offset {
2833 _next_ordinal_to_read += 1;
2834 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2835 next_offset += envelope_size;
2836 }
2837
2838 Ok(())
2839 }
2840 }
2841
2842 impl CompositeInfo {
2843 #[inline(always)]
2844 fn max_ordinal_present(&self) -> u64 {
2845 if let Some(_) = self.matched_driver {
2846 return 2;
2847 }
2848 if let Some(_) = self.spec {
2849 return 1;
2850 }
2851 0
2852 }
2853 }
2854
2855 impl fidl::encoding::ValueTypeMarker for CompositeInfo {
2856 type Borrowed<'a> = &'a Self;
2857 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2858 value
2859 }
2860 }
2861
2862 unsafe impl fidl::encoding::TypeMarker for CompositeInfo {
2863 type Owned = Self;
2864
2865 #[inline(always)]
2866 fn inline_align(_context: fidl::encoding::Context) -> usize {
2867 8
2868 }
2869
2870 #[inline(always)]
2871 fn inline_size(_context: fidl::encoding::Context) -> usize {
2872 16
2873 }
2874 }
2875
2876 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CompositeInfo, D>
2877 for &CompositeInfo
2878 {
2879 unsafe fn encode(
2880 self,
2881 encoder: &mut fidl::encoding::Encoder<'_, D>,
2882 offset: usize,
2883 mut depth: fidl::encoding::Depth,
2884 ) -> fidl::Result<()> {
2885 encoder.debug_check_bounds::<CompositeInfo>(offset);
2886 let max_ordinal: u64 = self.max_ordinal_present();
2888 encoder.write_num(max_ordinal, offset);
2889 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2890 if max_ordinal == 0 {
2892 return Ok(());
2893 }
2894 depth.increment()?;
2895 let envelope_size = 8;
2896 let bytes_len = max_ordinal as usize * envelope_size;
2897 #[allow(unused_variables)]
2898 let offset = encoder.out_of_line_offset(bytes_len);
2899 let mut _prev_end_offset: usize = 0;
2900 if 1 > max_ordinal {
2901 return Ok(());
2902 }
2903
2904 let cur_offset: usize = (1 - 1) * envelope_size;
2907
2908 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2910
2911 fidl::encoding::encode_in_envelope_optional::<CompositeNodeSpec, D>(
2916 self.spec
2917 .as_ref()
2918 .map(<CompositeNodeSpec as fidl::encoding::ValueTypeMarker>::borrow),
2919 encoder,
2920 offset + cur_offset,
2921 depth,
2922 )?;
2923
2924 _prev_end_offset = cur_offset + envelope_size;
2925 if 2 > max_ordinal {
2926 return Ok(());
2927 }
2928
2929 let cur_offset: usize = (2 - 1) * envelope_size;
2932
2933 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2935
2936 fidl::encoding::encode_in_envelope_optional::<CompositeDriverMatch, D>(
2941 self.matched_driver
2942 .as_ref()
2943 .map(<CompositeDriverMatch as fidl::encoding::ValueTypeMarker>::borrow),
2944 encoder,
2945 offset + cur_offset,
2946 depth,
2947 )?;
2948
2949 _prev_end_offset = cur_offset + envelope_size;
2950
2951 Ok(())
2952 }
2953 }
2954
2955 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CompositeInfo {
2956 #[inline(always)]
2957 fn new_empty() -> Self {
2958 Self::default()
2959 }
2960
2961 unsafe fn decode(
2962 &mut self,
2963 decoder: &mut fidl::encoding::Decoder<'_, D>,
2964 offset: usize,
2965 mut depth: fidl::encoding::Depth,
2966 ) -> fidl::Result<()> {
2967 decoder.debug_check_bounds::<Self>(offset);
2968 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2969 None => return Err(fidl::Error::NotNullable),
2970 Some(len) => len,
2971 };
2972 if len == 0 {
2974 return Ok(());
2975 };
2976 depth.increment()?;
2977 let envelope_size = 8;
2978 let bytes_len = len * envelope_size;
2979 let offset = decoder.out_of_line_offset(bytes_len)?;
2980 let mut _next_ordinal_to_read = 0;
2982 let mut next_offset = offset;
2983 let end_offset = offset + bytes_len;
2984 _next_ordinal_to_read += 1;
2985 if next_offset >= end_offset {
2986 return Ok(());
2987 }
2988
2989 while _next_ordinal_to_read < 1 {
2991 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2992 _next_ordinal_to_read += 1;
2993 next_offset += envelope_size;
2994 }
2995
2996 let next_out_of_line = decoder.next_out_of_line();
2997 let handles_before = decoder.remaining_handles();
2998 if let Some((inlined, num_bytes, num_handles)) =
2999 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3000 {
3001 let member_inline_size =
3002 <CompositeNodeSpec as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3003 if inlined != (member_inline_size <= 4) {
3004 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3005 }
3006 let inner_offset;
3007 let mut inner_depth = depth.clone();
3008 if inlined {
3009 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3010 inner_offset = next_offset;
3011 } else {
3012 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3013 inner_depth.increment()?;
3014 }
3015 let val_ref =
3016 self.spec.get_or_insert_with(|| fidl::new_empty!(CompositeNodeSpec, D));
3017 fidl::decode!(CompositeNodeSpec, D, val_ref, decoder, inner_offset, inner_depth)?;
3018 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3019 {
3020 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3021 }
3022 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3023 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3024 }
3025 }
3026
3027 next_offset += envelope_size;
3028 _next_ordinal_to_read += 1;
3029 if next_offset >= end_offset {
3030 return Ok(());
3031 }
3032
3033 while _next_ordinal_to_read < 2 {
3035 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3036 _next_ordinal_to_read += 1;
3037 next_offset += envelope_size;
3038 }
3039
3040 let next_out_of_line = decoder.next_out_of_line();
3041 let handles_before = decoder.remaining_handles();
3042 if let Some((inlined, num_bytes, num_handles)) =
3043 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3044 {
3045 let member_inline_size =
3046 <CompositeDriverMatch as fidl::encoding::TypeMarker>::inline_size(
3047 decoder.context,
3048 );
3049 if inlined != (member_inline_size <= 4) {
3050 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3051 }
3052 let inner_offset;
3053 let mut inner_depth = depth.clone();
3054 if inlined {
3055 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3056 inner_offset = next_offset;
3057 } else {
3058 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3059 inner_depth.increment()?;
3060 }
3061 let val_ref = self
3062 .matched_driver
3063 .get_or_insert_with(|| fidl::new_empty!(CompositeDriverMatch, D));
3064 fidl::decode!(
3065 CompositeDriverMatch,
3066 D,
3067 val_ref,
3068 decoder,
3069 inner_offset,
3070 inner_depth
3071 )?;
3072 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3073 {
3074 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3075 }
3076 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3077 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3078 }
3079 }
3080
3081 next_offset += envelope_size;
3082
3083 while next_offset < end_offset {
3085 _next_ordinal_to_read += 1;
3086 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3087 next_offset += envelope_size;
3088 }
3089
3090 Ok(())
3091 }
3092 }
3093
3094 impl CompositeNodeSpec {
3095 #[inline(always)]
3096 fn max_ordinal_present(&self) -> u64 {
3097 if let Some(_) = self.parents {
3098 return 2;
3099 }
3100 if let Some(_) = self.name {
3101 return 1;
3102 }
3103 0
3104 }
3105 }
3106
3107 impl fidl::encoding::ValueTypeMarker for CompositeNodeSpec {
3108 type Borrowed<'a> = &'a Self;
3109 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3110 value
3111 }
3112 }
3113
3114 unsafe impl fidl::encoding::TypeMarker for CompositeNodeSpec {
3115 type Owned = Self;
3116
3117 #[inline(always)]
3118 fn inline_align(_context: fidl::encoding::Context) -> usize {
3119 8
3120 }
3121
3122 #[inline(always)]
3123 fn inline_size(_context: fidl::encoding::Context) -> usize {
3124 16
3125 }
3126 }
3127
3128 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CompositeNodeSpec, D>
3129 for &CompositeNodeSpec
3130 {
3131 unsafe fn encode(
3132 self,
3133 encoder: &mut fidl::encoding::Encoder<'_, D>,
3134 offset: usize,
3135 mut depth: fidl::encoding::Depth,
3136 ) -> fidl::Result<()> {
3137 encoder.debug_check_bounds::<CompositeNodeSpec>(offset);
3138 let max_ordinal: u64 = self.max_ordinal_present();
3140 encoder.write_num(max_ordinal, offset);
3141 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3142 if max_ordinal == 0 {
3144 return Ok(());
3145 }
3146 depth.increment()?;
3147 let envelope_size = 8;
3148 let bytes_len = max_ordinal as usize * envelope_size;
3149 #[allow(unused_variables)]
3150 let offset = encoder.out_of_line_offset(bytes_len);
3151 let mut _prev_end_offset: usize = 0;
3152 if 1 > max_ordinal {
3153 return Ok(());
3154 }
3155
3156 let cur_offset: usize = (1 - 1) * envelope_size;
3159
3160 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3162
3163 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedString, D>(
3168 self.name.as_ref().map(
3169 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
3170 ),
3171 encoder,
3172 offset + cur_offset,
3173 depth,
3174 )?;
3175
3176 _prev_end_offset = cur_offset + envelope_size;
3177 if 2 > max_ordinal {
3178 return Ok(());
3179 }
3180
3181 let cur_offset: usize = (2 - 1) * envelope_size;
3184
3185 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3187
3188 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<ParentSpec>, D>(
3193 self.parents.as_ref().map(<fidl::encoding::UnboundedVector<ParentSpec> as fidl::encoding::ValueTypeMarker>::borrow),
3194 encoder, offset + cur_offset, depth
3195 )?;
3196
3197 _prev_end_offset = cur_offset + envelope_size;
3198
3199 Ok(())
3200 }
3201 }
3202
3203 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CompositeNodeSpec {
3204 #[inline(always)]
3205 fn new_empty() -> Self {
3206 Self::default()
3207 }
3208
3209 unsafe fn decode(
3210 &mut self,
3211 decoder: &mut fidl::encoding::Decoder<'_, D>,
3212 offset: usize,
3213 mut depth: fidl::encoding::Depth,
3214 ) -> fidl::Result<()> {
3215 decoder.debug_check_bounds::<Self>(offset);
3216 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3217 None => return Err(fidl::Error::NotNullable),
3218 Some(len) => len,
3219 };
3220 if len == 0 {
3222 return Ok(());
3223 };
3224 depth.increment()?;
3225 let envelope_size = 8;
3226 let bytes_len = len * envelope_size;
3227 let offset = decoder.out_of_line_offset(bytes_len)?;
3228 let mut _next_ordinal_to_read = 0;
3230 let mut next_offset = offset;
3231 let end_offset = offset + bytes_len;
3232 _next_ordinal_to_read += 1;
3233 if next_offset >= end_offset {
3234 return Ok(());
3235 }
3236
3237 while _next_ordinal_to_read < 1 {
3239 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3240 _next_ordinal_to_read += 1;
3241 next_offset += envelope_size;
3242 }
3243
3244 let next_out_of_line = decoder.next_out_of_line();
3245 let handles_before = decoder.remaining_handles();
3246 if let Some((inlined, num_bytes, num_handles)) =
3247 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3248 {
3249 let member_inline_size =
3250 <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
3251 decoder.context,
3252 );
3253 if inlined != (member_inline_size <= 4) {
3254 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3255 }
3256 let inner_offset;
3257 let mut inner_depth = depth.clone();
3258 if inlined {
3259 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3260 inner_offset = next_offset;
3261 } else {
3262 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3263 inner_depth.increment()?;
3264 }
3265 let val_ref = self
3266 .name
3267 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::UnboundedString, D));
3268 fidl::decode!(
3269 fidl::encoding::UnboundedString,
3270 D,
3271 val_ref,
3272 decoder,
3273 inner_offset,
3274 inner_depth
3275 )?;
3276 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3277 {
3278 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3279 }
3280 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3281 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3282 }
3283 }
3284
3285 next_offset += envelope_size;
3286 _next_ordinal_to_read += 1;
3287 if next_offset >= end_offset {
3288 return Ok(());
3289 }
3290
3291 while _next_ordinal_to_read < 2 {
3293 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3294 _next_ordinal_to_read += 1;
3295 next_offset += envelope_size;
3296 }
3297
3298 let next_out_of_line = decoder.next_out_of_line();
3299 let handles_before = decoder.remaining_handles();
3300 if let Some((inlined, num_bytes, num_handles)) =
3301 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3302 {
3303 let member_inline_size = <fidl::encoding::UnboundedVector<ParentSpec> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3304 if inlined != (member_inline_size <= 4) {
3305 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3306 }
3307 let inner_offset;
3308 let mut inner_depth = depth.clone();
3309 if inlined {
3310 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3311 inner_offset = next_offset;
3312 } else {
3313 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3314 inner_depth.increment()?;
3315 }
3316 let val_ref = self.parents.get_or_insert_with(|| {
3317 fidl::new_empty!(fidl::encoding::UnboundedVector<ParentSpec>, D)
3318 });
3319 fidl::decode!(
3320 fidl::encoding::UnboundedVector<ParentSpec>,
3321 D,
3322 val_ref,
3323 decoder,
3324 inner_offset,
3325 inner_depth
3326 )?;
3327 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3328 {
3329 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3330 }
3331 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3332 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3333 }
3334 }
3335
3336 next_offset += envelope_size;
3337
3338 while next_offset < end_offset {
3340 _next_ordinal_to_read += 1;
3341 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3342 next_offset += envelope_size;
3343 }
3344
3345 Ok(())
3346 }
3347 }
3348
3349 impl CompositeParent {
3350 #[inline(always)]
3351 fn max_ordinal_present(&self) -> u64 {
3352 if let Some(_) = self.index {
3353 return 2;
3354 }
3355 if let Some(_) = self.composite {
3356 return 1;
3357 }
3358 0
3359 }
3360 }
3361
3362 impl fidl::encoding::ValueTypeMarker for CompositeParent {
3363 type Borrowed<'a> = &'a Self;
3364 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3365 value
3366 }
3367 }
3368
3369 unsafe impl fidl::encoding::TypeMarker for CompositeParent {
3370 type Owned = Self;
3371
3372 #[inline(always)]
3373 fn inline_align(_context: fidl::encoding::Context) -> usize {
3374 8
3375 }
3376
3377 #[inline(always)]
3378 fn inline_size(_context: fidl::encoding::Context) -> usize {
3379 16
3380 }
3381 }
3382
3383 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CompositeParent, D>
3384 for &CompositeParent
3385 {
3386 unsafe fn encode(
3387 self,
3388 encoder: &mut fidl::encoding::Encoder<'_, D>,
3389 offset: usize,
3390 mut depth: fidl::encoding::Depth,
3391 ) -> fidl::Result<()> {
3392 encoder.debug_check_bounds::<CompositeParent>(offset);
3393 let max_ordinal: u64 = self.max_ordinal_present();
3395 encoder.write_num(max_ordinal, offset);
3396 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3397 if max_ordinal == 0 {
3399 return Ok(());
3400 }
3401 depth.increment()?;
3402 let envelope_size = 8;
3403 let bytes_len = max_ordinal as usize * envelope_size;
3404 #[allow(unused_variables)]
3405 let offset = encoder.out_of_line_offset(bytes_len);
3406 let mut _prev_end_offset: usize = 0;
3407 if 1 > max_ordinal {
3408 return Ok(());
3409 }
3410
3411 let cur_offset: usize = (1 - 1) * envelope_size;
3414
3415 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3417
3418 fidl::encoding::encode_in_envelope_optional::<CompositeInfo, D>(
3423 self.composite
3424 .as_ref()
3425 .map(<CompositeInfo as fidl::encoding::ValueTypeMarker>::borrow),
3426 encoder,
3427 offset + cur_offset,
3428 depth,
3429 )?;
3430
3431 _prev_end_offset = cur_offset + envelope_size;
3432 if 2 > max_ordinal {
3433 return Ok(());
3434 }
3435
3436 let cur_offset: usize = (2 - 1) * envelope_size;
3439
3440 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3442
3443 fidl::encoding::encode_in_envelope_optional::<u32, D>(
3448 self.index.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3449 encoder,
3450 offset + cur_offset,
3451 depth,
3452 )?;
3453
3454 _prev_end_offset = cur_offset + envelope_size;
3455
3456 Ok(())
3457 }
3458 }
3459
3460 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CompositeParent {
3461 #[inline(always)]
3462 fn new_empty() -> Self {
3463 Self::default()
3464 }
3465
3466 unsafe fn decode(
3467 &mut self,
3468 decoder: &mut fidl::encoding::Decoder<'_, D>,
3469 offset: usize,
3470 mut depth: fidl::encoding::Depth,
3471 ) -> fidl::Result<()> {
3472 decoder.debug_check_bounds::<Self>(offset);
3473 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3474 None => return Err(fidl::Error::NotNullable),
3475 Some(len) => len,
3476 };
3477 if len == 0 {
3479 return Ok(());
3480 };
3481 depth.increment()?;
3482 let envelope_size = 8;
3483 let bytes_len = len * envelope_size;
3484 let offset = decoder.out_of_line_offset(bytes_len)?;
3485 let mut _next_ordinal_to_read = 0;
3487 let mut next_offset = offset;
3488 let end_offset = offset + bytes_len;
3489 _next_ordinal_to_read += 1;
3490 if next_offset >= end_offset {
3491 return Ok(());
3492 }
3493
3494 while _next_ordinal_to_read < 1 {
3496 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3497 _next_ordinal_to_read += 1;
3498 next_offset += envelope_size;
3499 }
3500
3501 let next_out_of_line = decoder.next_out_of_line();
3502 let handles_before = decoder.remaining_handles();
3503 if let Some((inlined, num_bytes, num_handles)) =
3504 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3505 {
3506 let member_inline_size =
3507 <CompositeInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3508 if inlined != (member_inline_size <= 4) {
3509 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3510 }
3511 let inner_offset;
3512 let mut inner_depth = depth.clone();
3513 if inlined {
3514 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3515 inner_offset = next_offset;
3516 } else {
3517 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3518 inner_depth.increment()?;
3519 }
3520 let val_ref =
3521 self.composite.get_or_insert_with(|| fidl::new_empty!(CompositeInfo, D));
3522 fidl::decode!(CompositeInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
3523 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3524 {
3525 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3526 }
3527 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3528 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3529 }
3530 }
3531
3532 next_offset += envelope_size;
3533 _next_ordinal_to_read += 1;
3534 if next_offset >= end_offset {
3535 return Ok(());
3536 }
3537
3538 while _next_ordinal_to_read < 2 {
3540 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3541 _next_ordinal_to_read += 1;
3542 next_offset += envelope_size;
3543 }
3544
3545 let next_out_of_line = decoder.next_out_of_line();
3546 let handles_before = decoder.remaining_handles();
3547 if let Some((inlined, num_bytes, num_handles)) =
3548 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3549 {
3550 let member_inline_size =
3551 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3552 if inlined != (member_inline_size <= 4) {
3553 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3554 }
3555 let inner_offset;
3556 let mut inner_depth = depth.clone();
3557 if inlined {
3558 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3559 inner_offset = next_offset;
3560 } else {
3561 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3562 inner_depth.increment()?;
3563 }
3564 let val_ref = self.index.get_or_insert_with(|| fidl::new_empty!(u32, D));
3565 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
3566 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3567 {
3568 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3569 }
3570 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3571 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3572 }
3573 }
3574
3575 next_offset += envelope_size;
3576
3577 while next_offset < end_offset {
3579 _next_ordinal_to_read += 1;
3580 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3581 next_offset += envelope_size;
3582 }
3583
3584 Ok(())
3585 }
3586 }
3587
3588 impl DeviceCategory {
3589 #[inline(always)]
3590 fn max_ordinal_present(&self) -> u64 {
3591 if let Some(_) = self.subcategory {
3592 return 2;
3593 }
3594 if let Some(_) = self.category {
3595 return 1;
3596 }
3597 0
3598 }
3599 }
3600
3601 impl fidl::encoding::ValueTypeMarker for DeviceCategory {
3602 type Borrowed<'a> = &'a Self;
3603 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3604 value
3605 }
3606 }
3607
3608 unsafe impl fidl::encoding::TypeMarker for DeviceCategory {
3609 type Owned = Self;
3610
3611 #[inline(always)]
3612 fn inline_align(_context: fidl::encoding::Context) -> usize {
3613 8
3614 }
3615
3616 #[inline(always)]
3617 fn inline_size(_context: fidl::encoding::Context) -> usize {
3618 16
3619 }
3620 }
3621
3622 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceCategory, D>
3623 for &DeviceCategory
3624 {
3625 unsafe fn encode(
3626 self,
3627 encoder: &mut fidl::encoding::Encoder<'_, D>,
3628 offset: usize,
3629 mut depth: fidl::encoding::Depth,
3630 ) -> fidl::Result<()> {
3631 encoder.debug_check_bounds::<DeviceCategory>(offset);
3632 let max_ordinal: u64 = self.max_ordinal_present();
3634 encoder.write_num(max_ordinal, offset);
3635 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3636 if max_ordinal == 0 {
3638 return Ok(());
3639 }
3640 depth.increment()?;
3641 let envelope_size = 8;
3642 let bytes_len = max_ordinal as usize * envelope_size;
3643 #[allow(unused_variables)]
3644 let offset = encoder.out_of_line_offset(bytes_len);
3645 let mut _prev_end_offset: usize = 0;
3646 if 1 > max_ordinal {
3647 return Ok(());
3648 }
3649
3650 let cur_offset: usize = (1 - 1) * envelope_size;
3653
3654 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3656
3657 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedString, D>(
3662 self.category.as_ref().map(
3663 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
3664 ),
3665 encoder,
3666 offset + cur_offset,
3667 depth,
3668 )?;
3669
3670 _prev_end_offset = cur_offset + envelope_size;
3671 if 2 > max_ordinal {
3672 return Ok(());
3673 }
3674
3675 let cur_offset: usize = (2 - 1) * envelope_size;
3678
3679 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3681
3682 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedString, D>(
3687 self.subcategory.as_ref().map(
3688 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
3689 ),
3690 encoder,
3691 offset + cur_offset,
3692 depth,
3693 )?;
3694
3695 _prev_end_offset = cur_offset + envelope_size;
3696
3697 Ok(())
3698 }
3699 }
3700
3701 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceCategory {
3702 #[inline(always)]
3703 fn new_empty() -> Self {
3704 Self::default()
3705 }
3706
3707 unsafe fn decode(
3708 &mut self,
3709 decoder: &mut fidl::encoding::Decoder<'_, D>,
3710 offset: usize,
3711 mut depth: fidl::encoding::Depth,
3712 ) -> fidl::Result<()> {
3713 decoder.debug_check_bounds::<Self>(offset);
3714 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3715 None => return Err(fidl::Error::NotNullable),
3716 Some(len) => len,
3717 };
3718 if len == 0 {
3720 return Ok(());
3721 };
3722 depth.increment()?;
3723 let envelope_size = 8;
3724 let bytes_len = len * envelope_size;
3725 let offset = decoder.out_of_line_offset(bytes_len)?;
3726 let mut _next_ordinal_to_read = 0;
3728 let mut next_offset = offset;
3729 let end_offset = offset + bytes_len;
3730 _next_ordinal_to_read += 1;
3731 if next_offset >= end_offset {
3732 return Ok(());
3733 }
3734
3735 while _next_ordinal_to_read < 1 {
3737 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3738 _next_ordinal_to_read += 1;
3739 next_offset += envelope_size;
3740 }
3741
3742 let next_out_of_line = decoder.next_out_of_line();
3743 let handles_before = decoder.remaining_handles();
3744 if let Some((inlined, num_bytes, num_handles)) =
3745 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3746 {
3747 let member_inline_size =
3748 <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
3749 decoder.context,
3750 );
3751 if inlined != (member_inline_size <= 4) {
3752 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3753 }
3754 let inner_offset;
3755 let mut inner_depth = depth.clone();
3756 if inlined {
3757 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3758 inner_offset = next_offset;
3759 } else {
3760 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3761 inner_depth.increment()?;
3762 }
3763 let val_ref = self
3764 .category
3765 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::UnboundedString, D));
3766 fidl::decode!(
3767 fidl::encoding::UnboundedString,
3768 D,
3769 val_ref,
3770 decoder,
3771 inner_offset,
3772 inner_depth
3773 )?;
3774 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3775 {
3776 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3777 }
3778 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3779 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3780 }
3781 }
3782
3783 next_offset += envelope_size;
3784 _next_ordinal_to_read += 1;
3785 if next_offset >= end_offset {
3786 return Ok(());
3787 }
3788
3789 while _next_ordinal_to_read < 2 {
3791 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3792 _next_ordinal_to_read += 1;
3793 next_offset += envelope_size;
3794 }
3795
3796 let next_out_of_line = decoder.next_out_of_line();
3797 let handles_before = decoder.remaining_handles();
3798 if let Some((inlined, num_bytes, num_handles)) =
3799 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3800 {
3801 let member_inline_size =
3802 <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
3803 decoder.context,
3804 );
3805 if inlined != (member_inline_size <= 4) {
3806 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3807 }
3808 let inner_offset;
3809 let mut inner_depth = depth.clone();
3810 if inlined {
3811 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3812 inner_offset = next_offset;
3813 } else {
3814 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3815 inner_depth.increment()?;
3816 }
3817 let val_ref = self
3818 .subcategory
3819 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::UnboundedString, D));
3820 fidl::decode!(
3821 fidl::encoding::UnboundedString,
3822 D,
3823 val_ref,
3824 decoder,
3825 inner_offset,
3826 inner_depth
3827 )?;
3828 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3829 {
3830 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3831 }
3832 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3833 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3834 }
3835 }
3836
3837 next_offset += envelope_size;
3838
3839 while next_offset < end_offset {
3841 _next_ordinal_to_read += 1;
3842 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3843 next_offset += envelope_size;
3844 }
3845
3846 Ok(())
3847 }
3848 }
3849
3850 impl DriverInfo {
3851 #[inline(always)]
3852 fn max_ordinal_present(&self) -> u64 {
3853 if let Some(_) = self.is_disabled {
3854 return 9;
3855 }
3856 if let Some(_) = self.driver_framework_version {
3857 return 8;
3858 }
3859 if let Some(_) = self.bind_rules_bytecode {
3860 return 7;
3861 }
3862 if let Some(_) = self.device_categories {
3863 return 6;
3864 }
3865 if let Some(_) = self.is_fallback {
3866 return 5;
3867 }
3868 if let Some(_) = self.package_type {
3869 return 4;
3870 }
3871 if let Some(_) = self.colocate {
3872 return 3;
3873 }
3874 if let Some(_) = self.name {
3875 return 2;
3876 }
3877 if let Some(_) = self.url {
3878 return 1;
3879 }
3880 0
3881 }
3882 }
3883
3884 impl fidl::encoding::ValueTypeMarker for DriverInfo {
3885 type Borrowed<'a> = &'a Self;
3886 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3887 value
3888 }
3889 }
3890
3891 unsafe impl fidl::encoding::TypeMarker for DriverInfo {
3892 type Owned = Self;
3893
3894 #[inline(always)]
3895 fn inline_align(_context: fidl::encoding::Context) -> usize {
3896 8
3897 }
3898
3899 #[inline(always)]
3900 fn inline_size(_context: fidl::encoding::Context) -> usize {
3901 16
3902 }
3903 }
3904
3905 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DriverInfo, D>
3906 for &DriverInfo
3907 {
3908 unsafe fn encode(
3909 self,
3910 encoder: &mut fidl::encoding::Encoder<'_, D>,
3911 offset: usize,
3912 mut depth: fidl::encoding::Depth,
3913 ) -> fidl::Result<()> {
3914 encoder.debug_check_bounds::<DriverInfo>(offset);
3915 let max_ordinal: u64 = self.max_ordinal_present();
3917 encoder.write_num(max_ordinal, offset);
3918 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3919 if max_ordinal == 0 {
3921 return Ok(());
3922 }
3923 depth.increment()?;
3924 let envelope_size = 8;
3925 let bytes_len = max_ordinal as usize * envelope_size;
3926 #[allow(unused_variables)]
3927 let offset = encoder.out_of_line_offset(bytes_len);
3928 let mut _prev_end_offset: usize = 0;
3929 if 1 > max_ordinal {
3930 return Ok(());
3931 }
3932
3933 let cur_offset: usize = (1 - 1) * envelope_size;
3936
3937 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3939
3940 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<4096>, D>(
3945 self.url.as_ref().map(<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow),
3946 encoder, offset + cur_offset, depth
3947 )?;
3948
3949 _prev_end_offset = cur_offset + envelope_size;
3950 if 2 > max_ordinal {
3951 return Ok(());
3952 }
3953
3954 let cur_offset: usize = (2 - 1) * envelope_size;
3957
3958 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3960
3961 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedString, D>(
3966 self.name.as_ref().map(
3967 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
3968 ),
3969 encoder,
3970 offset + cur_offset,
3971 depth,
3972 )?;
3973
3974 _prev_end_offset = cur_offset + envelope_size;
3975 if 3 > max_ordinal {
3976 return Ok(());
3977 }
3978
3979 let cur_offset: usize = (3 - 1) * envelope_size;
3982
3983 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3985
3986 fidl::encoding::encode_in_envelope_optional::<bool, D>(
3991 self.colocate.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
3992 encoder,
3993 offset + cur_offset,
3994 depth,
3995 )?;
3996
3997 _prev_end_offset = cur_offset + envelope_size;
3998 if 4 > max_ordinal {
3999 return Ok(());
4000 }
4001
4002 let cur_offset: usize = (4 - 1) * envelope_size;
4005
4006 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4008
4009 fidl::encoding::encode_in_envelope_optional::<DriverPackageType, D>(
4014 self.package_type
4015 .as_ref()
4016 .map(<DriverPackageType as fidl::encoding::ValueTypeMarker>::borrow),
4017 encoder,
4018 offset + cur_offset,
4019 depth,
4020 )?;
4021
4022 _prev_end_offset = cur_offset + envelope_size;
4023 if 5 > max_ordinal {
4024 return Ok(());
4025 }
4026
4027 let cur_offset: usize = (5 - 1) * envelope_size;
4030
4031 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4033
4034 fidl::encoding::encode_in_envelope_optional::<bool, D>(
4039 self.is_fallback.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
4040 encoder,
4041 offset + cur_offset,
4042 depth,
4043 )?;
4044
4045 _prev_end_offset = cur_offset + envelope_size;
4046 if 6 > max_ordinal {
4047 return Ok(());
4048 }
4049
4050 let cur_offset: usize = (6 - 1) * envelope_size;
4053
4054 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4056
4057 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<DeviceCategory>, D>(
4062 self.device_categories.as_ref().map(<fidl::encoding::UnboundedVector<DeviceCategory> as fidl::encoding::ValueTypeMarker>::borrow),
4063 encoder, offset + cur_offset, depth
4064 )?;
4065
4066 _prev_end_offset = cur_offset + envelope_size;
4067 if 7 > max_ordinal {
4068 return Ok(());
4069 }
4070
4071 let cur_offset: usize = (7 - 1) * envelope_size;
4074
4075 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4077
4078 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<u8>, D>(
4083 self.bind_rules_bytecode.as_ref().map(<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow),
4084 encoder, offset + cur_offset, depth
4085 )?;
4086
4087 _prev_end_offset = cur_offset + envelope_size;
4088 if 8 > max_ordinal {
4089 return Ok(());
4090 }
4091
4092 let cur_offset: usize = (8 - 1) * envelope_size;
4095
4096 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4098
4099 fidl::encoding::encode_in_envelope_optional::<u8, D>(
4104 self.driver_framework_version
4105 .as_ref()
4106 .map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
4107 encoder,
4108 offset + cur_offset,
4109 depth,
4110 )?;
4111
4112 _prev_end_offset = cur_offset + envelope_size;
4113 if 9 > max_ordinal {
4114 return Ok(());
4115 }
4116
4117 let cur_offset: usize = (9 - 1) * envelope_size;
4120
4121 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4123
4124 fidl::encoding::encode_in_envelope_optional::<bool, D>(
4129 self.is_disabled.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
4130 encoder,
4131 offset + cur_offset,
4132 depth,
4133 )?;
4134
4135 _prev_end_offset = cur_offset + envelope_size;
4136
4137 Ok(())
4138 }
4139 }
4140
4141 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DriverInfo {
4142 #[inline(always)]
4143 fn new_empty() -> Self {
4144 Self::default()
4145 }
4146
4147 unsafe fn decode(
4148 &mut self,
4149 decoder: &mut fidl::encoding::Decoder<'_, D>,
4150 offset: usize,
4151 mut depth: fidl::encoding::Depth,
4152 ) -> fidl::Result<()> {
4153 decoder.debug_check_bounds::<Self>(offset);
4154 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4155 None => return Err(fidl::Error::NotNullable),
4156 Some(len) => len,
4157 };
4158 if len == 0 {
4160 return Ok(());
4161 };
4162 depth.increment()?;
4163 let envelope_size = 8;
4164 let bytes_len = len * envelope_size;
4165 let offset = decoder.out_of_line_offset(bytes_len)?;
4166 let mut _next_ordinal_to_read = 0;
4168 let mut next_offset = offset;
4169 let end_offset = offset + bytes_len;
4170 _next_ordinal_to_read += 1;
4171 if next_offset >= end_offset {
4172 return Ok(());
4173 }
4174
4175 while _next_ordinal_to_read < 1 {
4177 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4178 _next_ordinal_to_read += 1;
4179 next_offset += envelope_size;
4180 }
4181
4182 let next_out_of_line = decoder.next_out_of_line();
4183 let handles_before = decoder.remaining_handles();
4184 if let Some((inlined, num_bytes, num_handles)) =
4185 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4186 {
4187 let member_inline_size = <fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4188 if inlined != (member_inline_size <= 4) {
4189 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4190 }
4191 let inner_offset;
4192 let mut inner_depth = depth.clone();
4193 if inlined {
4194 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4195 inner_offset = next_offset;
4196 } else {
4197 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4198 inner_depth.increment()?;
4199 }
4200 let val_ref = self.url.get_or_insert_with(|| {
4201 fidl::new_empty!(fidl::encoding::BoundedString<4096>, D)
4202 });
4203 fidl::decode!(
4204 fidl::encoding::BoundedString<4096>,
4205 D,
4206 val_ref,
4207 decoder,
4208 inner_offset,
4209 inner_depth
4210 )?;
4211 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4212 {
4213 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4214 }
4215 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4216 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4217 }
4218 }
4219
4220 next_offset += envelope_size;
4221 _next_ordinal_to_read += 1;
4222 if next_offset >= end_offset {
4223 return Ok(());
4224 }
4225
4226 while _next_ordinal_to_read < 2 {
4228 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4229 _next_ordinal_to_read += 1;
4230 next_offset += envelope_size;
4231 }
4232
4233 let next_out_of_line = decoder.next_out_of_line();
4234 let handles_before = decoder.remaining_handles();
4235 if let Some((inlined, num_bytes, num_handles)) =
4236 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4237 {
4238 let member_inline_size =
4239 <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
4240 decoder.context,
4241 );
4242 if inlined != (member_inline_size <= 4) {
4243 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4244 }
4245 let inner_offset;
4246 let mut inner_depth = depth.clone();
4247 if inlined {
4248 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4249 inner_offset = next_offset;
4250 } else {
4251 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4252 inner_depth.increment()?;
4253 }
4254 let val_ref = self
4255 .name
4256 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::UnboundedString, D));
4257 fidl::decode!(
4258 fidl::encoding::UnboundedString,
4259 D,
4260 val_ref,
4261 decoder,
4262 inner_offset,
4263 inner_depth
4264 )?;
4265 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4266 {
4267 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4268 }
4269 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4270 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4271 }
4272 }
4273
4274 next_offset += envelope_size;
4275 _next_ordinal_to_read += 1;
4276 if next_offset >= end_offset {
4277 return Ok(());
4278 }
4279
4280 while _next_ordinal_to_read < 3 {
4282 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4283 _next_ordinal_to_read += 1;
4284 next_offset += envelope_size;
4285 }
4286
4287 let next_out_of_line = decoder.next_out_of_line();
4288 let handles_before = decoder.remaining_handles();
4289 if let Some((inlined, num_bytes, num_handles)) =
4290 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4291 {
4292 let member_inline_size =
4293 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4294 if inlined != (member_inline_size <= 4) {
4295 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4296 }
4297 let inner_offset;
4298 let mut inner_depth = depth.clone();
4299 if inlined {
4300 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4301 inner_offset = next_offset;
4302 } else {
4303 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4304 inner_depth.increment()?;
4305 }
4306 let val_ref = self.colocate.get_or_insert_with(|| fidl::new_empty!(bool, D));
4307 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
4308 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4309 {
4310 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4311 }
4312 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4313 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4314 }
4315 }
4316
4317 next_offset += envelope_size;
4318 _next_ordinal_to_read += 1;
4319 if next_offset >= end_offset {
4320 return Ok(());
4321 }
4322
4323 while _next_ordinal_to_read < 4 {
4325 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4326 _next_ordinal_to_read += 1;
4327 next_offset += envelope_size;
4328 }
4329
4330 let next_out_of_line = decoder.next_out_of_line();
4331 let handles_before = decoder.remaining_handles();
4332 if let Some((inlined, num_bytes, num_handles)) =
4333 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4334 {
4335 let member_inline_size =
4336 <DriverPackageType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4337 if inlined != (member_inline_size <= 4) {
4338 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4339 }
4340 let inner_offset;
4341 let mut inner_depth = depth.clone();
4342 if inlined {
4343 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4344 inner_offset = next_offset;
4345 } else {
4346 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4347 inner_depth.increment()?;
4348 }
4349 let val_ref =
4350 self.package_type.get_or_insert_with(|| fidl::new_empty!(DriverPackageType, D));
4351 fidl::decode!(DriverPackageType, D, val_ref, decoder, inner_offset, inner_depth)?;
4352 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4353 {
4354 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4355 }
4356 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4357 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4358 }
4359 }
4360
4361 next_offset += envelope_size;
4362 _next_ordinal_to_read += 1;
4363 if next_offset >= end_offset {
4364 return Ok(());
4365 }
4366
4367 while _next_ordinal_to_read < 5 {
4369 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4370 _next_ordinal_to_read += 1;
4371 next_offset += envelope_size;
4372 }
4373
4374 let next_out_of_line = decoder.next_out_of_line();
4375 let handles_before = decoder.remaining_handles();
4376 if let Some((inlined, num_bytes, num_handles)) =
4377 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4378 {
4379 let member_inline_size =
4380 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4381 if inlined != (member_inline_size <= 4) {
4382 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4383 }
4384 let inner_offset;
4385 let mut inner_depth = depth.clone();
4386 if inlined {
4387 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4388 inner_offset = next_offset;
4389 } else {
4390 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4391 inner_depth.increment()?;
4392 }
4393 let val_ref = self.is_fallback.get_or_insert_with(|| fidl::new_empty!(bool, D));
4394 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
4395 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4396 {
4397 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4398 }
4399 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4400 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4401 }
4402 }
4403
4404 next_offset += envelope_size;
4405 _next_ordinal_to_read += 1;
4406 if next_offset >= end_offset {
4407 return Ok(());
4408 }
4409
4410 while _next_ordinal_to_read < 6 {
4412 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4413 _next_ordinal_to_read += 1;
4414 next_offset += envelope_size;
4415 }
4416
4417 let next_out_of_line = decoder.next_out_of_line();
4418 let handles_before = decoder.remaining_handles();
4419 if let Some((inlined, num_bytes, num_handles)) =
4420 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4421 {
4422 let member_inline_size = <fidl::encoding::UnboundedVector<DeviceCategory> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4423 if inlined != (member_inline_size <= 4) {
4424 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4425 }
4426 let inner_offset;
4427 let mut inner_depth = depth.clone();
4428 if inlined {
4429 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4430 inner_offset = next_offset;
4431 } else {
4432 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4433 inner_depth.increment()?;
4434 }
4435 let val_ref = self.device_categories.get_or_insert_with(|| {
4436 fidl::new_empty!(fidl::encoding::UnboundedVector<DeviceCategory>, D)
4437 });
4438 fidl::decode!(
4439 fidl::encoding::UnboundedVector<DeviceCategory>,
4440 D,
4441 val_ref,
4442 decoder,
4443 inner_offset,
4444 inner_depth
4445 )?;
4446 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4447 {
4448 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4449 }
4450 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4451 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4452 }
4453 }
4454
4455 next_offset += envelope_size;
4456 _next_ordinal_to_read += 1;
4457 if next_offset >= end_offset {
4458 return Ok(());
4459 }
4460
4461 while _next_ordinal_to_read < 7 {
4463 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4464 _next_ordinal_to_read += 1;
4465 next_offset += envelope_size;
4466 }
4467
4468 let next_out_of_line = decoder.next_out_of_line();
4469 let handles_before = decoder.remaining_handles();
4470 if let Some((inlined, num_bytes, num_handles)) =
4471 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4472 {
4473 let member_inline_size = <fidl::encoding::UnboundedVector<u8> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4474 if inlined != (member_inline_size <= 4) {
4475 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4476 }
4477 let inner_offset;
4478 let mut inner_depth = depth.clone();
4479 if inlined {
4480 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4481 inner_offset = next_offset;
4482 } else {
4483 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4484 inner_depth.increment()?;
4485 }
4486 let val_ref = self.bind_rules_bytecode.get_or_insert_with(|| {
4487 fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D)
4488 });
4489 fidl::decode!(
4490 fidl::encoding::UnboundedVector<u8>,
4491 D,
4492 val_ref,
4493 decoder,
4494 inner_offset,
4495 inner_depth
4496 )?;
4497 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4498 {
4499 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4500 }
4501 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4502 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4503 }
4504 }
4505
4506 next_offset += envelope_size;
4507 _next_ordinal_to_read += 1;
4508 if next_offset >= end_offset {
4509 return Ok(());
4510 }
4511
4512 while _next_ordinal_to_read < 8 {
4514 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4515 _next_ordinal_to_read += 1;
4516 next_offset += envelope_size;
4517 }
4518
4519 let next_out_of_line = decoder.next_out_of_line();
4520 let handles_before = decoder.remaining_handles();
4521 if let Some((inlined, num_bytes, num_handles)) =
4522 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4523 {
4524 let member_inline_size =
4525 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4526 if inlined != (member_inline_size <= 4) {
4527 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4528 }
4529 let inner_offset;
4530 let mut inner_depth = depth.clone();
4531 if inlined {
4532 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4533 inner_offset = next_offset;
4534 } else {
4535 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4536 inner_depth.increment()?;
4537 }
4538 let val_ref =
4539 self.driver_framework_version.get_or_insert_with(|| fidl::new_empty!(u8, D));
4540 fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
4541 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4542 {
4543 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4544 }
4545 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4546 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4547 }
4548 }
4549
4550 next_offset += envelope_size;
4551 _next_ordinal_to_read += 1;
4552 if next_offset >= end_offset {
4553 return Ok(());
4554 }
4555
4556 while _next_ordinal_to_read < 9 {
4558 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4559 _next_ordinal_to_read += 1;
4560 next_offset += envelope_size;
4561 }
4562
4563 let next_out_of_line = decoder.next_out_of_line();
4564 let handles_before = decoder.remaining_handles();
4565 if let Some((inlined, num_bytes, num_handles)) =
4566 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4567 {
4568 let member_inline_size =
4569 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4570 if inlined != (member_inline_size <= 4) {
4571 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4572 }
4573 let inner_offset;
4574 let mut inner_depth = depth.clone();
4575 if inlined {
4576 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4577 inner_offset = next_offset;
4578 } else {
4579 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4580 inner_depth.increment()?;
4581 }
4582 let val_ref = self.is_disabled.get_or_insert_with(|| fidl::new_empty!(bool, D));
4583 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
4584 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4585 {
4586 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4587 }
4588 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4589 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4590 }
4591 }
4592
4593 next_offset += envelope_size;
4594
4595 while next_offset < end_offset {
4597 _next_ordinal_to_read += 1;
4598 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4599 next_offset += envelope_size;
4600 }
4601
4602 Ok(())
4603 }
4604 }
4605
4606 impl NodeControllerRequestBindRequest {
4607 #[inline(always)]
4608 fn max_ordinal_present(&self) -> u64 {
4609 if let Some(_) = self.driver_url_suffix {
4610 return 2;
4611 }
4612 if let Some(_) = self.force_rebind {
4613 return 1;
4614 }
4615 0
4616 }
4617 }
4618
4619 impl fidl::encoding::ValueTypeMarker for NodeControllerRequestBindRequest {
4620 type Borrowed<'a> = &'a Self;
4621 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4622 value
4623 }
4624 }
4625
4626 unsafe impl fidl::encoding::TypeMarker for NodeControllerRequestBindRequest {
4627 type Owned = Self;
4628
4629 #[inline(always)]
4630 fn inline_align(_context: fidl::encoding::Context) -> usize {
4631 8
4632 }
4633
4634 #[inline(always)]
4635 fn inline_size(_context: fidl::encoding::Context) -> usize {
4636 16
4637 }
4638 }
4639
4640 unsafe impl<D: fidl::encoding::ResourceDialect>
4641 fidl::encoding::Encode<NodeControllerRequestBindRequest, D>
4642 for &NodeControllerRequestBindRequest
4643 {
4644 unsafe fn encode(
4645 self,
4646 encoder: &mut fidl::encoding::Encoder<'_, D>,
4647 offset: usize,
4648 mut depth: fidl::encoding::Depth,
4649 ) -> fidl::Result<()> {
4650 encoder.debug_check_bounds::<NodeControllerRequestBindRequest>(offset);
4651 let max_ordinal: u64 = self.max_ordinal_present();
4653 encoder.write_num(max_ordinal, offset);
4654 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4655 if max_ordinal == 0 {
4657 return Ok(());
4658 }
4659 depth.increment()?;
4660 let envelope_size = 8;
4661 let bytes_len = max_ordinal as usize * envelope_size;
4662 #[allow(unused_variables)]
4663 let offset = encoder.out_of_line_offset(bytes_len);
4664 let mut _prev_end_offset: usize = 0;
4665 if 1 > max_ordinal {
4666 return Ok(());
4667 }
4668
4669 let cur_offset: usize = (1 - 1) * envelope_size;
4672
4673 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4675
4676 fidl::encoding::encode_in_envelope_optional::<bool, D>(
4681 self.force_rebind.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
4682 encoder,
4683 offset + cur_offset,
4684 depth,
4685 )?;
4686
4687 _prev_end_offset = cur_offset + envelope_size;
4688 if 2 > max_ordinal {
4689 return Ok(());
4690 }
4691
4692 let cur_offset: usize = (2 - 1) * envelope_size;
4695
4696 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4698
4699 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedString, D>(
4704 self.driver_url_suffix.as_ref().map(
4705 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
4706 ),
4707 encoder,
4708 offset + cur_offset,
4709 depth,
4710 )?;
4711
4712 _prev_end_offset = cur_offset + envelope_size;
4713
4714 Ok(())
4715 }
4716 }
4717
4718 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4719 for NodeControllerRequestBindRequest
4720 {
4721 #[inline(always)]
4722 fn new_empty() -> Self {
4723 Self::default()
4724 }
4725
4726 unsafe fn decode(
4727 &mut self,
4728 decoder: &mut fidl::encoding::Decoder<'_, D>,
4729 offset: usize,
4730 mut depth: fidl::encoding::Depth,
4731 ) -> fidl::Result<()> {
4732 decoder.debug_check_bounds::<Self>(offset);
4733 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4734 None => return Err(fidl::Error::NotNullable),
4735 Some(len) => len,
4736 };
4737 if len == 0 {
4739 return Ok(());
4740 };
4741 depth.increment()?;
4742 let envelope_size = 8;
4743 let bytes_len = len * envelope_size;
4744 let offset = decoder.out_of_line_offset(bytes_len)?;
4745 let mut _next_ordinal_to_read = 0;
4747 let mut next_offset = offset;
4748 let end_offset = offset + bytes_len;
4749 _next_ordinal_to_read += 1;
4750 if next_offset >= end_offset {
4751 return Ok(());
4752 }
4753
4754 while _next_ordinal_to_read < 1 {
4756 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4757 _next_ordinal_to_read += 1;
4758 next_offset += envelope_size;
4759 }
4760
4761 let next_out_of_line = decoder.next_out_of_line();
4762 let handles_before = decoder.remaining_handles();
4763 if let Some((inlined, num_bytes, num_handles)) =
4764 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4765 {
4766 let member_inline_size =
4767 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4768 if inlined != (member_inline_size <= 4) {
4769 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4770 }
4771 let inner_offset;
4772 let mut inner_depth = depth.clone();
4773 if inlined {
4774 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4775 inner_offset = next_offset;
4776 } else {
4777 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4778 inner_depth.increment()?;
4779 }
4780 let val_ref = self.force_rebind.get_or_insert_with(|| fidl::new_empty!(bool, D));
4781 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
4782 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4783 {
4784 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4785 }
4786 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4787 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4788 }
4789 }
4790
4791 next_offset += envelope_size;
4792 _next_ordinal_to_read += 1;
4793 if next_offset >= end_offset {
4794 return Ok(());
4795 }
4796
4797 while _next_ordinal_to_read < 2 {
4799 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4800 _next_ordinal_to_read += 1;
4801 next_offset += envelope_size;
4802 }
4803
4804 let next_out_of_line = decoder.next_out_of_line();
4805 let handles_before = decoder.remaining_handles();
4806 if let Some((inlined, num_bytes, num_handles)) =
4807 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4808 {
4809 let member_inline_size =
4810 <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
4811 decoder.context,
4812 );
4813 if inlined != (member_inline_size <= 4) {
4814 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4815 }
4816 let inner_offset;
4817 let mut inner_depth = depth.clone();
4818 if inlined {
4819 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4820 inner_offset = next_offset;
4821 } else {
4822 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4823 inner_depth.increment()?;
4824 }
4825 let val_ref = self
4826 .driver_url_suffix
4827 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::UnboundedString, D));
4828 fidl::decode!(
4829 fidl::encoding::UnboundedString,
4830 D,
4831 val_ref,
4832 decoder,
4833 inner_offset,
4834 inner_depth
4835 )?;
4836 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4837 {
4838 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4839 }
4840 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4841 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4842 }
4843 }
4844
4845 next_offset += envelope_size;
4846
4847 while next_offset < end_offset {
4849 _next_ordinal_to_read += 1;
4850 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4851 next_offset += envelope_size;
4852 }
4853
4854 Ok(())
4855 }
4856 }
4857
4858 impl NodeSymbol {
4859 #[inline(always)]
4860 fn max_ordinal_present(&self) -> u64 {
4861 if let Some(_) = self.module_name {
4862 return 3;
4863 }
4864 if let Some(_) = self.address {
4865 return 2;
4866 }
4867 if let Some(_) = self.name {
4868 return 1;
4869 }
4870 0
4871 }
4872 }
4873
4874 impl fidl::encoding::ValueTypeMarker for NodeSymbol {
4875 type Borrowed<'a> = &'a Self;
4876 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4877 value
4878 }
4879 }
4880
4881 unsafe impl fidl::encoding::TypeMarker for NodeSymbol {
4882 type Owned = Self;
4883
4884 #[inline(always)]
4885 fn inline_align(_context: fidl::encoding::Context) -> usize {
4886 8
4887 }
4888
4889 #[inline(always)]
4890 fn inline_size(_context: fidl::encoding::Context) -> usize {
4891 16
4892 }
4893 }
4894
4895 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NodeSymbol, D>
4896 for &NodeSymbol
4897 {
4898 unsafe fn encode(
4899 self,
4900 encoder: &mut fidl::encoding::Encoder<'_, D>,
4901 offset: usize,
4902 mut depth: fidl::encoding::Depth,
4903 ) -> fidl::Result<()> {
4904 encoder.debug_check_bounds::<NodeSymbol>(offset);
4905 let max_ordinal: u64 = self.max_ordinal_present();
4907 encoder.write_num(max_ordinal, offset);
4908 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4909 if max_ordinal == 0 {
4911 return Ok(());
4912 }
4913 depth.increment()?;
4914 let envelope_size = 8;
4915 let bytes_len = max_ordinal as usize * envelope_size;
4916 #[allow(unused_variables)]
4917 let offset = encoder.out_of_line_offset(bytes_len);
4918 let mut _prev_end_offset: usize = 0;
4919 if 1 > max_ordinal {
4920 return Ok(());
4921 }
4922
4923 let cur_offset: usize = (1 - 1) * envelope_size;
4926
4927 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4929
4930 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<128>, D>(
4935 self.name.as_ref().map(
4936 <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow,
4937 ),
4938 encoder,
4939 offset + cur_offset,
4940 depth,
4941 )?;
4942
4943 _prev_end_offset = cur_offset + envelope_size;
4944 if 2 > max_ordinal {
4945 return Ok(());
4946 }
4947
4948 let cur_offset: usize = (2 - 1) * envelope_size;
4951
4952 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4954
4955 fidl::encoding::encode_in_envelope_optional::<u64, D>(
4960 self.address.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
4961 encoder,
4962 offset + cur_offset,
4963 depth,
4964 )?;
4965
4966 _prev_end_offset = cur_offset + envelope_size;
4967 if 3 > max_ordinal {
4968 return Ok(());
4969 }
4970
4971 let cur_offset: usize = (3 - 1) * envelope_size;
4974
4975 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4977
4978 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<128>, D>(
4983 self.module_name.as_ref().map(
4984 <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow,
4985 ),
4986 encoder,
4987 offset + cur_offset,
4988 depth,
4989 )?;
4990
4991 _prev_end_offset = cur_offset + envelope_size;
4992
4993 Ok(())
4994 }
4995 }
4996
4997 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NodeSymbol {
4998 #[inline(always)]
4999 fn new_empty() -> Self {
5000 Self::default()
5001 }
5002
5003 unsafe fn decode(
5004 &mut self,
5005 decoder: &mut fidl::encoding::Decoder<'_, D>,
5006 offset: usize,
5007 mut depth: fidl::encoding::Depth,
5008 ) -> fidl::Result<()> {
5009 decoder.debug_check_bounds::<Self>(offset);
5010 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5011 None => return Err(fidl::Error::NotNullable),
5012 Some(len) => len,
5013 };
5014 if len == 0 {
5016 return Ok(());
5017 };
5018 depth.increment()?;
5019 let envelope_size = 8;
5020 let bytes_len = len * envelope_size;
5021 let offset = decoder.out_of_line_offset(bytes_len)?;
5022 let mut _next_ordinal_to_read = 0;
5024 let mut next_offset = offset;
5025 let end_offset = offset + bytes_len;
5026 _next_ordinal_to_read += 1;
5027 if next_offset >= end_offset {
5028 return Ok(());
5029 }
5030
5031 while _next_ordinal_to_read < 1 {
5033 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5034 _next_ordinal_to_read += 1;
5035 next_offset += envelope_size;
5036 }
5037
5038 let next_out_of_line = decoder.next_out_of_line();
5039 let handles_before = decoder.remaining_handles();
5040 if let Some((inlined, num_bytes, num_handles)) =
5041 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5042 {
5043 let member_inline_size =
5044 <fidl::encoding::BoundedString<128> as fidl::encoding::TypeMarker>::inline_size(
5045 decoder.context,
5046 );
5047 if inlined != (member_inline_size <= 4) {
5048 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5049 }
5050 let inner_offset;
5051 let mut inner_depth = depth.clone();
5052 if inlined {
5053 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5054 inner_offset = next_offset;
5055 } else {
5056 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5057 inner_depth.increment()?;
5058 }
5059 let val_ref = self
5060 .name
5061 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<128>, D));
5062 fidl::decode!(
5063 fidl::encoding::BoundedString<128>,
5064 D,
5065 val_ref,
5066 decoder,
5067 inner_offset,
5068 inner_depth
5069 )?;
5070 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5071 {
5072 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5073 }
5074 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5075 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5076 }
5077 }
5078
5079 next_offset += envelope_size;
5080 _next_ordinal_to_read += 1;
5081 if next_offset >= end_offset {
5082 return Ok(());
5083 }
5084
5085 while _next_ordinal_to_read < 2 {
5087 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5088 _next_ordinal_to_read += 1;
5089 next_offset += envelope_size;
5090 }
5091
5092 let next_out_of_line = decoder.next_out_of_line();
5093 let handles_before = decoder.remaining_handles();
5094 if let Some((inlined, num_bytes, num_handles)) =
5095 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5096 {
5097 let member_inline_size =
5098 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5099 if inlined != (member_inline_size <= 4) {
5100 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5101 }
5102 let inner_offset;
5103 let mut inner_depth = depth.clone();
5104 if inlined {
5105 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5106 inner_offset = next_offset;
5107 } else {
5108 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5109 inner_depth.increment()?;
5110 }
5111 let val_ref = self.address.get_or_insert_with(|| fidl::new_empty!(u64, D));
5112 fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
5113 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5114 {
5115 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5116 }
5117 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5118 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5119 }
5120 }
5121
5122 next_offset += envelope_size;
5123 _next_ordinal_to_read += 1;
5124 if next_offset >= end_offset {
5125 return Ok(());
5126 }
5127
5128 while _next_ordinal_to_read < 3 {
5130 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5131 _next_ordinal_to_read += 1;
5132 next_offset += envelope_size;
5133 }
5134
5135 let next_out_of_line = decoder.next_out_of_line();
5136 let handles_before = decoder.remaining_handles();
5137 if let Some((inlined, num_bytes, num_handles)) =
5138 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5139 {
5140 let member_inline_size =
5141 <fidl::encoding::BoundedString<128> as fidl::encoding::TypeMarker>::inline_size(
5142 decoder.context,
5143 );
5144 if inlined != (member_inline_size <= 4) {
5145 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5146 }
5147 let inner_offset;
5148 let mut inner_depth = depth.clone();
5149 if inlined {
5150 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5151 inner_offset = next_offset;
5152 } else {
5153 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5154 inner_depth.increment()?;
5155 }
5156 let val_ref = self
5157 .module_name
5158 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<128>, D));
5159 fidl::decode!(
5160 fidl::encoding::BoundedString<128>,
5161 D,
5162 val_ref,
5163 decoder,
5164 inner_offset,
5165 inner_depth
5166 )?;
5167 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5168 {
5169 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5170 }
5171 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5172 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5173 }
5174 }
5175
5176 next_offset += envelope_size;
5177
5178 while next_offset < end_offset {
5180 _next_ordinal_to_read += 1;
5181 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5182 next_offset += envelope_size;
5183 }
5184
5185 Ok(())
5186 }
5187 }
5188
5189 impl fidl::encoding::ValueTypeMarker for DeviceAddress {
5190 type Borrowed<'a> = &'a Self;
5191 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5192 value
5193 }
5194 }
5195
5196 unsafe impl fidl::encoding::TypeMarker for DeviceAddress {
5197 type Owned = Self;
5198
5199 #[inline(always)]
5200 fn inline_align(_context: fidl::encoding::Context) -> usize {
5201 8
5202 }
5203
5204 #[inline(always)]
5205 fn inline_size(_context: fidl::encoding::Context) -> usize {
5206 16
5207 }
5208 }
5209
5210 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceAddress, D>
5211 for &DeviceAddress
5212 {
5213 #[inline]
5214 unsafe fn encode(
5215 self,
5216 encoder: &mut fidl::encoding::Encoder<'_, D>,
5217 offset: usize,
5218 _depth: fidl::encoding::Depth,
5219 ) -> fidl::Result<()> {
5220 encoder.debug_check_bounds::<DeviceAddress>(offset);
5221 encoder.write_num::<u64>(self.ordinal(), offset);
5222 match self {
5223 DeviceAddress::IntValue(ref val) => {
5224 fidl::encoding::encode_in_envelope::<u8, D>(
5225 <u8 as fidl::encoding::ValueTypeMarker>::borrow(val),
5226 encoder, offset + 8, _depth
5227 )
5228 }
5229 DeviceAddress::ArrayIntValue(ref val) => {
5230 fidl::encoding::encode_in_envelope::<fidl::encoding::Vector<u8, 10>, D>(
5231 <fidl::encoding::Vector<u8, 10> as fidl::encoding::ValueTypeMarker>::borrow(val),
5232 encoder, offset + 8, _depth
5233 )
5234 }
5235 DeviceAddress::CharIntValue(ref val) => {
5236 fidl::encoding::encode_in_envelope::<fidl::encoding::BoundedString<4>, D>(
5237 <fidl::encoding::BoundedString<4> as fidl::encoding::ValueTypeMarker>::borrow(val),
5238 encoder, offset + 8, _depth
5239 )
5240 }
5241 DeviceAddress::ArrayCharIntValue(ref val) => {
5242 fidl::encoding::encode_in_envelope::<fidl::encoding::Vector<fidl::encoding::BoundedString<4>, 10>, D>(
5243 <fidl::encoding::Vector<fidl::encoding::BoundedString<4>, 10> as fidl::encoding::ValueTypeMarker>::borrow(val),
5244 encoder, offset + 8, _depth
5245 )
5246 }
5247 DeviceAddress::StringValue(ref val) => {
5248 fidl::encoding::encode_in_envelope::<fidl::encoding::BoundedString<32>, D>(
5249 <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(val),
5250 encoder, offset + 8, _depth
5251 )
5252 }
5253 DeviceAddress::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
5254 }
5255 }
5256 }
5257
5258 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceAddress {
5259 #[inline(always)]
5260 fn new_empty() -> Self {
5261 Self::__SourceBreaking { unknown_ordinal: 0 }
5262 }
5263
5264 #[inline]
5265 unsafe fn decode(
5266 &mut self,
5267 decoder: &mut fidl::encoding::Decoder<'_, D>,
5268 offset: usize,
5269 mut depth: fidl::encoding::Depth,
5270 ) -> fidl::Result<()> {
5271 decoder.debug_check_bounds::<Self>(offset);
5272 #[allow(unused_variables)]
5273 let next_out_of_line = decoder.next_out_of_line();
5274 let handles_before = decoder.remaining_handles();
5275 let (ordinal, inlined, num_bytes, num_handles) =
5276 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
5277
5278 let member_inline_size = match ordinal {
5279 1 => <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5280 2 => <fidl::encoding::Vector<u8, 10> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5281 3 => <fidl::encoding::BoundedString<4> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5282 4 => <fidl::encoding::Vector<fidl::encoding::BoundedString<4>, 10> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5283 5 => <fidl::encoding::BoundedString<32> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5284 0 => return Err(fidl::Error::UnknownUnionTag),
5285 _ => num_bytes as usize,
5286 };
5287
5288 if inlined != (member_inline_size <= 4) {
5289 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5290 }
5291 let _inner_offset;
5292 if inlined {
5293 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
5294 _inner_offset = offset + 8;
5295 } else {
5296 depth.increment()?;
5297 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5298 }
5299 match ordinal {
5300 1 => {
5301 #[allow(irrefutable_let_patterns)]
5302 if let DeviceAddress::IntValue(_) = self {
5303 } else {
5305 *self = DeviceAddress::IntValue(fidl::new_empty!(u8, D));
5307 }
5308 #[allow(irrefutable_let_patterns)]
5309 if let DeviceAddress::IntValue(ref mut val) = self {
5310 fidl::decode!(u8, D, val, decoder, _inner_offset, depth)?;
5311 } else {
5312 unreachable!()
5313 }
5314 }
5315 2 => {
5316 #[allow(irrefutable_let_patterns)]
5317 if let DeviceAddress::ArrayIntValue(_) = self {
5318 } else {
5320 *self = DeviceAddress::ArrayIntValue(
5322 fidl::new_empty!(fidl::encoding::Vector<u8, 10>, D),
5323 );
5324 }
5325 #[allow(irrefutable_let_patterns)]
5326 if let DeviceAddress::ArrayIntValue(ref mut val) = self {
5327 fidl::decode!(fidl::encoding::Vector<u8, 10>, D, val, decoder, _inner_offset, depth)?;
5328 } else {
5329 unreachable!()
5330 }
5331 }
5332 3 => {
5333 #[allow(irrefutable_let_patterns)]
5334 if let DeviceAddress::CharIntValue(_) = self {
5335 } else {
5337 *self = DeviceAddress::CharIntValue(fidl::new_empty!(
5339 fidl::encoding::BoundedString<4>,
5340 D
5341 ));
5342 }
5343 #[allow(irrefutable_let_patterns)]
5344 if let DeviceAddress::CharIntValue(ref mut val) = self {
5345 fidl::decode!(
5346 fidl::encoding::BoundedString<4>,
5347 D,
5348 val,
5349 decoder,
5350 _inner_offset,
5351 depth
5352 )?;
5353 } else {
5354 unreachable!()
5355 }
5356 }
5357 4 => {
5358 #[allow(irrefutable_let_patterns)]
5359 if let DeviceAddress::ArrayCharIntValue(_) = self {
5360 } else {
5362 *self = DeviceAddress::ArrayCharIntValue(fidl::new_empty!(
5364 fidl::encoding::Vector<fidl::encoding::BoundedString<4>, 10>,
5365 D
5366 ));
5367 }
5368 #[allow(irrefutable_let_patterns)]
5369 if let DeviceAddress::ArrayCharIntValue(ref mut val) = self {
5370 fidl::decode!(
5371 fidl::encoding::Vector<fidl::encoding::BoundedString<4>, 10>,
5372 D,
5373 val,
5374 decoder,
5375 _inner_offset,
5376 depth
5377 )?;
5378 } else {
5379 unreachable!()
5380 }
5381 }
5382 5 => {
5383 #[allow(irrefutable_let_patterns)]
5384 if let DeviceAddress::StringValue(_) = self {
5385 } else {
5387 *self = DeviceAddress::StringValue(fidl::new_empty!(
5389 fidl::encoding::BoundedString<32>,
5390 D
5391 ));
5392 }
5393 #[allow(irrefutable_let_patterns)]
5394 if let DeviceAddress::StringValue(ref mut val) = self {
5395 fidl::decode!(
5396 fidl::encoding::BoundedString<32>,
5397 D,
5398 val,
5399 decoder,
5400 _inner_offset,
5401 depth
5402 )?;
5403 } else {
5404 unreachable!()
5405 }
5406 }
5407 #[allow(deprecated)]
5408 ordinal => {
5409 for _ in 0..num_handles {
5410 decoder.drop_next_handle()?;
5411 }
5412 *self = DeviceAddress::__SourceBreaking { unknown_ordinal: ordinal };
5413 }
5414 }
5415 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
5416 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5417 }
5418 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5419 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5420 }
5421 Ok(())
5422 }
5423 }
5424
5425 impl fidl::encoding::ValueTypeMarker for NodePropertyKey {
5426 type Borrowed<'a> = &'a Self;
5427 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5428 value
5429 }
5430 }
5431
5432 unsafe impl fidl::encoding::TypeMarker for NodePropertyKey {
5433 type Owned = Self;
5434
5435 #[inline(always)]
5436 fn inline_align(_context: fidl::encoding::Context) -> usize {
5437 8
5438 }
5439
5440 #[inline(always)]
5441 fn inline_size(_context: fidl::encoding::Context) -> usize {
5442 16
5443 }
5444 }
5445
5446 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NodePropertyKey, D>
5447 for &NodePropertyKey
5448 {
5449 #[inline]
5450 unsafe fn encode(
5451 self,
5452 encoder: &mut fidl::encoding::Encoder<'_, D>,
5453 offset: usize,
5454 _depth: fidl::encoding::Depth,
5455 ) -> fidl::Result<()> {
5456 encoder.debug_check_bounds::<NodePropertyKey>(offset);
5457 encoder.write_num::<u64>(self.ordinal(), offset);
5458 match self {
5459 NodePropertyKey::IntValue(ref val) => fidl::encoding::encode_in_envelope::<u32, D>(
5460 <u32 as fidl::encoding::ValueTypeMarker>::borrow(val),
5461 encoder,
5462 offset + 8,
5463 _depth,
5464 ),
5465 NodePropertyKey::StringValue(ref val) => fidl::encoding::encode_in_envelope::<
5466 fidl::encoding::BoundedString<256>,
5467 D,
5468 >(
5469 <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
5470 val,
5471 ),
5472 encoder,
5473 offset + 8,
5474 _depth,
5475 ),
5476 }
5477 }
5478 }
5479
5480 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NodePropertyKey {
5481 #[inline(always)]
5482 fn new_empty() -> Self {
5483 Self::IntValue(fidl::new_empty!(u32, D))
5484 }
5485
5486 #[inline]
5487 unsafe fn decode(
5488 &mut self,
5489 decoder: &mut fidl::encoding::Decoder<'_, D>,
5490 offset: usize,
5491 mut depth: fidl::encoding::Depth,
5492 ) -> fidl::Result<()> {
5493 decoder.debug_check_bounds::<Self>(offset);
5494 #[allow(unused_variables)]
5495 let next_out_of_line = decoder.next_out_of_line();
5496 let handles_before = decoder.remaining_handles();
5497 let (ordinal, inlined, num_bytes, num_handles) =
5498 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
5499
5500 let member_inline_size = match ordinal {
5501 1 => <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5502 2 => {
5503 <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
5504 decoder.context,
5505 )
5506 }
5507 _ => return Err(fidl::Error::UnknownUnionTag),
5508 };
5509
5510 if inlined != (member_inline_size <= 4) {
5511 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5512 }
5513 let _inner_offset;
5514 if inlined {
5515 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
5516 _inner_offset = offset + 8;
5517 } else {
5518 depth.increment()?;
5519 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5520 }
5521 match ordinal {
5522 1 => {
5523 #[allow(irrefutable_let_patterns)]
5524 if let NodePropertyKey::IntValue(_) = self {
5525 } else {
5527 *self = NodePropertyKey::IntValue(fidl::new_empty!(u32, D));
5529 }
5530 #[allow(irrefutable_let_patterns)]
5531 if let NodePropertyKey::IntValue(ref mut val) = self {
5532 fidl::decode!(u32, D, val, decoder, _inner_offset, depth)?;
5533 } else {
5534 unreachable!()
5535 }
5536 }
5537 2 => {
5538 #[allow(irrefutable_let_patterns)]
5539 if let NodePropertyKey::StringValue(_) = self {
5540 } else {
5542 *self = NodePropertyKey::StringValue(fidl::new_empty!(
5544 fidl::encoding::BoundedString<256>,
5545 D
5546 ));
5547 }
5548 #[allow(irrefutable_let_patterns)]
5549 if let NodePropertyKey::StringValue(ref mut val) = self {
5550 fidl::decode!(
5551 fidl::encoding::BoundedString<256>,
5552 D,
5553 val,
5554 decoder,
5555 _inner_offset,
5556 depth
5557 )?;
5558 } else {
5559 unreachable!()
5560 }
5561 }
5562 ordinal => panic!("unexpected ordinal {:?}", ordinal),
5563 }
5564 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
5565 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5566 }
5567 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5568 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5569 }
5570 Ok(())
5571 }
5572 }
5573
5574 impl fidl::encoding::ValueTypeMarker for NodePropertyValue {
5575 type Borrowed<'a> = &'a Self;
5576 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5577 value
5578 }
5579 }
5580
5581 unsafe impl fidl::encoding::TypeMarker for NodePropertyValue {
5582 type Owned = Self;
5583
5584 #[inline(always)]
5585 fn inline_align(_context: fidl::encoding::Context) -> usize {
5586 8
5587 }
5588
5589 #[inline(always)]
5590 fn inline_size(_context: fidl::encoding::Context) -> usize {
5591 16
5592 }
5593 }
5594
5595 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NodePropertyValue, D>
5596 for &NodePropertyValue
5597 {
5598 #[inline]
5599 unsafe fn encode(
5600 self,
5601 encoder: &mut fidl::encoding::Encoder<'_, D>,
5602 offset: usize,
5603 _depth: fidl::encoding::Depth,
5604 ) -> fidl::Result<()> {
5605 encoder.debug_check_bounds::<NodePropertyValue>(offset);
5606 encoder.write_num::<u64>(self.ordinal(), offset);
5607 match self {
5608 NodePropertyValue::IntValue(ref val) => {
5609 fidl::encoding::encode_in_envelope::<u32, D>(
5610 <u32 as fidl::encoding::ValueTypeMarker>::borrow(val),
5611 encoder,
5612 offset + 8,
5613 _depth,
5614 )
5615 }
5616 NodePropertyValue::StringValue(ref val) => fidl::encoding::encode_in_envelope::<
5617 fidl::encoding::BoundedString<256>,
5618 D,
5619 >(
5620 <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
5621 val,
5622 ),
5623 encoder,
5624 offset + 8,
5625 _depth,
5626 ),
5627 NodePropertyValue::BoolValue(ref val) => {
5628 fidl::encoding::encode_in_envelope::<bool, D>(
5629 <bool as fidl::encoding::ValueTypeMarker>::borrow(val),
5630 encoder,
5631 offset + 8,
5632 _depth,
5633 )
5634 }
5635 NodePropertyValue::EnumValue(ref val) => fidl::encoding::encode_in_envelope::<
5636 fidl::encoding::BoundedString<256>,
5637 D,
5638 >(
5639 <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
5640 val,
5641 ),
5642 encoder,
5643 offset + 8,
5644 _depth,
5645 ),
5646 NodePropertyValue::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
5647 }
5648 }
5649 }
5650
5651 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NodePropertyValue {
5652 #[inline(always)]
5653 fn new_empty() -> Self {
5654 Self::__SourceBreaking { unknown_ordinal: 0 }
5655 }
5656
5657 #[inline]
5658 unsafe fn decode(
5659 &mut self,
5660 decoder: &mut fidl::encoding::Decoder<'_, D>,
5661 offset: usize,
5662 mut depth: fidl::encoding::Depth,
5663 ) -> fidl::Result<()> {
5664 decoder.debug_check_bounds::<Self>(offset);
5665 #[allow(unused_variables)]
5666 let next_out_of_line = decoder.next_out_of_line();
5667 let handles_before = decoder.remaining_handles();
5668 let (ordinal, inlined, num_bytes, num_handles) =
5669 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
5670
5671 let member_inline_size = match ordinal {
5672 1 => <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5673 2 => {
5674 <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
5675 decoder.context,
5676 )
5677 }
5678 3 => <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5679 4 => {
5680 <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
5681 decoder.context,
5682 )
5683 }
5684 0 => return Err(fidl::Error::UnknownUnionTag),
5685 _ => num_bytes as usize,
5686 };
5687
5688 if inlined != (member_inline_size <= 4) {
5689 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5690 }
5691 let _inner_offset;
5692 if inlined {
5693 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
5694 _inner_offset = offset + 8;
5695 } else {
5696 depth.increment()?;
5697 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5698 }
5699 match ordinal {
5700 1 => {
5701 #[allow(irrefutable_let_patterns)]
5702 if let NodePropertyValue::IntValue(_) = self {
5703 } else {
5705 *self = NodePropertyValue::IntValue(fidl::new_empty!(u32, D));
5707 }
5708 #[allow(irrefutable_let_patterns)]
5709 if let NodePropertyValue::IntValue(ref mut val) = self {
5710 fidl::decode!(u32, D, val, decoder, _inner_offset, depth)?;
5711 } else {
5712 unreachable!()
5713 }
5714 }
5715 2 => {
5716 #[allow(irrefutable_let_patterns)]
5717 if let NodePropertyValue::StringValue(_) = self {
5718 } else {
5720 *self = NodePropertyValue::StringValue(fidl::new_empty!(
5722 fidl::encoding::BoundedString<256>,
5723 D
5724 ));
5725 }
5726 #[allow(irrefutable_let_patterns)]
5727 if let NodePropertyValue::StringValue(ref mut val) = self {
5728 fidl::decode!(
5729 fidl::encoding::BoundedString<256>,
5730 D,
5731 val,
5732 decoder,
5733 _inner_offset,
5734 depth
5735 )?;
5736 } else {
5737 unreachable!()
5738 }
5739 }
5740 3 => {
5741 #[allow(irrefutable_let_patterns)]
5742 if let NodePropertyValue::BoolValue(_) = self {
5743 } else {
5745 *self = NodePropertyValue::BoolValue(fidl::new_empty!(bool, D));
5747 }
5748 #[allow(irrefutable_let_patterns)]
5749 if let NodePropertyValue::BoolValue(ref mut val) = self {
5750 fidl::decode!(bool, D, val, decoder, _inner_offset, depth)?;
5751 } else {
5752 unreachable!()
5753 }
5754 }
5755 4 => {
5756 #[allow(irrefutable_let_patterns)]
5757 if let NodePropertyValue::EnumValue(_) = self {
5758 } else {
5760 *self = NodePropertyValue::EnumValue(fidl::new_empty!(
5762 fidl::encoding::BoundedString<256>,
5763 D
5764 ));
5765 }
5766 #[allow(irrefutable_let_patterns)]
5767 if let NodePropertyValue::EnumValue(ref mut val) = self {
5768 fidl::decode!(
5769 fidl::encoding::BoundedString<256>,
5770 D,
5771 val,
5772 decoder,
5773 _inner_offset,
5774 depth
5775 )?;
5776 } else {
5777 unreachable!()
5778 }
5779 }
5780 #[allow(deprecated)]
5781 ordinal => {
5782 for _ in 0..num_handles {
5783 decoder.drop_next_handle()?;
5784 }
5785 *self = NodePropertyValue::__SourceBreaking { unknown_ordinal: ordinal };
5786 }
5787 }
5788 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
5789 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5790 }
5791 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5792 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5793 }
5794 Ok(())
5795 }
5796 }
5797
5798 impl fidl::encoding::ValueTypeMarker for Offer {
5799 type Borrowed<'a> = &'a Self;
5800 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5801 value
5802 }
5803 }
5804
5805 unsafe impl fidl::encoding::TypeMarker for Offer {
5806 type Owned = Self;
5807
5808 #[inline(always)]
5809 fn inline_align(_context: fidl::encoding::Context) -> usize {
5810 8
5811 }
5812
5813 #[inline(always)]
5814 fn inline_size(_context: fidl::encoding::Context) -> usize {
5815 16
5816 }
5817 }
5818
5819 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Offer, D> for &Offer {
5820 #[inline]
5821 unsafe fn encode(
5822 self,
5823 encoder: &mut fidl::encoding::Encoder<'_, D>,
5824 offset: usize,
5825 _depth: fidl::encoding::Depth,
5826 ) -> fidl::Result<()> {
5827 encoder.debug_check_bounds::<Offer>(offset);
5828 encoder.write_num::<u64>(self.ordinal(), offset);
5829 match self {
5830 Offer::ZirconTransport(ref val) => fidl::encoding::encode_in_envelope::<
5831 fidl_fuchsia_component_decl::Offer,
5832 D,
5833 >(
5834 <fidl_fuchsia_component_decl::Offer as fidl::encoding::ValueTypeMarker>::borrow(
5835 val,
5836 ),
5837 encoder,
5838 offset + 8,
5839 _depth,
5840 ),
5841 Offer::DriverTransport(ref val) => fidl::encoding::encode_in_envelope::<
5842 fidl_fuchsia_component_decl::Offer,
5843 D,
5844 >(
5845 <fidl_fuchsia_component_decl::Offer as fidl::encoding::ValueTypeMarker>::borrow(
5846 val,
5847 ),
5848 encoder,
5849 offset + 8,
5850 _depth,
5851 ),
5852 Offer::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
5853 }
5854 }
5855 }
5856
5857 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Offer {
5858 #[inline(always)]
5859 fn new_empty() -> Self {
5860 Self::__SourceBreaking { unknown_ordinal: 0 }
5861 }
5862
5863 #[inline]
5864 unsafe fn decode(
5865 &mut self,
5866 decoder: &mut fidl::encoding::Decoder<'_, D>,
5867 offset: usize,
5868 mut depth: fidl::encoding::Depth,
5869 ) -> fidl::Result<()> {
5870 decoder.debug_check_bounds::<Self>(offset);
5871 #[allow(unused_variables)]
5872 let next_out_of_line = decoder.next_out_of_line();
5873 let handles_before = decoder.remaining_handles();
5874 let (ordinal, inlined, num_bytes, num_handles) =
5875 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
5876
5877 let member_inline_size = match ordinal {
5878 1 => {
5879 <fidl_fuchsia_component_decl::Offer as fidl::encoding::TypeMarker>::inline_size(
5880 decoder.context,
5881 )
5882 }
5883 2 => {
5884 <fidl_fuchsia_component_decl::Offer as fidl::encoding::TypeMarker>::inline_size(
5885 decoder.context,
5886 )
5887 }
5888 0 => return Err(fidl::Error::UnknownUnionTag),
5889 _ => num_bytes as usize,
5890 };
5891
5892 if inlined != (member_inline_size <= 4) {
5893 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5894 }
5895 let _inner_offset;
5896 if inlined {
5897 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
5898 _inner_offset = offset + 8;
5899 } else {
5900 depth.increment()?;
5901 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5902 }
5903 match ordinal {
5904 1 => {
5905 #[allow(irrefutable_let_patterns)]
5906 if let Offer::ZirconTransport(_) = self {
5907 } else {
5909 *self = Offer::ZirconTransport(fidl::new_empty!(
5911 fidl_fuchsia_component_decl::Offer,
5912 D
5913 ));
5914 }
5915 #[allow(irrefutable_let_patterns)]
5916 if let Offer::ZirconTransport(ref mut val) = self {
5917 fidl::decode!(
5918 fidl_fuchsia_component_decl::Offer,
5919 D,
5920 val,
5921 decoder,
5922 _inner_offset,
5923 depth
5924 )?;
5925 } else {
5926 unreachable!()
5927 }
5928 }
5929 2 => {
5930 #[allow(irrefutable_let_patterns)]
5931 if let Offer::DriverTransport(_) = self {
5932 } else {
5934 *self = Offer::DriverTransport(fidl::new_empty!(
5936 fidl_fuchsia_component_decl::Offer,
5937 D
5938 ));
5939 }
5940 #[allow(irrefutable_let_patterns)]
5941 if let Offer::DriverTransport(ref mut val) = self {
5942 fidl::decode!(
5943 fidl_fuchsia_component_decl::Offer,
5944 D,
5945 val,
5946 decoder,
5947 _inner_offset,
5948 depth
5949 )?;
5950 } else {
5951 unreachable!()
5952 }
5953 }
5954 #[allow(deprecated)]
5955 ordinal => {
5956 for _ in 0..num_handles {
5957 decoder.drop_next_handle()?;
5958 }
5959 *self = Offer::__SourceBreaking { unknown_ordinal: ordinal };
5960 }
5961 }
5962 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
5963 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5964 }
5965 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5966 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5967 }
5968 Ok(())
5969 }
5970 }
5971}