5 unstable releases

new 0.3.1 Dec 7, 2025
0.3.0 Jun 3, 2025
0.2.1 May 26, 2025
0.2.0 Oct 6, 2024
0.1.0 Aug 29, 2024

#10 in #rfc-822

Download history 906/week @ 2025-08-15 1325/week @ 2025-08-22 1102/week @ 2025-08-29 1495/week @ 2025-09-05 1429/week @ 2025-09-12 816/week @ 2025-09-19 1230/week @ 2025-09-26 1094/week @ 2025-10-03 903/week @ 2025-10-10 1132/week @ 2025-10-17 1707/week @ 2025-10-24 1146/week @ 2025-10-31 803/week @ 2025-11-07 790/week @ 2025-11-14 804/week @ 2025-11-21 916/week @ 2025-11-28

3,463 downloads per month
Used in 20 crates (2 directly)

Apache-2.0

14KB
220 lines

This crate provides a basic proc-macro for converting a Deb822Paragraph into a Rust struct and vice versa.

You probably want to use the deb822_lossless crate instead, with the derive feature enabled.

Example

use deb822_lossless::Deb822;

#[derive(Deb822)]
struct Foo {
    field1: String,
    field2: Option<String>,
}

let paragraph: deb822::Deb822Paragraph = "field1: value1\nfield2: value2".parse().unwrap();
let foo: Foo = paragraph.into();

Field Formatting Attributes

The derive macros support field formatting attributes to control how fields are serialized:

single_line

Forces the field value to be on a single line.

#[derive(ToDeb822)]
struct Package {
    #[deb822(field = "Package", single_line)]
    name: String,
}

multi_line

Ensures continuation lines start with a space character, following deb822 format conventions.

#[derive(ToDeb822)]
struct Package {
    #[deb822(field = "Description", multi_line)]
    description: String,
}

folded

Strips leading and trailing whitespace from each line and joins them with spaces, implementing RFC 822 folding behavior.

#[derive(ToDeb822)]
struct Package {
    #[deb822(field = "Depends", folded)]
    depends: String,
}

Dependencies

~175–600KB
~14K SLoC