Procedural macro implementation for function indexing in impl blocks.
impls_index_meta is the proc-macro companion crate for impls_index. It provides macros that wrap each function in an impl block under a named macro, enabling function discovery and indexing at compile time.
Important: This crate should not be used directly. Use the impls_index crate which re-exports this functionality.
impls_index_meta is responsible for providing procedural macros that generate wrapper macros for functions in impl blocks, enabling compile-time function indexing.
impls!macro: Wrap impl block functions under named macrosimpls1!,impls2!,impls3!macros: Variants for different contexts- Function analysis: Parse function signatures
- Macro generation: Generate wrapper macros for each function
- Runtime behavior: Pure compile-time code generation
- User-facing API: Use
impls_indexcrate instead - Function body modification: Only wraps, doesn't transform
- Upstream: Uses
macro_toolsfor syntax parsing - Downstream: Re-exported by
impls_indexcrate - Compile-time only: No runtime dependencies
impls_index_meta/
├── src/
│ └── lib.rs # Proc-macro entry point
├── Cargo.toml
├── readme.md
└── spec.md
// Input
impls!
{
fn add( a: i32, b: i32 ) -> i32 { a + b }
fn sub( a: i32, b: i32 ) -> i32 { a - b }
}
// Generates (conceptual):
macro_rules! add { ... }
macro_rules! sub { ... }
fn add( a: i32, b: i32 ) -> i32 { a + b }
fn sub( a: i32, b: i32 ) -> i32 { a - b }Index functions in impl block.
use impls_index::impls;
impls!
{
fn greet( name: &str ) -> String
{
format!( "Hello, {}!", name )
}
}
// Function is available both directly and via generated macro
let msg = greet( "World" );| Feature | Default | Description |
|---|---|---|
enabled |
✓ | Enable the crate |
full |
- | All features |
| Dependency | Purpose |
|---|---|
macro_tools |
Syntax parsing utilities |
impls_index- Re-exports this crate's macros
Function indexing enables:
- Compile-time function discovery
- Macro-based function invocation
- Metaprogramming over function sets
| Crate | Relationship |
|---|---|
impls_index |
Parent facade crate |
macro_tools |
Upstream syntax utilities |