Skip to content

Commit

Permalink
fix: inlining files with rust crate
Browse files Browse the repository at this point in the history
  • Loading branch information
palerdot committed Jan 31, 2024
1 parent 55adad1 commit 12a7da1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
21 changes: 6 additions & 15 deletions src/wordle/data.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
use std::fs;

fn parse_file(path: String) -> Vec<String> {
let file_data = fs::read_to_string(path.clone());

if file_data.is_err() {
panic!("cannot read file {}", path.clone());
}

let file_data = file_data.unwrap();
pub fn valid_guesses() -> Vec<String> {
let file_data = include_str!("./guess.txt");
let words = file_data.split("\n");

words.map(|x| x.to_string()).collect()
}

pub fn valid_guesses() -> Vec<String> {
parse_file("./data/guess.txt".to_string())
}

pub fn valid_wordles() -> Vec<String> {
parse_file("./data/answer.txt".to_string())
let file_data = include_str!("./answer.txt");
let words = file_data.split("\n");

words.map(|x| x.to_string()).collect()
}
File renamed without changes.

0 comments on commit 12a7da1

Please # to comment.