reflect_tools 0.9.0

Collection of mechanisms for reflection.
Documentation

Module :: reflect_tools

Runtime type reflection system providing traits, descriptors, and utilities for dynamic inspection of Rust types. Enables introspection of type names, sizes, elements, and structure at runtime without compile-time knowledge of the concrete type.

experimental rust-status docs.rs Open in Gitpod discord

Basic use-case

use reflect_tools::*;

let value = vec![ 1i32, 2, 3 ];
let entity = reflect( &value );
println!( "{}", entity.type_name() );    // "Vec"
println!( "{}", entity.len() );          // 3
println!( "{}", entity.is_container() ); // true
for kv in entity.elements()
{
  println!( "{:?}", kv );
}

To add to your project

cargo add reflect_tools

Try out from the repository

git clone https://github.com/Wandalen/wTools
cd wTools
cd examples/reflect_tools_trivial
cargo run