Function
is_daily_file
(path: &Path, prefix: &str, suffix: &str)
Source from the content-addressed store, hash-verified
| 39 | } |
| 40 | |
| 41 | fn is_daily_file(path: &Path, prefix: &str, suffix: &str) -> bool { |
| 42 | let Some(name) = path.file_name().and_then(|name| name.to_str()) else { |
| 43 | return false; |
| 44 | }; |
| 45 | let date = name |
| 46 | .strip_prefix(prefix) |
| 47 | .and_then(|rest| rest.strip_prefix('.')) |
| 48 | .and_then(|rest| rest.strip_suffix(suffix)) |
| 49 | .and_then(|rest| rest.strip_suffix('.')); |
| 50 | date.is_some_and(is_iso_date) |
| 51 | } |
| 52 | |
| 53 | fn is_iso_date(text: &str) -> bool { |
| 54 | text.len() == 10 |
Tested by
no test coverage detected