fidl_next_codec/wire/
empty_struct.rs1use core::mem::MaybeUninit;
6
7use crate::{Constrained, Slot, ValidationError, Wire};
8
9#[repr(u8)]
13#[derive(Clone, Copy)]
14pub enum EmptyStruct {
15 Zero = 0,
17}
18
19impl Constrained for EmptyStruct {
20 type Constraint = ();
21
22 fn validate(_: Slot<'_, Self>, _: Self::Constraint) -> Result<(), ValidationError> {
23 Ok(())
24 }
25}
26
27unsafe impl Wire for EmptyStruct {
28 type Narrowed<'de> = Self;
29
30 #[inline]
31 fn zero_padding(_: &mut MaybeUninit<Self>) {}
32}
33
34impl core::fmt::Debug for EmptyStruct {
35 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
36 write!(f, "(empty)")
37 }
38}