Initial Rust skeleton

wip
Alpha Chen 9 years ago
parent 124ae44c0d
commit 763665c05a

1
rust/.gitignore vendored

@ -0,0 +1 @@
target

4
rust/Cargo.lock generated

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

@ -0,0 +1,4 @@
[package]
name = "advent_of_code"
version = "0.1.0"
authors = ["Alpha Chen <alpha.chen@gmail.com>"]

File diff suppressed because one or more lines are too long

@ -0,0 +1,20 @@
use std::io::Error;
pub trait Day {
fn new(String) -> Self;
fn solve(self) -> Result<i32, Error>;
}
pub struct Day01 {
input: String,
}
impl Day for Day01 {
fn new(input: String) -> Day01 {
Day01 { input: input }
}
fn solve(self) -> Result<i32, Error> {
Ok(1)
}
}

@ -0,0 +1,10 @@
extern crate advent_of_code;
use advent_of_code::*;
fn main() {
let day = Day01::new("".to_string());
match day.solve() {
Ok(n) => println!("{}", n),
Err(e) => println!("{}", e),
}
}
Loading…
Cancel
Save