#deb822 #control #debian #rfc-822

deb822-fast

Fast parsing of Debian control files in the deb822 format

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

Download history 1135/week @ 2025-10-22 751/week @ 2025-10-29 560/week @ 2025-11-05 553/week @ 2025-11-12 770/week @ 2025-11-19 643/week @ 2025-11-26 710/week @ 2025-12-03 528/week @ 2025-12-10 260/week @ 2025-12-17 769/week @ 2025-12-24 562/week @ 2025-12-31 609/week @ 2026-01-07 376/week @ 2026-01-14 392/week @ 2026-01-21 639/week @ 2026-01-28 729/week @ 2026-02-04

2,252 downloads per month
Used in 22 crates (11 directly)

Apache-2.0

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 String values. Easy to use, no lifetime management.
  • Borrowed API (borrowed module): 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