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<'static>;
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 DictionaryEntry {
78    type EncodedOption = ::fidl_next::WireBox<'static, WireDictionaryEntry<'static>>;
79}
80
81unsafe impl<___E> ::fidl_next::EncodeOption<___E> for 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 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<'de> ::fidl_next::FromWire<WireDictionaryEntry<'de>> for DictionaryEntry {
126    #[inline]
127    fn from_wire(wire: WireDictionaryEntry<'de>) -> Self {
128        Self {
129            key: ::fidl_next::FromWire::from_wire(wire.key),
130
131            value: ::fidl_next::FromWire::from_wire(wire.value),
132        }
133    }
134}
135
136impl<'de> ::fidl_next::FromWireRef<WireDictionaryEntry<'de>> for DictionaryEntry {
137    #[inline]
138    fn from_wire_ref(wire: &WireDictionaryEntry<'de>) -> Self {
139        Self {
140            key: ::fidl_next::FromWireRef::from_wire_ref(&wire.key),
141
142            value: ::fidl_next::FromWireRef::from_wire_ref(&wire.value),
143        }
144    }
145}
146
147/// The wire type corresponding to [`DictionaryEntry`].
148#[derive(Debug)]
149#[repr(C)]
150pub struct WireDictionaryEntry<'de> {
151    pub key: ::fidl_next::WireString<'de>,
152
153    pub value: crate::WireOptionalDictionaryValue<'de>,
154}
155
156unsafe impl ::fidl_next::Wire for WireDictionaryEntry<'static> {
157    type Decoded<'de> = WireDictionaryEntry<'de>;
158
159    #[inline]
160    fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
161}
162
163unsafe impl<___D> ::fidl_next::Decode<___D> for WireDictionaryEntry<'static>
164where
165    ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
166
167    ___D: ::fidl_next::Decoder,
168{
169    fn decode(
170        slot: ::fidl_next::Slot<'_, Self>,
171        decoder: &mut ___D,
172    ) -> Result<(), ::fidl_next::DecodeError> {
173        ::fidl_next::munge! {
174            let Self {
175                mut key,
176                mut value,
177
178            } = slot;
179        }
180
181        ::fidl_next::Decode::decode(key.as_mut(), decoder)?;
182
183        let key = unsafe { key.deref_unchecked() };
184
185        if key.len() > 1024 {
186            return Err(::fidl_next::DecodeError::VectorTooLong {
187                size: key.len() as u64,
188                limit: 1024,
189            });
190        }
191
192        ::fidl_next::Decode::decode(value.as_mut(), decoder)?;
193
194        Ok(())
195    }
196}
197
198#[doc = " A dictionary is a sequence of key/value pairs.\n Keys must be unique and sorted in lexicographically increasing order.\n"]
199#[derive(Clone, Debug, Default)]
200pub struct Dictionary {
201    pub entries: Option<Vec<crate::DictionaryEntry>>,
202}
203
204impl Dictionary {
205    fn __max_ordinal(&self) -> usize {
206        if self.entries.is_some() {
207            return 1;
208        }
209
210        0
211    }
212}
213
214impl ::fidl_next::Encodable for Dictionary {
215    type Encoded = WireDictionary<'static>;
216}
217
218unsafe impl<___E> ::fidl_next::Encode<___E> for Dictionary
219where
220    ___E: ::fidl_next::Encoder + ?Sized,
221{
222    #[inline]
223    fn encode(
224        mut self,
225        encoder: &mut ___E,
226        out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
227    ) -> Result<(), ::fidl_next::EncodeError> {
228        ::fidl_next::munge!(let WireDictionary { table } = out);
229
230        let max_ord = self.__max_ordinal();
231
232        let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
233        ::fidl_next::Wire::zero_padding(&mut out);
234
235        let mut preallocated =
236            ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
237
238        for i in 1..=max_ord {
239            match i {
240                1 => {
241                    if let Some(entries) = self.entries.take() {
242                        ::fidl_next::WireEnvelope::encode_value(
243                            entries,
244                            preallocated.encoder,
245                            &mut out,
246                        )?;
247                    } else {
248                        ::fidl_next::WireEnvelope::encode_zero(&mut out)
249                    }
250                }
251
252                _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
253            }
254            unsafe {
255                preallocated.write_next(out.assume_init_ref());
256            }
257        }
258
259        ::fidl_next::WireTable::encode_len(table, max_ord);
260
261        Ok(())
262    }
263}
264
265unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Dictionary
266where
267    ___E: ::fidl_next::Encoder + ?Sized,
268{
269    #[inline]
270    fn encode_ref(
271        &self,
272        encoder: &mut ___E,
273        out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
274    ) -> Result<(), ::fidl_next::EncodeError> {
275        ::fidl_next::munge!(let WireDictionary { table } = out);
276
277        let max_ord = self.__max_ordinal();
278
279        let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
280        ::fidl_next::Wire::zero_padding(&mut out);
281
282        let mut preallocated =
283            ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
284
285        for i in 1..=max_ord {
286            match i {
287                1 => {
288                    if let Some(entries) = &self.entries {
289                        ::fidl_next::WireEnvelope::encode_value(
290                            entries,
291                            preallocated.encoder,
292                            &mut out,
293                        )?;
294                    } else {
295                        ::fidl_next::WireEnvelope::encode_zero(&mut out)
296                    }
297                }
298
299                _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
300            }
301            unsafe {
302                preallocated.write_next(out.assume_init_ref());
303            }
304        }
305
306        ::fidl_next::WireTable::encode_len(table, max_ord);
307
308        Ok(())
309    }
310}
311
312impl<'de> ::fidl_next::FromWire<WireDictionary<'de>> for Dictionary {
313    #[inline]
314    fn from_wire(wire: WireDictionary<'de>) -> Self {
315        let wire = ::core::mem::ManuallyDrop::new(wire);
316
317        let entries = wire.table.get(1);
318
319        Self {
320
321
322                entries: entries.map(|envelope| ::fidl_next::FromWire::from_wire(
323                    unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireDictionaryEntry<'de>>>() }
324                )),
325
326        }
327    }
328}
329
330impl<'de> ::fidl_next::FromWireRef<WireDictionary<'de>> for Dictionary {
331    #[inline]
332    fn from_wire_ref(wire: &WireDictionary<'de>) -> Self {
333        Self {
334
335
336                entries: wire.table.get(1)
337                    .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
338                        unsafe { envelope.deref_unchecked::<::fidl_next::WireVector<'de, crate::WireDictionaryEntry<'de>>>() }
339                    )),
340
341        }
342    }
343}
344
345/// The wire type corresponding to [`Dictionary`].
346#[repr(C)]
347pub struct WireDictionary<'de> {
348    table: ::fidl_next::WireTable<'de>,
349}
350
351impl<'de> Drop for WireDictionary<'de> {
352    fn drop(&mut self) {
353        let _ = self.table.get(1)
354                .map(|envelope| unsafe {
355                    envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::WireDictionaryEntry<'de>>>()
356                });
357    }
358}
359
360unsafe impl ::fidl_next::Wire for WireDictionary<'static> {
361    type Decoded<'de> = WireDictionary<'de>;
362
363    #[inline]
364    fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
365        ::fidl_next::munge!(let Self { table } = out);
366        ::fidl_next::WireTable::zero_padding(table);
367    }
368}
369
370unsafe impl<___D> ::fidl_next::Decode<___D> for WireDictionary<'static>
371where
372    ___D: ::fidl_next::Decoder + ?Sized,
373{
374    fn decode(
375        slot: ::fidl_next::Slot<'_, Self>,
376        decoder: &mut ___D,
377    ) -> Result<(), ::fidl_next::DecodeError> {
378        ::fidl_next::munge!(let Self { table } = slot);
379
380        ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
381            match ordinal {
382                0 => unsafe { ::core::hint::unreachable_unchecked() },
383
384                1 => {
385                    ::fidl_next::WireEnvelope::decode_as::<
386                        ___D,
387                        ::fidl_next::WireVector<'static, crate::WireDictionaryEntry<'static>>,
388                    >(slot.as_mut(), decoder)?;
389
390                    let entries = unsafe {
391                        slot
392                                            .deref_unchecked()
393                                            .deref_unchecked::<
394                                                ::fidl_next::WireVector<'_, crate::WireDictionaryEntry<'_>>
395                                            >()
396                    };
397
398                    if entries.len() > 1024 {
399                        return Err(::fidl_next::DecodeError::VectorTooLong {
400                            size: entries.len() as u64,
401                            limit: 1024,
402                        });
403                    }
404
405                    Ok(())
406                }
407
408                _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
409            }
410        })
411    }
412}
413
414impl<'de> WireDictionary<'de> {
415    pub fn entries(
416        &self,
417    ) -> Option<&::fidl_next::WireVector<'de, crate::WireDictionaryEntry<'de>>> {
418        unsafe { Some(self.table.get(1)?.deref_unchecked()) }
419    }
420}
421
422impl<'de> ::core::fmt::Debug for WireDictionary<'de> {
423    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
424        f.debug_struct("Dictionary").field("entries", &self.entries()).finish()
425    }
426}
427
428pub const MAX_NUM_VALUE_ITEMS: u32 = 1024;
429
430pub const MAX_VALUE_LENGTH: u32 = 32768;
431
432#[doc = " A dictionary\'s value is a string, a list of strings, or a list of objects.\n"]
433#[derive(Clone, Debug)]
434pub enum DictionaryValue {
435    Str(String),
436
437    StrVec(Vec<String>),
438
439    ObjVec(Vec<crate::Dictionary>),
440
441    UnknownOrdinal_(u64),
442}
443
444impl ::fidl_next::Encodable for DictionaryValue {
445    type Encoded = WireDictionaryValue<'static>;
446}
447
448unsafe impl<___E> ::fidl_next::Encode<___E> for DictionaryValue
449where
450    ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
451
452    ___E: ::fidl_next::Encoder,
453{
454    #[inline]
455    fn encode(
456        self,
457        encoder: &mut ___E,
458        out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
459    ) -> Result<(), ::fidl_next::EncodeError> {
460        ::fidl_next::munge!(let WireDictionaryValue { raw, _phantom: _ } = out);
461
462        match self {
463            Self::Str(value) => {
464                ::fidl_next::RawWireUnion::encode_as::<___E, String>(value, 1, encoder, raw)?
465            }
466
467            Self::StrVec(value) => {
468                ::fidl_next::RawWireUnion::encode_as::<___E, Vec<String>>(value, 2, encoder, raw)?
469            }
470
471            Self::ObjVec(value) => ::fidl_next::RawWireUnion::encode_as::<
472                ___E,
473                Vec<crate::Dictionary>,
474            >(value, 3, encoder, raw)?,
475
476            Self::UnknownOrdinal_(ordinal) => {
477                return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize))
478            }
479        }
480
481        Ok(())
482    }
483}
484
485unsafe impl<___E> ::fidl_next::EncodeRef<___E> for DictionaryValue
486where
487    ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
488
489    ___E: ::fidl_next::Encoder,
490{
491    #[inline]
492    fn encode_ref(
493        &self,
494        encoder: &mut ___E,
495        out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
496    ) -> Result<(), ::fidl_next::EncodeError> {
497        ::fidl_next::munge!(let WireDictionaryValue { raw, _phantom: _ } = out);
498
499        match self {
500            Self::Str(value) => {
501                ::fidl_next::RawWireUnion::encode_as::<___E, &String>(value, 1, encoder, raw)?
502            }
503
504            Self::StrVec(value) => {
505                ::fidl_next::RawWireUnion::encode_as::<___E, &Vec<String>>(value, 2, encoder, raw)?
506            }
507
508            Self::ObjVec(value) => ::fidl_next::RawWireUnion::encode_as::<
509                ___E,
510                &Vec<crate::Dictionary>,
511            >(value, 3, encoder, raw)?,
512
513            Self::UnknownOrdinal_(ordinal) => {
514                return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize))
515            }
516        }
517
518        Ok(())
519    }
520}
521
522impl ::fidl_next::EncodableOption for DictionaryValue {
523    type EncodedOption = WireOptionalDictionaryValue<'static>;
524}
525
526unsafe impl<___E> ::fidl_next::EncodeOption<___E> for DictionaryValue
527where
528    ___E: ?Sized,
529    DictionaryValue: ::fidl_next::Encode<___E>,
530{
531    #[inline]
532    fn encode_option(
533        this: Option<Self>,
534        encoder: &mut ___E,
535        out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
536    ) -> Result<(), ::fidl_next::EncodeError> {
537        ::fidl_next::munge!(let WireOptionalDictionaryValue { raw, _phantom: _ } = &mut *out);
538
539        if let Some(inner) = this {
540            let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
541            ::fidl_next::Encode::encode(inner, encoder, value_out)?;
542        } else {
543            ::fidl_next::RawWireUnion::encode_absent(raw);
544        }
545
546        Ok(())
547    }
548}
549
550unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for DictionaryValue
551where
552    ___E: ?Sized,
553    DictionaryValue: ::fidl_next::EncodeRef<___E>,
554{
555    #[inline]
556    fn encode_option_ref(
557        this: Option<&Self>,
558        encoder: &mut ___E,
559        out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
560    ) -> Result<(), ::fidl_next::EncodeError> {
561        ::fidl_next::munge!(let WireOptionalDictionaryValue { raw, _phantom: _ } = &mut *out);
562
563        if let Some(inner) = this {
564            let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
565            ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out)?;
566        } else {
567            ::fidl_next::RawWireUnion::encode_absent(raw);
568        }
569
570        Ok(())
571    }
572}
573
574impl<'de> ::fidl_next::FromWire<WireDictionaryValue<'de>> for DictionaryValue {
575    #[inline]
576    fn from_wire(wire: WireDictionaryValue<'de>) -> Self {
577        let wire = ::core::mem::ManuallyDrop::new(wire);
578        match wire.raw.ordinal() {
579            1 => Self::Str(::fidl_next::FromWire::from_wire(unsafe {
580                wire.raw.get().read_unchecked::<::fidl_next::WireString<'de>>()
581            })),
582
583            2 => {
584                Self::StrVec(::fidl_next::FromWire::from_wire(unsafe {
585                    wire.raw.get().read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>>()
586                }))
587            }
588
589            3 => Self::ObjVec(::fidl_next::FromWire::from_wire(unsafe {
590                wire.raw
591                    .get()
592                    .read_unchecked::<::fidl_next::WireVector<'de, crate::WireDictionary<'de>>>()
593            })),
594
595            _ => unsafe { ::core::hint::unreachable_unchecked() },
596        }
597    }
598}
599
600impl<'de> ::fidl_next::FromWireRef<WireDictionaryValue<'de>> for DictionaryValue {
601    #[inline]
602    fn from_wire_ref(wire: &WireDictionaryValue<'de>) -> Self {
603        match wire.raw.ordinal() {
604            1 => Self::Str(::fidl_next::FromWireRef::from_wire_ref(unsafe {
605                wire.raw.get().deref_unchecked::<::fidl_next::WireString<'de>>()
606            })),
607
608            2 => {
609                Self::StrVec(::fidl_next::FromWireRef::from_wire_ref(unsafe {
610                    wire.raw.get().deref_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>>()
611                }))
612            }
613
614            3 => {
615                Self::ObjVec(::fidl_next::FromWireRef::from_wire_ref(unsafe {
616                    wire.raw.get().deref_unchecked::<::fidl_next::WireVector<'de, crate::WireDictionary<'de>>>()
617                }))
618            }
619
620            _ => unsafe { ::core::hint::unreachable_unchecked() },
621        }
622    }
623}
624
625impl<'de> ::fidl_next::FromWireOption<WireOptionalDictionaryValue<'de>> for Box<DictionaryValue> {
626    #[inline]
627    fn from_wire_option(wire: WireOptionalDictionaryValue<'de>) -> Option<Self> {
628        if let Some(inner) = wire.into_option() {
629            Some(Box::new(::fidl_next::FromWire::from_wire(inner)))
630        } else {
631            None
632        }
633    }
634}
635
636impl<'de> ::fidl_next::FromWireOptionRef<WireOptionalDictionaryValue<'de>>
637    for Box<DictionaryValue>
638{
639    #[inline]
640    fn from_wire_option_ref(wire: &WireOptionalDictionaryValue<'de>) -> Option<Self> {
641        if let Some(inner) = wire.as_ref() {
642            Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner)))
643        } else {
644            None
645        }
646    }
647}
648
649/// The wire type corresponding to [`DictionaryValue`].
650#[repr(transparent)]
651pub struct WireDictionaryValue<'de> {
652    raw: ::fidl_next::RawWireUnion,
653    _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
654}
655
656impl<'de> Drop for WireDictionaryValue<'de> {
657    fn drop(&mut self) {
658        match self.raw.ordinal() {
659            1 => {
660                let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireString<'de>>() };
661            }
662
663            2 => {
664                let _ = unsafe {
665                    self.raw.get().read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>>()
666                };
667            }
668
669            3 => {
670                let _ = unsafe {
671                    self.raw
672                        .get()
673                        .read_unchecked::<::fidl_next::WireVector<'de, crate::WireDictionary<'de>>>(
674                        )
675                };
676            }
677
678            _ => (),
679        }
680    }
681}
682
683unsafe impl ::fidl_next::Wire for WireDictionaryValue<'static> {
684    type Decoded<'de> = WireDictionaryValue<'de>;
685
686    #[inline]
687    fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
688        ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
689        ::fidl_next::RawWireUnion::zero_padding(raw);
690    }
691}
692
693pub mod dictionary_value {
694    pub enum Ref<'de> {
695        Str(&'de ::fidl_next::WireString<'de>),
696
697        StrVec(&'de ::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>),
698
699        ObjVec(&'de ::fidl_next::WireVector<'de, crate::WireDictionary<'de>>),
700
701        UnknownOrdinal_(u64),
702    }
703}
704
705impl<'de> WireDictionaryValue<'de> {
706    pub fn as_ref(&self) -> crate::dictionary_value::Ref<'_> {
707        match self.raw.ordinal() {
708            1 => crate::dictionary_value::Ref::Str(unsafe {
709                self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>()
710            }),
711
712            2 => {
713                crate::dictionary_value::Ref::StrVec(unsafe {
714                    self.raw.get().deref_unchecked::<::fidl_next::WireVector<'_, ::fidl_next::WireString<'_>>>()
715                })
716            }
717
718            3 => crate::dictionary_value::Ref::ObjVec(unsafe {
719                self.raw
720                    .get()
721                    .deref_unchecked::<::fidl_next::WireVector<'_, crate::WireDictionary<'_>>>()
722            }),
723
724            unknown => crate::dictionary_value::Ref::UnknownOrdinal_(unknown),
725        }
726    }
727}
728
729unsafe impl<___D> ::fidl_next::Decode<___D> for WireDictionaryValue<'static>
730where
731    ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
732
733    ___D: ::fidl_next::Decoder,
734{
735    fn decode(
736        mut slot: ::fidl_next::Slot<'_, Self>,
737        decoder: &mut ___D,
738    ) -> Result<(), ::fidl_next::DecodeError> {
739        ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
740        match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
741            1 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString<'static>>(
742                raw, decoder,
743            )?,
744
745            2 => ::fidl_next::RawWireUnion::decode_as::<
746                ___D,
747                ::fidl_next::WireVector<'static, ::fidl_next::WireString<'static>>,
748            >(raw, decoder)?,
749
750            3 => ::fidl_next::RawWireUnion::decode_as::<
751                ___D,
752                ::fidl_next::WireVector<'static, crate::WireDictionary<'static>>,
753            >(raw, decoder)?,
754
755            _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
756        }
757
758        Ok(())
759    }
760}
761
762impl<'de> ::core::fmt::Debug for WireDictionaryValue<'de> {
763    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
764        match self.raw.ordinal() {
765            1 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>().fmt(f) },
766            2 => unsafe {
767                self.raw
768                    .get()
769                    .deref_unchecked::<::fidl_next::WireVector<'_, ::fidl_next::WireString<'_>>>()
770                    .fmt(f)
771            },
772            3 => unsafe {
773                self.raw
774                    .get()
775                    .deref_unchecked::<::fidl_next::WireVector<'_, crate::WireDictionary<'_>>>()
776                    .fmt(f)
777            },
778            _ => unsafe { ::core::hint::unreachable_unchecked() },
779        }
780    }
781}
782
783#[repr(transparent)]
784pub struct WireOptionalDictionaryValue<'de> {
785    raw: ::fidl_next::RawWireUnion,
786    _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
787}
788
789unsafe impl ::fidl_next::Wire for WireOptionalDictionaryValue<'static> {
790    type Decoded<'de> = WireOptionalDictionaryValue<'de>;
791
792    #[inline]
793    fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
794        ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
795        ::fidl_next::RawWireUnion::zero_padding(raw);
796    }
797}
798
799impl<'de> WireOptionalDictionaryValue<'de> {
800    pub fn is_some(&self) -> bool {
801        self.raw.is_some()
802    }
803
804    pub fn is_none(&self) -> bool {
805        self.raw.is_none()
806    }
807
808    pub fn as_ref(&self) -> Option<&WireDictionaryValue<'de>> {
809        if self.is_some() {
810            Some(unsafe { &*(self as *const Self).cast() })
811        } else {
812            None
813        }
814    }
815
816    pub fn into_option(self) -> Option<WireDictionaryValue<'de>> {
817        if self.is_some() {
818            Some(WireDictionaryValue { raw: self.raw, _phantom: ::core::marker::PhantomData })
819        } else {
820            None
821        }
822    }
823}
824
825unsafe impl<___D> ::fidl_next::Decode<___D> for WireOptionalDictionaryValue<'static>
826where
827    ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
828
829    ___D: ::fidl_next::Decoder,
830{
831    fn decode(
832        mut slot: ::fidl_next::Slot<'_, Self>,
833        decoder: &mut ___D,
834    ) -> Result<(), ::fidl_next::DecodeError> {
835        ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
836        match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
837            1 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString<'static>>(
838                raw, decoder,
839            )?,
840
841            2 => ::fidl_next::RawWireUnion::decode_as::<
842                ___D,
843                ::fidl_next::WireVector<'static, ::fidl_next::WireString<'static>>,
844            >(raw, decoder)?,
845
846            3 => ::fidl_next::RawWireUnion::decode_as::<
847                ___D,
848                ::fidl_next::WireVector<'static, crate::WireDictionary<'static>>,
849            >(raw, decoder)?,
850
851            0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
852            _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
853        }
854
855        Ok(())
856    }
857}
858
859impl<'de> ::core::fmt::Debug for WireOptionalDictionaryValue<'de> {
860    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
861        self.as_ref().fmt(f)
862    }
863}
864
865/// Compatibility shims which mimic some API surfaces of the current Rust bindings.
866pub mod compat {}