Enum Spacing
enum Spacing
Indicates whether a Punct token can join with the following token
to form a multi-character operator.
Variants
-
Joint A
Puncttoken can join with the following token to form a multi-character operator.In token streams constructed using proc macro interfaces,
Jointpunctuation tokens can be followed by any other tokens. However, in token streams parsed from source code, the compiler will only set spacing toJointin the following cases.- When a
Punctis immediately followed by anotherPunctwithout a whitespace. E.g.+isJointin+=and++. - When a single quote
'is immediately followed by an identifier without a whitespace. E.g.'isJointin'lifetime.
This list may be extended in the future to enable more token combinations.
- When a
-
Alone A
Puncttoken cannot join with the following token to form a multi-character operator.Alonepunctuation tokens can be followed by any other tokens. In token streams parsed from source code, the compiler will set spacing toAlonein all cases not covered by the conditions forJointabove. E.g.+isAlonein+ =,+identand+(). In particular, tokens not followed by anything will be marked asAlone.
Implementations
impl Clone for Spacing
fn clone(self: &Self) -> Spacing
impl Copy for Spacing
impl Debug for Spacing
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Result
impl Eq for Spacing
impl Freeze for Spacing
impl PartialEq for Spacing
fn eq(self: &Self, other: &Spacing) -> bool
impl RefUnwindSafe for Spacing
impl Send for Spacing
impl StructuralPartialEq for Spacing
impl Sync for Spacing
impl Unpin for Spacing
impl UnwindSafe for Spacing
impl<T> Any for Spacing
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Spacing
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Spacing
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for Spacing
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for Spacing
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for Spacing
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T, U> Into for Spacing
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for Spacing
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Spacing
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>