Skip to main content

fidl_next_common_fuchsia_driver_metadata/
fidl_next_common_fuchsia_driver_metadata.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 mod natural {
6
7    #[doc = " A dictionary\'s value is an integer or a list of integers.\n"]
8    #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
9    pub enum DictionaryValue {
10        Int64(i64),
11
12        Int64Vec(::std::vec::Vec<i64>),
13
14        UnknownOrdinal_(u64),
15    }
16
17    impl DictionaryValue {
18        pub fn is_unknown(&self) -> bool {
19            #[allow(unreachable_patterns)]
20            match self {
21                Self::UnknownOrdinal_(_) => true,
22                _ => false,
23            }
24        }
25    }
26
27    unsafe impl<___E> ::fidl_next::Encode<crate::wire::DictionaryValue<'static>, ___E>
28        for DictionaryValue
29    where
30        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
31        ___E: ::fidl_next::Encoder,
32    {
33        #[inline]
34        fn encode(
35            self,
36            encoder: &mut ___E,
37            out: &mut ::core::mem::MaybeUninit<crate::wire::DictionaryValue<'static>>,
38            _: (),
39        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
40            ::fidl_next::munge!(let crate::wire::DictionaryValue { raw, _phantom: _ } = out);
41
42            match self {
43                Self::Int64(value) => ::fidl_next::wire::Union::encode_as::<
44                    ___E,
45                    ::fidl_next::wire::Int64,
46                >(value, 1, encoder, raw, ())?,
47
48                Self::Int64Vec(value) => ::fidl_next::wire::Union::encode_as::<
49                    ___E,
50                    ::fidl_next::wire::Vector<'static, ::fidl_next::wire::Int64>,
51                >(value, 2, encoder, raw, (1024, ()))?,
52
53                Self::UnknownOrdinal_(ordinal) => {
54                    return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize));
55                }
56            }
57
58            Ok(())
59        }
60    }
61
62    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DictionaryValue<'static>, ___E>
63        for &'a DictionaryValue
64    where
65        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
66        ___E: ::fidl_next::Encoder,
67    {
68        #[inline]
69        fn encode(
70            self,
71            encoder: &mut ___E,
72            out: &mut ::core::mem::MaybeUninit<crate::wire::DictionaryValue<'static>>,
73            _: (),
74        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
75            ::fidl_next::munge!(let crate::wire::DictionaryValue { raw, _phantom: _ } = out);
76
77            match self {
78                DictionaryValue::Int64(value) => ::fidl_next::wire::Union::encode_as::<
79                    ___E,
80                    ::fidl_next::wire::Int64,
81                >(value, 1, encoder, raw, ())?,
82
83                DictionaryValue::Int64Vec(value) => {
84                    ::fidl_next::wire::Union::encode_as::<
85                        ___E,
86                        ::fidl_next::wire::Vector<'static, ::fidl_next::wire::Int64>,
87                    >(value, 2, encoder, raw, (1024, ()))?
88                }
89
90                DictionaryValue::UnknownOrdinal_(ordinal) => {
91                    return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize));
92                }
93            }
94
95            Ok(())
96        }
97    }
98
99    unsafe impl<___E>
100        ::fidl_next::EncodeOption<crate::wire_optional::DictionaryValue<'static>, ___E>
101        for DictionaryValue
102    where
103        ___E: ?Sized,
104        DictionaryValue: ::fidl_next::Encode<crate::wire::DictionaryValue<'static>, ___E>,
105    {
106        #[inline]
107        fn encode_option(
108            this: ::core::option::Option<Self>,
109            encoder: &mut ___E,
110            out: &mut ::core::mem::MaybeUninit<crate::wire_optional::DictionaryValue<'static>>,
111            _: (),
112        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
113            ::fidl_next::munge!(let crate::wire_optional::DictionaryValue { raw, _phantom: _ } = &mut *out);
114
115            if let Some(inner) = this {
116                let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
117                ::fidl_next::Encode::encode(inner, encoder, value_out, ())?;
118            } else {
119                ::fidl_next::wire::Union::encode_absent(raw);
120            }
121
122            Ok(())
123        }
124    }
125
126    unsafe impl<'a, ___E>
127        ::fidl_next::EncodeOption<crate::wire_optional::DictionaryValue<'static>, ___E>
128        for &'a DictionaryValue
129    where
130        ___E: ?Sized,
131        &'a DictionaryValue: ::fidl_next::Encode<crate::wire::DictionaryValue<'static>, ___E>,
132    {
133        #[inline]
134        fn encode_option(
135            this: ::core::option::Option<Self>,
136            encoder: &mut ___E,
137            out: &mut ::core::mem::MaybeUninit<crate::wire_optional::DictionaryValue<'static>>,
138            _: (),
139        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
140            ::fidl_next::munge!(let crate::wire_optional::DictionaryValue { raw, _phantom: _ } = &mut *out);
141
142            if let Some(inner) = this {
143                let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
144                ::fidl_next::Encode::encode(inner, encoder, value_out, ())?;
145            } else {
146                ::fidl_next::wire::Union::encode_absent(raw);
147            }
148
149            Ok(())
150        }
151    }
152
153    impl<'de> ::fidl_next::FromWire<crate::wire::DictionaryValue<'de>> for DictionaryValue {
154        #[inline]
155        fn from_wire(wire: crate::wire::DictionaryValue<'de>) -> Self {
156            let wire = ::core::mem::ManuallyDrop::new(wire);
157            match wire.raw.ordinal() {
158                1 => Self::Int64(::fidl_next::FromWire::from_wire(unsafe {
159                    wire.raw.get().read_unchecked::<::fidl_next::wire::Int64>()
160                })),
161
162                2 => {
163                    Self::Int64Vec(::fidl_next::FromWire::from_wire(unsafe {
164                        wire.raw.get().read_unchecked::<::fidl_next::wire::Vector<'de, ::fidl_next::wire::Int64>>()
165                    }))
166                }
167
168                ord => return Self::UnknownOrdinal_(ord as u64),
169            }
170        }
171    }
172
173    impl<'de> ::fidl_next::FromWireRef<crate::wire::DictionaryValue<'de>> for DictionaryValue {
174        #[inline]
175        fn from_wire_ref(wire: &crate::wire::DictionaryValue<'de>) -> Self {
176            match wire.raw.ordinal() {
177                1 => Self::Int64(::fidl_next::FromWireRef::from_wire_ref(unsafe {
178                    wire.raw.get().deref_unchecked::<::fidl_next::wire::Int64>()
179                })),
180
181                2 => Self::Int64Vec(::fidl_next::FromWireRef::from_wire_ref(unsafe {
182                    wire.raw.get().deref_unchecked::<::fidl_next::wire::Vector<'de, ::fidl_next::wire::Int64>>()
183                })),
184
185                ord => return Self::UnknownOrdinal_(ord as u64),
186            }
187        }
188    }
189
190    impl<'de> ::fidl_next::FromWireOption<crate::wire_optional::DictionaryValue<'de>>
191        for DictionaryValue
192    {
193        #[inline]
194        fn from_wire_option(
195            wire: crate::wire_optional::DictionaryValue<'de>,
196        ) -> ::core::option::Option<Self> {
197            if let Some(inner) = wire.into_option() {
198                Some(::fidl_next::FromWire::from_wire(inner))
199            } else {
200                None
201            }
202        }
203    }
204
205    impl<'de> ::fidl_next::FromWireOption<crate::wire_optional::DictionaryValue<'de>>
206        for Box<DictionaryValue>
207    {
208        #[inline]
209        fn from_wire_option(
210            wire: crate::wire_optional::DictionaryValue<'de>,
211        ) -> ::core::option::Option<Self> {
212            <DictionaryValue as ::fidl_next::FromWireOption<
213                crate::wire_optional::DictionaryValue<'de>,
214            >>::from_wire_option(wire)
215            .map(Box::new)
216        }
217    }
218
219    impl<'de> ::fidl_next::FromWireOptionRef<crate::wire_optional::DictionaryValue<'de>>
220        for Box<DictionaryValue>
221    {
222        #[inline]
223        fn from_wire_option_ref(
224            wire: &crate::wire_optional::DictionaryValue<'de>,
225        ) -> ::core::option::Option<Self> {
226            if let Some(inner) = wire.as_ref() {
227                Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner)))
228            } else {
229                None
230            }
231        }
232    }
233
234    #[doc = " A key/value pair in a `Dictionary`.\n"]
235    #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
236    pub struct DictionaryEntry {
237        pub key: ::std::string::String,
238
239        pub value: crate::natural::DictionaryValue,
240    }
241
242    unsafe impl<___E> ::fidl_next::Encode<crate::wire::DictionaryEntry<'static>, ___E>
243        for DictionaryEntry
244    where
245        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
246        ___E: ::fidl_next::Encoder,
247    {
248        #[inline]
249        fn encode(
250            self,
251            encoder_: &mut ___E,
252            out_: &mut ::core::mem::MaybeUninit<crate::wire::DictionaryEntry<'static>>,
253            _: (),
254        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
255            ::fidl_next::munge! {
256                let crate::wire::DictionaryEntry {
257                    key,
258                    value,
259
260                } = out_;
261            }
262
263            ::fidl_next::Encode::encode(self.key, encoder_, key, 1024)?;
264
265            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(key.as_mut_ptr()) };
266            ::fidl_next::Constrained::validate(_field, 1024)?;
267
268            ::fidl_next::Encode::encode(self.value, encoder_, value, ())?;
269
270            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(value.as_mut_ptr()) };
271
272            Ok(())
273        }
274    }
275
276    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DictionaryEntry<'static>, ___E>
277        for &'a DictionaryEntry
278    where
279        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
280        ___E: ::fidl_next::Encoder,
281    {
282        #[inline]
283        fn encode(
284            self,
285            encoder_: &mut ___E,
286            out_: &mut ::core::mem::MaybeUninit<crate::wire::DictionaryEntry<'static>>,
287            _: (),
288        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
289            ::fidl_next::munge! {
290                let crate::wire::DictionaryEntry {
291                    key,
292                    value,
293
294                } = out_;
295            }
296
297            ::fidl_next::Encode::encode(&self.key, encoder_, key, 1024)?;
298
299            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(key.as_mut_ptr()) };
300            ::fidl_next::Constrained::validate(_field, 1024)?;
301
302            ::fidl_next::Encode::encode(&self.value, encoder_, value, ())?;
303
304            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(value.as_mut_ptr()) };
305
306            Ok(())
307        }
308    }
309
310    unsafe impl<___E>
311        ::fidl_next::EncodeOption<
312            ::fidl_next::wire::Box<'static, crate::wire::DictionaryEntry<'static>>,
313            ___E,
314        > for DictionaryEntry
315    where
316        ___E: ::fidl_next::Encoder + ?Sized,
317        DictionaryEntry: ::fidl_next::Encode<crate::wire::DictionaryEntry<'static>, ___E>,
318    {
319        #[inline]
320        fn encode_option(
321            this: ::core::option::Option<Self>,
322            encoder: &mut ___E,
323            out: &mut ::core::mem::MaybeUninit<
324                ::fidl_next::wire::Box<'static, crate::wire::DictionaryEntry<'static>>,
325            >,
326            _: (),
327        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
328            if let Some(inner) = this {
329                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
330                ::fidl_next::wire::Box::encode_present(out);
331            } else {
332                ::fidl_next::wire::Box::encode_absent(out);
333            }
334
335            Ok(())
336        }
337    }
338
339    unsafe impl<'a, ___E>
340        ::fidl_next::EncodeOption<
341            ::fidl_next::wire::Box<'static, crate::wire::DictionaryEntry<'static>>,
342            ___E,
343        > for &'a DictionaryEntry
344    where
345        ___E: ::fidl_next::Encoder + ?Sized,
346        &'a DictionaryEntry: ::fidl_next::Encode<crate::wire::DictionaryEntry<'static>, ___E>,
347    {
348        #[inline]
349        fn encode_option(
350            this: ::core::option::Option<Self>,
351            encoder: &mut ___E,
352            out: &mut ::core::mem::MaybeUninit<
353                ::fidl_next::wire::Box<'static, crate::wire::DictionaryEntry<'static>>,
354            >,
355            _: (),
356        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
357            if let Some(inner) = this {
358                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
359                ::fidl_next::wire::Box::encode_present(out);
360            } else {
361                ::fidl_next::wire::Box::encode_absent(out);
362            }
363
364            Ok(())
365        }
366    }
367
368    impl<'de> ::fidl_next::FromWire<crate::wire::DictionaryEntry<'de>> for DictionaryEntry {
369        #[inline]
370        fn from_wire(wire: crate::wire::DictionaryEntry<'de>) -> Self {
371            Self {
372                key: ::fidl_next::FromWire::from_wire(wire.key),
373
374                value: ::fidl_next::FromWire::from_wire(wire.value),
375            }
376        }
377    }
378
379    impl<'de> ::fidl_next::FromWireRef<crate::wire::DictionaryEntry<'de>> for DictionaryEntry {
380        #[inline]
381        fn from_wire_ref(wire: &crate::wire::DictionaryEntry<'de>) -> Self {
382            Self {
383                key: ::fidl_next::FromWireRef::from_wire_ref(&wire.key),
384
385                value: ::fidl_next::FromWireRef::from_wire_ref(&wire.value),
386            }
387        }
388    }
389
390    #[doc = " A dictionary-like structure for generic metadata.\n"]
391    #[derive(Debug, Default, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
392    pub struct Dictionary {
393        pub entries: ::core::option::Option<::std::vec::Vec<crate::natural::DictionaryEntry>>,
394    }
395
396    impl Dictionary {
397        fn __max_ordinal(&self) -> usize {
398            if self.entries.is_some() {
399                return 1;
400            }
401
402            0
403        }
404    }
405
406    unsafe impl<___E> ::fidl_next::Encode<crate::wire::Dictionary<'static>, ___E> for Dictionary
407    where
408        ___E: ::fidl_next::Encoder + ?Sized,
409    {
410        #[inline]
411        fn encode(
412            mut self,
413            encoder: &mut ___E,
414            out: &mut ::core::mem::MaybeUninit<crate::wire::Dictionary<'static>>,
415            _: (),
416        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
417            ::fidl_next::munge!(let crate::wire::Dictionary { table } = out);
418
419            let max_ord = self.__max_ordinal();
420
421            let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
422            ::fidl_next::Wire::zero_padding(&mut out);
423
424            let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
425                ::fidl_next::wire::Envelope,
426            >(encoder, max_ord);
427
428            for i in 1..=max_ord {
429                match i {
430                    1 => {
431                        if let Some(value) = self.entries.take() {
432                            ::fidl_next::wire::Envelope::encode_value::<
433                                ::fidl_next::wire::Vector<
434                                    'static,
435                                    crate::wire::DictionaryEntry<'static>,
436                                >,
437                                ___E,
438                            >(
439                                value, preallocated.encoder, &mut out, (1024, ())
440                            )?;
441                        } else {
442                            ::fidl_next::wire::Envelope::encode_zero(&mut out)
443                        }
444                    }
445
446                    _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
447                }
448                unsafe {
449                    preallocated.write_next(out.assume_init_ref());
450                }
451            }
452
453            ::fidl_next::wire::Table::encode_len(table, max_ord);
454
455            Ok(())
456        }
457    }
458
459    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::Dictionary<'static>, ___E> for &'a Dictionary
460    where
461        ___E: ::fidl_next::Encoder + ?Sized,
462    {
463        #[inline]
464        fn encode(
465            self,
466            encoder: &mut ___E,
467            out: &mut ::core::mem::MaybeUninit<crate::wire::Dictionary<'static>>,
468            _: (),
469        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
470            ::fidl_next::munge!(let crate::wire::Dictionary { table } = out);
471
472            let max_ord = self.__max_ordinal();
473
474            let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
475            ::fidl_next::Wire::zero_padding(&mut out);
476
477            let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
478                ::fidl_next::wire::Envelope,
479            >(encoder, max_ord);
480
481            for i in 1..=max_ord {
482                match i {
483                    1 => {
484                        if let Some(value) = &self.entries {
485                            ::fidl_next::wire::Envelope::encode_value::<
486                                ::fidl_next::wire::Vector<
487                                    'static,
488                                    crate::wire::DictionaryEntry<'static>,
489                                >,
490                                ___E,
491                            >(
492                                value, preallocated.encoder, &mut out, (1024, ())
493                            )?;
494                        } else {
495                            ::fidl_next::wire::Envelope::encode_zero(&mut out)
496                        }
497                    }
498
499                    _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
500                }
501                unsafe {
502                    preallocated.write_next(out.assume_init_ref());
503                }
504            }
505
506            ::fidl_next::wire::Table::encode_len(table, max_ord);
507
508            Ok(())
509        }
510    }
511
512    impl<'de> ::fidl_next::FromWire<crate::wire::Dictionary<'de>> for Dictionary {
513        #[inline]
514        fn from_wire(wire_: crate::wire::Dictionary<'de>) -> Self {
515            let wire_ = ::core::mem::ManuallyDrop::new(wire_);
516
517            let entries = wire_.table.get(1);
518
519            Self {
520
521
522                entries: entries.map(|envelope| ::fidl_next::FromWire::from_wire(
523                    unsafe { envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::DictionaryEntry<'de>>>() }
524                )),
525
526        }
527        }
528    }
529
530    impl<'de> ::fidl_next::FromWireRef<crate::wire::Dictionary<'de>> for Dictionary {
531        #[inline]
532        fn from_wire_ref(wire: &crate::wire::Dictionary<'de>) -> Self {
533            Self {
534
535
536                entries: wire.table.get(1)
537                    .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
538                        unsafe { envelope.deref_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::DictionaryEntry<'de>>>() }
539                    )),
540
541        }
542        }
543    }
544
545    #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
546    pub struct MetadataGetPersistedMetadataResponse {
547        pub persisted_metadata: ::std::vec::Vec<u8>,
548    }
549
550    unsafe impl<___E>
551        ::fidl_next::Encode<crate::wire::MetadataGetPersistedMetadataResponse<'static>, ___E>
552        for MetadataGetPersistedMetadataResponse
553    where
554        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
555        ___E: ::fidl_next::Encoder,
556    {
557        #[inline]
558        fn encode(
559            self,
560            encoder_: &mut ___E,
561            out_: &mut ::core::mem::MaybeUninit<
562                crate::wire::MetadataGetPersistedMetadataResponse<'static>,
563            >,
564            _: (),
565        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
566            ::fidl_next::munge! {
567                let crate::wire::MetadataGetPersistedMetadataResponse {
568                    persisted_metadata,
569
570                } = out_;
571            }
572
573            ::fidl_next::Encode::encode(
574                self.persisted_metadata,
575                encoder_,
576                persisted_metadata,
577                (4294967295, ()),
578            )?;
579
580            let mut _field =
581                unsafe { ::fidl_next::Slot::new_unchecked(persisted_metadata.as_mut_ptr()) };
582            ::fidl_next::Constrained::validate(_field, (4294967295, ()))?;
583
584            Ok(())
585        }
586    }
587
588    unsafe impl<'a, ___E>
589        ::fidl_next::Encode<crate::wire::MetadataGetPersistedMetadataResponse<'static>, ___E>
590        for &'a MetadataGetPersistedMetadataResponse
591    where
592        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
593        ___E: ::fidl_next::Encoder,
594    {
595        #[inline]
596        fn encode(
597            self,
598            encoder_: &mut ___E,
599            out_: &mut ::core::mem::MaybeUninit<
600                crate::wire::MetadataGetPersistedMetadataResponse<'static>,
601            >,
602            _: (),
603        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
604            ::fidl_next::munge! {
605                let crate::wire::MetadataGetPersistedMetadataResponse {
606                    persisted_metadata,
607
608                } = out_;
609            }
610
611            ::fidl_next::Encode::encode(
612                &self.persisted_metadata,
613                encoder_,
614                persisted_metadata,
615                (4294967295, ()),
616            )?;
617
618            let mut _field =
619                unsafe { ::fidl_next::Slot::new_unchecked(persisted_metadata.as_mut_ptr()) };
620            ::fidl_next::Constrained::validate(_field, (4294967295, ()))?;
621
622            Ok(())
623        }
624    }
625
626    unsafe impl<___E>
627        ::fidl_next::EncodeOption<
628            ::fidl_next::wire::Box<
629                'static,
630                crate::wire::MetadataGetPersistedMetadataResponse<'static>,
631            >,
632            ___E,
633        > for MetadataGetPersistedMetadataResponse
634    where
635        ___E: ::fidl_next::Encoder + ?Sized,
636        MetadataGetPersistedMetadataResponse:
637            ::fidl_next::Encode<crate::wire::MetadataGetPersistedMetadataResponse<'static>, ___E>,
638    {
639        #[inline]
640        fn encode_option(
641            this: ::core::option::Option<Self>,
642            encoder: &mut ___E,
643            out: &mut ::core::mem::MaybeUninit<
644                ::fidl_next::wire::Box<
645                    'static,
646                    crate::wire::MetadataGetPersistedMetadataResponse<'static>,
647                >,
648            >,
649            _: (),
650        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
651            if let Some(inner) = this {
652                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
653                ::fidl_next::wire::Box::encode_present(out);
654            } else {
655                ::fidl_next::wire::Box::encode_absent(out);
656            }
657
658            Ok(())
659        }
660    }
661
662    unsafe impl<'a, ___E>
663        ::fidl_next::EncodeOption<
664            ::fidl_next::wire::Box<
665                'static,
666                crate::wire::MetadataGetPersistedMetadataResponse<'static>,
667            >,
668            ___E,
669        > for &'a MetadataGetPersistedMetadataResponse
670    where
671        ___E: ::fidl_next::Encoder + ?Sized,
672        &'a MetadataGetPersistedMetadataResponse:
673            ::fidl_next::Encode<crate::wire::MetadataGetPersistedMetadataResponse<'static>, ___E>,
674    {
675        #[inline]
676        fn encode_option(
677            this: ::core::option::Option<Self>,
678            encoder: &mut ___E,
679            out: &mut ::core::mem::MaybeUninit<
680                ::fidl_next::wire::Box<
681                    'static,
682                    crate::wire::MetadataGetPersistedMetadataResponse<'static>,
683                >,
684            >,
685            _: (),
686        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
687            if let Some(inner) = this {
688                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
689                ::fidl_next::wire::Box::encode_present(out);
690            } else {
691                ::fidl_next::wire::Box::encode_absent(out);
692            }
693
694            Ok(())
695        }
696    }
697
698    impl<'de> ::fidl_next::FromWire<crate::wire::MetadataGetPersistedMetadataResponse<'de>>
699        for MetadataGetPersistedMetadataResponse
700    {
701        #[inline]
702        fn from_wire(wire: crate::wire::MetadataGetPersistedMetadataResponse<'de>) -> Self {
703            Self { persisted_metadata: ::fidl_next::FromWire::from_wire(wire.persisted_metadata) }
704        }
705    }
706
707    impl<'de> ::fidl_next::FromWireRef<crate::wire::MetadataGetPersistedMetadataResponse<'de>>
708        for MetadataGetPersistedMetadataResponse
709    {
710        #[inline]
711        fn from_wire_ref(wire: &crate::wire::MetadataGetPersistedMetadataResponse<'de>) -> Self {
712            Self {
713                persisted_metadata: ::fidl_next::FromWireRef::from_wire_ref(
714                    &wire.persisted_metadata,
715                ),
716            }
717        }
718    }
719}
720
721pub mod wire {
722
723    /// The wire type corresponding to [`DictionaryValue`].
724    #[repr(transparent)]
725    pub struct DictionaryValue<'de> {
726        pub(crate) raw: ::fidl_next::wire::Union,
727        pub(crate) _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
728    }
729
730    impl<'de> Drop for DictionaryValue<'de> {
731        fn drop(&mut self) {
732            match self.raw.ordinal() {
733                1 => {
734                    let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::wire::Int64>() };
735                }
736
737                2 => {
738                    let _ = unsafe {
739                        self.raw.get().read_unchecked::<::fidl_next::wire::Vector<'de, ::fidl_next::wire::Int64>>()
740                    };
741                }
742
743                _ => (),
744            }
745        }
746    }
747
748    impl ::fidl_next::Constrained for DictionaryValue<'_> {
749        type Constraint = ();
750
751        fn validate(
752            _: ::fidl_next::Slot<'_, Self>,
753            _: Self::Constraint,
754        ) -> Result<(), ::fidl_next::ValidationError> {
755            Ok(())
756        }
757    }
758
759    unsafe impl ::fidl_next::Wire for DictionaryValue<'static> {
760        type Narrowed<'de> = DictionaryValue<'de>;
761
762        #[inline]
763        fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
764            ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
765            ::fidl_next::wire::Union::zero_padding(raw);
766        }
767    }
768
769    pub mod dictionary_value {
770        pub enum Ref<'de> {
771            Int64(&'de ::fidl_next::wire::Int64),
772
773            Int64Vec(&'de ::fidl_next::wire::Vector<'de, ::fidl_next::wire::Int64>),
774
775            UnknownOrdinal_(u64),
776        }
777
778        pub enum Value<'de> {
779            Int64(::fidl_next::wire::Int64),
780
781            Int64Vec(::fidl_next::wire::Vector<'de, ::fidl_next::wire::Int64>),
782
783            UnknownOrdinal_(u64),
784        }
785    }
786
787    impl<'de> DictionaryValue<'de> {
788        pub fn as_ref(&self) -> crate::wire::dictionary_value::Ref<'_> {
789            match self.raw.ordinal() {
790                1 => crate::wire::dictionary_value::Ref::Int64(unsafe {
791                    self.raw.get().deref_unchecked::<::fidl_next::wire::Int64>()
792                }),
793
794                2 => {
795                    crate::wire::dictionary_value::Ref::Int64Vec(unsafe {
796                        self.raw.get().deref_unchecked::<::fidl_next::wire::Vector<'_, ::fidl_next::wire::Int64>>()
797                    })
798                }
799
800                unknown => crate::wire::dictionary_value::Ref::UnknownOrdinal_(unknown),
801            }
802        }
803
804        pub fn into_inner(self) -> crate::wire::dictionary_value::Value<'de> {
805            let this = ::core::mem::ManuallyDrop::new(self);
806
807            match this.raw.ordinal() {
808                1 => crate::wire::dictionary_value::Value::Int64(unsafe {
809                    this.raw.get().read_unchecked::<::fidl_next::wire::Int64>()
810                }),
811
812                2 => {
813                    crate::wire::dictionary_value::Value::Int64Vec(unsafe {
814                        this.raw.get().read_unchecked::<::fidl_next::wire::Vector<'de, ::fidl_next::wire::Int64>>()
815                    })
816                }
817
818                unknown => crate::wire::dictionary_value::Value::UnknownOrdinal_(unknown),
819            }
820        }
821    }
822
823    unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for DictionaryValue<'de>
824    where
825        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
826        ___D: ::fidl_next::Decoder<'de>,
827    {
828        fn decode(
829            mut slot: ::fidl_next::Slot<'_, Self>,
830            decoder: &mut ___D,
831            _: (),
832        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
833            ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
834            match ::fidl_next::wire::Union::encoded_ordinal(raw.as_mut()) {
835                1 => ::fidl_next::wire::Union::decode_as::<___D, ::fidl_next::wire::Int64>(
836                    raw,
837                    decoder,
838                    (),
839                )?,
840
841                2 => ::fidl_next::wire::Union::decode_as::<
842                    ___D,
843                    ::fidl_next::wire::Vector<'de, ::fidl_next::wire::Int64>,
844                >(raw, decoder, (1024, ()))?,
845
846                _ => ::fidl_next::wire::Union::decode_unknown(raw, decoder)?,
847            }
848
849            Ok(())
850        }
851    }
852
853    impl<'de> ::core::fmt::Debug for DictionaryValue<'de> {
854        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
855            match self.raw.ordinal() {
856                1 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::wire::Int64>().fmt(f) },
857                2 => unsafe {
858                    self.raw
859                        .get()
860                        .deref_unchecked::<::fidl_next::wire::Vector<'_, ::fidl_next::wire::Int64>>(
861                        )
862                        .fmt(f)
863                },
864                _ => unsafe { ::core::hint::unreachable_unchecked() },
865            }
866        }
867    }
868
869    impl<'de> ::fidl_next::IntoNatural for DictionaryValue<'de> {
870        type Natural = crate::natural::DictionaryValue;
871    }
872
873    /// The wire type corresponding to [`DictionaryEntry`].
874    #[derive(Debug)]
875    #[repr(C)]
876    pub struct DictionaryEntry<'de> {
877        pub key: ::fidl_next::wire::String<'de>,
878
879        pub value: crate::wire::DictionaryValue<'de>,
880    }
881
882    static_assertions::const_assert_eq!(std::mem::size_of::<DictionaryEntry<'_>>(), 32);
883    static_assertions::const_assert_eq!(std::mem::align_of::<DictionaryEntry<'_>>(), 8);
884
885    static_assertions::const_assert_eq!(std::mem::offset_of!(DictionaryEntry<'_>, key), 0);
886
887    static_assertions::const_assert_eq!(std::mem::offset_of!(DictionaryEntry<'_>, value), 16);
888
889    impl ::fidl_next::Constrained for DictionaryEntry<'_> {
890        type Constraint = ();
891
892        fn validate(
893            _: ::fidl_next::Slot<'_, Self>,
894            _: Self::Constraint,
895        ) -> Result<(), ::fidl_next::ValidationError> {
896            Ok(())
897        }
898    }
899
900    unsafe impl ::fidl_next::Wire for DictionaryEntry<'static> {
901        type Narrowed<'de> = DictionaryEntry<'de>;
902
903        #[inline]
904        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
905            ::fidl_next::munge! {
906                let Self {
907                    key,
908                    value,
909
910                } = &mut *out_;
911            }
912
913            ::fidl_next::Wire::zero_padding(key);
914
915            ::fidl_next::Wire::zero_padding(value);
916        }
917    }
918
919    unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for DictionaryEntry<'de>
920    where
921        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
922        ___D: ::fidl_next::Decoder<'de>,
923    {
924        fn decode(
925            slot_: ::fidl_next::Slot<'_, Self>,
926            decoder_: &mut ___D,
927            _: (),
928        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
929            ::fidl_next::munge! {
930                let Self {
931                    mut key,
932                    mut value,
933
934                } = slot_;
935            }
936
937            let _field = key.as_mut();
938            ::fidl_next::Constrained::validate(_field, 1024)?;
939            ::fidl_next::Decode::decode(key.as_mut(), decoder_, 1024)?;
940
941            let key = unsafe { key.deref_unchecked() };
942
943            if key.len() > 1024 {
944                return Err(::fidl_next::DecodeError::VectorTooLong {
945                    size: key.len() as u64,
946                    limit: 1024,
947                });
948            }
949
950            let _field = value.as_mut();
951
952            ::fidl_next::Decode::decode(value.as_mut(), decoder_, ())?;
953
954            Ok(())
955        }
956    }
957
958    impl<'de> ::fidl_next::IntoNatural for DictionaryEntry<'de> {
959        type Natural = crate::natural::DictionaryEntry;
960    }
961
962    /// The wire type corresponding to [`Dictionary`].
963    #[repr(C)]
964    pub struct Dictionary<'de> {
965        pub(crate) table: ::fidl_next::wire::Table<'de>,
966    }
967
968    impl<'de> Drop for Dictionary<'de> {
969        fn drop(&mut self) {
970            let _ = self.table.get(1)
971                .map(|envelope| unsafe {
972                    envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::DictionaryEntry<'de>>>()
973                });
974        }
975    }
976
977    impl ::fidl_next::Constrained for Dictionary<'_> {
978        type Constraint = ();
979
980        fn validate(
981            _: ::fidl_next::Slot<'_, Self>,
982            _: Self::Constraint,
983        ) -> Result<(), ::fidl_next::ValidationError> {
984            Ok(())
985        }
986    }
987
988    unsafe impl ::fidl_next::Wire for Dictionary<'static> {
989        type Narrowed<'de> = Dictionary<'de>;
990
991        #[inline]
992        fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
993            ::fidl_next::munge!(let Self { table } = out);
994            ::fidl_next::wire::Table::zero_padding(table);
995        }
996    }
997
998    unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for Dictionary<'de>
999    where
1000        ___D: ::fidl_next::Decoder<'de> + ?Sized,
1001    {
1002        fn decode(
1003            slot: ::fidl_next::Slot<'_, Self>,
1004            decoder: &mut ___D,
1005            _: (),
1006        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1007            ::fidl_next::munge!(let Self { table } = slot);
1008
1009            ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
1010                match ordinal {
1011                    0 => unsafe { ::core::hint::unreachable_unchecked() },
1012
1013                    1 => {
1014                        ::fidl_next::wire::Envelope::decode_as::<
1015                            ___D,
1016                            ::fidl_next::wire::Vector<'de, crate::wire::DictionaryEntry<'de>>,
1017                        >(slot.as_mut(), decoder, (1024, ()))?;
1018
1019                        let value = unsafe {
1020                            slot
1021                                            .deref_unchecked()
1022                                            .deref_unchecked::<
1023                                                ::fidl_next::wire::Vector<'_, crate::wire::DictionaryEntry<'_>>
1024                                            >()
1025                        };
1026
1027                        if value.len() > 1024 {
1028                            return Err(::fidl_next::DecodeError::VectorTooLong {
1029                                size: value.len() as u64,
1030                                limit: 1024,
1031                            });
1032                        }
1033
1034                        Ok(())
1035                    }
1036
1037                    _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
1038                }
1039            })
1040        }
1041    }
1042
1043    impl<'de> Dictionary<'de> {
1044        pub fn entries(
1045            &self,
1046        ) -> ::core::option::Option<
1047            &::fidl_next::wire::Vector<'de, crate::wire::DictionaryEntry<'de>>,
1048        > {
1049            unsafe { Some(self.table.get(1)?.deref_unchecked()) }
1050        }
1051
1052        pub fn take_entries(
1053            &mut self,
1054        ) -> ::core::option::Option<::fidl_next::wire::Vector<'de, crate::wire::DictionaryEntry<'de>>>
1055        {
1056            unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
1057        }
1058    }
1059
1060    impl<'de> ::core::fmt::Debug for Dictionary<'de> {
1061        fn fmt(
1062            &self,
1063            f: &mut ::core::fmt::Formatter<'_>,
1064        ) -> ::core::result::Result<(), ::core::fmt::Error> {
1065            f.debug_struct("Dictionary").field("entries", &self.entries()).finish()
1066        }
1067    }
1068
1069    impl<'de> ::fidl_next::IntoNatural for Dictionary<'de> {
1070        type Natural = crate::natural::Dictionary;
1071    }
1072
1073    /// The wire type corresponding to [`MetadataGetPersistedMetadataResponse`].
1074    #[derive(Debug)]
1075    #[repr(C)]
1076    pub struct MetadataGetPersistedMetadataResponse<'de> {
1077        pub persisted_metadata: ::fidl_next::wire::Vector<'de, u8>,
1078    }
1079
1080    static_assertions::const_assert_eq!(
1081        std::mem::size_of::<MetadataGetPersistedMetadataResponse<'_>>(),
1082        16
1083    );
1084    static_assertions::const_assert_eq!(
1085        std::mem::align_of::<MetadataGetPersistedMetadataResponse<'_>>(),
1086        8
1087    );
1088
1089    static_assertions::const_assert_eq!(
1090        std::mem::offset_of!(MetadataGetPersistedMetadataResponse<'_>, persisted_metadata),
1091        0
1092    );
1093
1094    impl ::fidl_next::Constrained for MetadataGetPersistedMetadataResponse<'_> {
1095        type Constraint = ();
1096
1097        fn validate(
1098            _: ::fidl_next::Slot<'_, Self>,
1099            _: Self::Constraint,
1100        ) -> Result<(), ::fidl_next::ValidationError> {
1101            Ok(())
1102        }
1103    }
1104
1105    unsafe impl ::fidl_next::Wire for MetadataGetPersistedMetadataResponse<'static> {
1106        type Narrowed<'de> = MetadataGetPersistedMetadataResponse<'de>;
1107
1108        #[inline]
1109        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1110            ::fidl_next::munge! {
1111                let Self {
1112                    persisted_metadata,
1113
1114                } = &mut *out_;
1115            }
1116
1117            ::fidl_next::Wire::zero_padding(persisted_metadata);
1118        }
1119    }
1120
1121    unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for MetadataGetPersistedMetadataResponse<'de>
1122    where
1123        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1124        ___D: ::fidl_next::Decoder<'de>,
1125    {
1126        fn decode(
1127            slot_: ::fidl_next::Slot<'_, Self>,
1128            decoder_: &mut ___D,
1129            _: (),
1130        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1131            ::fidl_next::munge! {
1132                let Self {
1133                    mut persisted_metadata,
1134
1135                } = slot_;
1136            }
1137
1138            let _field = persisted_metadata.as_mut();
1139            ::fidl_next::Constrained::validate(_field, (4294967295, ()))?;
1140            ::fidl_next::Decode::decode(persisted_metadata.as_mut(), decoder_, (4294967295, ()))?;
1141
1142            Ok(())
1143        }
1144    }
1145
1146    impl<'de> ::fidl_next::IntoNatural for MetadataGetPersistedMetadataResponse<'de> {
1147        type Natural = crate::natural::MetadataGetPersistedMetadataResponse;
1148    }
1149}
1150
1151pub mod wire_optional {
1152
1153    #[repr(transparent)]
1154    pub struct DictionaryValue<'de> {
1155        pub(crate) raw: ::fidl_next::wire::Union,
1156        pub(crate) _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
1157    }
1158
1159    impl ::fidl_next::Constrained for DictionaryValue<'_> {
1160        type Constraint = ();
1161
1162        fn validate(
1163            _: ::fidl_next::Slot<'_, Self>,
1164            _: Self::Constraint,
1165        ) -> Result<(), ::fidl_next::ValidationError> {
1166            Ok(())
1167        }
1168    }
1169
1170    unsafe impl ::fidl_next::Wire for DictionaryValue<'static> {
1171        type Narrowed<'de> = DictionaryValue<'de>;
1172
1173        #[inline]
1174        fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1175            ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
1176            ::fidl_next::wire::Union::zero_padding(raw);
1177        }
1178    }
1179
1180    impl<'de> DictionaryValue<'de> {
1181        pub fn is_some(&self) -> bool {
1182            self.raw.is_some()
1183        }
1184
1185        pub fn is_none(&self) -> bool {
1186            self.raw.is_none()
1187        }
1188
1189        pub fn as_ref(&self) -> ::core::option::Option<&crate::wire::DictionaryValue<'de>> {
1190            if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None }
1191        }
1192
1193        pub fn into_option(self) -> ::core::option::Option<crate::wire::DictionaryValue<'de>> {
1194            if self.is_some() {
1195                Some(crate::wire::DictionaryValue {
1196                    raw: self.raw,
1197                    _phantom: ::core::marker::PhantomData,
1198                })
1199            } else {
1200                None
1201            }
1202        }
1203    }
1204
1205    unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for DictionaryValue<'de>
1206    where
1207        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1208        ___D: ::fidl_next::Decoder<'de>,
1209    {
1210        fn decode(
1211            mut slot: ::fidl_next::Slot<'_, Self>,
1212            decoder: &mut ___D,
1213            _: (),
1214        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1215            ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
1216            match ::fidl_next::wire::Union::encoded_ordinal(raw.as_mut()) {
1217                1 => ::fidl_next::wire::Union::decode_as::<___D, ::fidl_next::wire::Int64>(
1218                    raw,
1219                    decoder,
1220                    (),
1221                )?,
1222
1223                2 => ::fidl_next::wire::Union::decode_as::<
1224                    ___D,
1225                    ::fidl_next::wire::Vector<'de, ::fidl_next::wire::Int64>,
1226                >(raw, decoder, (1024, ()))?,
1227
1228                0 => ::fidl_next::wire::Union::decode_absent(raw)?,
1229                _ => ::fidl_next::wire::Union::decode_unknown(raw, decoder)?,
1230            }
1231
1232            Ok(())
1233        }
1234    }
1235
1236    impl<'de> ::core::fmt::Debug for DictionaryValue<'de> {
1237        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1238            self.as_ref().fmt(f)
1239        }
1240    }
1241
1242    impl<'de> ::fidl_next::IntoNatural for DictionaryValue<'de> {
1243        type Natural = ::core::option::Option<crate::natural::DictionaryValue>;
1244    }
1245}
1246
1247pub mod generic {
1248
1249    /// The generic type corresponding to [`DictionaryEntry`].
1250    pub struct DictionaryEntry<T0, T1> {
1251        pub key: T0,
1252
1253        pub value: T1,
1254    }
1255
1256    unsafe impl<___E, T0, T1> ::fidl_next::Encode<crate::wire::DictionaryEntry<'static>, ___E>
1257        for DictionaryEntry<T0, T1>
1258    where
1259        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1260        ___E: ::fidl_next::Encoder,
1261        T0: ::fidl_next::Encode<::fidl_next::wire::String<'static>, ___E>,
1262        T1: ::fidl_next::Encode<crate::wire::DictionaryValue<'static>, ___E>,
1263    {
1264        #[inline]
1265        fn encode(
1266            self,
1267            encoder_: &mut ___E,
1268            out_: &mut ::core::mem::MaybeUninit<crate::wire::DictionaryEntry<'static>>,
1269            _: (),
1270        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1271            ::fidl_next::munge! {
1272                let crate::wire::DictionaryEntry {
1273                    key,
1274                    value,
1275
1276                } = out_;
1277            }
1278
1279            ::fidl_next::Encode::encode(self.key, encoder_, key, 1024)?;
1280
1281            ::fidl_next::Encode::encode(self.value, encoder_, value, ())?;
1282
1283            Ok(())
1284        }
1285    }
1286
1287    /// The generic type corresponding to [`MetadataGetPersistedMetadataResponse`].
1288    pub struct MetadataGetPersistedMetadataResponse<T0> {
1289        pub persisted_metadata: T0,
1290    }
1291
1292    unsafe impl<___E, T0>
1293        ::fidl_next::Encode<crate::wire::MetadataGetPersistedMetadataResponse<'static>, ___E>
1294        for MetadataGetPersistedMetadataResponse<T0>
1295    where
1296        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1297        ___E: ::fidl_next::Encoder,
1298        T0: ::fidl_next::Encode<::fidl_next::wire::Vector<'static, u8>, ___E>,
1299    {
1300        #[inline]
1301        fn encode(
1302            self,
1303            encoder_: &mut ___E,
1304            out_: &mut ::core::mem::MaybeUninit<
1305                crate::wire::MetadataGetPersistedMetadataResponse<'static>,
1306            >,
1307            _: (),
1308        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1309            ::fidl_next::munge! {
1310                let crate::wire::MetadataGetPersistedMetadataResponse {
1311                    persisted_metadata,
1312
1313                } = out_;
1314            }
1315
1316            ::fidl_next::Encode::encode(
1317                self.persisted_metadata,
1318                encoder_,
1319                persisted_metadata,
1320                (4294967295, ()),
1321            )?;
1322
1323            Ok(())
1324        }
1325    }
1326}
1327
1328pub use self::natural::*;
1329
1330pub const MAX_KEY_LENGTH: u32 = 1024 as u32;
1331
1332pub const MAX_NUM_VALUE_ITEMS: u32 = 1024 as u32;
1333
1334pub const MAX_NUM_ENTRIES: u32 = 1024 as u32;
1335
1336pub const MAX_VALUE_LENGTH: u32 = 32768 as u32;
1337
1338/// The type corresponding to the Metadata protocol.
1339#[derive(PartialEq, Debug)]
1340pub struct Metadata;
1341
1342#[cfg(target_os = "fuchsia")]
1343impl ::fidl_next::HasTransport for Metadata {
1344    type Transport = ::fidl_next::fuchsia::zx::Channel;
1345}
1346
1347pub mod metadata {
1348    pub mod prelude {
1349        pub use crate::{
1350            Metadata, MetadataClientHandler, MetadataLocalClientHandler,
1351            MetadataLocalServerHandler, MetadataServerHandler, metadata,
1352        };
1353
1354        pub use crate::natural::MetadataGetPersistedMetadataResponse;
1355    }
1356
1357    pub struct GetPersistedMetadata;
1358
1359    impl ::fidl_next::Method for GetPersistedMetadata {
1360        const ORDINAL: u64 = 4835307543437455991;
1361        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1362            ::fidl_next::protocol::Flexibility::Strict;
1363
1364        type Protocol = crate::Metadata;
1365
1366        type Request = ::fidl_next::wire::EmptyMessageBody;
1367    }
1368
1369    impl ::fidl_next::TwoWayMethod for GetPersistedMetadata {
1370        type Response = ::fidl_next::wire::Result<
1371            'static,
1372            crate::wire::MetadataGetPersistedMetadataResponse<'static>,
1373            ::fidl_next::wire::fuchsia::Status,
1374        >;
1375    }
1376
1377    impl<___R> ::fidl_next::Respond<___R> for GetPersistedMetadata {
1378        type Output = ::core::result::Result<
1379            crate::generic::MetadataGetPersistedMetadataResponse<___R>,
1380            ::fidl_next::never::Never,
1381        >;
1382
1383        fn respond(response: ___R) -> Self::Output {
1384            ::core::result::Result::Ok(crate::generic::MetadataGetPersistedMetadataResponse {
1385                persisted_metadata: response,
1386            })
1387        }
1388    }
1389
1390    impl<___R> ::fidl_next::RespondErr<___R> for GetPersistedMetadata {
1391        type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
1392
1393        fn respond_err(response: ___R) -> Self::Output {
1394            ::core::result::Result::Err(response)
1395        }
1396    }
1397
1398    mod ___detail {
1399        unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Metadata
1400        where
1401            ___T: ::fidl_next::Transport,
1402        {
1403            type Client = MetadataClient<___T>;
1404            type Server = MetadataServer<___T>;
1405        }
1406
1407        /// The client for the `Metadata` protocol.
1408        #[repr(transparent)]
1409        pub struct MetadataClient<___T: ::fidl_next::Transport> {
1410            #[allow(dead_code)]
1411            client: ::fidl_next::protocol::Client<___T>,
1412        }
1413
1414        impl<___T> MetadataClient<___T>
1415        where
1416            ___T: ::fidl_next::Transport,
1417        {
1418            #[doc = " Retrieve the persisted metadata provided by the server. Returns ZX_ERR_NOT_FOUND if the\n server does not have metadata to provide.\n"]
1419            pub fn get_persisted_metadata(
1420                &self,
1421            ) -> ::fidl_next::TwoWayFuture<'_, super::GetPersistedMetadata, ___T> {
1422                ::fidl_next::TwoWayFuture::from_untyped(
1423                    self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
1424                        4835307543437455991,
1425                        <super::GetPersistedMetadata as ::fidl_next::Method>::FLEXIBILITY,
1426                        (),
1427                    ),
1428                )
1429            }
1430        }
1431
1432        /// The server for the `Metadata` protocol.
1433        #[repr(transparent)]
1434        pub struct MetadataServer<___T: ::fidl_next::Transport> {
1435            server: ::fidl_next::protocol::Server<___T>,
1436        }
1437
1438        impl<___T> MetadataServer<___T> where ___T: ::fidl_next::Transport {}
1439    }
1440}
1441
1442#[diagnostic::on_unimplemented(
1443    note = "If {Self} implements the non-local MetadataClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
1444)]
1445
1446/// A client handler for the Metadata protocol.
1447///
1448/// See [`Metadata`] for more details.
1449pub trait MetadataLocalClientHandler<
1450    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1451    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1452>
1453{
1454}
1455
1456impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Metadata
1457where
1458    ___H: MetadataLocalClientHandler<___T>,
1459    ___T: ::fidl_next::Transport,
1460{
1461    async fn on_event(
1462        handler: &mut ___H,
1463        mut message: ::fidl_next::Message<___T>,
1464    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1465        match *message.header().ordinal {
1466            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1467        }
1468    }
1469}
1470
1471#[diagnostic::on_unimplemented(
1472    note = "If {Self} implements the non-local MetadataServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
1473)]
1474
1475/// A server handler for the Metadata protocol.
1476///
1477/// See [`Metadata`] for more details.
1478pub trait MetadataLocalServerHandler<
1479    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1480    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1481>
1482{
1483    #[doc = " Retrieve the persisted metadata provided by the server. Returns ZX_ERR_NOT_FOUND if the\n server does not have metadata to provide.\n"]
1484    fn get_persisted_metadata(
1485        &mut self,
1486
1487        responder: ::fidl_next::Responder<metadata::GetPersistedMetadata, ___T>,
1488    ) -> impl ::core::future::Future<Output = ()>;
1489}
1490
1491impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Metadata
1492where
1493    ___H: MetadataLocalServerHandler<___T>,
1494    ___T: ::fidl_next::Transport,
1495{
1496    async fn on_one_way(
1497        handler: &mut ___H,
1498        mut message: ::fidl_next::Message<___T>,
1499    ) -> ::core::result::Result<
1500        (),
1501        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1502    > {
1503        match *message.header().ordinal {
1504            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1505        }
1506    }
1507
1508    async fn on_two_way(
1509        handler: &mut ___H,
1510        mut message: ::fidl_next::Message<___T>,
1511        responder: ::fidl_next::protocol::Responder<___T>,
1512    ) -> ::core::result::Result<
1513        (),
1514        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1515    > {
1516        match *message.header().ordinal {
1517            4835307543437455991 => {
1518                let responder = ::fidl_next::Responder::from_untyped(responder);
1519
1520                handler.get_persisted_metadata(responder).await;
1521                Ok(())
1522            }
1523
1524            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1525        }
1526    }
1527}
1528
1529/// A client handler for the Metadata protocol.
1530///
1531/// See [`Metadata`] for more details.
1532pub trait MetadataClientHandler<
1533    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1534    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1535>
1536{
1537}
1538
1539impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Metadata
1540where
1541    ___H: MetadataClientHandler<___T> + ::core::marker::Send,
1542    ___T: ::fidl_next::Transport,
1543{
1544    async fn on_event(
1545        handler: &mut ___H,
1546        mut message: ::fidl_next::Message<___T>,
1547    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1548        match *message.header().ordinal {
1549            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1550        }
1551    }
1552}
1553
1554/// A server handler for the Metadata protocol.
1555///
1556/// See [`Metadata`] for more details.
1557pub trait MetadataServerHandler<
1558    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1559    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1560>
1561{
1562    #[doc = " Retrieve the persisted metadata provided by the server. Returns ZX_ERR_NOT_FOUND if the\n server does not have metadata to provide.\n"]
1563    fn get_persisted_metadata(
1564        &mut self,
1565
1566        responder: ::fidl_next::Responder<metadata::GetPersistedMetadata, ___T>,
1567    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1568}
1569
1570impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Metadata
1571where
1572    ___H: MetadataServerHandler<___T> + ::core::marker::Send,
1573    ___T: ::fidl_next::Transport,
1574{
1575    async fn on_one_way(
1576        handler: &mut ___H,
1577        mut message: ::fidl_next::Message<___T>,
1578    ) -> ::core::result::Result<
1579        (),
1580        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1581    > {
1582        match *message.header().ordinal {
1583            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1584        }
1585    }
1586
1587    async fn on_two_way(
1588        handler: &mut ___H,
1589        mut message: ::fidl_next::Message<___T>,
1590        responder: ::fidl_next::protocol::Responder<___T>,
1591    ) -> ::core::result::Result<
1592        (),
1593        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1594    > {
1595        match *message.header().ordinal {
1596            4835307543437455991 => {
1597                let responder = ::fidl_next::Responder::from_untyped(responder);
1598
1599                handler.get_persisted_metadata(responder).await;
1600                Ok(())
1601            }
1602
1603            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1604        }
1605    }
1606}
1607
1608impl<___T> MetadataClientHandler<___T> for ::fidl_next::IgnoreEvents where
1609    ___T: ::fidl_next::Transport
1610{
1611}
1612
1613impl<___H, ___T> MetadataLocalClientHandler<___T> for ::fidl_next::Local<___H>
1614where
1615    ___H: MetadataClientHandler<___T>,
1616    ___T: ::fidl_next::Transport,
1617{
1618}
1619
1620impl<___H, ___T> MetadataLocalServerHandler<___T> for ::fidl_next::Local<___H>
1621where
1622    ___H: MetadataServerHandler<___T>,
1623    ___T: ::fidl_next::Transport,
1624{
1625    async fn get_persisted_metadata(
1626        &mut self,
1627
1628        responder: ::fidl_next::Responder<metadata::GetPersistedMetadata, ___T>,
1629    ) {
1630        ___H::get_persisted_metadata(&mut self.0, responder).await
1631    }
1632}