Added rust to practice

This commit is contained in:
2017-04-11 16:17:19 -07:00
parent f6a827b078
commit 2a38448585
9 changed files with 162 additions and 5 deletions

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

@@ -0,0 +1 @@
target

30
rust/curses_test2/Cargo.lock generated Normal file
View File

@@ -0,0 +1,30 @@
[root]
name = "curses_test2"
version = "0.1.0"
dependencies = [
"ncurses 5.85.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 = "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)",
]
[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 ncurses 5.85.0 (registry+https://github.com/rust-lang/crates.io-index)" = "21f71f0e1ae96558612b1e9d188ec4f23149a11ee4fb4b96e130523bea52d605"

View File

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

View File

@@ -0,0 +1,27 @@
extern crate ncurses;
use ncurses::*;
fn main()
{
/* If your locale env is unicode, you should use `setlocale`. */
// let locale_conf = LcCategory::all;
// setlocale(locale_conf, "zh_CN.UTF-8"); // if your locale is like mine(zh_CN.UTF-8).
/* Start ncurses. */
initscr();
/* Print to the back buffer. */
printw("Hello, world!");
/* Print some unicode(Chinese) string. */
// printw("Great Firewall dislike VPN protocol.\nGFW 不喜欢 VPN 协议。";
/* Update the screen. */
refresh();
/* Wait for a key press. */
getch();
/* Terminate ncurses. */
endwin();
}