Expand description
proc_macro by exporting just the correct proc_macro API.
This allow to inject an external proc_macro API
like proc_macro2, and this is convenient for
library that do not implement directly a
procedural macro or avoid to include the external
dependencies just to mimic the proc_macro API.
The last case is particular useful when the parser is injected inside the procedural macro code, such as the linux kernel
Modules§
- token_
stream - Public implementation details for the
TokenStreamtype, such as iterators. - tracked_
env Experimental - Tracked access to environment variables.
- tracked_
path Experimental - Tracked access to additional files.
Macros§
- quote
Experimental quote!(..)accepts arbitrary tokens and expands into aTokenStreamdescribing the input. For example,quote!(a + b)will produce an expression, that, when evaluated, constructs theTokenStream[Ident("a"), Punct('+', Alone), Ident("b")].
Structs§
- Group
- A delimited token stream.
- Ident
- An identifier (
ident). - LexError
- Error returned from
TokenStream::from_str. - Literal
- A literal string (
"hello"), byte string (b"hello"), C string (c"hello"), character ('a'), byte character (b'a'), an integer or floating point number with or without a suffix (1,1u8,2.3,2.3f32). Boolean literals liketrueandfalsedo not belong here, they areIdents. - Punct
- A
Punctis a single punctuation character such as+,-or#. - Span
- A region of source code, along with macro expansion information.
- Token
Stream - The main type provided by this crate, representing an abstract stream of tokens, or, more specifically, a sequence of token trees. The type provides interfaces for iterating over those token trees and, conversely, collecting a number of token trees into one stream.
- Diagnostic
Experimental - A structure representing a diagnostic message and associated children messages.
- Expand
Error Experimental - Error returned from
TokenStream::expand_expr.
Enums§
- Delimiter
- Describes how a sequence of token trees is delimited.
- Spacing
- Indicates whether a
Puncttoken can join with the following token to form a multi-character operator. - Token
Tree - A single token or a delimited sequence of token trees (e.g.,
[1, (), ..]). - Conversion
Error Kind Experimental - Errors returned when trying to retrieve a literal unescaped value.
- Escape
Error - Errors and warnings that can occur during string, char, and byte unescaping.
- Level
Experimental - An enum representing a diagnostic level.
Traits§
- Multi
Span Experimental - Trait implemented by types that can be converted into a set of
Spans. - ToTokens
Experimental - Types that can be interpolated inside a
quote!invocation.
Functions§
- is_
available - Determines whether proc_macro has been made accessible to the currently running program.
- quote
Experimental - Quote a
TokenStreaminto aTokenStream. This is the actual implementation of thequote!()proc macro. - quote_
span Experimental - Quote a
Spaninto aTokenStream. This is needed to implement a custom quoter.