From 02b258ae1eefbcc613afbd9fab0f195401a00b35 Mon Sep 17 00:00:00 2001 From: HampusM Date: Mon, 8 Jun 2026 15:11:16 +0200 Subject: feat(engine): add visibility reflection --- engine-reflection/src/lib.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'engine-reflection/src') diff --git a/engine-reflection/src/lib.rs b/engine-reflection/src/lib.rs index 5122cca..ef705a0 100644 --- a/engine-reflection/src/lib.rs +++ b/engine-reflection/src/lib.rs @@ -1,5 +1,6 @@ use std::alloc::Layout; use std::any::{type_name, TypeId}; +use std::borrow::Cow; use std::fmt::Debug; /// Trait implemented by types that support runtime reflection on them. @@ -81,6 +82,7 @@ pub struct StructField pub type_id: TypeId, pub type_name: &'static str, pub get_type: FnWithDebug>, + pub visibility: Visibility, } impl StructField @@ -149,6 +151,23 @@ pub enum LiteralType Str, } +#[derive(Debug, Clone)] +pub enum Visibility +{ + Pub, + PubScoped(VisibilityScope), + Private, +} + +#[derive(Debug, Clone)] +pub enum VisibilityScope +{ + Crate, + Super, + SelfModule, + In(Cow<'static, str>), +} + macro_rules! impl_reflection_for_literals { ($(($literal_type: ident, $literal: ty)),*) => { $( -- cgit v1.2.3-18-g5258