Expand description
A support library for macro authors when defining new macros.
This library, provided by the standard distribution, provides the types
consumed in the interfaces of procedurally defined macro definitions such as
function-like macros #[proc_macro], macro attributes #[proc_macro_attribute] and
custom derive attributes#[proc_macro_derive].
See the book for more.
Modules§
- Public implementation details for theTokenStreamtype, such as iterators.
- tracked_env Experimental Tracked access to environment variables.
- tracked_path Experimental Tracked access to additional files.
Macros§
- quoteExperimental 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§
- A delimited token stream.
- An identifier (ident).
- Error returned fromTokenStream::from_str.
- 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.
- APunctis a single punctuation character such as+,-or#.
- A region of source code, along with macro expansion information.
- 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.
- DiagnosticExperimental A structure representing a diagnostic message and associated children messages.
- ExpandError Experimental Error returned fromTokenStream::expand_expr.
- SourceFile Experimental The source file of a givenSpan.
Enums§
- Describes how a sequence of token trees is delimited.
- Indicates whether aPuncttoken can join with the following token to form a multi-character operator.
- A single token or a delimited sequence of token trees (e.g.,[1, (), ..]).
- LevelExperimental An enum representing a diagnostic level.
Traits§
- MultiSpan Experimental Trait implemented by types that can be converted into a set ofSpans.
- ToTokensExperimental Types that can be interpolated inside aquote!invocation.
Functions§
- Determines whether proc_macro has been made accessible to the currently running program.
- quoteExperimental Quote aTokenStreaminto aTokenStream. This is the actual implementation of thequote!()proc macro.
- quote_span Experimental Quote aSpaninto aTokenStream. This is needed to implement a custom quoter.