Skip to content

Commit

Permalink
Implement Author::new() and derive debug
Browse files Browse the repository at this point in the history
  • Loading branch information
sondr3 committed Oct 15, 2018
1 parent 3ee8911 commit 13df37c
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,20 @@ use std::error::Error;

static CURSES: &str = include_str!("words.txt");

//struct Author {
// name: String,
// curses: HashMap<String, usize>,
//}
#[derive(Debug)]
struct Author {
name: String,
curses: HashMap<&'static str, usize>,
}

impl Author {
fn new(name: &str, curses: HashMap<&'static str, usize>) -> Author {
let name = name.to_string();
Author {
name, curses
}
}
}

fn main() -> Result<(), Box<Error>> {
let curses: Vec<&str> = CURSES.lines().collect();
Expand Down

0 comments on commit 13df37c

Please sign in to comment.