Reflection examples
The engine's reflection examples: what each one shows, whether it runs in a browser and the command that runs it.
Reflecting types at runtime, the type registry, dynamic types and serialization. There are 10 examples on this page. For the concepts behind them, see Reflection.
Run any of them from the engine core's workspace (the folder of the engine source that holds the neo crate's Cargo.toml); see Run an example.
Examples#
| Example | What it shows | Web | Run |
|---|---|---|---|
| Automatic types registration | Demonstrates how to set up automatic reflect types registration for platforms without inventory support | No | cargo run --example auto_register_static |
| Custom Attributes | Registering and accessing custom attributes on reflected types | No | cargo run --example custom_attributes |
| Dynamic Types | How dynamic types are used with reflection | No | cargo run --example dynamic_types |
| Function Reflection | Demonstrates how functions can be called dynamically using reflection | No | cargo run --example function_reflection --features reflect_functions |
| Generic Reflection | Registers concrete instances of generic types that may be used with reflection | No | cargo run --example generic_reflection |
| Mutation by Reflection | Demonstrates how to mutate abstract or non-Rust data at runtime using reflection | No | cargo run --example mutation_by_reflection |
| Reflection | Demonstrates how reflection in NEO provides a way to dynamically interact with Rust types | No | cargo run --example reflection |
| Reflection Types | Illustrates the various reflection types available | No | cargo run --example reflection_types |
| Serialization | Demonstrates serialization and deserialization using reflection without serde's Serialize/Deserialize traits | No | cargo run --example serialization |
| Type Data | Demonstrates how to create and use type data | No | cargo run --example type_data |