[2018][rust][2] move from lib to bin
change kyqwktryxrxkoqnynkxowuqkpoyrxyux
commit fc5c7c930741eb394b334e442bd819de59431af4
author Alpha Chen <alpha.chen@gmail.com>
date
parent mqwtvnom
diff --git a/2018/rust/src/day_02.rs b/2018/rust/src/bin/day_02.rs
similarity index 83%
rename from 2018/rust/src/day_02.rs
rename to 2018/rust/src/bin/day_02.rs
index d24771d..414573c 100644
--- a/2018/rust/src/day_02.rs
+++ b/2018/rust/src/bin/day_02.rs
@@ -1,4 +1,17 @@
-pub fn solve(input: &str) -> String {
+use std::error::Error;
+use std::io::{self, Read};
+
+fn main() -> Result<(), Box<Error>> {
+    let mut input = String::new();
+    io::stdin().read_to_string(&mut input)?;
+
+    let output = solve(&input);
+    println!("{}", output);
+
+    Ok(())
+}
+
+fn solve(input: &str) -> String {
     let box_ids: Vec<_> = input.lines().map(BoxId::new).collect();
 
     let two_count = box_ids.iter().filter(|&x| x.is_two()).count();
diff --git a/2018/rust/src/main.rs b/2018/rust/src/main.rs
index 0135cf4..00bcf0b 100644
--- a/2018/rust/src/main.rs
+++ b/2018/rust/src/main.rs
@@ -1,12 +1,5 @@
 use std::io::{self, Read};
 
 mod day_01;
-mod day_02;
 
-fn main() {
-    let mut input = String::new();
-    io::stdin().read_to_string(&mut input).unwrap();
-
-    let output = day_02::solve(&input);
-    println!("{}", output);
-}
+fn main() {}