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