tpt-logfmt-parse 0.1.0

Zero-copy, high-performance logfmt (key=value) parser with no dependencies
Documentation
  • Coverage
  • 100%
    8 out of 8 items documented3 out of 5 items with examples
  • Size
  • Source code size: 16.06 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 565.16 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 3s Average build duration of successful builds.
  • all releases: 3s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • tpt-solutions/tpt-data-parsers
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • PhillipC05

tpt-logfmt-parse

docs.rs crates.io

Zero-copy, high-performance logfmt parser for Rust. No dependencies.

Logfmt is the key=value structured logging format used by Heroku, Datadog agents, and many Go services.

Features

  • Zero-copy iterator — yields (&str, &str) slices directly into the input string
  • Owned convenience APIparse_to_map() returns HashMap<String, String> with escape sequences resolved
  • No dependencies — pure Rust, no regex, no allocations in the iterator path
  • Handles quoted strings, \" / \\ / \n / \t escape sequences, and bare keys (no =)

Usage

Zero-copy iterator

use tpt_logfmt_parse::LogfmtParser;

let input = r#"level=info msg="hello world" latency=42ms"#;
for pair in LogfmtParser::new(input) {
    let (key, value) = pair.unwrap();
    println!("{key} = {value}");
}

Owned HashMap

use tpt_logfmt_parse::parse_to_map;

let map = parse_to_map(r#"level=error msg="disk full" retries=3"#).unwrap();
println!("{}", map["msg"]); // disk full

License

Licensed under either of Apache License 2.0 or MIT at your option.