diff options
| author | HampusM <hampus@hampusmat.com> | 2026-06-10 19:05:51 +0200 |
|---|---|---|
| committer | HampusM <hampus@hampusmat.com> | 2026-06-10 19:05:51 +0200 |
| commit | 5c218bd5301618f279d34f257ff109488e48f715 (patch) | |
| tree | d21162e1cdaae66e71c134b7a9a85b8e41007ece /engine-reflection | |
| parent | 9e3d3be6a9413d76d230bc0ec48f68f9e051caa0 (diff) | |
feat(engine): add discriminants to enum variant reflection
Diffstat (limited to 'engine-reflection')
| -rw-r--r-- | engine-reflection/src/lib.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/engine-reflection/src/lib.rs b/engine-reflection/src/lib.rs index 0382598..c884edb 100644 --- a/engine-reflection/src/lib.rs +++ b/engine-reflection/src/lib.rs @@ -89,6 +89,8 @@ pub struct EnumVariant /// The fields of this variant. If `None`, this variant is a unit variant. pub fields: Option<EnumVariantFields>, + + pub discriminant: EnumDiscriminant, } #[derive(Debug, Clone)] @@ -104,6 +106,15 @@ pub enum EnumVariantFields }, } +/// The discriminant of a enum variant. +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct EnumDiscriminant +{ + /// This buffer is the size of a u128/i128 because they are the largest possible enum + /// discriminant representations. + pub buf: [u8; size_of::<u128>()], +} + #[derive(Debug, Clone)] pub struct Field { |
