Enum Spacing

pub enum Spacing

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 another Punct without a whitespace. E.g. + is Joint in += and ++.
  • When a single quote ' is immediately followed by an identifier without a whitespace. E.g. ' is Joint 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 Clone for Spacing

fn clone(&self) -> Spacing

impl Copy for Spacing

impl Debug for Spacing

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl Eq for Spacing

fn assert_fields_are_eq(&self)

impl PartialEq for Spacing

fn eq(&self, other: &Spacing) -> bool

impl StructuralPartialEq for Spacing

impl TrivialClone 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 UnsafeUnpin for Spacing

impl UnwindSafe for Spacing

Blanket Implementations

impl<T> Any for Spacing where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for Spacing where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for Spacing where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> CloneToUninit for Spacing where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for Spacing

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Printable for Spacing where T: Copy + Debug,

impl<T> SizeHint for Spacing where T: ?Sized,

fn lower_bound(&self) -> usize
fn upper_bound(&self) -> Option<usize>

impl<T> SizedTypeProperties for Spacing

impl<T> ToOwned for Spacing where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T, U> Into<U> for Spacing where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for Spacing where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for Spacing where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>