Skip to main content

parse_dotenv

Function parse_dotenv 

Source
pub fn parse_dotenv(content: &str) -> Result<BTreeMap<String, String>, EnvError>
Expand description

Parses a .env document into an ordered map of key-value pairs.

Supports # comments, optional export prefix, single/double quotes, escape sequences, and ${VAR} / $VAR interpolation from preceding keys.

§Arguments

  • &str - Raw .env text content.

§Returns

  • Result<BTreeMap<String, String>, EnvError> - Parsed key-value map or syntax error.