From 87ab1a9ee41a0899b53162eeb3953ebde388b765 Mon Sep 17 00:00:00 2001 From: alnotz Date: Sat, 23 Jul 2022 19:19:24 +0200 Subject: [PATCH] To clean --- Rust/hello_cargo/Cargo.lock | 85 ++++++++++++++++++++++++++++++++++++ Rust/hello_cargo/Cargo.toml | 9 ++++ Rust/hello_cargo/src/main.rs | 23 ++++++++++ 3 files changed, 117 insertions(+) create mode 100644 Rust/hello_cargo/Cargo.lock create mode 100644 Rust/hello_cargo/Cargo.toml create mode 100644 Rust/hello_cargo/src/main.rs diff --git a/Rust/hello_cargo/Cargo.lock b/Rust/hello_cargo/Cargo.lock new file mode 100644 index 0000000..c1fc0ff --- /dev/null +++ b/Rust/hello_cargo/Cargo.lock @@ -0,0 +1,85 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "getrandom" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418d37c8b1d42553c93648be529cb70f920d3baf8ef469b74b9638df426e0b4c" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "hello_cargo" +version = "0.1.0" +dependencies = [ + "rand", +] + +[[package]] +name = "libc" +version = "0.2.115" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a8d982fa7a96a000f6ec4cfe966de9703eccde29750df2bb8949da91b0e818d" + +[[package]] +name = "ppv-lite86" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" + +[[package]] +name = "rand" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", + "rand_hc", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rand_hc" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" +dependencies = [ + "rand_core", +] + +[[package]] +name = "wasi" +version = "0.10.2+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" diff --git a/Rust/hello_cargo/Cargo.toml b/Rust/hello_cargo/Cargo.toml new file mode 100644 index 0000000..ae8a6e1 --- /dev/null +++ b/Rust/hello_cargo/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "hello_cargo" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +rand = "^0.8.3" diff --git a/Rust/hello_cargo/src/main.rs b/Rust/hello_cargo/src/main.rs new file mode 100644 index 0000000..cda214d --- /dev/null +++ b/Rust/hello_cargo/src/main.rs @@ -0,0 +1,23 @@ +use std::string::String; +fn tbl_str(tbl: &[u8]) -> String { + let l = tbl.len(); + let mut out = String::new(); + out.push_str("["); + let rg = 0..l; + for i in rg { + if i != l-1 { + out = out + &format!("{},", i); + } + else { + out += &format!("{}", i); + } + } + out = format!("{}]", out); + return out; +} +fn main() { + println!("DEBUT!"); + let tbl = [0, 1, 2]; + println!("{}", tbl_str(&tbl)); + println!("FIN"); +}