aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNika Layzell <nika@thelayzells.com>2019-08-16 12:10:17 -0700
committerNika Layzell <nika@thelayzells.com>2019-08-16 12:10:17 -0700
commitc6a5958a8738670422ed9ea59e0e61f28bcd16c2 (patch)
treeb8689a607386cd24d5155619c91a8cfd42ae2cef
parent78f551dd7ce6b58c4b7e783bdfc8d1221c91b9c0 (diff)
downloadplatform_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.md10
1 files changed, 10 insertions, 0 deletions
diff --git a/README.md b/README.md
index 8c3bff2..255dc88 100644
--- a/README.md
+++ b/README.md
@@ -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