关联常量
associated-constants.mdcommit 024aa9a345e92aa1926517c4d9b16bd83e74c10d通过associated_consts功能,你像这样可以定义常量:#![feature(associated_consts)]trait Foo { const ID: i32;}impl Foo for i32 { const ID: i32 = 1;}fn main() { assert_eq!(1, i32::ID);}任何Foo的定义都必须定义ID,不定义的话:#!
欢马劈雪