mirror of
https://github.com/KaiserY/trpl-zh-cn
synced 2025-02-24 13:22:19 +08:00
13 lines
219 B
Rust
Executable File
13 lines
219 B
Rust
Executable File
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));
|
|
}
|