43 releases

0.2.0 Oct 28, 2025
0.1.46 Jul 28, 2025
0.1.41 Mar 11, 2025
0.1.40 Nov 16, 2024
0.1.1 Jun 16, 2023

#2416 in Parser implementations

Download history 432/week @ 2025-07-18 756/week @ 2025-07-25 1326/week @ 2025-08-01 644/week @ 2025-08-08 439/week @ 2025-08-15 541/week @ 2025-08-22 527/week @ 2025-08-29 516/week @ 2025-09-05 633/week @ 2025-09-12 373/week @ 2025-09-19 553/week @ 2025-09-26 516/week @ 2025-10-03 333/week @ 2025-10-10 351/week @ 2025-10-17 1040/week @ 2025-10-24 570/week @ 2025-10-31

2,323 downloads per month
Used in 10 crates (9 directly)

Apache-2.0

520KB
9K SLoC

Parser for Debian control files.

This crate provides a parser for Debian control files.

Example

use debian_control::lossy::Control;
use debian_control::fields::Priority;
use std::fs::File;

let mut control = Control::new();
let mut source = &mut control.source;
source.name = "hello".to_string();
source.section = Some("rust".to_string());

let mut binary = control.add_binary("hello");
binary.architecture = Some("amd64".to_string());
binary.priority = Some(Priority::Optional);
binary.description = Some("Hello, world!".to_string());

assert_eq!(control.to_string(), r#"Source: hello
Section: rust

Package: hello
Architecture: amd64
Priority: optional
Description: Hello, world!
"#);

See the lossless module for a parser that preserves all comments and formatting, and as well as allowing inline errors.


Lossless parser for Debian Control files

This crate provides a parser for Debian control files. It is lossless, meaning that it will preserve the original formatting of the file. It also provides a way to serialize the parsed data back to a string.

use debian_control::{Control, Priority};
use std::fs::File;

let mut control = Control::new();
let mut source = control.add_source("hello");
source.set_section("rust");

let mut binary = control.add_binary("hello");
binary.set_architecture("amd64");
binary.set_priority(Priority::Optional);
binary.set_description("Hello, world!");

assert_eq!(control.to_string(), r#"Source: hello
Section: rust

Package: hello
Architecture: amd64
Priority: optional
Description: Hello, world!
"#);

Dependencies

~5.5–9MB
~159K SLoC