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