#introspection #traits #enums #derive #type #basic

introspectable

Basic introspection via the Introspectable trait

6 releases (breaking)

0.5.0 May 16, 2023
0.4.0 May 15, 2023
0.3.1 May 15, 2023
0.2.0 May 15, 2023
0.1.0 May 12, 2023

#2808 in Rust patterns

Download history 3/week @ 2024-09-24

64 downloads per month

MIT/Apache

15KB
305 lines

Introspectable

crates.io crates.io docs.rs

Provides extremely simple introspection through the Introspectable trait, which enables runtime type introspection. A derive macro is available through the crate introspectable_derive.

This crate only supports owned types, excepting specifically 'static lifetimes.

Example

#[macro_use]
extern crate introspectable_derive;

use introspectable::Introspectable;


#[derive(Introspectable)]
struct TestIntrospect {
    a: u32,
    b: &'static u32,
    c: [u128; 2]
}

fn main() {
    println!("{:?}", TestIntrospect::introspect());
}

Dependencies

~105KB