diff options
author | Adam Carpenter <53hornet@gmail.com> | 2019-03-21 17:10:15 -0400 |
---|---|---|
committer | Adam Carpenter <53hornet@gmail.com> | 2019-03-21 17:10:15 -0400 |
commit | 333965318a5d000140d54be2a2a9e0832372f271 (patch) | |
tree | e7f28b53144982cfdf2cb95c9d71e5ea7a566b77 /advanced/adv-traits | |
parent | 2fadb006603139c335ed8df8fa9c25402986c4fd (diff) | |
download | learning-rust-333965318a5d000140d54be2a2a9e0832372f271.tar.xz learning-rust-333965318a5d000140d54be2a2a9e0832372f271.zip |
Added advanced features.
Diffstat (limited to 'advanced/adv-traits')
25 files changed, 51 insertions, 0 deletions
diff --git a/advanced/adv-traits/Cargo.toml b/advanced/adv-traits/Cargo.toml new file mode 100644 index 0000000..b1c5f6a --- /dev/null +++ b/advanced/adv-traits/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "adv-traits" +version = "0.1.0" +authors = ["Adam Carpenter <53hornet@gmail.com>"] +edition = "2018" + +[dependencies] diff --git a/advanced/adv-traits/src/main.rs b/advanced/adv-traits/src/main.rs new file mode 100644 index 0000000..6ec0aac --- /dev/null +++ b/advanced/adv-traits/src/main.rs @@ -0,0 +1,34 @@ +//fn main() { +// println!("Hello, world!"); +//} +// +//pub trait Iterator { +// type Item; +// +// fn next(&mut self) -> Option<Self::Item>; +//} +// +use std::ops::Add; + +#[derive(Debug, PartialEq)] +struct Point { + x: i32, + y: i32, +} + +impl Add for Point { + type Output = Point; + + fn add(self, other: Point) -> Point { + Point { + x: self.x + other.x, + y: self.y + other.y, + } + } +} + +fn main() { + assert_eq!(Point { x: 1, y: 0 } + Point { x: 2, y: 3 }, + Point { x: 3, y: 3 }); + println!("Done."); +} diff --git a/advanced/adv-traits/target/.rustc_info.json b/advanced/adv-traits/target/.rustc_info.json new file mode 100644 index 0000000..7928d45 --- /dev/null +++ b/advanced/adv-traits/target/.rustc_info.json @@ -0,0 +1 @@ +{"rustc_fingerprint":13873747241073698561,"outputs":{"1617349019360157463":["___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/home/carpenat/.rustup/toolchains/stable-x86_64-unknown-linux-gnu\ndebug_assertions\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"unknown\"\nunix\n",""],"1164083562126845933":["rustc 1.33.0 (2aa4c46cf 2019-02-28)\nbinary: rustc\ncommit-hash: 2aa4c46cfdd726e97360c2734835aa3515e8c858\ncommit-date: 2019-02-28\nhost: x86_64-unknown-linux-gnu\nrelease: 1.33.0\nLLVM version: 8.0\n",""],"15337506775154344876":["___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/home/carpenat/.rustup/toolchains/stable-x86_64-unknown-linux-gnu\ndebug_assertions\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"unknown\"\nunix\n",""]},"successes":{}}
\ No newline at end of file diff --git a/advanced/adv-traits/target/debug/.cargo-lock b/advanced/adv-traits/target/debug/.cargo-lock new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/advanced/adv-traits/target/debug/.cargo-lock diff --git a/advanced/adv-traits/target/debug/.fingerprint/adv-traits-7a3f023f72f2e99b/bin-adv_traits-7a3f023f72f2e99b b/advanced/adv-traits/target/debug/.fingerprint/adv-traits-7a3f023f72f2e99b/bin-adv_traits-7a3f023f72f2e99b new file mode 100644 index 0000000..e613bbc --- /dev/null +++ b/advanced/adv-traits/target/debug/.fingerprint/adv-traits-7a3f023f72f2e99b/bin-adv_traits-7a3f023f72f2e99b @@ -0,0 +1 @@ +636ef41b82832f13
\ No newline at end of file diff --git a/advanced/adv-traits/target/debug/.fingerprint/adv-traits-7a3f023f72f2e99b/bin-adv_traits-7a3f023f72f2e99b.json b/advanced/adv-traits/target/debug/.fingerprint/adv-traits-7a3f023f72f2e99b/bin-adv_traits-7a3f023f72f2e99b.json new file mode 100644 index 0000000..8b613d0 --- /dev/null +++ b/advanced/adv-traits/target/debug/.fingerprint/adv-traits-7a3f023f72f2e99b/bin-adv_traits-7a3f023f72f2e99b.json @@ -0,0 +1 @@ +{"rustc":14715343205281380114,"features":"[]","target":4630177701526872026,"profile":36343588025168328,"path":1036222786711178230,"deps":[],"local":[{"MtimeBased":[[1553199946,719046300],".fingerprint/adv-traits-7a3f023f72f2e99b/dep-bin-adv_traits-7a3f023f72f2e99b"]}],"rustflags":[],"edition":"Edition2018"}
\ No newline at end of file diff --git a/advanced/adv-traits/target/debug/.fingerprint/adv-traits-7a3f023f72f2e99b/dep-bin-adv_traits-7a3f023f72f2e99b b/advanced/adv-traits/target/debug/.fingerprint/adv-traits-7a3f023f72f2e99b/dep-bin-adv_traits-7a3f023f72f2e99b Binary files differnew file mode 100644 index 0000000..e046c38 --- /dev/null +++ b/advanced/adv-traits/target/debug/.fingerprint/adv-traits-7a3f023f72f2e99b/dep-bin-adv_traits-7a3f023f72f2e99b diff --git a/advanced/adv-traits/target/debug/.fingerprint/adv-traits-7a3f023f72f2e99b/invoked.timestamp b/advanced/adv-traits/target/debug/.fingerprint/adv-traits-7a3f023f72f2e99b/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/advanced/adv-traits/target/debug/.fingerprint/adv-traits-7a3f023f72f2e99b/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started.
\ No newline at end of file diff --git a/advanced/adv-traits/target/debug/adv-traits b/advanced/adv-traits/target/debug/adv-traits Binary files differnew file mode 100755 index 0000000..11e80f1 --- /dev/null +++ b/advanced/adv-traits/target/debug/adv-traits diff --git a/advanced/adv-traits/target/debug/adv-traits.d b/advanced/adv-traits/target/debug/adv-traits.d new file mode 100644 index 0000000..8564f19 --- /dev/null +++ b/advanced/adv-traits/target/debug/adv-traits.d @@ -0,0 +1 @@ +/home/carpenat/devel/learning-rust/advanced/adv-traits/target/debug/adv-traits: /home/carpenat/devel/learning-rust/advanced/adv-traits/src/main.rs diff --git a/advanced/adv-traits/target/debug/deps/adv_traits-7a3f023f72f2e99b b/advanced/adv-traits/target/debug/deps/adv_traits-7a3f023f72f2e99b Binary files differnew file mode 100755 index 0000000..11e80f1 --- /dev/null +++ b/advanced/adv-traits/target/debug/deps/adv_traits-7a3f023f72f2e99b diff --git a/advanced/adv-traits/target/debug/deps/adv_traits-7a3f023f72f2e99b.d b/advanced/adv-traits/target/debug/deps/adv_traits-7a3f023f72f2e99b.d new file mode 100644 index 0000000..ea0dbeb --- /dev/null +++ b/advanced/adv-traits/target/debug/deps/adv_traits-7a3f023f72f2e99b.d @@ -0,0 +1,5 @@ +/home/carpenat/devel/learning-rust/advanced/adv-traits/target/debug/deps/adv_traits-7a3f023f72f2e99b: src/main.rs + +/home/carpenat/devel/learning-rust/advanced/adv-traits/target/debug/deps/adv_traits-7a3f023f72f2e99b.d: src/main.rs + +src/main.rs: diff --git a/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia-2bomoy8swd05u/1817p87j5sskdd2d.o b/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia-2bomoy8swd05u/1817p87j5sskdd2d.o Binary files differnew file mode 100644 index 0000000..e6e5dbd --- /dev/null +++ b/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia-2bomoy8swd05u/1817p87j5sskdd2d.o diff --git a/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia-2bomoy8swd05u/18dwqulmfpgc4a76.o b/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia-2bomoy8swd05u/18dwqulmfpgc4a76.o Binary files differnew file mode 100644 index 0000000..7217217 --- /dev/null +++ b/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia-2bomoy8swd05u/18dwqulmfpgc4a76.o diff --git a/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia-2bomoy8swd05u/1uwm6llvq8hpxxe4.o b/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia-2bomoy8swd05u/1uwm6llvq8hpxxe4.o Binary files differnew file mode 100644 index 0000000..a50fb0f --- /dev/null +++ b/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia-2bomoy8swd05u/1uwm6llvq8hpxxe4.o diff --git a/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia-2bomoy8swd05u/22vo1hhgz7nrqprk.o b/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia-2bomoy8swd05u/22vo1hhgz7nrqprk.o Binary files differnew file mode 100644 index 0000000..2d0b66a --- /dev/null +++ b/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia-2bomoy8swd05u/22vo1hhgz7nrqprk.o diff --git a/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia-2bomoy8swd05u/39s13eb25j8u8cmp.o b/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia-2bomoy8swd05u/39s13eb25j8u8cmp.o Binary files differnew file mode 100644 index 0000000..f3d3ce6 --- /dev/null +++ b/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia-2bomoy8swd05u/39s13eb25j8u8cmp.o diff --git a/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia-2bomoy8swd05u/3scspgmrophbznf2.o b/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia-2bomoy8swd05u/3scspgmrophbznf2.o Binary files differnew file mode 100644 index 0000000..9d2899c --- /dev/null +++ b/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia-2bomoy8swd05u/3scspgmrophbznf2.o diff --git a/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia-2bomoy8swd05u/3syc801cqhizh1el.o b/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia-2bomoy8swd05u/3syc801cqhizh1el.o Binary files differnew file mode 100644 index 0000000..f364532 --- /dev/null +++ b/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia-2bomoy8swd05u/3syc801cqhizh1el.o diff --git a/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia-2bomoy8swd05u/4iuush58y7c4c0jb.o b/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia-2bomoy8swd05u/4iuush58y7c4c0jb.o Binary files differnew file mode 100644 index 0000000..ae9ba65 --- /dev/null +++ b/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia-2bomoy8swd05u/4iuush58y7c4c0jb.o diff --git a/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia-2bomoy8swd05u/5baiae7vuud9a1ml.o b/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia-2bomoy8swd05u/5baiae7vuud9a1ml.o Binary files differnew file mode 100644 index 0000000..73eeb93 --- /dev/null +++ b/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia-2bomoy8swd05u/5baiae7vuud9a1ml.o diff --git a/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia-2bomoy8swd05u/dep-graph.bin b/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia-2bomoy8swd05u/dep-graph.bin Binary files differnew file mode 100644 index 0000000..37818e6 --- /dev/null +++ b/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia-2bomoy8swd05u/dep-graph.bin diff --git a/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia-2bomoy8swd05u/query-cache.bin b/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia-2bomoy8swd05u/query-cache.bin Binary files differnew file mode 100644 index 0000000..017fbfc --- /dev/null +++ b/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia-2bomoy8swd05u/query-cache.bin diff --git a/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia-2bomoy8swd05u/work-products.bin b/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia-2bomoy8swd05u/work-products.bin Binary files differnew file mode 100644 index 0000000..669496c --- /dev/null +++ b/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia-2bomoy8swd05u/work-products.bin diff --git a/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia.lock b/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia.lock new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/advanced/adv-traits/target/debug/incremental/adv_traits-2ru2bytkxlvmk/s-faka7dwbdr-1ec8yia.lock |