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
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.
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) -> TReturns the argument unchanged.
impl<T> Printable for Spacing
where
T: Copy + Debug,
impl<T> SizeHint for Spacing
where
T: ?Sized,
fn lower_bound(&self) -> usizefn 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) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for Spacing
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses 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>