proc_macro

枚举 Spacing

1.29.0 · Source
pub enum Spacing {
    Joint,
    Alone,
}
展开描述

指示 Punct 标记是否可以与后面的标记连接以形成多字符运算符。

变体§

§1.29.0

联合

Punct 标记可以与后面的标记连接以形成多字符运算符。

在使用 proc macro 接口构建的标记流中,Joint 标点符号标记可以后跟任何其他标记。但是,在从源代码解析的标记流中,编译器仅在以下情况下将间距设置为 Joint

  • Punct 紧跟另一个 Punct 而没有空格时。例如,在 +=++ 中,+Joint
  • 当单引号 ' 紧跟一个标识符而没有空格时。例如,在 'lifetime 中,'Joint

未来可能会扩展此列表以启用更多标记组合。

§1.29.0

单独

Punct 标记不能与后面的标记连接以形成多字符运算符。

Alone 标点符号标记可以后跟任何其他标记。在从源代码解析的标记流中,对于上面 Joint 条件未涵盖的所有情况,编译器都会将间距设置为 Alone。例如,在 + =+ident+() 中,+Alone。特别是,未跟随任何内容的标记将被标记为 Alone

Trait 实现§

1.29.0 · Source§

impl Clone for Spacing

Source§

fn clone(&self) -> Spacing

返回值的副本。阅读更多
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

执行从 source 的复制赋值。阅读更多
1.29.0 · Source§

impl Debug for Spacing

Source§

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

使用给定的 formatter 格式化值。阅读更多
1.29.0 · Source§

impl PartialEq for Spacing

Source§

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

测试 selfother 值是否相等,并由 == 使用。
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

测试 !=。默认实现几乎总是足够的,除非有非常好的理由,否则不应被覆盖。
1.29.0 · Source§

impl Copy for Spacing

1.29.0 · Source§

impl Eq for Spacing

1.29.0 · Source§

impl StructuralPartialEq for Spacing

自动 Trait 实现§

通用的实现§

Source§

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

Source§

fn type_id(&self) -> TypeId

获取 selfTypeId阅读更多
Source§

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

Source§

fn borrow(&self) -> &T

不可变地从拥有的值借用。阅读更多
Source§

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

Source§

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

可变地从拥有的值借用。阅读更多
Source§

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

Source§

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

🔬这是一个仅在 nightly 版本中提供的实验性 API。(clone_to_uninit #126799)
执行从 selfdst 的复制赋值。阅读更多
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

返回未更改的参数。

Source§

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

Source§

fn into(self) -> U

调用 U::from(self)

也就是说,此转换是 From<T> for U 的实现选择执行的任何操作。

Source§

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

Source§

type Owned = T

获取所有权后的结果类型。
Source§

fn to_owned(&self) -> T

从借用的数据创建拥有的数据,通常通过克隆。阅读更多
Source§

fn clone_into(&self, target: &mut T)

使用借用的数据替换拥有的数据,通常通过克隆。阅读更多
Source§

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

Source§

type Error = Infallible

转换错误时返回的类型。
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

执行转换。
Source§

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

Source§

type Error = <U as TryFrom<T>>::Error

转换错误时返回的类型。
Source§

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

执行转换。