fidl_next_fuchsia_data/
fidl_next_fuchsia_data.rs

1// DO NOT EDIT: This file is machine-generated by fidlgen
2#![warn(clippy::all)]
3#![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)]
4
5pub const MAX_KEY_LENGTH: u32 = 1024;
6
7pub const MAX_NUM_ENTRIES: u32 = 1024;
8
9#[doc = " A key/value pair in a `Dictionary`.\n"]
10#[derive(Clone, Debug)]
11pub struct DictionaryEntry {
12    pub key: String,
13
14    pub value: Option<Box<crate::DictionaryValue>>,
15}
16
17impl ::fidl_next::Encodable for DictionaryEntry {
18    type Encoded = WireDictionaryEntry;
19}
20
21unsafe impl<___E> ::fidl_next::Encode<___E> for DictionaryEntry
22where
23    ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
24
25    ___E: ::fidl_next::Encoder,
26{
27    #[inline]
28    fn encode(
29        self,
30        encoder: &mut ___E,
31        out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
32    ) -> Result<(), ::fidl_next::EncodeError> {
33        ::fidl_next::munge! {
34            let Self::Encoded {
35                key,
36                value,
37
38            } = out;
39        }
40
41        ::fidl_next::Encode::encode(self.key, encoder, key)?;
42
43        ::fidl_next::Encode::encode(self.value, encoder, value)?;
44
45        Ok(())
46    }
47}
48
49unsafe impl<___E> ::fidl_next::EncodeRef<___E> for DictionaryEntry
50where
51    ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
52
53    ___E: ::fidl_next::Encoder,
54{
55    #[inline]
56    fn encode_ref(
57        &self,
58        encoder: &mut ___E,
59        out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
60    ) -> Result<(), ::fidl_next::EncodeError> {
61        ::fidl_next::munge! {
62            let Self::Encoded {
63                key,
64                value,
65
66            } = out;
67        }
68
69        ::fidl_next::EncodeRef::encode_ref(&self.key, encoder, key)?;
70
71        ::fidl_next::EncodeRef::encode_ref(&self.value, encoder, value)?;
72
73        Ok(())
74    }
75}
76
77impl ::fidl_next::EncodableOption for Box<DictionaryEntry> {
78    type EncodedOption = ::fidl_next::WireBox<WireDictionaryEntry>;
79}
80
81unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Box<DictionaryEntry>
82where
83    ___E: ::fidl_next::Encoder + ?Sized,
84    DictionaryEntry: ::fidl_next::Encode<___E>,
85{
86    #[inline]
87    fn encode_option(
88        this: Option<Self>,
89        encoder: &mut ___E,
90        out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
91    ) -> Result<(), ::fidl_next::EncodeError> {
92        if let Some(inner) = this {
93            ::fidl_next::EncoderExt::encode_next(encoder, *inner)?;
94            ::fidl_next::WireBox::encode_present(out);
95        } else {
96            ::fidl_next::WireBox::encode_absent(out);
97        }
98
99        Ok(())
100    }
101}
102
103unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for Box<DictionaryEntry>
104where
105    ___E: ::fidl_next::Encoder + ?Sized,
106    DictionaryEntry: ::fidl_next::EncodeRef<___E>,
107{
108    #[inline]
109    fn encode_option_ref(
110        this: Option<&Self>,
111        encoder: &mut ___E,
112        out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
113    ) -> Result<(), ::fidl_next::EncodeError> {
114        if let Some(inner) = this {
115            ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
116            ::fidl_next::WireBox::encode_present(out);
117        } else {
118            ::fidl_next::WireBox::encode_absent(out);
119        }
120
121        Ok(())
122    }
123}
124
125impl ::fidl_next::TakeFrom<WireDictionaryEntry> for DictionaryEntry {
126    #[inline]
127    fn take_from(from: &WireDictionaryEntry) -> Self {
128        Self {
129            key: ::fidl_next::TakeFrom::take_from(&from.key),
130
131            value: ::fidl_next::TakeFrom::take_from(&from.value),
132        }
133    }
134}
135
136/// The wire type corresponding to [`DictionaryEntry`].
137#[derive(Debug)]
138#[repr(C)]
139pub struct WireDictionaryEntry {
140    pub key: ::fidl_next::WireString,
141
142    pub value: crate::WireOptionalDictionaryValue,
143}
144
145unsafe impl ::fidl_next::ZeroPadding for WireDictionaryEntry {
146    #[inline]
147    fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
148}
149
150unsafe impl<___D> ::fidl_next::Decode<___D> for WireDictionaryEntry
151where
152    ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
153
154    ___D: ::fidl_next::Decoder,
155{
156    fn decode(
157        slot: ::fidl_next::Slot<'_, Self>,
158        decoder: &mut ___D,
159    ) -> Result<(), ::fidl_next::DecodeError> {
160        ::fidl_next::munge! {
161            let Self {
162                mut key,
163                mut value,
164
165            } = slot;
166        }
167
168        ::fidl_next::Decode::decode(key.as_mut(), decoder)?;
169
170        let key = unsafe { key.deref_unchecked() };
171
172        if key.len() > 1024 {
173            return Err(::fidl_next::DecodeError::VectorTooLong {
174                size: key.len() as u64,
175                limit: 1024,
176            });
177        }
178
179        ::fidl_next::Decode::decode(value.as_mut(), decoder)?;
180
181        Ok(())
182    }
183}
184
185#[doc = " A dictionary is a sequence of key/value pairs.\n Keys must be unique and sorted in lexicographically increasing order.\n"]
186#[derive(Clone, Debug, Default)]
187pub struct Dictionary {
188    pub entries: Option<Vec<crate::DictionaryEntry>>,
189}
190
191impl Dictionary {
192    fn __max_ordinal(&self) -> usize {
193        if self.entries.is_some() {
194            return 1;
195        }
196
197        0
198    }
199}
200
201impl ::fidl_next::Encodable for Dictionary {
202    type Encoded = WireDictionary;
203}
204
205unsafe impl<___E> ::fidl_next::Encode<___E> for Dictionary
206where
207    ___E: ::fidl_next::Encoder + ?Sized,
208{
209    #[inline]
210    fn encode(
211        mut self,
212        encoder: &mut ___E,
213        out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
214    ) -> Result<(), ::fidl_next::EncodeError> {
215        ::fidl_next::munge!(let WireDictionary { table } = out);
216
217        let max_ord = self.__max_ordinal();
218
219        let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
220        ::fidl_next::ZeroPadding::zero_padding(&mut out);
221
222        let mut preallocated =
223            ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
224
225        for i in 1..=max_ord {
226            match i {
227                1 => {
228                    if let Some(entries) = self.entries.take() {
229                        ::fidl_next::WireEnvelope::encode_value(
230                            entries,
231                            preallocated.encoder,
232                            &mut out,
233                        )?;
234                    } else {
235                        ::fidl_next::WireEnvelope::encode_zero(&mut out)
236                    }
237                }
238
239                _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
240            }
241            unsafe {
242                preallocated.write_next(out.assume_init_ref());
243            }
244        }
245
246        ::fidl_next::WireTable::encode_len(table, max_ord);
247
248        Ok(())
249    }
250}
251
252unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Dictionary
253where
254    ___E: ::fidl_next::Encoder + ?Sized,
255{
256    #[inline]
257    fn encode_ref(
258        &self,
259        encoder: &mut ___E,
260        out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
261    ) -> Result<(), ::fidl_next::EncodeError> {
262        ::fidl_next::munge!(let WireDictionary { table } = out);
263
264        let max_ord = self.__max_ordinal();
265
266        let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
267        ::fidl_next::ZeroPadding::zero_padding(&mut out);
268
269        let mut preallocated =
270            ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
271
272        for i in 1..=max_ord {
273            match i {
274                1 => {
275                    if let Some(entries) = &self.entries {
276                        ::fidl_next::WireEnvelope::encode_value(
277                            entries,
278                            preallocated.encoder,
279                            &mut out,
280                        )?;
281                    } else {
282                        ::fidl_next::WireEnvelope::encode_zero(&mut out)
283                    }
284                }
285
286                _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
287            }
288            unsafe {
289                preallocated.write_next(out.assume_init_ref());
290            }
291        }
292
293        ::fidl_next::WireTable::encode_len(table, max_ord);
294
295        Ok(())
296    }
297}
298
299impl ::fidl_next::TakeFrom<WireDictionary> for Dictionary {
300    #[inline]
301    fn take_from(from: &WireDictionary) -> Self {
302        Self { entries: from.entries().map(::fidl_next::TakeFrom::take_from) }
303    }
304}
305
306/// The wire type corresponding to [`Dictionary`].
307#[repr(C)]
308pub struct WireDictionary {
309    table: ::fidl_next::WireTable,
310}
311
312unsafe impl ::fidl_next::ZeroPadding for WireDictionary {
313    #[inline]
314    fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
315        ::fidl_next::munge!(let Self { table } = out);
316        ::fidl_next::WireTable::zero_padding(table);
317    }
318}
319
320unsafe impl<___D> ::fidl_next::Decode<___D> for WireDictionary
321where
322    ___D: ::fidl_next::Decoder + ?Sized,
323{
324    fn decode(
325        slot: ::fidl_next::Slot<'_, Self>,
326        decoder: &mut ___D,
327    ) -> Result<(), ::fidl_next::DecodeError> {
328        ::fidl_next::munge!(let Self { table } = slot);
329
330        ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
331            match ordinal {
332                0 => unsafe { ::core::hint::unreachable_unchecked() },
333
334                1 => {
335                    ::fidl_next::WireEnvelope::decode_as::<
336                        ___D,
337                        ::fidl_next::WireVector<crate::WireDictionaryEntry>,
338                    >(slot.as_mut(), decoder)?;
339
340                    let entries = unsafe {
341                        slot.deref_unchecked()
342                            .deref_unchecked::<::fidl_next::WireVector<crate::WireDictionaryEntry>>(
343                            )
344                    };
345
346                    if entries.len() > 1024 {
347                        return Err(::fidl_next::DecodeError::VectorTooLong {
348                            size: entries.len() as u64,
349                            limit: 1024,
350                        });
351                    }
352
353                    Ok(())
354                }
355
356                _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
357            }
358        })
359    }
360}
361
362impl WireDictionary {
363    pub fn entries(&self) -> Option<&::fidl_next::WireVector<crate::WireDictionaryEntry>> {
364        unsafe { Some(self.table.get(1)?.deref_unchecked()) }
365    }
366}
367
368impl ::core::fmt::Debug for WireDictionary {
369    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
370        f.debug_struct("Dictionary").field("entries", &self.entries()).finish()
371    }
372}
373
374pub const MAX_NUM_VALUE_ITEMS: u32 = 1024;
375
376pub const MAX_VALUE_LENGTH: u32 = 32768;
377
378#[doc = " A dictionary\'s value is a string, a list of strings, or a list of objects.\n"]
379#[derive(Clone, Debug)]
380pub enum DictionaryValue {
381    Str(String),
382
383    StrVec(Vec<String>),
384
385    ObjVec(Vec<crate::Dictionary>),
386
387    UnknownOrdinal_(u64),
388}
389
390impl ::fidl_next::Encodable for DictionaryValue {
391    type Encoded = WireDictionaryValue;
392}
393
394unsafe impl<___E> ::fidl_next::Encode<___E> for DictionaryValue
395where
396    ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
397
398    ___E: ::fidl_next::Encoder,
399{
400    #[inline]
401    fn encode(
402        self,
403        encoder: &mut ___E,
404        out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
405    ) -> Result<(), ::fidl_next::EncodeError> {
406        ::fidl_next::munge!(let WireDictionaryValue { raw } = out);
407
408        match self {
409            Self::Str(value) => {
410                ::fidl_next::RawWireUnion::encode_as::<___E, String>(value, 1, encoder, raw)?
411            }
412
413            Self::StrVec(value) => {
414                ::fidl_next::RawWireUnion::encode_as::<___E, Vec<String>>(value, 2, encoder, raw)?
415            }
416
417            Self::ObjVec(value) => ::fidl_next::RawWireUnion::encode_as::<
418                ___E,
419                Vec<crate::Dictionary>,
420            >(value, 3, encoder, raw)?,
421
422            Self::UnknownOrdinal_(ordinal) => {
423                return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize))
424            }
425        }
426
427        Ok(())
428    }
429}
430
431unsafe impl<___E> ::fidl_next::EncodeRef<___E> for DictionaryValue
432where
433    ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
434
435    ___E: ::fidl_next::Encoder,
436{
437    #[inline]
438    fn encode_ref(
439        &self,
440        encoder: &mut ___E,
441        out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
442    ) -> Result<(), ::fidl_next::EncodeError> {
443        ::fidl_next::munge!(let WireDictionaryValue { raw } = out);
444
445        match self {
446            Self::Str(value) => {
447                ::fidl_next::RawWireUnion::encode_as::<___E, &String>(value, 1, encoder, raw)?
448            }
449
450            Self::StrVec(value) => {
451                ::fidl_next::RawWireUnion::encode_as::<___E, &Vec<String>>(value, 2, encoder, raw)?
452            }
453
454            Self::ObjVec(value) => ::fidl_next::RawWireUnion::encode_as::<
455                ___E,
456                &Vec<crate::Dictionary>,
457            >(value, 3, encoder, raw)?,
458
459            Self::UnknownOrdinal_(ordinal) => {
460                return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize))
461            }
462        }
463
464        Ok(())
465    }
466}
467
468impl ::fidl_next::EncodableOption for Box<DictionaryValue> {
469    type EncodedOption = WireOptionalDictionaryValue;
470}
471
472unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Box<DictionaryValue>
473where
474    ___E: ?Sized,
475    DictionaryValue: ::fidl_next::Encode<___E>,
476{
477    #[inline]
478    fn encode_option(
479        this: Option<Self>,
480        encoder: &mut ___E,
481        out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
482    ) -> Result<(), ::fidl_next::EncodeError> {
483        ::fidl_next::munge!(let WireOptionalDictionaryValue { raw } = &mut *out);
484
485        if let Some(inner) = this {
486            let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
487            ::fidl_next::Encode::encode(inner, encoder, value_out)?;
488        } else {
489            ::fidl_next::RawWireUnion::encode_absent(raw);
490        }
491
492        Ok(())
493    }
494}
495
496unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for Box<DictionaryValue>
497where
498    ___E: ?Sized,
499    DictionaryValue: ::fidl_next::EncodeRef<___E>,
500{
501    #[inline]
502    fn encode_option_ref(
503        this: Option<&Self>,
504        encoder: &mut ___E,
505        out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
506    ) -> Result<(), ::fidl_next::EncodeError> {
507        ::fidl_next::munge!(let WireOptionalDictionaryValue { raw } = &mut *out);
508
509        if let Some(inner) = this {
510            let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
511            ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?;
512        } else {
513            ::fidl_next::RawWireUnion::encode_absent(raw);
514        }
515
516        Ok(())
517    }
518}
519
520impl ::fidl_next::TakeFrom<WireDictionaryValue> for DictionaryValue {
521    #[inline]
522    fn take_from(from: &WireDictionaryValue) -> Self {
523        match from.raw.ordinal() {
524            1 => Self::Str(::fidl_next::TakeFrom::take_from(unsafe {
525                from.raw.get().deref_unchecked::<::fidl_next::WireString>()
526            })),
527
528            2 => Self::StrVec(::fidl_next::TakeFrom::take_from(unsafe {
529                from.raw.get().deref_unchecked::<::fidl_next::WireVector<::fidl_next::WireString>>()
530            })),
531
532            3 => Self::ObjVec(::fidl_next::TakeFrom::take_from(unsafe {
533                from.raw.get().deref_unchecked::<::fidl_next::WireVector<crate::WireDictionary>>()
534            })),
535
536            _ => unsafe { ::core::hint::unreachable_unchecked() },
537        }
538    }
539}
540
541impl ::fidl_next::TakeFrom<WireOptionalDictionaryValue> for Option<Box<DictionaryValue>> {
542    #[inline]
543    fn take_from(from: &WireOptionalDictionaryValue) -> Self {
544        if let Some(inner) = from.as_ref() {
545            Some(::fidl_next::TakeFrom::take_from(inner))
546        } else {
547            None
548        }
549    }
550}
551
552/// The wire type corresponding to [`DictionaryValue`].
553#[repr(transparent)]
554pub struct WireDictionaryValue {
555    raw: ::fidl_next::RawWireUnion,
556}
557
558unsafe impl ::fidl_next::ZeroPadding for WireDictionaryValue {
559    #[inline]
560    fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
561        ::fidl_next::munge!(let Self { raw } = out);
562        ::fidl_next::RawWireUnion::zero_padding(raw);
563    }
564}
565
566pub mod dictionary_value {
567    pub enum Ref<'union> {
568        Str(&'union ::fidl_next::WireString),
569
570        StrVec(&'union ::fidl_next::WireVector<::fidl_next::WireString>),
571
572        ObjVec(&'union ::fidl_next::WireVector<crate::WireDictionary>),
573
574        UnknownOrdinal_(u64),
575    }
576}
577
578impl WireDictionaryValue {
579    pub fn as_ref(&self) -> crate::dictionary_value::Ref<'_> {
580        match self.raw.ordinal() {
581            1 => crate::dictionary_value::Ref::Str(unsafe {
582                self.raw.get().deref_unchecked::<::fidl_next::WireString>()
583            }),
584
585            2 => crate::dictionary_value::Ref::StrVec(unsafe {
586                self.raw.get().deref_unchecked::<::fidl_next::WireVector<::fidl_next::WireString>>()
587            }),
588
589            3 => crate::dictionary_value::Ref::ObjVec(unsafe {
590                self.raw.get().deref_unchecked::<::fidl_next::WireVector<crate::WireDictionary>>()
591            }),
592
593            unknown => crate::dictionary_value::Ref::UnknownOrdinal_(unknown),
594        }
595    }
596}
597
598unsafe impl<___D> ::fidl_next::Decode<___D> for WireDictionaryValue
599where
600    ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
601
602    ___D: ::fidl_next::Decoder,
603{
604    fn decode(
605        mut slot: ::fidl_next::Slot<'_, Self>,
606        decoder: &mut ___D,
607    ) -> Result<(), ::fidl_next::DecodeError> {
608        ::fidl_next::munge!(let Self { mut raw } = slot.as_mut());
609        match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
610            1 => {
611                ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString>(raw, decoder)?
612            }
613
614            2 => ::fidl_next::RawWireUnion::decode_as::<
615                ___D,
616                ::fidl_next::WireVector<::fidl_next::WireString>,
617            >(raw, decoder)?,
618
619            3 => ::fidl_next::RawWireUnion::decode_as::<
620                ___D,
621                ::fidl_next::WireVector<crate::WireDictionary>,
622            >(raw, decoder)?,
623
624            _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
625        }
626
627        Ok(())
628    }
629}
630
631impl ::core::fmt::Debug for WireDictionaryValue {
632    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
633        match self.raw.ordinal() {
634            1 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireString>().fmt(f) },
635            2 => unsafe {
636                self.raw
637                    .get()
638                    .deref_unchecked::<::fidl_next::WireVector<::fidl_next::WireString>>()
639                    .fmt(f)
640            },
641            3 => unsafe {
642                self.raw
643                    .get()
644                    .deref_unchecked::<::fidl_next::WireVector<crate::WireDictionary>>()
645                    .fmt(f)
646            },
647            _ => unsafe { ::core::hint::unreachable_unchecked() },
648        }
649    }
650}
651
652#[repr(transparent)]
653pub struct WireOptionalDictionaryValue {
654    raw: ::fidl_next::RawWireUnion,
655}
656
657unsafe impl ::fidl_next::ZeroPadding for WireOptionalDictionaryValue {
658    #[inline]
659    fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
660        ::fidl_next::munge!(let Self { raw } = out);
661        ::fidl_next::RawWireUnion::zero_padding(raw);
662    }
663}
664
665impl WireOptionalDictionaryValue {
666    pub fn is_some(&self) -> bool {
667        self.raw.is_some()
668    }
669
670    pub fn is_none(&self) -> bool {
671        self.raw.is_none()
672    }
673
674    pub fn as_ref(&self) -> Option<&WireDictionaryValue> {
675        if self.is_some() {
676            Some(unsafe { &*(self as *const Self).cast() })
677        } else {
678            None
679        }
680    }
681}
682
683unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalDictionaryValue
684where
685    ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
686
687    ___D: ::fidl_next::Decoder,
688{
689    fn decode(
690        mut slot: ::fidl_next::Slot<'_, Self>,
691        decoder: &mut ___D,
692    ) -> Result<(), ::fidl_next::DecodeError> {
693        ::fidl_next::munge!(let Self { mut raw } = slot.as_mut());
694        match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
695            1 => {
696                ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString>(raw, decoder)?
697            }
698
699            2 => ::fidl_next::RawWireUnion::decode_as::<
700                ___D,
701                ::fidl_next::WireVector<::fidl_next::WireString>,
702            >(raw, decoder)?,
703
704            3 => ::fidl_next::RawWireUnion::decode_as::<
705                ___D,
706                ::fidl_next::WireVector<crate::WireDictionary>,
707            >(raw, decoder)?,
708
709            0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
710            _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
711        }
712
713        Ok(())
714    }
715}
716
717impl ::core::fmt::Debug for WireOptionalDictionaryValue {
718    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
719        self.as_ref().fmt(f)
720    }
721}
722
723/// Compatibility shims which mimic some API surfaces of the current Rust bindings.
724pub mod compat {
725
726    impl ::fidl_next::TakeFrom<crate::WireDictionaryEntry> for ::fidl_fuchsia_data::DictionaryEntry {
727        #[inline]
728        fn take_from(from: &crate::WireDictionaryEntry) -> Self {
729            Self {
730                key: ::fidl_next::TakeFrom::take_from(&from.key),
731
732                value: ::fidl_next::TakeFrom::take_from(&from.value),
733            }
734        }
735    }
736
737    impl ::fidl_next::TakeFrom<crate::WireDictionary> for ::fidl_fuchsia_data::Dictionary {
738        #[inline]
739        fn take_from(from: &crate::WireDictionary) -> Self {
740            Self {
741                entries: from.entries().map(::fidl_next::TakeFrom::take_from),
742
743                __source_breaking: ::fidl::marker::SourceBreaking,
744            }
745        }
746    }
747
748    impl ::fidl_next::TakeFrom<crate::WireDictionaryValue> for ::fidl_fuchsia_data::DictionaryValue {
749        #[inline]
750        fn take_from(from: &crate::WireDictionaryValue) -> Self {
751            match from.as_ref() {
752                crate::dictionary_value::Ref::Str(value) => {
753                    Self::Str(::fidl_next::TakeFrom::take_from(value))
754                }
755
756                crate::dictionary_value::Ref::StrVec(value) => {
757                    Self::StrVec(::fidl_next::TakeFrom::take_from(value))
758                }
759
760                crate::dictionary_value::Ref::ObjVec(value) => {
761                    Self::ObjVec(::fidl_next::TakeFrom::take_from(value))
762                }
763
764                crate::dictionary_value::Ref::UnknownOrdinal_(unknown_ordinal) => {
765                    Self::__SourceBreaking { unknown_ordinal }
766                }
767            }
768        }
769    }
770
771    impl ::fidl_next::TakeFrom<crate::WireOptionalDictionaryValue>
772        for Option<Box<::fidl_fuchsia_data::DictionaryValue>>
773    {
774        #[inline]
775        fn take_from(from: &crate::WireOptionalDictionaryValue) -> Self {
776            if let Some(inner) = from.as_ref() {
777                Some(::fidl_next::TakeFrom::take_from(inner))
778            } else {
779                None
780            }
781        }
782    }
783}