Trait std::marker::StructuralPartialEq[−][src]

pub trait StructuralPartialEq { }
🔬 This is a nightly-only experimental API. (structural_match #31434)
Expand description

模式匹配中使用的常量需要 trait。

不管其类型参数是否实现 Eq,任何派生 PartialEq 的类型都会自动实现此 trait。

如果 const 项包含某种不实现此 trait 的类型,则该类型要么 (1.) 不实现 PartialEq (这意味着常量将不提供该比较方法 (代码生成假定可用) ),要么 (2.) 自身实现 itsPartialEq 的版本 (我们认为不符合结构相等性比较)。

在以上两种情况中的任何一种情况下,我们都拒绝在模式匹配中使用此类常量。

另请参见 structural match RFC 和 issue 63438,它们促使从基于属性的设计迁移到此 trait。

Implementations on Foreign Types

Implementors

This is supported on Unix only.