Spacing in proc_macro - Rust (original) (raw)

Enum Spacing

1.29.0 · Source

pub enum Spacing {
    Joint,
    Alone,
}

Expand description

Indicates whether a Punct token can join with the following token to form a multi-character operator.

§1.29.0

A Punct token can join with the following token to form a multi-character operator.

In token streams constructed using proc macro interfaces, Joint punctuation tokens can be followed by any other tokens. However, in token streams parsed from source code, the compiler will only set spacing to Joint in the following cases.

This list may be extended in the future to enable more token combinations.

§1.29.0

A Punct token cannot join with the following token to form a multi-character operator.

Alone punctuation tokens can be followed by any other tokens. In token streams parsed from source code, the compiler will set spacing to Alone in all cases not covered by the conditions for Joint above. E.g. + is Alone in + =, +ident and +(). In particular, tokens not followed by anything will be marked as Alone.

1.29.0 · Source§

1.29.0 · Source§

1.29.0 · Source§

Source§

Tests for self and other values to be equal, and is used by ==.

1.0.0 · Source§

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

1.29.0 · Source§

1.29.0 · Source§

1.29.0 · Source§

§

§

§

§

§

§