1#![warn(clippy::all)]
3#![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)]
4
5pub mod natural {
6
7    #[doc = " A key/value pair in a `Dictionary`.\n"]
8    #[derive(PartialEq, Clone, Debug)]
9    pub struct DictionaryEntry {
10        pub key: ::std::string::String,
11
12        pub value: ::core::option::Option<::std::boxed::Box<crate::natural::DictionaryValue>>,
13    }
14
15    unsafe impl<___E> ::fidl_next::Encode<crate::wire::DictionaryEntry<'static>, ___E>
16        for DictionaryEntry
17    where
18        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
19        ___E: ::fidl_next::Encoder,
20    {
21        #[inline]
22        fn encode(
23            self,
24            encoder_: &mut ___E,
25            out_: &mut ::core::mem::MaybeUninit<crate::wire::DictionaryEntry<'static>>,
26            _: (),
27        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
28            ::fidl_next::munge! {
29                let crate::wire::DictionaryEntry {
30                    key,
31                    value,
32
33                } = out_;
34            }
35
36            ::fidl_next::Encode::encode(self.key, encoder_, key, 1024)?;
37
38            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(key.as_mut_ptr()) };
39            ::fidl_next::Constrained::validate(_field, 1024)?;
40
41            ::fidl_next::Encode::encode(self.value, encoder_, value, ())?;
42
43            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(value.as_mut_ptr()) };
44
45            Ok(())
46        }
47    }
48
49    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DictionaryEntry<'static>, ___E>
50        for &'a DictionaryEntry
51    where
52        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
53        ___E: ::fidl_next::Encoder,
54    {
55        #[inline]
56        fn encode(
57            self,
58            encoder_: &mut ___E,
59            out_: &mut ::core::mem::MaybeUninit<crate::wire::DictionaryEntry<'static>>,
60            _: (),
61        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
62            ::fidl_next::munge! {
63                let crate::wire::DictionaryEntry {
64
65                    key,
66                    value,
67
68                } = out_;
69            }
70
71            ::fidl_next::Encode::encode(&self.key, encoder_, key, 1024)?;
72
73            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(key.as_mut_ptr()) };
74            ::fidl_next::Constrained::validate(_field, 1024)?;
75
76            ::fidl_next::Encode::encode(&self.value, encoder_, value, ())?;
77
78            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(value.as_mut_ptr()) };
79
80            Ok(())
81        }
82    }
83
84    unsafe impl<___E>
85        ::fidl_next::EncodeOption<
86            ::fidl_next::WireBox<'static, crate::wire::DictionaryEntry<'static>>,
87            ___E,
88        > for DictionaryEntry
89    where
90        ___E: ::fidl_next::Encoder + ?Sized,
91        DictionaryEntry: ::fidl_next::Encode<crate::wire::DictionaryEntry<'static>, ___E>,
92    {
93        #[inline]
94        fn encode_option(
95            this: ::core::option::Option<Self>,
96            encoder: &mut ___E,
97            out: &mut ::core::mem::MaybeUninit<
98                ::fidl_next::WireBox<'static, crate::wire::DictionaryEntry<'static>>,
99            >,
100            _: (),
101        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
102            if let Some(inner) = this {
103                ::fidl_next::EncoderExt::encode_next(encoder, inner, ())?;
104                ::fidl_next::WireBox::encode_present(out);
105            } else {
106                ::fidl_next::WireBox::encode_absent(out);
107            }
108
109            Ok(())
110        }
111    }
112
113    unsafe impl<'a, ___E>
114        ::fidl_next::EncodeOption<
115            ::fidl_next::WireBox<'static, crate::wire::DictionaryEntry<'static>>,
116            ___E,
117        > for &'a DictionaryEntry
118    where
119        ___E: ::fidl_next::Encoder + ?Sized,
120        &'a DictionaryEntry: ::fidl_next::Encode<crate::wire::DictionaryEntry<'static>, ___E>,
121    {
122        #[inline]
123        fn encode_option(
124            this: ::core::option::Option<Self>,
125            encoder: &mut ___E,
126            out: &mut ::core::mem::MaybeUninit<
127                ::fidl_next::WireBox<'static, crate::wire::DictionaryEntry<'static>>,
128            >,
129            _: (),
130        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
131            if let Some(inner) = this {
132                ::fidl_next::EncoderExt::encode_next(encoder, inner, ())?;
133                ::fidl_next::WireBox::encode_present(out);
134            } else {
135                ::fidl_next::WireBox::encode_absent(out);
136            }
137
138            Ok(())
139        }
140    }
141
142    impl<'de> ::fidl_next::FromWire<crate::wire::DictionaryEntry<'de>> for DictionaryEntry {
143        #[inline]
144        fn from_wire(wire: crate::wire::DictionaryEntry<'de>) -> Self {
145            Self {
146                key: ::fidl_next::FromWire::from_wire(wire.key),
147
148                value: ::fidl_next::FromWire::from_wire(wire.value),
149            }
150        }
151    }
152
153    impl<'de> ::fidl_next::FromWireRef<crate::wire::DictionaryEntry<'de>> for DictionaryEntry {
154        #[inline]
155        fn from_wire_ref(wire: &crate::wire::DictionaryEntry<'de>) -> Self {
156            Self {
157                key: ::fidl_next::FromWireRef::from_wire_ref(&wire.key),
158
159                value: ::fidl_next::FromWireRef::from_wire_ref(&wire.value),
160            }
161        }
162    }
163
164    #[doc = " A dictionary is a sequence of key/value pairs.\n Keys must be unique and sorted in lexicographically increasing order.\n"]
165    #[derive(PartialEq, Clone, Debug, Default)]
166    pub struct Dictionary {
167        pub entries: ::core::option::Option<::std::vec::Vec<crate::natural::DictionaryEntry>>,
168    }
169
170    impl Dictionary {
171        fn __max_ordinal(&self) -> usize {
172            if self.entries.is_some() {
173                return 1;
174            }
175
176            0
177        }
178    }
179
180    unsafe impl<___E> ::fidl_next::Encode<crate::wire::Dictionary<'static>, ___E> for Dictionary
181    where
182        ___E: ::fidl_next::Encoder + ?Sized,
183    {
184        #[inline]
185        fn encode(
186            mut self,
187            encoder: &mut ___E,
188            out: &mut ::core::mem::MaybeUninit<crate::wire::Dictionary<'static>>,
189            _: (),
190        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
191            ::fidl_next::munge!(let crate::wire::Dictionary { table } = out);
192
193            let max_ord = self.__max_ordinal();
194
195            let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
196            ::fidl_next::Wire::zero_padding(&mut out);
197
198            let mut preallocated =
199                ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
200
201            for i in 1..=max_ord {
202                match i {
203                    1 => {
204                        if let Some(value) = self.entries.take() {
205                            ::fidl_next::WireEnvelope::encode_value::<
206                                ::fidl_next::WireVector<
207                                    'static,
208                                    crate::wire::DictionaryEntry<'static>,
209                                >,
210                                ___E,
211                            >(
212                                value, preallocated.encoder, &mut out, (1024, ())
213                            )?;
214                        } else {
215                            ::fidl_next::WireEnvelope::encode_zero(&mut out)
216                        }
217                    }
218
219                    _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
220                }
221                unsafe {
222                    preallocated.write_next(out.assume_init_ref());
223                }
224            }
225
226            ::fidl_next::WireTable::encode_len(table, max_ord);
227
228            Ok(())
229        }
230    }
231
232    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::Dictionary<'static>, ___E> for &'a Dictionary
233    where
234        ___E: ::fidl_next::Encoder + ?Sized,
235    {
236        #[inline]
237        fn encode(
238            self,
239            encoder: &mut ___E,
240            out: &mut ::core::mem::MaybeUninit<crate::wire::Dictionary<'static>>,
241            _: (),
242        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
243            ::fidl_next::munge!(let crate::wire::Dictionary { table } = out);
244
245            let max_ord = self.__max_ordinal();
246
247            let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
248            ::fidl_next::Wire::zero_padding(&mut out);
249
250            let mut preallocated =
251                ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
252
253            for i in 1..=max_ord {
254                match i {
255                    1 => {
256                        if let Some(value) = &self.entries {
257                            ::fidl_next::WireEnvelope::encode_value::<
258                                ::fidl_next::WireVector<
259                                    'static,
260                                    crate::wire::DictionaryEntry<'static>,
261                                >,
262                                ___E,
263                            >(
264                                value, preallocated.encoder, &mut out, (1024, ())
265                            )?;
266                        } else {
267                            ::fidl_next::WireEnvelope::encode_zero(&mut out)
268                        }
269                    }
270
271                    _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
272                }
273                unsafe {
274                    preallocated.write_next(out.assume_init_ref());
275                }
276            }
277
278            ::fidl_next::WireTable::encode_len(table, max_ord);
279
280            Ok(())
281        }
282    }
283
284    impl<'de> ::fidl_next::FromWire<crate::wire::Dictionary<'de>> for Dictionary {
285        #[inline]
286        fn from_wire(wire_: crate::wire::Dictionary<'de>) -> Self {
287            let wire_ = ::core::mem::ManuallyDrop::new(wire_);
288
289            let entries = wire_.table.get(1);
290
291            Self {
292
293
294                entries: entries.map(|envelope| ::fidl_next::FromWire::from_wire(
295                    unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::wire::DictionaryEntry<'de>>>() }
296                )),
297
298        }
299        }
300    }
301
302    impl<'de> ::fidl_next::FromWireRef<crate::wire::Dictionary<'de>> for Dictionary {
303        #[inline]
304        fn from_wire_ref(wire: &crate::wire::Dictionary<'de>) -> Self {
305            Self {
306
307
308                entries: wire.table.get(1)
309                    .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
310                        unsafe { envelope.deref_unchecked::<::fidl_next::WireVector<'de, crate::wire::DictionaryEntry<'de>>>() }
311                    )),
312
313        }
314        }
315    }
316
317    #[doc = " A dictionary\'s value is a string, a list of strings, or a list of objects.\n"]
318    #[derive(PartialEq, Clone, Debug)]
319    pub enum DictionaryValue {
320        Str(::std::string::String),
321
322        StrVec(::std::vec::Vec<::std::string::String>),
323
324        ObjVec(::std::vec::Vec<crate::natural::Dictionary>),
325
326        UnknownOrdinal_(u64),
327    }
328
329    impl DictionaryValue {
330        pub fn is_unknown(&self) -> bool {
331            #[allow(unreachable_patterns)]
332            match self {
333                Self::UnknownOrdinal_(_) => true,
334                _ => false,
335            }
336        }
337    }
338
339    unsafe impl<___E> ::fidl_next::Encode<crate::wire::DictionaryValue<'static>, ___E>
340        for DictionaryValue
341    where
342        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
343        ___E: ::fidl_next::Encoder,
344    {
345        #[inline]
346        fn encode(
347            self,
348            encoder: &mut ___E,
349            out: &mut ::core::mem::MaybeUninit<crate::wire::DictionaryValue<'static>>,
350            _: (),
351        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
352            ::fidl_next::munge!(let crate::wire::DictionaryValue { raw, _phantom: _ } = out);
353
354            match self {
355                Self::Str(value) => ::fidl_next::RawWireUnion::encode_as::<
356                    ___E,
357                    ::fidl_next::WireString<'static>,
358                >(value, 1, encoder, raw, 32768)?,
359
360                Self::StrVec(value) => ::fidl_next::RawWireUnion::encode_as::<
361                    ___E,
362                    ::fidl_next::WireVector<'static, ::fidl_next::WireString<'static>>,
363                >(value, 2, encoder, raw, (1024, 32768))?,
364
365                Self::ObjVec(value) => ::fidl_next::RawWireUnion::encode_as::<
366                    ___E,
367                    ::fidl_next::WireVector<'static, crate::wire::Dictionary<'static>>,
368                >(value, 3, encoder, raw, (1024, ()))?,
369
370                Self::UnknownOrdinal_(ordinal) => {
371                    return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize));
372                }
373            }
374
375            Ok(())
376        }
377    }
378
379    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DictionaryValue<'static>, ___E>
380        for &'a DictionaryValue
381    where
382        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
383        ___E: ::fidl_next::Encoder,
384    {
385        #[inline]
386        fn encode(
387            self,
388            encoder: &mut ___E,
389            out: &mut ::core::mem::MaybeUninit<crate::wire::DictionaryValue<'static>>,
390            _: (),
391        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
392            ::fidl_next::munge!(let crate::wire::DictionaryValue { raw, _phantom: _ } = out);
393
394            match self {
395                DictionaryValue::Str(value) => ::fidl_next::RawWireUnion::encode_as::<
396                    ___E,
397                    ::fidl_next::WireString<'static>,
398                >(value, 1, encoder, raw, 32768)?,
399
400                DictionaryValue::StrVec(value) => {
401                    ::fidl_next::RawWireUnion::encode_as::<
402                        ___E,
403                        ::fidl_next::WireVector<'static, ::fidl_next::WireString<'static>>,
404                    >(value, 2, encoder, raw, (1024, 32768))?
405                }
406
407                DictionaryValue::ObjVec(value) => {
408                    ::fidl_next::RawWireUnion::encode_as::<
409                        ___E,
410                        ::fidl_next::WireVector<'static, crate::wire::Dictionary<'static>>,
411                    >(value, 3, encoder, raw, (1024, ()))?
412                }
413
414                DictionaryValue::UnknownOrdinal_(ordinal) => {
415                    return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize));
416                }
417            }
418
419            Ok(())
420        }
421    }
422
423    unsafe impl<___E>
424        ::fidl_next::EncodeOption<crate::wire_optional::DictionaryValue<'static>, ___E>
425        for DictionaryValue
426    where
427        ___E: ?Sized,
428        DictionaryValue: ::fidl_next::Encode<crate::wire::DictionaryValue<'static>, ___E>,
429    {
430        #[inline]
431        fn encode_option(
432            this: ::core::option::Option<Self>,
433            encoder: &mut ___E,
434            out: &mut ::core::mem::MaybeUninit<crate::wire_optional::DictionaryValue<'static>>,
435            _: (),
436        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
437            ::fidl_next::munge!(let crate::wire_optional::DictionaryValue { raw, _phantom: _ } = &mut *out);
438
439            if let Some(inner) = this {
440                let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
441                ::fidl_next::Encode::encode(inner, encoder, value_out, ())?;
442            } else {
443                ::fidl_next::RawWireUnion::encode_absent(raw);
444            }
445
446            Ok(())
447        }
448    }
449
450    unsafe impl<'a, ___E>
451        ::fidl_next::EncodeOption<crate::wire_optional::DictionaryValue<'static>, ___E>
452        for &'a DictionaryValue
453    where
454        ___E: ?Sized,
455        &'a DictionaryValue: ::fidl_next::Encode<crate::wire::DictionaryValue<'static>, ___E>,
456    {
457        #[inline]
458        fn encode_option(
459            this: ::core::option::Option<Self>,
460            encoder: &mut ___E,
461            out: &mut ::core::mem::MaybeUninit<crate::wire_optional::DictionaryValue<'static>>,
462            _: (),
463        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
464            ::fidl_next::munge!(let crate::wire_optional::DictionaryValue { raw, _phantom: _ } = &mut *out);
465
466            if let Some(inner) = this {
467                let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
468                ::fidl_next::Encode::encode(inner, encoder, value_out, ())?;
469            } else {
470                ::fidl_next::RawWireUnion::encode_absent(raw);
471            }
472
473            Ok(())
474        }
475    }
476
477    impl<'de> ::fidl_next::FromWire<crate::wire::DictionaryValue<'de>> for DictionaryValue {
478        #[inline]
479        fn from_wire(wire: crate::wire::DictionaryValue<'de>) -> Self {
480            let wire = ::core::mem::ManuallyDrop::new(wire);
481            match wire.raw.ordinal() {
482                1 => Self::Str(::fidl_next::FromWire::from_wire(unsafe {
483                    wire.raw.get().read_unchecked::<::fidl_next::WireString<'de>>()
484                })),
485
486                2 => Self::StrVec(::fidl_next::FromWire::from_wire(unsafe {
487                    wire.raw.get().read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>>()
488                })),
489
490                3 => Self::ObjVec(::fidl_next::FromWire::from_wire(unsafe {
491                    wire.raw.get().read_unchecked::<::fidl_next::WireVector<'de, crate::wire::Dictionary<'de>>>()
492                })),
493
494                ord => return Self::UnknownOrdinal_(ord as u64),
495            }
496        }
497    }
498
499    impl<'de> ::fidl_next::FromWireRef<crate::wire::DictionaryValue<'de>> for DictionaryValue {
500        #[inline]
501        fn from_wire_ref(wire: &crate::wire::DictionaryValue<'de>) -> Self {
502            match wire.raw.ordinal() {
503                1 => Self::Str(::fidl_next::FromWireRef::from_wire_ref(unsafe {
504                    wire.raw.get().deref_unchecked::<::fidl_next::WireString<'de>>()
505                })),
506
507                2 => Self::StrVec(::fidl_next::FromWireRef::from_wire_ref(unsafe {
508                    wire.raw.get().deref_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>>()
509                })),
510
511                3 => Self::ObjVec(::fidl_next::FromWireRef::from_wire_ref(unsafe {
512                    wire.raw.get().deref_unchecked::<::fidl_next::WireVector<'de, crate::wire::Dictionary<'de>>>()
513                })),
514
515                ord => return Self::UnknownOrdinal_(ord as u64),
516            }
517        }
518    }
519
520    impl<'de> ::fidl_next::FromWireOption<crate::wire_optional::DictionaryValue<'de>>
521        for DictionaryValue
522    {
523        #[inline]
524        fn from_wire_option(
525            wire: crate::wire_optional::DictionaryValue<'de>,
526        ) -> ::core::option::Option<Self> {
527            if let Some(inner) = wire.into_option() {
528                Some(::fidl_next::FromWire::from_wire(inner))
529            } else {
530                None
531            }
532        }
533    }
534
535    impl<'de> ::fidl_next::FromWireOption<crate::wire_optional::DictionaryValue<'de>>
536        for Box<DictionaryValue>
537    {
538        #[inline]
539        fn from_wire_option(
540            wire: crate::wire_optional::DictionaryValue<'de>,
541        ) -> ::core::option::Option<Self> {
542            <DictionaryValue as ::fidl_next::FromWireOption<
543                crate::wire_optional::DictionaryValue<'de>,
544            >>::from_wire_option(wire)
545            .map(Box::new)
546        }
547    }
548
549    impl<'de> ::fidl_next::FromWireOptionRef<crate::wire_optional::DictionaryValue<'de>>
550        for Box<DictionaryValue>
551    {
552        #[inline]
553        fn from_wire_option_ref(
554            wire: &crate::wire_optional::DictionaryValue<'de>,
555        ) -> ::core::option::Option<Self> {
556            if let Some(inner) = wire.as_ref() {
557                Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner)))
558            } else {
559                None
560            }
561        }
562    }
563}
564
565pub mod wire {
566
567    #[derive(Debug)]
569    #[repr(C)]
570    pub struct DictionaryEntry<'de> {
571        pub key: ::fidl_next::WireString<'de>,
572
573        pub value: crate::wire_optional::DictionaryValue<'de>,
574    }
575
576    static_assertions::const_assert_eq!(std::mem::size_of::<DictionaryEntry<'_>>(), 32);
577    static_assertions::const_assert_eq!(std::mem::align_of::<DictionaryEntry<'_>>(), 8);
578
579    static_assertions::const_assert_eq!(std::mem::offset_of!(DictionaryEntry<'_>, key), 0);
580
581    static_assertions::const_assert_eq!(std::mem::offset_of!(DictionaryEntry<'_>, value), 16);
582
583    unsafe impl ::fidl_next::Wire for DictionaryEntry<'static> {
584        type Owned<'de> = DictionaryEntry<'de>;
585
586        #[inline]
587        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
588            ::fidl_next::munge! {
589                let Self {
590
591                    key,
592                    value,
593
594                } = &mut *out_;
595            }
596
597            ::fidl_next::Wire::zero_padding(key);
598
599            ::fidl_next::Wire::zero_padding(value);
600        }
601    }
602
603    unsafe impl<___D> ::fidl_next::Decode<___D> for DictionaryEntry<'static>
604    where
605        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
606        ___D: ::fidl_next::Decoder,
607    {
608        fn decode(
609            slot_: ::fidl_next::Slot<'_, Self>,
610            decoder_: &mut ___D,
611            _: (),
612        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
613            ::fidl_next::munge! {
614                let Self {
615
616                    mut key,
617                    mut value,
618
619                } = slot_;
620            }
621
622            let _field = key.as_mut();
623            ::fidl_next::Constrained::validate(_field, 1024)?;
624            ::fidl_next::Decode::decode(key.as_mut(), decoder_, 1024)?;
625
626            let key = unsafe { key.deref_unchecked() };
627
628            if key.len() > 1024 {
629                return Err(::fidl_next::DecodeError::VectorTooLong {
630                    size: key.len() as u64,
631                    limit: 1024,
632                });
633            }
634
635            let _field = value.as_mut();
636
637            ::fidl_next::Decode::decode(value.as_mut(), decoder_, ())?;
638
639            Ok(())
640        }
641    }
642
643    impl<'de> ::fidl_next::IntoNatural for DictionaryEntry<'de> {
644        type Natural = crate::natural::DictionaryEntry;
645    }
646
647    impl ::fidl_next::Unconstrained for DictionaryEntry<'static> {}
648
649    #[repr(C)]
651    pub struct Dictionary<'de> {
652        pub(crate) table: ::fidl_next::WireTable<'de>,
653    }
654
655    impl<'de> Drop for Dictionary<'de> {
656        fn drop(&mut self) {
657            let _ = self.table.get(1)
658                .map(|envelope| unsafe {
659                    envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::wire::DictionaryEntry<'de>>>()
660                });
661        }
662    }
663
664    unsafe impl ::fidl_next::Wire for Dictionary<'static> {
665        type Owned<'de> = Dictionary<'de>;
666
667        #[inline]
668        fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
669            ::fidl_next::munge!(let Self { table } = out);
670            ::fidl_next::WireTable::zero_padding(table);
671        }
672    }
673
674    unsafe impl<___D> ::fidl_next::Decode<___D> for Dictionary<'static>
675    where
676        ___D: ::fidl_next::Decoder + ?Sized,
677    {
678        fn decode(
679            slot: ::fidl_next::Slot<'_, Self>,
680            decoder: &mut ___D,
681            _: (),
682        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
683            ::fidl_next::munge!(let Self { table } = slot);
684
685            ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
686                match ordinal {
687                    0 => unsafe { ::core::hint::unreachable_unchecked() },
688
689                    1 => {
690                        ::fidl_next::WireEnvelope::decode_as::<
691                            ___D,
692                            ::fidl_next::WireVector<'static, crate::wire::DictionaryEntry<'static>>,
693                        >(slot.as_mut(), decoder, (1024, ()))?;
694
695                        let value = unsafe {
696                            slot
697                                            .deref_unchecked()
698                                            .deref_unchecked::<
699                                                ::fidl_next::WireVector<'_, crate::wire::DictionaryEntry<'_>>
700                                            >()
701                        };
702
703                        if value.len() > 1024 {
704                            return Err(::fidl_next::DecodeError::VectorTooLong {
705                                size: value.len() as u64,
706                                limit: 1024,
707                            });
708                        }
709
710                        Ok(())
711                    }
712
713                    _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
714                }
715            })
716        }
717    }
718
719    impl<'de> Dictionary<'de> {
720        pub fn entries(
721            &self,
722        ) -> ::core::option::Option<&::fidl_next::WireVector<'de, crate::wire::DictionaryEntry<'de>>>
723        {
724            unsafe { Some(self.table.get(1)?.deref_unchecked()) }
725        }
726    }
727
728    impl<'de> ::core::fmt::Debug for Dictionary<'de> {
729        fn fmt(
730            &self,
731            f: &mut ::core::fmt::Formatter<'_>,
732        ) -> ::core::result::Result<(), ::core::fmt::Error> {
733            f.debug_struct("Dictionary").field("entries", &self.entries()).finish()
734        }
735    }
736
737    impl<'de> ::fidl_next::IntoNatural for Dictionary<'de> {
738        type Natural = crate::natural::Dictionary;
739    }
740
741    impl ::fidl_next::Unconstrained for Dictionary<'_> {}
742
743    #[repr(transparent)]
745    pub struct DictionaryValue<'de> {
746        pub(crate) raw: ::fidl_next::RawWireUnion,
747        pub(crate) _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
748    }
749
750    impl<'de> Drop for DictionaryValue<'de> {
751        fn drop(&mut self) {
752            match self.raw.ordinal() {
753                1 => {
754                    let _ =
755                        unsafe { self.raw.get().read_unchecked::<::fidl_next::WireString<'de>>() };
756                }
757
758                2 => {
759                    let _ = unsafe {
760                        self.raw.get().read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>>()
761                    };
762                }
763
764                3 => {
765                    let _ = unsafe {
766                        self.raw.get().read_unchecked::<::fidl_next::WireVector<'de, crate::wire::Dictionary<'de>>>()
767                    };
768                }
769
770                _ => (),
771            }
772        }
773    }
774
775    unsafe impl ::fidl_next::Wire for DictionaryValue<'static> {
776        type Owned<'de> = DictionaryValue<'de>;
777
778        #[inline]
779        fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
780            ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
781            ::fidl_next::RawWireUnion::zero_padding(raw);
782        }
783    }
784
785    pub mod dictionary_value {
786        pub enum Ref<'de> {
787            Str(&'de ::fidl_next::WireString<'de>),
788
789            StrVec(&'de ::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>),
790
791            ObjVec(&'de ::fidl_next::WireVector<'de, crate::wire::Dictionary<'de>>),
792
793            UnknownOrdinal_(u64),
794        }
795    }
796
797    impl<'de> DictionaryValue<'de> {
798        pub fn as_ref(&self) -> crate::wire::dictionary_value::Ref<'_> {
799            match self.raw.ordinal() {
800                1 => crate::wire::dictionary_value::Ref::Str(unsafe {
801                    self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>()
802                }),
803
804                2 => crate::wire::dictionary_value::Ref::StrVec(unsafe {
805                    self.raw.get().deref_unchecked::<::fidl_next::WireVector<'_, ::fidl_next::WireString<'_>>>()
806                }),
807
808                3 => crate::wire::dictionary_value::Ref::ObjVec(unsafe {
809                    self.raw.get().deref_unchecked::<::fidl_next::WireVector<'_, crate::wire::Dictionary<'_>>>()
810                }),
811
812                unknown => crate::wire::dictionary_value::Ref::UnknownOrdinal_(unknown),
813            }
814        }
815    }
816
817    unsafe impl<___D> ::fidl_next::Decode<___D> for DictionaryValue<'static>
818    where
819        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
820        ___D: ::fidl_next::Decoder,
821    {
822        fn decode(
823            mut slot: ::fidl_next::Slot<'_, Self>,
824            decoder: &mut ___D,
825            _: (),
826        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
827            ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
828            match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
829                1 => {
830                    ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString<'static>>(
831                        raw, decoder, 32768,
832                    )?
833                }
834
835                2 => ::fidl_next::RawWireUnion::decode_as::<
836                    ___D,
837                    ::fidl_next::WireVector<'static, ::fidl_next::WireString<'static>>,
838                >(raw, decoder, (1024, 32768))?,
839
840                3 => ::fidl_next::RawWireUnion::decode_as::<
841                    ___D,
842                    ::fidl_next::WireVector<'static, crate::wire::Dictionary<'static>>,
843                >(raw, decoder, (1024, ()))?,
844
845                _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
846            }
847
848            Ok(())
849        }
850    }
851
852    impl<'de> ::core::fmt::Debug for DictionaryValue<'de> {
853        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
854            match self.raw.ordinal() {
855                1 => unsafe {
856                    self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>().fmt(f)
857                },
858                2 => unsafe {
859                    self.raw.get().deref_unchecked::<
860                            ::fidl_next::WireVector<'_, ::fidl_next::WireString<'_>>
861                        >().fmt(f)
862                },
863                3 => unsafe {
864                    self.raw.get().deref_unchecked::<
865                            ::fidl_next::WireVector<'_, crate::wire::Dictionary<'_>>
866                        >().fmt(f)
867                },
868                _ => unsafe { ::core::hint::unreachable_unchecked() },
869            }
870        }
871    }
872
873    impl<'de> ::fidl_next::IntoNatural for DictionaryValue<'de> {
874        type Natural = crate::natural::DictionaryValue;
875    }
876
877    impl ::fidl_next::Unconstrained for DictionaryValue<'static> {}
878}
879
880pub mod wire_optional {
881
882    #[repr(transparent)]
883    pub struct DictionaryValue<'de> {
884        pub(crate) raw: ::fidl_next::RawWireUnion,
885        pub(crate) _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
886    }
887
888    unsafe impl ::fidl_next::Wire for DictionaryValue<'static> {
889        type Owned<'de> = DictionaryValue<'de>;
890
891        #[inline]
892        fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
893            ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
894            ::fidl_next::RawWireUnion::zero_padding(raw);
895        }
896    }
897
898    impl<'de> DictionaryValue<'de> {
899        pub fn is_some(&self) -> bool {
900            self.raw.is_some()
901        }
902
903        pub fn is_none(&self) -> bool {
904            self.raw.is_none()
905        }
906
907        pub fn as_ref(&self) -> ::core::option::Option<&crate::wire::DictionaryValue<'de>> {
908            if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None }
909        }
910
911        pub fn into_option(self) -> ::core::option::Option<crate::wire::DictionaryValue<'de>> {
912            if self.is_some() {
913                Some(crate::wire::DictionaryValue {
914                    raw: self.raw,
915                    _phantom: ::core::marker::PhantomData,
916                })
917            } else {
918                None
919            }
920        }
921    }
922
923    unsafe impl<___D> ::fidl_next::Decode<___D> for DictionaryValue<'static>
924    where
925        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
926        ___D: ::fidl_next::Decoder,
927    {
928        fn decode(
929            mut slot: ::fidl_next::Slot<'_, Self>,
930            decoder: &mut ___D,
931            _: (),
932        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
933            ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
934            match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
935                1 => {
936                    ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString<'static>>(
937                        raw, decoder, 32768,
938                    )?
939                }
940
941                2 => ::fidl_next::RawWireUnion::decode_as::<
942                    ___D,
943                    ::fidl_next::WireVector<'static, ::fidl_next::WireString<'static>>,
944                >(raw, decoder, (1024, 32768))?,
945
946                3 => ::fidl_next::RawWireUnion::decode_as::<
947                    ___D,
948                    ::fidl_next::WireVector<'static, crate::wire::Dictionary<'static>>,
949                >(raw, decoder, (1024, ()))?,
950
951                0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
952                _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
953            }
954
955            Ok(())
956        }
957    }
958
959    impl<'de> ::core::fmt::Debug for DictionaryValue<'de> {
960        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
961            self.as_ref().fmt(f)
962        }
963    }
964
965    impl<'de> ::fidl_next::IntoNatural for DictionaryValue<'de> {
966        type Natural = ::core::option::Option<crate::natural::DictionaryValue>;
967    }
968
969    impl ::fidl_next::Unconstrained for DictionaryValue<'static> {}
970}
971
972pub mod generic {
973
974    pub struct DictionaryEntry<T0, T1> {
975        pub key: T0,
976
977        pub value: T1,
978    }
979
980    unsafe impl<___E, T0, T1> ::fidl_next::Encode<crate::wire::DictionaryEntry<'static>, ___E>
981        for DictionaryEntry<T0, T1>
982    where
983        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
984        ___E: ::fidl_next::Encoder,
985        T0: ::fidl_next::Encode<::fidl_next::WireString<'static>, ___E>,
986        T1: ::fidl_next::Encode<crate::wire_optional::DictionaryValue<'static>, ___E>,
987    {
988        #[inline]
989        fn encode(
990            self,
991            encoder_: &mut ___E,
992            out_: &mut ::core::mem::MaybeUninit<crate::wire::DictionaryEntry<'static>>,
993            _: (),
994        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
995            ::fidl_next::munge! {
996                let crate::wire::DictionaryEntry {
997
998                    key,
999                    value,
1000
1001                } = out_;
1002            }
1003
1004            ::fidl_next::Encode::encode(self.key, encoder_, key, 1024)?;
1005
1006            ::fidl_next::Encode::encode(self.value, encoder_, value, ())?;
1007
1008            Ok(())
1009        }
1010    }
1011}
1012
1013pub use self::natural::*;
1014
1015pub const MAX_KEY_LENGTH: u32 = 1024 as u32;
1016
1017pub const MAX_NUM_ENTRIES: u32 = 1024 as u32;
1018
1019pub const MAX_NUM_VALUE_ITEMS: u32 = 1024 as u32;
1020
1021pub const MAX_VALUE_LENGTH: u32 = 32768 as u32;
1022
1023pub mod compat {
1025
1026    impl ::fidl_next::CompatFrom<crate::DictionaryEntry> for ::fidl_fuchsia_data::DictionaryEntry {
1027        #[inline]
1028        fn compat_from(value: crate::DictionaryEntry) -> Self {
1029            Self {
1030                key: ::fidl_next::CompatFrom::compat_from(value.key),
1031
1032                value: ::fidl_next::CompatFrom::compat_from(value.value),
1033            }
1034        }
1035    }
1036
1037    impl ::fidl_next::CompatFrom<::fidl_fuchsia_data::DictionaryEntry> for crate::DictionaryEntry {
1038        #[inline]
1039        fn compat_from(value: ::fidl_fuchsia_data::DictionaryEntry) -> Self {
1040            Self {
1041                key: ::fidl_next::CompatFrom::compat_from(value.key),
1042
1043                value: ::fidl_next::CompatFrom::compat_from(value.value),
1044            }
1045        }
1046    }
1047
1048    impl ::fidl_next::CompatFrom<crate::Dictionary> for ::fidl_fuchsia_data::Dictionary {
1049        fn compat_from(value: crate::Dictionary) -> Self {
1050            Self {
1051                entries: ::fidl_next::CompatFrom::compat_from(value.entries),
1052
1053                __source_breaking: ::fidl::marker::SourceBreaking,
1054            }
1055        }
1056    }
1057
1058    impl ::fidl_next::CompatFrom<::fidl_fuchsia_data::Dictionary> for crate::Dictionary {
1059        fn compat_from(value: ::fidl_fuchsia_data::Dictionary) -> Self {
1060            Self { entries: ::fidl_next::CompatFrom::compat_from(value.entries) }
1061        }
1062    }
1063
1064    impl ::fidl_next::CompatFrom<crate::DictionaryValue> for ::fidl_fuchsia_data::DictionaryValue {
1065        fn compat_from(value: crate::DictionaryValue) -> Self {
1066            match value {
1067                crate::DictionaryValue::Str(value) => {
1068                    Self::Str(::fidl_next::CompatFrom::compat_from(value))
1069                }
1070
1071                crate::DictionaryValue::StrVec(value) => {
1072                    Self::StrVec(::fidl_next::CompatFrom::compat_from(value))
1073                }
1074
1075                crate::DictionaryValue::ObjVec(value) => {
1076                    Self::ObjVec(::fidl_next::CompatFrom::compat_from(value))
1077                }
1078
1079                crate::DictionaryValue::UnknownOrdinal_(unknown_ordinal) => {
1080                    Self::__SourceBreaking { unknown_ordinal }
1081                }
1082            }
1083        }
1084    }
1085
1086    impl ::fidl_next::CompatFrom<::fidl_fuchsia_data::DictionaryValue> for crate::DictionaryValue {
1087        fn compat_from(value: ::fidl_fuchsia_data::DictionaryValue) -> Self {
1088            match value {
1089                ::fidl_fuchsia_data::DictionaryValue::Str(value) => {
1090                    Self::Str(::fidl_next::CompatFrom::compat_from(value))
1091                }
1092
1093                ::fidl_fuchsia_data::DictionaryValue::StrVec(value) => {
1094                    Self::StrVec(::fidl_next::CompatFrom::compat_from(value))
1095                }
1096
1097                ::fidl_fuchsia_data::DictionaryValue::ObjVec(value) => {
1098                    Self::ObjVec(::fidl_next::CompatFrom::compat_from(value))
1099                }
1100
1101                ::fidl_fuchsia_data::DictionaryValue::__SourceBreaking { unknown_ordinal } => {
1102                    Self::UnknownOrdinal_(unknown_ordinal)
1103                }
1104            }
1105        }
1106    }
1107}