mirror of
https://github.com/KaiserY/trpl-zh-cn
synced 2025-02-24 21:32:15 +08:00
13 lines
219 B
Rust
13 lines
219 B
Rust
|
enum List {
|
||
|
Cons(i32, Box<List>),
|
||
|
Nil,
|
||
|
}
|
||
|
|
||
|
use crate::List::{Cons, Nil};
|
||
|
|
||
|
fn main() {
|
||
|
let a = Cons(5, Box::new(Cons(10, Box::new(Nil))));
|
||
|
let b = Cons(3, Box::new(a));
|
||
|
let c = Cons(4, Box::new(a));
|
||
|
}
|