| Crates.io | deb822-derive |
| lib.rs | deb822-derive |
| version | 0.3.1 |
| created_at | 2024-08-29 10:51:23.811981+00 |
| updated_at | 2025-12-07 04:56:30.016987+00 |
| description | Derive macro for deb822 style paragraphs |
| homepage | https://github.com/jelmer/deb822-lossless |
| repository | https://github.com/jelmer/deb822-lossless |
| max_upload_size | |
| id | 1355963 |
| size | 14,924 |
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.
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();
The derive macros support field formatting attributes to control how fields are serialized:
single_lineForces the field value to be on a single line.
#[derive(ToDeb822)]
struct Package {
#[deb822(field = "Package", single_line)]
name: String,
}
multi_lineEnsures continuation lines start with a space character, following deb822 format conventions.
#[derive(ToDeb822)]
struct Package {
#[deb822(field = "Description", multi_line)]
description: String,
}
foldedStrips 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,
}