Rust Build / Check (push) Successful in 32s
Rust Build / Test Suite (push) Successful in 25s
Rust Build / Rustfmt (push) Successful in 25s
Release Tagging / release (push) Successful in 1m24s
Rust Build / Clippy (push) Successful in 31s
Rust Build / build (push) Successful in 58s
Reviewed-on: phoenix/textsender-models#16
16 lines
501 B
Rust
16 lines
501 B
Rust
/// Take the Environment variable and delimitize it. If the value has a delimiter,
|
|
/// extract it into some strings
|
|
pub fn delimitize(var: &crate::envy::EnvVar) -> Result<Vec<String>, std::io::Error> {
|
|
if var.has_delimiter {
|
|
Ok(var
|
|
.value
|
|
.split(var.delimiter)
|
|
.map(|c| c.parse::<String>().unwrap())
|
|
.collect())
|
|
} else {
|
|
Err(std::io::Error::other(
|
|
"Environment variable does not have a delimiter",
|
|
))
|
|
}
|
|
}
|