dotenvpp-parser 0.0.2

Core .env parser for DotenvPP — no_std compatible
Documentation
  • Coverage
  • 100%
    18 out of 18 items documented2 out of 2 items with examples
  • Size
  • Source code size: 40.82 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.01 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 52s Average build duration of successful builds.
  • all releases: 42s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Carabryx/DotenvPP
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • AriajSarkar

dotenvpp-parser

Core .env file parser for DotenvPP.

This crate is no_std-compatible (with alloc) so it can be used in WASM and embedded environments. Enable the std feature (on by default) for std::error::Error implementations.

Features

  • KEY=VALUE basic parsing with comment and blank-line handling
  • Single-quoted values (literal, multiline supported), double-quoted values (with escapes), and unquoted values
  • Multiline values in single-quoted and double-quoted strings
  • export KEY=VALUE prefix support
  • Escape sequences: \\, \", \n, \t, \r, \$
  • Common unquoted escapes for spaces, quotes, dollar signs, and newlines

Example

use dotenvpp_parser::parse;

let input = "# Database config\nDB_HOST=localhost\nDB_PORT=5432\nSECRET='keep-it-safe'\n";

let pairs = parse(input).unwrap();
assert_eq!(pairs.len(), 3);
assert_eq!(pairs[0].key, "DB_HOST");
assert_eq!(pairs[0].value, "localhost");