summaryrefslogtreecommitdiff
path: root/advanced/adv-types/src/main.rs
diff options
context:
space:
mode:
authorAdam Carpenter <53hornet@gmail.com>2019-03-22 16:48:03 -0400
committerAdam Carpenter <53hornet@gmail.com>2019-03-22 16:48:03 -0400
commitcbfe2f1de7f0e24525e641228fec4c659badde93 (patch)
tree5939189ff3e3178e4f740a6038c6ccea7a182c0d /advanced/adv-types/src/main.rs
parentb1ea85616e4367713afbeabb6cfb6ae553c17a60 (diff)
downloadlearning-rust-cbfe2f1de7f0e24525e641228fec4c659badde93.tar.xz
learning-rust-cbfe2f1de7f0e24525e641228fec4c659badde93.zip
Added advanced traits, types, functions.
Diffstat (limited to 'advanced/adv-types/src/main.rs')
-rw-r--r--advanced/adv-types/src/main.rs41
1 files changed, 41 insertions, 0 deletions
diff --git a/advanced/adv-types/src/main.rs b/advanced/adv-types/src/main.rs
new file mode 100644
index 0000000..60d42b2
--- /dev/null
+++ b/advanced/adv-types/src/main.rs
@@ -0,0 +1,41 @@
+//use std::io::Error;
+//use std::fmt;
+
+//pub trait Write {
+//
+// fn write(&mut self, buf: &[u8]) -> Result<usize>;
+// fn flush(&mut self) -> Result<(), Error>;
+//
+// fn write_all(&mut self, buf: &[u8]) -> Result<()>;
+// fn write_fmt(&mut self, fmt: fmt::Arguments) -> Result<()>;
+//}
+
+//fn main() {
+// type Miles = i32;
+//
+// let x: i32 = 5;
+// let y: Miles = 5;
+//
+// println!("x + y = {}", x + y);
+
+
+//}
+
+//type Thunk = Box<dyn Fn() + Send + 'static>;
+//
+//let f: Thunk = Box::new(|| println!("hi"));
+//
+//fn takes_long_type(f: Thunk) {
+//}
+//
+//fn returns_long_type() -> Thunk {
+//}
+
+fn main() {
+ print!("forever");
+
+ loop {
+ print!("and ever ");
+ }
+}
+