title: Is it possible to write something as complex as `print!` in a pure Rust macro?
body: <p>I am starting out learning Rust macros, but the documentation is somewhat limited. Which is fine — they're an expert feature, I guess. While I can do basic code generation, implementation of traits, and so on, some of the built-in macros seem well beyond that, such as the various print macros, which examine a string literal and use that for code expansion.</p>
  
  <p>I looked at <a href="https://github.com/rust-lang/rust/blob/1.26.0/src/libstd/macros.rs" rel="nofollow noreferrer">the source for <code>print!</code></a> and it calls another macro called <code>format_args</code>. Unfortunately this doesn't seem to be built in "pure Rust"  the comment just says "compiler built-in."</p>
  
  <p>Is it possible to write something as complex as <code>print!</code> in a pure Rust macro? If so, how would it be done?</p>
  
  <p>I'm actually interested in building a "compile time trie" -- basically recognizing certain fixed strings as "keywords" fixed at compile time. This would be performant (probably) but mostly I'm just interested in code generation.</p>