diff --git a/rust/check_this_out.txt b/rust/check_this_out.txt new file mode 100644 index 0000000..576ffe4 --- /dev/null +++ b/rust/check_this_out.txt @@ -0,0 +1 @@ +SolidOak - Editor with Rust in mind diff --git a/rust/curses_test/.gitignore b/rust/curses_test/.gitignore new file mode 100644 index 0000000..eb5a316 --- /dev/null +++ b/rust/curses_test/.gitignore @@ -0,0 +1 @@ +target diff --git a/rust/curses_test/Cargo.lock b/rust/curses_test/Cargo.lock new file mode 100644 index 0000000..852e24d --- /dev/null +++ b/rust/curses_test/Cargo.lock @@ -0,0 +1,58 @@ +[root] +name = "curses_test" +version = "0.1.0" +dependencies = [ + "pancurses 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gcc" +version = "0.3.45" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "libc" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "log" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "ncurses" +version = "5.85.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gcc 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "pancurses" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "ncurses 5.85.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pdcurses-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "pdcurses-sys" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gcc 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[metadata] +"checksum gcc 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)" = "40899336fb50db0c78710f53e87afc54d8c7266fb76262fecc78ca1a7f09deae" +"checksum libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)" = "88ee81885f9f04bff991e306fea7c1c60a5f0f9e409e99f6b40e3311a3363135" +"checksum log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "5141eca02775a762cc6cd564d8d2c50f67c0ea3a372cbf1c51592b3e029e10ad" +"checksum ncurses 5.85.0 (registry+https://github.com/rust-lang/crates.io-index)" = "21f71f0e1ae96558612b1e9d188ec4f23149a11ee4fb4b96e130523bea52d605" +"checksum pancurses 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f88b65d6c3270b130a648d46d7de9d135516710619795a3c8b912bf1785f229e" +"checksum pdcurses-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc2afa9ac25ddaa04ce736b1525bff865beaf219bb2bb86a5b3354f34a5173b1" diff --git a/rust/curses_test/Cargo.toml b/rust/curses_test/Cargo.toml new file mode 100644 index 0000000..ea70dc3 --- /dev/null +++ b/rust/curses_test/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "curses_test" +version = "0.1.0" +authors = ["Logen Kain "] + +[dependencies] +pancurses = "0.8" diff --git a/rust/curses_test/src/main.rs b/rust/curses_test/src/main.rs new file mode 100644 index 0000000..c6d9069 --- /dev/null +++ b/rust/curses_test/src/main.rs @@ -0,0 +1,29 @@ +extern crate pancurses; + +use pancurses::{initscr, endwin, noecho, curs_set}; + +fn main() { + /*Create the window*/ + let window = initscr(); + + /*Set some ncurses config*/ + init(); + window.printw("Hello Rust"); + + /*See function for explination */ + refresh_win(&window); + window.getch(); + endwin(); +} + +fn init() { + noecho(); + curs_set(0); +} + + +/* This is a test to see how I can find a way to manipulate main() + * data in functions */ +fn refresh_win(window: &pancurses::Window) { + window.refresh(); +} diff --git a/rust/declare_test/.gitignore b/rust/declare_test/.gitignore new file mode 100644 index 0000000..eb5a316 --- /dev/null +++ b/rust/declare_test/.gitignore @@ -0,0 +1 @@ +target diff --git a/rust/declare_test/Cargo.lock b/rust/declare_test/Cargo.lock new file mode 100644 index 0000000..1b888a4 --- /dev/null +++ b/rust/declare_test/Cargo.lock @@ -0,0 +1,4 @@ +[root] +name = "declare_test" +version = "0.1.0" + diff --git a/rust/declare_test/Cargo.toml b/rust/declare_test/Cargo.toml new file mode 100644 index 0000000..932166c --- /dev/null +++ b/rust/declare_test/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "declare_test" +version = "0.1.0" +authors = ["Logen Kain "] + +[dependencies] diff --git a/rust/declare_test/src/main.rs b/rust/declare_test/src/main.rs new file mode 100644 index 0000000..b9ae106 --- /dev/null +++ b/rust/declare_test/src/main.rs @@ -0,0 +1,5 @@ +fn main() { + let x: i32; + x = 42; + println!("Hello, world! This is X, {}", x); +} diff --git a/rust/fuck_test/.gitignore b/rust/fuck_test/.gitignore new file mode 100644 index 0000000..eb5a316 --- /dev/null +++ b/rust/fuck_test/.gitignore @@ -0,0 +1 @@ +target diff --git a/rust/fuck_test/Cargo.lock b/rust/fuck_test/Cargo.lock new file mode 100644 index 0000000..0578903 --- /dev/null +++ b/rust/fuck_test/Cargo.lock @@ -0,0 +1,4 @@ +[root] +name = "fuck_test" +version = "0.1.0" + diff --git a/rust/fuck_test/Cargo.toml b/rust/fuck_test/Cargo.toml new file mode 100644 index 0000000..535e710 --- /dev/null +++ b/rust/fuck_test/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "fuck_test" +version = "0.1.0" +authors = ["Logen Kain "] + +[dependencies] diff --git a/rust/fuck_test/src/main.rs b/rust/fuck_test/src/main.rs new file mode 100644 index 0000000..e7a11a9 --- /dev/null +++ b/rust/fuck_test/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +} diff --git a/rust/guessing_game/.gitignore b/rust/guessing_game/.gitignore new file mode 100644 index 0000000..eb5a316 --- /dev/null +++ b/rust/guessing_game/.gitignore @@ -0,0 +1 @@ +target diff --git a/rust/guessing_game/Cargo.lock b/rust/guessing_game/Cargo.lock new file mode 100644 index 0000000..2b300da --- /dev/null +++ b/rust/guessing_game/Cargo.lock @@ -0,0 +1,4 @@ +[root] +name = "guessing_game" +version = "0.1.0" + diff --git a/rust/guessing_game/Cargo.toml b/rust/guessing_game/Cargo.toml new file mode 100644 index 0000000..d8a2e5f --- /dev/null +++ b/rust/guessing_game/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "guessing_game" +version = "0.1.0" +authors = ["Logen Kain "] + +[dependencies] +rand="0.3.0" diff --git a/rust/guessing_game/src/main.rs b/rust/guessing_game/src/main.rs new file mode 100644 index 0000000..a909c78 --- /dev/null +++ b/rust/guessing_game/src/main.rs @@ -0,0 +1,15 @@ +use std::io; + +fn main() { + println!("Guess a number!"); + + println!("Please input your guess."); + + let mut guess = String::new(); + + io::stdin().read_line(&mut guess) + .expect("Failed to read line"); + + println!("You guessed: {}", guess); + +} diff --git a/rust/hello_world/.gitignore b/rust/hello_world/.gitignore new file mode 100644 index 0000000..eb5a316 --- /dev/null +++ b/rust/hello_world/.gitignore @@ -0,0 +1 @@ +target diff --git a/rust/hello_world/Cargo.lock b/rust/hello_world/Cargo.lock new file mode 100644 index 0000000..8295e51 --- /dev/null +++ b/rust/hello_world/Cargo.lock @@ -0,0 +1,4 @@ +[root] +name = "hello_world" +version = "0.0.1" + diff --git a/rust/hello_world/Cargo.toml b/rust/hello_world/Cargo.toml new file mode 100644 index 0000000..12ee27d --- /dev/null +++ b/rust/hello_world/Cargo.toml @@ -0,0 +1,5 @@ +[package] + +name = "hello_world" +version = "0.0.1" +authors = [ "Logen Kain " ] diff --git a/rust/hello_world/src/main.rs b/rust/hello_world/src/main.rs new file mode 100644 index 0000000..a30eb95 --- /dev/null +++ b/rust/hello_world/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +} diff --git a/rust/notes b/rust/notes new file mode 100644 index 0000000..067c881 --- /dev/null +++ b/rust/notes @@ -0,0 +1,2 @@ +cargo run will build and run +cargo build --release will be optimised for distro