### Macro extension
You can extend macros easily with processor interface which is enabled by
**template** feature.
Refer last part of this documentation if you want to extend macros as binary
target.
**Basic demo**
```toml
[dependencies]
r4d = {version="*", features = ["template"]}
```
```rust
use r4d::ExtMacroBuilder;
use r4d::ext_template::*;
use r4d::AuthType;
use r4d::Processor;
use r4d::RadResult;
// ---
// Processor creation precedes...
// ---
// DEMOS
// Extend function macro
processor.add_ext_macro(
ExtMacroBuilder::new("mac1")
.args(&["a_first", "a_second"])
.desc("Description comes here")
.function(function_template!(
// NOTE
// Function macro does not need to expand arguments
// Because it is already expanded
// NOTE
// On split_args macro,
// Function macro should give second argument as "false"
// If true, then it will not strip literal quotes
let args = split_args!(2,false)?;
let result = format!("{} + {}", args[0], args[1]);
Ok(Some(result))
)),
);
// Extend deterred macro
processor.add_ext_macro(
ExtMacroBuilder::new("mac2")
.args(&["a_first", "a_second"])
.desc("Description comes here")
.deterred(deterred_template!(
// NOTE
// Audit authentication
// Macro name, and required auth type
audit_auth!("mac2",AuthType::CMD);
// NOTE
// On split_args macro,
// Deterred macro should have second argument as "true"
// because deterred should not strip before expansion
let args = split_args!(2,true)?;
// NOTE
// expand_args macro should be only called on deterred macros
// because it expands arguments and also strip
let result = if expand_args!(&args[0])? == "doit" {
// NOTE
// You can expand normal expression with expand_args macro
Some(format!("I did it -> {}", expand_args!(&args[1])?))
} else { None };
Ok(result)
)),
);
```
**More about codes**
These macros are actually a convenience for trivial typings. Actual code under
the hood are expanded as closure.
```rust
// Original function macro's type
pub(crate) type FunctionMacroType = fn(&str, &mut Processor) -> RadResult