diff options
author | Nika Layzell <nika@thelayzells.com> | 2019-08-16 12:10:17 -0700 |
---|---|---|
committer | Nika Layzell <nika@thelayzells.com> | 2019-08-16 12:10:17 -0700 |
commit | c6a5958a8738670422ed9ea59e0e61f28bcd16c2 (patch) | |
tree | b8689a607386cd24d5155619c91a8cfd42ae2cef | |
parent | 78f551dd7ce6b58c4b7e783bdfc8d1221c91b9c0 (diff) | |
download | platform_external_rust_crates_quote-c6a5958a8738670422ed9ea59e0e61f28bcd16c2.tar.gz platform_external_rust_crates_quote-c6a5958a8738670422ed9ea59e0e61f28bcd16c2.tar.bz2 platform_external_rust_crates_quote-c6a5958a8738670422ed9ea59e0e61f28bcd16c2.zip |
Add format_ident example from lib.rs to the README
-rw-r--r-- | README.md | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -159,6 +159,16 @@ quote! { } ``` +For identifier concatenation specifically, since this is such a common case, +the `format_ident!` macro provides a more concise equivalent of the above. + +```rust +let varname = format_ident!("_{}", ident); +quote! { + let mut #varname = 0; +} +``` + ### Making method calls Let's say our macro requires some type specified in the macro input to have a |