Crate pistonite_pm

Source
Expand description

Batteries-included proc-macro utils

This re-exports the common libraries - syn, quote, and proc-macro2, that you need to work with proc-macros, as well as utilities to interop between them.

§Re-exports

Most of quote, proc_macro, and proc_macro2 are re-exported, and they can be used with the pm:: prefix. Types that have the same name in proc_macro and proc_macro2 are suffixed with 2 in the proc_macro2 export.

Types from syn can be used as with syn:: prefix, by adding the prelude import use pm::pre::*.

Modules§

lib
pre

Macros§

bail
Bail with a syn::Error. Use from a function that returns syn::Result.
format_ident
Formatting macro for constructing Idents.
quote
The whole point.
quote_spanned
Same as quote!, but applies a given span to all tokens originating within the macro invocation.

Structs§

Error
Error returned when a Syn parser cannot parse the input tokens.
Group
A delimited token stream.
Group2
A delimited token stream.
Ident
An identifier (ident).
Ident2
A word of Rust code, which may be a keyword or legal variable name.
LexError
Error returned from TokenStream::from_str.
LexError2
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 like true and false do not belong here, they are Idents.
Literal2
A literal string ("hello"), byte string (b"hello"), character ('a'), byte character (b'a'), an integer or floating point number with or without a suffix (1, 1u8, 2.3, 2.3f32).
Punct
A Punct is a single punctuation character such as +, - or #.
Punct2
A Punct is a single punctuation character like +, - or #.
Span
A region of source code, along with macro expansion information.
Span2
A region of source code, along with macro expansion information.
TokenStream
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.
TokenStream2
An abstract stream of tokens, or more concretely a sequence of token trees.

Enums§

Delimiter
Describes how a sequence of token trees is delimited.
Delimiter2
Describes how a sequence of token trees is delimited.
Spacing
Indicates whether a Punct token can join with the following token to form a multi-character operator.
Spacing2
Whether a Punct is followed immediately by another Punct or followed by another token or whitespace.
TokenTree
A single token or a delimited sequence of token trees (e.g., [1, (), ..]).
TokenTree2
A single token or a delimited sequence of token trees (e.g. [1, (), ..]).

Traits§

ToTokens
Types that can be interpolated inside a quote! invocation.

Functions§

flatten
Flatten an expansion result or error into token stream.

Type Aliases§

Result
The result of a Syn parser.