summaryrefslogtreecommitdiffstats
path: root/examples/20_list.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-07-02 02:54:21 -0400
committerJesse Luehrs <doy@tozt.net>2014-07-02 02:54:21 -0400
commite620daf3b1a40ae825c625bc4328fb7d2b3ee8b6 (patch)
treefaa469408ee78623eaa8d2720dcbb36096788ca1 /examples/20_list.rs
downloadintro-to-rust-yapc-na-2014-master.tar.gz
intro-to-rust-yapc-na-2014-master.zip
initial commitHEADmaster
Diffstat (limited to 'examples/20_list.rs')
-rw-r--r--examples/20_list.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/examples/20_list.rs b/examples/20_list.rs
new file mode 100644
index 0000000..a8b7e6f
--- /dev/null
+++ b/examples/20_list.rs
@@ -0,0 +1,12 @@
+extern crate debug;
+
+enum List<T> {
+ Cons(T, Box<List<T>>),
+ Nil
+}
+
+fn main () {
+ let l = box Cons(1i, box Cons(2i, box Cons(4i, box Nil)));
+ println!("{:?}", l);
+}
+