pub enum Spacing {
Joint,
Alone,
}
Expand description
Indicates whether a Punct
token can join with the following token
to form a multi-character operator.
Variants§
Joint
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.
- When a
Punct
is immediately followed by anotherPunct
without a whitespace. E.g.+
isJoint
in+=
and++
. - When a single quote
'
is immediately followed by an identifier without a whitespace. E.g.'
isJoint
in'lifetime
.
This list may be extended in the future to enable more token combinations.
Alone
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
.
Trait Implementations§
impl Copy for Spacing
impl Eq for Spacing
impl StructuralPartialEq for Spacing
Auto Trait Implementations§
impl Freeze for Spacing
impl RefUnwindSafe for Spacing
impl Send for Spacing
impl Sync for Spacing
impl Unpin for Spacing
impl UnwindSafe for Spacing
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more