Skip to main content

fidl_next_fuchsia_mem/
fidl_next_fuchsia_mem.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    pub use fidl_next_common_fuchsia_mem::natural::*;
8
9    #[doc = " A buffer for data whose size is not necessarily a multiple of the page\n size.\n\n DEPRECATED: This type is superfluous and deprecated. Instead of using this type,\n use a zx.Handle:VMO object and store the size of the contents in the ZX_PROP_VMO_CONTENT_SIZE\n property.\n"]
10    #[derive(Debug, PartialEq)]
11    pub struct Buffer {
12        pub vmo: ::fidl_next::fuchsia::zx::Vmo,
13
14        pub size: u64,
15    }
16
17    unsafe impl<___E> ::fidl_next::Encode<crate::wire::Buffer, ___E> for Buffer
18    where
19        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
20        ___E: ::fidl_next::fuchsia::HandleEncoder,
21    {
22        #[inline]
23        fn encode(
24            self,
25            encoder_: &mut ___E,
26            out_: &mut ::core::mem::MaybeUninit<crate::wire::Buffer>,
27            _: (),
28        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
29            ::fidl_next::munge! {
30                let crate::wire::Buffer {
31                    vmo,
32                    size,
33
34                } = out_;
35            }
36
37            ::fidl_next::Encode::encode(self.vmo, encoder_, vmo, ())?;
38
39            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(vmo.as_mut_ptr()) };
40
41            ::fidl_next::Encode::encode(self.size, encoder_, size, ())?;
42
43            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(size.as_mut_ptr()) };
44
45            Ok(())
46        }
47    }
48
49    unsafe impl<___E>
50        ::fidl_next::EncodeOption<::fidl_next::wire::Box<'static, crate::wire::Buffer>, ___E>
51        for Buffer
52    where
53        ___E: ::fidl_next::Encoder + ?Sized,
54        Buffer: ::fidl_next::Encode<crate::wire::Buffer, ___E>,
55    {
56        #[inline]
57        fn encode_option(
58            this: ::core::option::Option<Self>,
59            encoder: &mut ___E,
60            out: &mut ::core::mem::MaybeUninit<
61                ::fidl_next::wire::Box<'static, crate::wire::Buffer>,
62            >,
63            _: (),
64        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
65            if let Some(inner) = this {
66                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
67                ::fidl_next::wire::Box::encode_present(out);
68            } else {
69                ::fidl_next::wire::Box::encode_absent(out);
70            }
71
72            Ok(())
73        }
74    }
75
76    impl ::fidl_next::FromWire<crate::wire::Buffer> for Buffer {
77        #[inline]
78        fn from_wire(wire: crate::wire::Buffer) -> Self {
79            Self {
80                vmo: ::fidl_next::FromWire::from_wire(wire.vmo),
81
82                size: ::fidl_next::FromWire::from_wire(wire.size),
83            }
84        }
85    }
86
87    #[doc = " Binary data that might be stored inline or in a VMO.\n\n Useful for performance-sensitive protocols that sometimes receive small\n amounts of binary data (i.e., which is more efficient to provide using\n `bytes`) but also need to support arbitrary amounts of data (i.e., which\n need to be provided out-of-line in a `Buffer`).\n"]
88    #[derive(Debug, PartialEq)]
89    pub enum Data {
90        Bytes(::std::vec::Vec<u8>),
91
92        Buffer(crate::natural::Buffer),
93
94        UnknownOrdinal_(u64),
95    }
96
97    impl Data {
98        pub fn is_unknown(&self) -> bool {
99            #[allow(unreachable_patterns)]
100            match self {
101                Self::UnknownOrdinal_(_) => true,
102                _ => false,
103            }
104        }
105    }
106
107    unsafe impl<___E> ::fidl_next::Encode<crate::wire::Data<'static>, ___E> for Data
108    where
109        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
110        ___E: ::fidl_next::Encoder,
111        ___E: ::fidl_next::fuchsia::HandleEncoder,
112    {
113        #[inline]
114        fn encode(
115            self,
116            encoder: &mut ___E,
117            out: &mut ::core::mem::MaybeUninit<crate::wire::Data<'static>>,
118            _: (),
119        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
120            ::fidl_next::munge!(let crate::wire::Data { raw, _phantom: _ } = out);
121
122            match self {
123                Self::Bytes(value) => ::fidl_next::wire::Union::encode_as::<
124                    ___E,
125                    ::fidl_next::wire::Vector<'static, u8>,
126                >(value, 1, encoder, raw, (4294967295, ()))?,
127
128                Self::Buffer(value) => ::fidl_next::wire::Union::encode_as::<
129                    ___E,
130                    crate::wire::Buffer,
131                >(value, 2, encoder, raw, ())?,
132
133                Self::UnknownOrdinal_(ordinal) => {
134                    return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize));
135                }
136            }
137
138            Ok(())
139        }
140    }
141
142    unsafe impl<___E> ::fidl_next::EncodeOption<crate::wire_optional::Data<'static>, ___E> for Data
143    where
144        ___E: ?Sized,
145        Data: ::fidl_next::Encode<crate::wire::Data<'static>, ___E>,
146    {
147        #[inline]
148        fn encode_option(
149            this: ::core::option::Option<Self>,
150            encoder: &mut ___E,
151            out: &mut ::core::mem::MaybeUninit<crate::wire_optional::Data<'static>>,
152            _: (),
153        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
154            ::fidl_next::munge!(let crate::wire_optional::Data { raw, _phantom: _ } = &mut *out);
155
156            if let Some(inner) = this {
157                let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
158                ::fidl_next::Encode::encode(inner, encoder, value_out, ())?;
159            } else {
160                ::fidl_next::wire::Union::encode_absent(raw);
161            }
162
163            Ok(())
164        }
165    }
166
167    impl<'de> ::fidl_next::FromWire<crate::wire::Data<'de>> for Data {
168        #[inline]
169        fn from_wire(wire: crate::wire::Data<'de>) -> Self {
170            let wire = ::core::mem::ManuallyDrop::new(wire);
171            match wire.raw.ordinal() {
172                1 => Self::Bytes(::fidl_next::FromWire::from_wire(unsafe {
173                    wire.raw.get().read_unchecked::<::fidl_next::wire::Vector<'de, u8>>()
174                })),
175
176                2 => Self::Buffer(::fidl_next::FromWire::from_wire(unsafe {
177                    wire.raw.get().read_unchecked::<crate::wire::Buffer>()
178                })),
179
180                ord => return Self::UnknownOrdinal_(ord as u64),
181            }
182        }
183    }
184
185    impl<'de> ::fidl_next::FromWireOption<crate::wire_optional::Data<'de>> for Data {
186        #[inline]
187        fn from_wire_option(wire: crate::wire_optional::Data<'de>) -> ::core::option::Option<Self> {
188            if let Some(inner) = wire.into_option() {
189                Some(::fidl_next::FromWire::from_wire(inner))
190            } else {
191                None
192            }
193        }
194    }
195
196    impl<'de> ::fidl_next::FromWireOption<crate::wire_optional::Data<'de>> for Box<Data> {
197        #[inline]
198        fn from_wire_option(wire: crate::wire_optional::Data<'de>) -> ::core::option::Option<Self> {
199            <
200            Data as ::fidl_next::FromWireOption<crate::wire_optional::Data<'de>>
201        >::from_wire_option(wire).map(Box::new)
202        }
203    }
204
205    #[doc = " A range of bytes within a VMO.\n"]
206    #[derive(Debug, PartialEq)]
207    pub struct Range {
208        pub vmo: ::fidl_next::fuchsia::zx::Vmo,
209
210        pub offset: u64,
211
212        pub size: u64,
213    }
214
215    unsafe impl<___E> ::fidl_next::Encode<crate::wire::Range, ___E> for Range
216    where
217        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
218        ___E: ::fidl_next::fuchsia::HandleEncoder,
219    {
220        #[inline]
221        fn encode(
222            self,
223            encoder_: &mut ___E,
224            out_: &mut ::core::mem::MaybeUninit<crate::wire::Range>,
225            _: (),
226        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
227            ::fidl_next::munge! {
228                let crate::wire::Range {
229                    vmo,
230                    offset,
231                    size,
232
233                } = out_;
234            }
235
236            ::fidl_next::Encode::encode(self.vmo, encoder_, vmo, ())?;
237
238            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(vmo.as_mut_ptr()) };
239
240            ::fidl_next::Encode::encode(self.offset, encoder_, offset, ())?;
241
242            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(offset.as_mut_ptr()) };
243
244            ::fidl_next::Encode::encode(self.size, encoder_, size, ())?;
245
246            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(size.as_mut_ptr()) };
247
248            Ok(())
249        }
250    }
251
252    unsafe impl<___E>
253        ::fidl_next::EncodeOption<::fidl_next::wire::Box<'static, crate::wire::Range>, ___E>
254        for Range
255    where
256        ___E: ::fidl_next::Encoder + ?Sized,
257        Range: ::fidl_next::Encode<crate::wire::Range, ___E>,
258    {
259        #[inline]
260        fn encode_option(
261            this: ::core::option::Option<Self>,
262            encoder: &mut ___E,
263            out: &mut ::core::mem::MaybeUninit<::fidl_next::wire::Box<'static, crate::wire::Range>>,
264            _: (),
265        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
266            if let Some(inner) = this {
267                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
268                ::fidl_next::wire::Box::encode_present(out);
269            } else {
270                ::fidl_next::wire::Box::encode_absent(out);
271            }
272
273            Ok(())
274        }
275    }
276
277    impl ::fidl_next::FromWire<crate::wire::Range> for Range {
278        #[inline]
279        fn from_wire(wire: crate::wire::Range) -> Self {
280            Self {
281                vmo: ::fidl_next::FromWire::from_wire(wire.vmo),
282
283                offset: ::fidl_next::FromWire::from_wire(wire.offset),
284
285                size: ::fidl_next::FromWire::from_wire(wire.size),
286            }
287        }
288    }
289}
290
291pub mod wire {
292
293    pub use fidl_next_common_fuchsia_mem::wire::*;
294
295    /// The wire type corresponding to [`Buffer`].
296    #[derive(Debug)]
297    #[repr(C)]
298    pub struct Buffer {
299        pub vmo: ::fidl_next::wire::fuchsia::Vmo,
300
301        pub size: ::fidl_next::wire::Uint64,
302    }
303
304    static_assertions::const_assert_eq!(std::mem::size_of::<Buffer>(), 16);
305    static_assertions::const_assert_eq!(std::mem::align_of::<Buffer>(), 8);
306
307    static_assertions::const_assert_eq!(std::mem::offset_of!(Buffer, vmo), 0);
308
309    static_assertions::const_assert_eq!(std::mem::offset_of!(Buffer, size), 8);
310
311    impl ::fidl_next::Constrained for Buffer {
312        type Constraint = ();
313
314        fn validate(
315            _: ::fidl_next::Slot<'_, Self>,
316            _: Self::Constraint,
317        ) -> Result<(), ::fidl_next::ValidationError> {
318            Ok(())
319        }
320    }
321
322    unsafe impl ::fidl_next::Wire for Buffer {
323        type Narrowed<'de> = Buffer;
324
325        #[inline]
326        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
327            ::fidl_next::munge! {
328                let Self {
329                    vmo,
330                    size,
331
332                } = &mut *out_;
333            }
334
335            ::fidl_next::Wire::zero_padding(vmo);
336
337            ::fidl_next::Wire::zero_padding(size);
338
339            unsafe {
340                out_.as_mut_ptr().cast::<u8>().add(4).write_bytes(0, 4);
341            }
342        }
343    }
344
345    unsafe impl<___D> ::fidl_next::Decode<___D> for Buffer
346    where
347        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
348        ___D: ::fidl_next::fuchsia::HandleDecoder,
349    {
350        fn decode(
351            slot_: ::fidl_next::Slot<'_, Self>,
352            decoder_: &mut ___D,
353            _: (),
354        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
355            if slot_.as_bytes()[4..8] != [0u8; 4] {
356                return Err(::fidl_next::DecodeError::InvalidPadding);
357            }
358
359            ::fidl_next::munge! {
360                let Self {
361                    mut vmo,
362                    mut size,
363
364                } = slot_;
365            }
366
367            let _field = vmo.as_mut();
368
369            ::fidl_next::Decode::decode(vmo.as_mut(), decoder_, ())?;
370
371            let _field = size.as_mut();
372
373            ::fidl_next::Decode::decode(size.as_mut(), decoder_, ())?;
374
375            Ok(())
376        }
377    }
378
379    impl ::fidl_next::IntoNatural for Buffer {
380        type Natural = crate::natural::Buffer;
381    }
382
383    /// The wire type corresponding to [`Data`].
384    #[repr(transparent)]
385    pub struct Data<'de> {
386        pub(crate) raw: ::fidl_next::wire::Union,
387        pub(crate) _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
388    }
389
390    impl<'de> Drop for Data<'de> {
391        fn drop(&mut self) {
392            match self.raw.ordinal() {
393                1 => {
394                    let _ = unsafe {
395                        self.raw.get().read_unchecked::<::fidl_next::wire::Vector<'de, u8>>()
396                    };
397                }
398
399                2 => {
400                    let _ = unsafe { self.raw.get().read_unchecked::<crate::wire::Buffer>() };
401                }
402
403                _ => (),
404            }
405        }
406    }
407
408    impl ::fidl_next::Constrained for Data<'_> {
409        type Constraint = ();
410
411        fn validate(
412            _: ::fidl_next::Slot<'_, Self>,
413            _: Self::Constraint,
414        ) -> Result<(), ::fidl_next::ValidationError> {
415            Ok(())
416        }
417    }
418
419    unsafe impl ::fidl_next::Wire for Data<'static> {
420        type Narrowed<'de> = Data<'de>;
421
422        #[inline]
423        fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
424            ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
425            ::fidl_next::wire::Union::zero_padding(raw);
426        }
427    }
428
429    pub mod data {
430        pub enum Ref<'de> {
431            Bytes(&'de ::fidl_next::wire::Vector<'de, u8>),
432
433            Buffer(&'de crate::wire::Buffer),
434
435            UnknownOrdinal_(u64),
436        }
437
438        pub enum Value<'de> {
439            Bytes(::fidl_next::wire::Vector<'de, u8>),
440
441            Buffer(crate::wire::Buffer),
442
443            UnknownOrdinal_(u64),
444        }
445    }
446
447    impl<'de> Data<'de> {
448        pub fn as_ref(&self) -> crate::wire::data::Ref<'_> {
449            match self.raw.ordinal() {
450                1 => crate::wire::data::Ref::Bytes(unsafe {
451                    self.raw.get().deref_unchecked::<::fidl_next::wire::Vector<'_, u8>>()
452                }),
453
454                2 => crate::wire::data::Ref::Buffer(unsafe {
455                    self.raw.get().deref_unchecked::<crate::wire::Buffer>()
456                }),
457
458                unknown => crate::wire::data::Ref::UnknownOrdinal_(unknown),
459            }
460        }
461
462        pub fn into_inner(self) -> crate::wire::data::Value<'de> {
463            let this = ::core::mem::ManuallyDrop::new(self);
464
465            match this.raw.ordinal() {
466                1 => crate::wire::data::Value::Bytes(unsafe {
467                    this.raw.get().read_unchecked::<::fidl_next::wire::Vector<'de, u8>>()
468                }),
469
470                2 => crate::wire::data::Value::Buffer(unsafe {
471                    this.raw.get().read_unchecked::<crate::wire::Buffer>()
472                }),
473
474                unknown => crate::wire::data::Value::UnknownOrdinal_(unknown),
475            }
476        }
477    }
478
479    unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for Data<'de>
480    where
481        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
482        ___D: ::fidl_next::Decoder<'de>,
483        ___D: ::fidl_next::fuchsia::HandleDecoder,
484    {
485        fn decode(
486            mut slot: ::fidl_next::Slot<'_, Self>,
487            decoder: &mut ___D,
488            _: (),
489        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
490            ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
491            match ::fidl_next::wire::Union::encoded_ordinal(raw.as_mut()) {
492                1 => {
493                    ::fidl_next::wire::Union::decode_as::<___D, ::fidl_next::wire::Vector<'de, u8>>(
494                        raw,
495                        decoder,
496                        (4294967295, ()),
497                    )?
498                }
499
500                2 => ::fidl_next::wire::Union::decode_as::<___D, crate::wire::Buffer>(
501                    raw,
502                    decoder,
503                    (),
504                )?,
505
506                _ => ::fidl_next::wire::Union::decode_unknown(raw, decoder)?,
507            }
508
509            Ok(())
510        }
511    }
512
513    impl<'de> ::core::fmt::Debug for Data<'de> {
514        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
515            match self.raw.ordinal() {
516                1 => unsafe {
517                    self.raw.get().deref_unchecked::<::fidl_next::wire::Vector<'_, u8>>().fmt(f)
518                },
519                2 => unsafe { self.raw.get().deref_unchecked::<crate::wire::Buffer>().fmt(f) },
520                _ => unsafe { ::core::hint::unreachable_unchecked() },
521            }
522        }
523    }
524
525    impl<'de> ::fidl_next::IntoNatural for Data<'de> {
526        type Natural = crate::natural::Data;
527    }
528
529    /// The wire type corresponding to [`Range`].
530    #[derive(Debug)]
531    #[repr(C)]
532    pub struct Range {
533        pub vmo: ::fidl_next::wire::fuchsia::Vmo,
534
535        pub offset: ::fidl_next::wire::Uint64,
536
537        pub size: ::fidl_next::wire::Uint64,
538    }
539
540    static_assertions::const_assert_eq!(std::mem::size_of::<Range>(), 24);
541    static_assertions::const_assert_eq!(std::mem::align_of::<Range>(), 8);
542
543    static_assertions::const_assert_eq!(std::mem::offset_of!(Range, vmo), 0);
544
545    static_assertions::const_assert_eq!(std::mem::offset_of!(Range, offset), 8);
546
547    static_assertions::const_assert_eq!(std::mem::offset_of!(Range, size), 16);
548
549    impl ::fidl_next::Constrained for Range {
550        type Constraint = ();
551
552        fn validate(
553            _: ::fidl_next::Slot<'_, Self>,
554            _: Self::Constraint,
555        ) -> Result<(), ::fidl_next::ValidationError> {
556            Ok(())
557        }
558    }
559
560    unsafe impl ::fidl_next::Wire for Range {
561        type Narrowed<'de> = Range;
562
563        #[inline]
564        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
565            ::fidl_next::munge! {
566                let Self {
567                    vmo,
568                    offset,
569                    size,
570
571                } = &mut *out_;
572            }
573
574            ::fidl_next::Wire::zero_padding(vmo);
575
576            ::fidl_next::Wire::zero_padding(offset);
577
578            ::fidl_next::Wire::zero_padding(size);
579
580            unsafe {
581                out_.as_mut_ptr().cast::<u8>().add(4).write_bytes(0, 4);
582            }
583        }
584    }
585
586    unsafe impl<___D> ::fidl_next::Decode<___D> for Range
587    where
588        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
589        ___D: ::fidl_next::fuchsia::HandleDecoder,
590    {
591        fn decode(
592            slot_: ::fidl_next::Slot<'_, Self>,
593            decoder_: &mut ___D,
594            _: (),
595        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
596            if slot_.as_bytes()[4..8] != [0u8; 4] {
597                return Err(::fidl_next::DecodeError::InvalidPadding);
598            }
599
600            ::fidl_next::munge! {
601                let Self {
602                    mut vmo,
603                    mut offset,
604                    mut size,
605
606                } = slot_;
607            }
608
609            let _field = vmo.as_mut();
610
611            ::fidl_next::Decode::decode(vmo.as_mut(), decoder_, ())?;
612
613            let _field = offset.as_mut();
614
615            ::fidl_next::Decode::decode(offset.as_mut(), decoder_, ())?;
616
617            let _field = size.as_mut();
618
619            ::fidl_next::Decode::decode(size.as_mut(), decoder_, ())?;
620
621            Ok(())
622        }
623    }
624
625    impl ::fidl_next::IntoNatural for Range {
626        type Natural = crate::natural::Range;
627    }
628}
629
630pub mod wire_optional {
631
632    pub use fidl_next_common_fuchsia_mem::wire_optional::*;
633
634    #[repr(transparent)]
635    pub struct Data<'de> {
636        pub(crate) raw: ::fidl_next::wire::Union,
637        pub(crate) _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
638    }
639
640    impl ::fidl_next::Constrained for Data<'_> {
641        type Constraint = ();
642
643        fn validate(
644            _: ::fidl_next::Slot<'_, Self>,
645            _: Self::Constraint,
646        ) -> Result<(), ::fidl_next::ValidationError> {
647            Ok(())
648        }
649    }
650
651    unsafe impl ::fidl_next::Wire for Data<'static> {
652        type Narrowed<'de> = Data<'de>;
653
654        #[inline]
655        fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
656            ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
657            ::fidl_next::wire::Union::zero_padding(raw);
658        }
659    }
660
661    impl<'de> Data<'de> {
662        pub fn is_some(&self) -> bool {
663            self.raw.is_some()
664        }
665
666        pub fn is_none(&self) -> bool {
667            self.raw.is_none()
668        }
669
670        pub fn as_ref(&self) -> ::core::option::Option<&crate::wire::Data<'de>> {
671            if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None }
672        }
673
674        pub fn into_option(self) -> ::core::option::Option<crate::wire::Data<'de>> {
675            if self.is_some() {
676                Some(crate::wire::Data { raw: self.raw, _phantom: ::core::marker::PhantomData })
677            } else {
678                None
679            }
680        }
681    }
682
683    unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for Data<'de>
684    where
685        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
686        ___D: ::fidl_next::Decoder<'de>,
687        ___D: ::fidl_next::fuchsia::HandleDecoder,
688    {
689        fn decode(
690            mut slot: ::fidl_next::Slot<'_, Self>,
691            decoder: &mut ___D,
692            _: (),
693        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
694            ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
695            match ::fidl_next::wire::Union::encoded_ordinal(raw.as_mut()) {
696                1 => {
697                    ::fidl_next::wire::Union::decode_as::<___D, ::fidl_next::wire::Vector<'de, u8>>(
698                        raw,
699                        decoder,
700                        (4294967295, ()),
701                    )?
702                }
703
704                2 => ::fidl_next::wire::Union::decode_as::<___D, crate::wire::Buffer>(
705                    raw,
706                    decoder,
707                    (),
708                )?,
709
710                0 => ::fidl_next::wire::Union::decode_absent(raw)?,
711                _ => ::fidl_next::wire::Union::decode_unknown(raw, decoder)?,
712            }
713
714            Ok(())
715        }
716    }
717
718    impl<'de> ::core::fmt::Debug for Data<'de> {
719        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
720            self.as_ref().fmt(f)
721        }
722    }
723
724    impl<'de> ::fidl_next::IntoNatural for Data<'de> {
725        type Natural = ::core::option::Option<crate::natural::Data>;
726    }
727}
728
729pub mod generic {
730
731    pub use fidl_next_common_fuchsia_mem::generic::*;
732
733    /// The generic type corresponding to [`Buffer`].
734    pub struct Buffer<T0, T1> {
735        pub vmo: T0,
736
737        pub size: T1,
738    }
739
740    unsafe impl<___E, T0, T1> ::fidl_next::Encode<crate::wire::Buffer, ___E> for Buffer<T0, T1>
741    where
742        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
743        ___E: ::fidl_next::fuchsia::HandleEncoder,
744        T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::Vmo, ___E>,
745        T1: ::fidl_next::Encode<::fidl_next::wire::Uint64, ___E>,
746    {
747        #[inline]
748        fn encode(
749            self,
750            encoder_: &mut ___E,
751            out_: &mut ::core::mem::MaybeUninit<crate::wire::Buffer>,
752            _: (),
753        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
754            ::fidl_next::munge! {
755                let crate::wire::Buffer {
756                    vmo,
757                    size,
758
759                } = out_;
760            }
761
762            ::fidl_next::Encode::encode(self.vmo, encoder_, vmo, ())?;
763
764            ::fidl_next::Encode::encode(self.size, encoder_, size, ())?;
765
766            Ok(())
767        }
768    }
769
770    /// The generic type corresponding to [`Range`].
771    pub struct Range<T0, T1, T2> {
772        pub vmo: T0,
773
774        pub offset: T1,
775
776        pub size: T2,
777    }
778
779    unsafe impl<___E, T0, T1, T2> ::fidl_next::Encode<crate::wire::Range, ___E> for Range<T0, T1, T2>
780    where
781        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
782        ___E: ::fidl_next::fuchsia::HandleEncoder,
783        T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::Vmo, ___E>,
784        T1: ::fidl_next::Encode<::fidl_next::wire::Uint64, ___E>,
785        T2: ::fidl_next::Encode<::fidl_next::wire::Uint64, ___E>,
786    {
787        #[inline]
788        fn encode(
789            self,
790            encoder_: &mut ___E,
791            out_: &mut ::core::mem::MaybeUninit<crate::wire::Range>,
792            _: (),
793        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
794            ::fidl_next::munge! {
795                let crate::wire::Range {
796                    vmo,
797                    offset,
798                    size,
799
800                } = out_;
801            }
802
803            ::fidl_next::Encode::encode(self.vmo, encoder_, vmo, ())?;
804
805            ::fidl_next::Encode::encode(self.offset, encoder_, offset, ())?;
806
807            ::fidl_next::Encode::encode(self.size, encoder_, size, ())?;
808
809            Ok(())
810        }
811    }
812}
813
814pub use self::natural::*;
815
816pub use fidl_next_common_fuchsia_mem::*;