summaryrefslogtreecommitdiff
path: root/add/add-one
diff options
context:
space:
mode:
authorAdam Carpenter <53hornet@gmail.com>2019-03-13 10:02:15 -0400
committerAdam Carpenter <53hornet@gmail.com>2019-03-13 10:02:15 -0400
commit8a4d2fb922c2c5a9e900b4b836d7787a09a1fe90 (patch)
treeafb760597bf4cc78194892be910febde0209f7f3 /add/add-one
parentb71e253b697bae079a0cf2526209334f4b81f9a5 (diff)
downloadlearning-rust-8a4d2fb922c2c5a9e900b4b836d7787a09a1fe90.tar.xz
learning-rust-8a4d2fb922c2c5a9e900b4b836d7787a09a1fe90.zip
Added concurrency, pointers, oop
Diffstat (limited to 'add/add-one')
-rw-r--r--add/add-one/Cargo.toml8
-rw-r--r--add/add-one/src/lib.rs11
2 files changed, 19 insertions, 0 deletions
diff --git a/add/add-one/Cargo.toml b/add/add-one/Cargo.toml
new file mode 100644
index 0000000..88d65d1
--- /dev/null
+++ b/add/add-one/Cargo.toml
@@ -0,0 +1,8 @@
+[package]
+name = "add-one"
+version = "0.1.0"
+authors = ["Adam Carpenter <53hornet@gmail.com>"]
+edition = "2018"
+
+[dependencies]
+rand = "0.3.14"
diff --git a/add/add-one/src/lib.rs b/add/add-one/src/lib.rs
new file mode 100644
index 0000000..fe3583e
--- /dev/null
+++ b/add/add-one/src/lib.rs
@@ -0,0 +1,11 @@
+pub fn add_one(x: i32) -> i32 {
+ x + 1
+}
+
+#[cfg(test)]
+mod tests {
+ #[test]
+ fn it_works() {
+ assert_eq!(2 + 2, 4);
+ }
+}