Expand description
§kvf — Kv Format 1.0 Parser
kvf is a minimal, spec-compliant parser for Kv Format 1.0.
§Quick start
use kvf::{parse, Entry};
let input = b"APP_NAME=My Application\nDEBUG=true\n";
let entries = parse(input).unwrap();
for entry in &entries {
if let Entry::Kv { key, value, .. } = entry {
println!("{key} = {value}");
}
}§Parser configuration
use kvf::{parse_with_config, Entry, ParserConfig};
let config = ParserConfig {
emit_comments: false,
emit_blanks: false,
emit_shebang: false,
};
let input = b"# comment\nKEY=value\n";
let entries = parse_with_config(input, &config).unwrap();
assert_eq!(entries.len(), 1);§Streaming
use kvf::parse_iter;
let input = b"KEY=value\n";
for result in parse_iter(input) {
println!("{:?}", result);
}Structs§
- Parser
Config - Configuration for the Kv Format parser.
Enums§
- Entry
- A parsed entry from a Kv Format text.
- Parse
Error - Errors that can occur while parsing a Kv Format text.
Functions§
- parse
- Parse the entire input at once.
- parse_
iter - Return a streaming iterator over the input.
- parse_
iter_ with_ config - Return a streaming iterator over the input with a custom
ParserConfig. - parse_
with_ config - Parse the entire input at once with a custom
ParserConfig.