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
439    impl<'de> Data<'de> {
440        pub fn as_ref(&self) -> crate::wire::data::Ref<'_> {
441            match self.raw.ordinal() {
442                1 => crate::wire::data::Ref::Bytes(unsafe {
443                    self.raw.get().deref_unchecked::<::fidl_next::wire::Vector<'_, u8>>()
444                }),
445
446                2 => crate::wire::data::Ref::Buffer(unsafe {
447                    self.raw.get().deref_unchecked::<crate::wire::Buffer>()
448                }),
449
450                unknown => crate::wire::data::Ref::UnknownOrdinal_(unknown),
451            }
452        }
453    }
454
455    unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for Data<'de>
456    where
457        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
458        ___D: ::fidl_next::Decoder<'de>,
459        ___D: ::fidl_next::fuchsia::HandleDecoder,
460    {
461        fn decode(
462            mut slot: ::fidl_next::Slot<'_, Self>,
463            decoder: &mut ___D,
464            _: (),
465        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
466            ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
467            match ::fidl_next::wire::Union::encoded_ordinal(raw.as_mut()) {
468                1 => {
469                    ::fidl_next::wire::Union::decode_as::<___D, ::fidl_next::wire::Vector<'de, u8>>(
470                        raw,
471                        decoder,
472                        (4294967295, ()),
473                    )?
474                }
475
476                2 => ::fidl_next::wire::Union::decode_as::<___D, crate::wire::Buffer>(
477                    raw,
478                    decoder,
479                    (),
480                )?,
481
482                _ => ::fidl_next::wire::Union::decode_unknown(raw, decoder)?,
483            }
484
485            Ok(())
486        }
487    }
488
489    impl<'de> ::core::fmt::Debug for Data<'de> {
490        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
491            match self.raw.ordinal() {
492                1 => unsafe {
493                    self.raw.get().deref_unchecked::<::fidl_next::wire::Vector<'_, u8>>().fmt(f)
494                },
495                2 => unsafe { self.raw.get().deref_unchecked::<crate::wire::Buffer>().fmt(f) },
496                _ => unsafe { ::core::hint::unreachable_unchecked() },
497            }
498        }
499    }
500
501    impl<'de> ::fidl_next::IntoNatural for Data<'de> {
502        type Natural = crate::natural::Data;
503    }
504
505    /// The wire type corresponding to [`Range`].
506    #[derive(Debug)]
507    #[repr(C)]
508    pub struct Range {
509        pub vmo: ::fidl_next::wire::fuchsia::Vmo,
510
511        pub offset: ::fidl_next::wire::Uint64,
512
513        pub size: ::fidl_next::wire::Uint64,
514    }
515
516    static_assertions::const_assert_eq!(std::mem::size_of::<Range>(), 24);
517    static_assertions::const_assert_eq!(std::mem::align_of::<Range>(), 8);
518
519    static_assertions::const_assert_eq!(std::mem::offset_of!(Range, vmo), 0);
520
521    static_assertions::const_assert_eq!(std::mem::offset_of!(Range, offset), 8);
522
523    static_assertions::const_assert_eq!(std::mem::offset_of!(Range, size), 16);
524
525    impl ::fidl_next::Constrained for Range {
526        type Constraint = ();
527
528        fn validate(
529            _: ::fidl_next::Slot<'_, Self>,
530            _: Self::Constraint,
531        ) -> Result<(), ::fidl_next::ValidationError> {
532            Ok(())
533        }
534    }
535
536    unsafe impl ::fidl_next::Wire for Range {
537        type Narrowed<'de> = Range;
538
539        #[inline]
540        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
541            ::fidl_next::munge! {
542                let Self {
543                    vmo,
544                    offset,
545                    size,
546
547                } = &mut *out_;
548            }
549
550            ::fidl_next::Wire::zero_padding(vmo);
551
552            ::fidl_next::Wire::zero_padding(offset);
553
554            ::fidl_next::Wire::zero_padding(size);
555
556            unsafe {
557                out_.as_mut_ptr().cast::<u8>().add(4).write_bytes(0, 4);
558            }
559        }
560    }
561
562    unsafe impl<___D> ::fidl_next::Decode<___D> for Range
563    where
564        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
565        ___D: ::fidl_next::fuchsia::HandleDecoder,
566    {
567        fn decode(
568            slot_: ::fidl_next::Slot<'_, Self>,
569            decoder_: &mut ___D,
570            _: (),
571        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
572            if slot_.as_bytes()[4..8] != [0u8; 4] {
573                return Err(::fidl_next::DecodeError::InvalidPadding);
574            }
575
576            ::fidl_next::munge! {
577                let Self {
578                    mut vmo,
579                    mut offset,
580                    mut size,
581
582                } = slot_;
583            }
584
585            let _field = vmo.as_mut();
586
587            ::fidl_next::Decode::decode(vmo.as_mut(), decoder_, ())?;
588
589            let _field = offset.as_mut();
590
591            ::fidl_next::Decode::decode(offset.as_mut(), decoder_, ())?;
592
593            let _field = size.as_mut();
594
595            ::fidl_next::Decode::decode(size.as_mut(), decoder_, ())?;
596
597            Ok(())
598        }
599    }
600
601    impl ::fidl_next::IntoNatural for Range {
602        type Natural = crate::natural::Range;
603    }
604}
605
606pub mod wire_optional {
607
608    pub use fidl_next_common_fuchsia_mem::wire_optional::*;
609
610    #[repr(transparent)]
611    pub struct Data<'de> {
612        pub(crate) raw: ::fidl_next::wire::Union,
613        pub(crate) _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
614    }
615
616    impl ::fidl_next::Constrained for Data<'_> {
617        type Constraint = ();
618
619        fn validate(
620            _: ::fidl_next::Slot<'_, Self>,
621            _: Self::Constraint,
622        ) -> Result<(), ::fidl_next::ValidationError> {
623            Ok(())
624        }
625    }
626
627    unsafe impl ::fidl_next::Wire for Data<'static> {
628        type Narrowed<'de> = Data<'de>;
629
630        #[inline]
631        fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
632            ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
633            ::fidl_next::wire::Union::zero_padding(raw);
634        }
635    }
636
637    impl<'de> Data<'de> {
638        pub fn is_some(&self) -> bool {
639            self.raw.is_some()
640        }
641
642        pub fn is_none(&self) -> bool {
643            self.raw.is_none()
644        }
645
646        pub fn as_ref(&self) -> ::core::option::Option<&crate::wire::Data<'de>> {
647            if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None }
648        }
649
650        pub fn into_option(self) -> ::core::option::Option<crate::wire::Data<'de>> {
651            if self.is_some() {
652                Some(crate::wire::Data { raw: self.raw, _phantom: ::core::marker::PhantomData })
653            } else {
654                None
655            }
656        }
657    }
658
659    unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for Data<'de>
660    where
661        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
662        ___D: ::fidl_next::Decoder<'de>,
663        ___D: ::fidl_next::fuchsia::HandleDecoder,
664    {
665        fn decode(
666            mut slot: ::fidl_next::Slot<'_, Self>,
667            decoder: &mut ___D,
668            _: (),
669        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
670            ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
671            match ::fidl_next::wire::Union::encoded_ordinal(raw.as_mut()) {
672                1 => {
673                    ::fidl_next::wire::Union::decode_as::<___D, ::fidl_next::wire::Vector<'de, u8>>(
674                        raw,
675                        decoder,
676                        (4294967295, ()),
677                    )?
678                }
679
680                2 => ::fidl_next::wire::Union::decode_as::<___D, crate::wire::Buffer>(
681                    raw,
682                    decoder,
683                    (),
684                )?,
685
686                0 => ::fidl_next::wire::Union::decode_absent(raw)?,
687                _ => ::fidl_next::wire::Union::decode_unknown(raw, decoder)?,
688            }
689
690            Ok(())
691        }
692    }
693
694    impl<'de> ::core::fmt::Debug for Data<'de> {
695        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
696            self.as_ref().fmt(f)
697        }
698    }
699
700    impl<'de> ::fidl_next::IntoNatural for Data<'de> {
701        type Natural = ::core::option::Option<crate::natural::Data>;
702    }
703}
704
705pub mod generic {
706
707    pub use fidl_next_common_fuchsia_mem::generic::*;
708
709    /// The generic type corresponding to [`Buffer`].
710    pub struct Buffer<T0, T1> {
711        pub vmo: T0,
712
713        pub size: T1,
714    }
715
716    unsafe impl<___E, T0, T1> ::fidl_next::Encode<crate::wire::Buffer, ___E> for Buffer<T0, T1>
717    where
718        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
719        ___E: ::fidl_next::fuchsia::HandleEncoder,
720        T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::Vmo, ___E>,
721        T1: ::fidl_next::Encode<::fidl_next::wire::Uint64, ___E>,
722    {
723        #[inline]
724        fn encode(
725            self,
726            encoder_: &mut ___E,
727            out_: &mut ::core::mem::MaybeUninit<crate::wire::Buffer>,
728            _: (),
729        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
730            ::fidl_next::munge! {
731                let crate::wire::Buffer {
732                    vmo,
733                    size,
734
735                } = out_;
736            }
737
738            ::fidl_next::Encode::encode(self.vmo, encoder_, vmo, ())?;
739
740            ::fidl_next::Encode::encode(self.size, encoder_, size, ())?;
741
742            Ok(())
743        }
744    }
745
746    /// The generic type corresponding to [`Range`].
747    pub struct Range<T0, T1, T2> {
748        pub vmo: T0,
749
750        pub offset: T1,
751
752        pub size: T2,
753    }
754
755    unsafe impl<___E, T0, T1, T2> ::fidl_next::Encode<crate::wire::Range, ___E> for Range<T0, T1, T2>
756    where
757        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
758        ___E: ::fidl_next::fuchsia::HandleEncoder,
759        T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::Vmo, ___E>,
760        T1: ::fidl_next::Encode<::fidl_next::wire::Uint64, ___E>,
761        T2: ::fidl_next::Encode<::fidl_next::wire::Uint64, ___E>,
762    {
763        #[inline]
764        fn encode(
765            self,
766            encoder_: &mut ___E,
767            out_: &mut ::core::mem::MaybeUninit<crate::wire::Range>,
768            _: (),
769        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
770            ::fidl_next::munge! {
771                let crate::wire::Range {
772                    vmo,
773                    offset,
774                    size,
775
776                } = out_;
777            }
778
779            ::fidl_next::Encode::encode(self.vmo, encoder_, vmo, ())?;
780
781            ::fidl_next::Encode::encode(self.offset, encoder_, offset, ())?;
782
783            ::fidl_next::Encode::encode(self.size, encoder_, size, ())?;
784
785            Ok(())
786        }
787    }
788}
789
790pub use self::natural::*;
791
792pub use fidl_next_common_fuchsia_mem::*;