瀏覽代碼

initial commit

Nicolas Winkler 6 年之前
當前提交
c7fd7ca5de
共有 4 個文件被更改,包括 29 次插入0 次删除
  1. 2 0
      .gitignore
  2. 7 0
      Cargo.toml
  3. 11 0
      src/hex.rs
  4. 9 0
      src/main.rs

+ 2 - 0
.gitignore

@@ -0,0 +1,2 @@
+/target
+**/*.rs.bk

+ 7 - 0
Cargo.toml

@@ -0,0 +1,7 @@
+[package]
+name = "xd"
+version = "0.1.0"
+authors = ["Nicolas Winkler <nicolas.winkler@gmx.ch>"]
+edition = "2018"
+
+[dependencies]

+ 11 - 0
src/hex.rs

@@ -0,0 +1,11 @@
+
+
+
+pub fn get_hex(x: u8) -> char {
+    const LUTABLE: [char; 16] = 
+        ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D',
+        'E', 'F'];
+
+    LUTABLE[x as usize]
+}
+

+ 9 - 0
src/main.rs

@@ -0,0 +1,9 @@
+
+pub mod hex;
+
+fn main() {
+    println!("Hello: {}", hex::get_hex(12));
+}
+
+
+