Compare commits

..
Author SHA1 Message Date
phoenix 403a941ece cargo update
textsender_models PR / Rustfmt (pull_request) Successful in 1m1s
textsender_models PR / Clippy (pull_request) Successful in 1m14s
Release Tagging / release (pull_request) Successful in 27s
textsender_models PR / Check (pull_request) Successful in 1m42s
2026-07-01 22:58:27 -04:00
phoenix 904e50f981 Some refactoring
textsender_models PR / Rustfmt (pull_request) Successful in 32s
textsender_models PR / Check (pull_request) Has been cancelled
textsender_models PR / Clippy (pull_request) Has been cancelled
Release Tagging / release (pull_request) Successful in 35s
2026-07-01 22:57:45 -04:00
phoenix 6b84cc42d6 Removing async from functions
textsender_models PR / Rustfmt (pull_request) Successful in 35s
Release Tagging / release (pull_request) Successful in 39s
textsender_models PR / Clippy (pull_request) Successful in 1m23s
textsender_models PR / Check (pull_request) Successful in 1m29s
2026-07-01 22:53:09 -04:00
phoenix b25b651241 bump: textsender_models
textsender_models PR / Rustfmt (pull_request) Successful in 48s
textsender_models PR / Check (pull_request) Successful in 1m2s
Release Tagging / release (pull_request) Successful in 31s
textsender_models PR / Clippy (pull_request) Successful in 1m38s
2026-07-01 22:49:48 -04:00
phoenix cc6e6286c7 Adding test
textsender_models PR / Rustfmt (pull_request) Successful in 1m9s
textsender_models PR / Check (pull_request) Successful in 1m20s
textsender_models PR / Clippy (pull_request) Successful in 1m27s
Release Tagging / release (pull_request) Successful in 34s
2026-07-01 22:47:36 -04:00
+3 -41
View File
@@ -2,52 +2,14 @@
/// extract it into some strings
pub fn delimitize(var: &crate::envy::EnvVar) -> Result<Vec<String>, std::io::Error> {
if var.has_delimiter {
let values: Vec<String> = match var
Ok(var
.value
.split(var.delimiter)
.map(|c| c.parse::<String>())
.collect()
{
Ok(v) => v,
Err(err) => {
return Err(std::io::Error::other(err));
}
};
Ok(values)
.map(|c| c.parse::<String>().unwrap())
.collect())
} else {
Err(std::io::Error::other(
"Environment variable does not have a delimiter",
))
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_delimitize() {
let envvar = crate::envy::EnvVar {
key: "OCEANS".to_string(),
value: "Atlantic|Pacific|Indian|Arctic".to_string(),
has_delimiter: true,
delimiter: '|',
};
let all_values = vec![
"Atlantic".to_string(),
"Pacific".to_string(),
"Indian".to_string(),
"Arctic".to_string(),
];
match delimitize(&envvar) {
Ok(values) => {
assert_eq!(values, all_values, "Failure in delimitizing EnvVar values");
}
Err(err) => {
assert!(false, "Error delimitizing: {err:?}");
}
}
}
}