diff --git a/current/algorithms/rust_algo/.gitignore b/current/algorithms/rust_algo/.gitignore new file mode 100644 index 0000000..eb5a316 --- /dev/null +++ b/current/algorithms/rust_algo/.gitignore @@ -0,0 +1 @@ +target diff --git a/current/algorithms/rust_algo/Cargo.lock b/current/algorithms/rust_algo/Cargo.lock new file mode 100644 index 0000000..539808a --- /dev/null +++ b/current/algorithms/rust_algo/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "rust_algo" +version = "0.1.0" diff --git a/current/algorithms/rust_algo/Cargo.toml b/current/algorithms/rust_algo/Cargo.toml new file mode 100644 index 0000000..f68107d --- /dev/null +++ b/current/algorithms/rust_algo/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "rust_algo" +version = "0.1.0" +edition = "2024" + +[dependencies] diff --git a/current/algorithms/rust_algo/src/main.rs b/current/algorithms/rust_algo/src/main.rs new file mode 100644 index 0000000..62c407b --- /dev/null +++ b/current/algorithms/rust_algo/src/main.rs @@ -0,0 +1,19 @@ +fn main() { + let mut v = [4.1, -5.1, 1.1, -3.1, 2.1]; + v.sort_by(f64::total_cmp); + + println!("Hello, world!"); + for el in v { + println!("Element {}.", el); + } + + let mut v = vec![5, 2, 1]; + v.push(2); + v.push(5); + + for (idx, elem) in v.iter().enumerate() { + println!("Val: {}. {}.", idx, elem); + } + + println!("Done"); +}