aboutsummaryrefslogtreecommitdiff
path: root/src/deck.rs
diff options
context:
space:
mode:
authorJoris2022-02-13 12:17:00 +0100
committerJoris2022-02-13 12:17:00 +0100
commit8a29f30fb2a949c03b318c4f7699136a8001be37 (patch)
tree51decc33aa776201bc800dc2196bc4f8b72337d7 /src/deck.rs
parent8170fb5e432cc81986479a6a3a400e009426d76a (diff)
Synchronize deck only if necessary
Look at the modification time of the deck, and synchronize if it has been modified after the last deck read.
Diffstat (limited to 'src/deck.rs')
-rw-r--r--src/deck.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/deck.rs b/src/deck.rs
index 3524c96..e0f9fab 100644
--- a/src/deck.rs
+++ b/src/deck.rs
@@ -23,7 +23,7 @@ impl std::error::Error for ParseError {
}
}
-pub fn read(deck: &String) -> Result<Vec<Entry>> {
+pub fn read(deck: &str) -> Result<Vec<Entry>> {
let file = File::open(deck)?;
let reader = BufReader::new(file);
let mut entries: Vec<Entry> = Vec::new();
@@ -69,7 +69,9 @@ pub fn read(deck: &String) -> Result<Vec<Entry>> {
}
pub fn pp_from_path(path: &String) -> Option<String> {
- Some(capitalize(Path::new(&path).with_extension("").file_name()?.to_str()?))
+ Some(capitalize(
+ Path::new(&path).with_extension("").file_name()?.to_str()?,
+ ))
}
fn capitalize(s: &str) -> String {