11
有没有办法让代码在下面工作?也就是说,在类型别名下导出一个枚举,并允许以新名称访问这些变体?枚举类型别名
enum One { A, B, C }
type Two = One;
fn main() {
// error: no associated item named `B` found for type `One` in the current scope
let b = Two::B;
}
重新导出没有窍门 - 我猜测枚举类型的行为更像微型模块而不是结构和基元。 –