Expand description
Environment file parsing with comment preservation.
This module provides zero-copy parsing of .env
files that preserves comments
and associates them with environment variables. Comments can appear before
variables (preceding comments) or on the same line (inline comments).
§Examples
use env_sync::parse::EnvFile;
use std::convert::TryFrom;
let content = r#"
DB_HOST=localhost
DB_PORT=5432 # Default PostgreSQL port
"#;
let env_file = EnvFile::try_from(content).unwrap();
println!("{}", env_file);
Structs§
- EnvComment
- Represents a comment in an environment file.
- EnvFile
- Represents a parsed environment file with preserved comments.
- EnvVariable
- Represents an environment variable with its value and associated comments.
Enums§
- EnvEntry
- Represents a single entry in an environment file.
- Parse
Error - Errors that can occur during parsing.