Debian Codegraph @

examples/read-dep3.rs

raw symbols SCIP
1 use dep3::lossy::PatchHeader;
2 use std::str::FromStr;
3
4 pub const TEXT: &str = r#"From: John Doe <john.doe@example>
5 Date: Mon, 1 Jan 2000 00:00:00 +0000
6 Subject: [PATCH] fix a bug
7 Bug-Debian: https://bugs.debian.org/123456
8 Bug: https://bugzilla.example.com/bug.cgi?id=123456
9 Forwarded: not-needed
10 "#;
11
12 pub fn main() {
13 let patch_header = match PatchHeader::from_str(TEXT) {
14 Ok(header) => header,
15 Err(e) => {
16 eprintln!("Failed to parse patch header: {}", e);
17 std::process::exit(1);
18 }
19 };
20
21 if let Some(description) = &patch_header.description {
22 println!("Description: {}", description);
23 }
24
25 if let Some(bug_debian) = &patch_header.bug_debian {
26 println!("Debian Bugs: {}", bug_debian);
27 }
28 }