6 个版本
0.1.13 | 2024年7月16日 |
---|---|
0.1.12 | 2024年6月24日 |
0.1.2 | 2024年2月22日 |
0.1.1 | 2023年11月28日 |
#2102 in 解析器实现
3,329 每月下载量
在 3 个crate中使用(通过 debian-analyzer)
63KB
1.5K SLoC
Debian DEP-3 补丁头部的 Rust 解析器
示例
use dep3::PatchHeader;
use std::str::FromStr;
let text = r#"From: John Doe <john.doe@example>
Date: Mon, 1 Jan 2000 00:00:00 +0000
Subject: [PATCH] fix a bug
Bug-Debian: https://bugs.debian.org/123456
Bug: https://bugzilla.example.com/bug.cgi?id=123456
Forwarded: not-needed
"#;
let patch_header = PatchHeader::from_str(text).unwrap();
assert_eq!(patch_header.description(), Some("[PATCH] fix a bug".to_string()));
assert_eq!(patch_header.vendor_bugs("Debian").collect::<Vec<_>>(), vec!["https://bugs.debian.org/123456".to_string()]);
有关详细信息,请参阅 https://dep-team.pages.debian.net/deps/dep3/
lib.rs
:
用于解析和生成 Debian 补丁头的库。
示例
use dep3::PatchHeader;
use std::str::FromStr;
let text = r#"From: John Doe <john.doe@example>
Date: Mon, 1 Jan 2000 00:00:00 +0000
Subject: [PATCH] fix a bug
Bug-Debian: https://bugs.debian.org/123456
Bug: https://bugzilla.example.com/bug.cgi?id=123456
Forwarded: not-needed
"#;
let patch_header = PatchHeader::from_str(text).unwrap();
assert_eq!(patch_header.description(), Some("[PATCH] fix a bug".to_string()));
assert_eq!(patch_header.vendor_bugs("Debian").collect::<Vec<_>>(), vec!["https://bugs.debian.org/123456".to_string()]);
依赖项
~4–6MB
~105K SLoC