X-Git-Url: http://git.scottworley.com/voter/blobdiff_plain/8b8f8d1435e33c0f63fa0dfa940b3b582dc1cf90..5ee4072bf723ad5b091bcf8e5869382fed9f00ba:/src/main.rs diff --git a/src/main.rs b/src/main.rs index 865fcb8..92937e5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -81,8 +81,16 @@ fn tally_votes(dir: &Path) -> std::io::Result>> } } +fn read_elim_list(dir: &Path) -> std::io::Result> { + match std::fs::File::open(dir.join("eliminated")) { + Err(e) if e.kind() == std::io::ErrorKind::NotFound => Ok(HashSet::new()), + Err(e) => Err(e), + Ok(elimfile) => std::io::BufReader::new(elimfile).lines().collect(), + } +} + fn valid_id_char(c: u8) -> bool { - (b'A'..=b'Z').contains(&c) || (b'a'..=b'z').contains(&c) || (b'0'..=b'9').contains(&c) + c.is_ascii_alphanumeric() } fn make_random_id() -> [u8; COOKIE_LENGTH] { @@ -121,6 +129,7 @@ const HTML_HEADER: &str = "