| Crates.io | expand-env-vars |
| lib.rs | expand-env-vars |
| version | 0.1.0 |
| created_at | 2025-04-09 14:52:23.689228+00 |
| updated_at | 2025-04-09 14:52:23.689228+00 |
| description | Cross-platform environment variable expander for Rust (supports $VAR, ${VAR}, and %VAR%) |
| homepage | https://github.com/uzaaft/expand-env-vars |
| repository | https://github.com/uzaaft/expand-env-vars |
| max_upload_size | |
| id | 1626917 |
| size | 8,771 |
A simple cross-platform Rust utility to expand environment variable placeholders in strings.
Supports:
$VAR, ${VAR}%VAR%Missing environment variables are replaced with empty strings by default. In the future they will error out
Add to your project:
mod env_expand;
use env_expand::expand_env_vars;
fn main() {
std::env::set_var("USERNAME", "alice");
let input = "Hello $USERNAME!";
match expand_env_vars(input) {