Punct in proc_macro - Rust (original) (raw)
Struct Punct
1.29.0 · Source
pub struct Punct(/* private fields */);
Expand description
A Punct
is a single punctuation character such as +
, -
or #
.
Multi-character operators like +=
are represented as two instances of Punct
with different forms of Spacing
returned.
1.29.0 · Source
Creates a new Punct
from the given character and spacing. The ch
argument must be a valid punctuation character permitted by the language, otherwise the function will panic.
The returned Punct
will have the default span of Span::call_site()
which can be further configured with the set_span
method below.
1.29.0 · Source
Returns the value of this punctuation character as char
.
1.29.0 · Source
Returns the spacing of this punctuation character, indicating whether it can be potentially combined into a multi-character operator with the following token (Joint
), or whether the operator has definitely ended (Alone
).
1.29.0 · Source
Returns the span for this punctuation character.
1.29.0 · Source
Configure the span for this punctuation character.
Prints the punctuation character as a string that should be losslessly convertible back into the same character.
Converts to this type from the input type.
Tests for self
and other
values to be equal, and is used by ==
.
Tests for !=
. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Tests for self
and other
values to be equal, and is used by ==
.
Tests for !=
. The default implementation is almost always sufficient, and should not be overridden without very good reason.
🔬This is a nightly-only experimental API. (proc_macro_totokens
#130977)
Write self
to the given TokenStream
. Read more
🔬This is a nightly-only experimental API. (proc_macro_totokens
#130977)
Convert self
directly into a TokenStream
object. Read more
🔬This is a nightly-only experimental API. (proc_macro_totokens
#130977)
Convert self
directly into a TokenStream
object. Read more