• Home
  • Raw
  • Download

Lines Matching +full:proc +full:- +full:macro +full:- +full:api

1 # proc-macro2
3 …/badge/github-dtolnay/proc--macro2-8da0cb?style=for-the-badge&labelColor=555555&logo=github" heigh…
4 …img.shields.io/crates/v/proc-macro2.svg?style=for-the-badge&color=fc8d62&logo=rust" height="20">](…
5 …ields.io/badge/docs.rs-proc--macro2-66c2a5?style=for-the-badge&labelColor=555555&logo=docs.rs" hei…
6 …s/workflow/status/dtolnay/proc-macro2/ci.yml?branch=master&style=for-the-badge" height="20">](http…
8 A wrapper around the procedural macro API of the compiler's `proc_macro` crate.
11 - **Bring proc-macro-like functionality to other contexts like build.rs and
13 and cannot ever exist in code outside of a procedural macro. Meanwhile
14 `proc_macro2` types may exist anywhere including non-macro code. By developing
16 than `proc_macro`, the procedural macro ecosystem becomes easily applicable to
17 many other use cases and we avoid reimplementing non-macro equivalents of
20 - **Make procedural macros unit testable.** As a consequence of being specific
22 unit test. In order for helper libraries or components of a macro to be
32 proc-macro2 = "1.0"
35 The skeleton of a typical procedural macro typically looks like this:
41 pub fn my_derive(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
55 [`parse_macro_input!`]: https://docs.rs/syn/2.0/syn/macro.parse_macro_input.html
59 The default feature set of proc-macro2 tracks the most recent stable compiler
60 API. Functionality in `proc_macro` that is not yet stable is not exposed by
61 proc-macro2 by default.
65 polyfill those nightly-only APIs back to Rust 1.56.0. As these are unstable APIs
66 that track the nightly compiler, minor versions of proc-macro2 may make breaking
70 RUSTFLAGS='--cfg procmacro2_semver_exempt' cargo build
77 Semver exempt methods are marked as such in the proc-macro2 documentation.
84 Licensed under either of <a href="LICENSE-APACHE">Apache License, Version
85 2.0</a> or <a href="LICENSE-MIT">MIT license</a> at your option.
92 for inclusion in this crate by you, as defined in the Apache-2.0 license, shall