6 releases
| 0.2.3 | Dec 7, 2025 |
|---|---|
| 0.2.2 | Nov 28, 2025 |
| 0.2.0 | Jun 3, 2025 |
| 0.1.1 | May 26, 2025 |
| 0.1.0 | Nov 20, 2024 |
#2644 in Parser implementations
2,252 downloads per month
Used in 22 crates
(11 directly)
83KB
1.5K
SLoC
Fast parser for deb822 format.
This parser is lossy in the sense that it will discard whitespace and comments in the input.
API Variants
This crate provides two parsing APIs:
Owned API (default)
The main API using Deb822, Paragraph, and Field types that own their data.
- Easy to use - no lifetime management required
- Can be stored, moved, and outlive the source string
- Good performance with moderate allocations
Borrowed API (low-allocation)
The borrowed module provides a low-allocation API using borrowed string slices.
- Maximum performance - avoids allocating owned Strings for field data
- Still allocates Vec structures for paragraphs and fields
- Requires lifetime management
- Data cannot outlive the source string
- Best for parsing large files where you process data immediately
use deb822_fast::{Deb822, borrowed::BorrowedParser};
let input = "Package: hello\nVersion: 1.0\n";
// Owned API - easy to use
let doc: Deb822 = input.parse().unwrap();
let package = doc.iter().next().unwrap().get("Package");
// Borrowed API - maximum performance
let paragraphs = BorrowedParser::new(input).parse_all().unwrap();
let package = paragraphs[0].get("Package");
Lossy parser for deb822 format.
This parser is lossy in the sense that it will discard whitespace and comments in the input.
This parser is optimized for speed and memory usage. It provides two APIs:
- Owned API (default): Returns owned
Stringvalues. Easy to use, no lifetime management. - Borrowed API (
borrowedmodule): Returns borrowed string slices. Lower allocation overhead (avoids String allocations for field data, but still allocates Vec structures for paragraphs and fields). Requires lifetime management.
For editing purposes where you need to preserve formatting, whitespace and comments,
you may want to use a more feature-complete parser like deb822-lossless.
Dependencies
~75KB