mirror of https://github.com/KaiserY/trpl-zh-cn
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
219 B
13 lines
219 B
4 years ago
|
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));
|
||
|
}
|