This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 定义零:作为自然数的起点 | |
struct Zero; | |
// 定义后继:Succ<N> 表示自然数 N 的后继(即 N + 1) | |
struct Succ<N>(N); | |
// 为自然数定义特性 | |
trait Natural { | |
// 获取数值(运行时) | |
fn value() -> usize; |