From 5c218bd5301618f279d34f257ff109488e48f715 Mon Sep 17 00:00:00 2001 From: HampusM Date: Wed, 10 Jun 2026 19:05:51 +0200 Subject: feat(engine): add discriminants to enum variant reflection --- engine-reflection/src/lib.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'engine-reflection') 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, + + 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::()], +} + #[derive(Debug, Clone)] pub struct Field { -- cgit v1.2.3-18-g5258