diff options
| author | HampusM <hampus@hampusmat.com> | 2026-06-08 15:11:16 +0200 |
|---|---|---|
| committer | HampusM <hampus@hampusmat.com> | 2026-06-08 15:11:16 +0200 |
| commit | 02b258ae1eefbcc613afbd9fab0f195401a00b35 (patch) | |
| tree | 18b413e8575923b807155aa3477bd2155b08319f /engine-reflection/src | |
| parent | ca33e594edea5e17ec26c760f92804b4e7f653a7 (diff) | |
feat(engine): add visibility reflection
Diffstat (limited to 'engine-reflection/src')
| -rw-r--r-- | engine-reflection/src/lib.rs | 19 |
1 files changed, 19 insertions, 0 deletions
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<Option<&'static Type>>, + 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)),*) => { $( |
