inline_fn!() { /* proc-macro */ }Expand description
Inline a function from a file. Expands to the function body fetched from the specified file.
§Usage
- Function from a specific file relative from the workspace root (this is best for performance reasons)
inline_fn!(fn_name, "crates/app/src/file.rs") - Function from the first file with the matching function name (this will cause a recursive scan in the workspace):
inline_fn!(fn_name)
§Examples
ⓘ
fn add_two(a: usize, b: usize) -> usize {
a + b
}
fn add_three(a: usize, b: usize, c: usize) -> usize {
inline_fn::inline_fn!(add_two) + c // no need to repeat the code
}