Added rust to practice

This commit is contained in:
Logen Kain 2017-03-29 12:42:23 -07:00
parent 3c3a83f482
commit 53bf1e4edf
22 changed files with 168 additions and 0 deletions

1
rust/check_this_out.txt Normal file
View File

@ -0,0 +1 @@
SolidOak - Editor with Rust in mind

1
rust/curses_test/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
target

58
rust/curses_test/Cargo.lock generated Normal file
View File

@ -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"

View File

@ -0,0 +1,7 @@
[package]
name = "curses_test"
version = "0.1.0"
authors = ["Logen Kain <logen@sudotask.com>"]
[dependencies]
pancurses = "0.8"

View File

@ -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();
}

1
rust/declare_test/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
target

4
rust/declare_test/Cargo.lock generated Normal file
View File

@ -0,0 +1,4 @@
[root]
name = "declare_test"
version = "0.1.0"

View File

@ -0,0 +1,6 @@
[package]
name = "declare_test"
version = "0.1.0"
authors = ["Logen Kain <logen@sudotask.com>"]
[dependencies]

View File

@ -0,0 +1,5 @@
fn main() {
let x: i32;
x = 42;
println!("Hello, world! This is X, {}", x);
}

1
rust/fuck_test/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
target

4
rust/fuck_test/Cargo.lock generated Normal file
View File

@ -0,0 +1,4 @@
[root]
name = "fuck_test"
version = "0.1.0"

View File

@ -0,0 +1,6 @@
[package]
name = "fuck_test"
version = "0.1.0"
authors = ["Logen Kain <logen@sudotask.com>"]
[dependencies]

View File

@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}

1
rust/guessing_game/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
target

4
rust/guessing_game/Cargo.lock generated Normal file
View File

@ -0,0 +1,4 @@
[root]
name = "guessing_game"
version = "0.1.0"

View File

@ -0,0 +1,7 @@
[package]
name = "guessing_game"
version = "0.1.0"
authors = ["Logen Kain <logen@sudotask.com>"]
[dependencies]
rand="0.3.0"

View File

@ -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);
}

1
rust/hello_world/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
target

4
rust/hello_world/Cargo.lock generated Normal file
View File

@ -0,0 +1,4 @@
[root]
name = "hello_world"
version = "0.0.1"

View File

@ -0,0 +1,5 @@
[package]
name = "hello_world"
version = "0.0.1"
authors = [ "Logen Kain <logen@sudotask.com>" ]

View File

@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}

2
rust/notes Normal file
View File

@ -0,0 +1,2 @@
cargo run will build and run
cargo build --release will be optimised for distro