From cd9c071ad96629acd94f2708e807f55fadd91e63 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Sun, 24 May 2026 14:30:18 +0800 Subject: Add IMPORTANT field to ResultDumpAll struct Extract entries containing "IMPORTANT" (case-insensitive) in title or content into a separate field, serialized as "IMPORTANT". --- src/mem_mgr.rs | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/mem_mgr.rs b/src/mem_mgr.rs index c6e442e..0709866 100644 --- a/src/mem_mgr.rs +++ b/src/mem_mgr.rs @@ -91,6 +91,8 @@ pub fn phantom_render_result_forgotten(_p: ResultForgotten) {} #[derive(Serialize, Groupped)] pub struct ResultDumpAll { + #[serde(rename = "IMPORTANT")] + pub important: Vec, pub entries: Vec, } @@ -100,6 +102,12 @@ pub struct DumpEntry { pub content: String, } +#[derive(Serialize)] +pub struct ImportantEntry { + pub title: String, + pub reason: String, +} + #[renderer] pub fn phantom_render_result_dumpall(_p: ResultDumpAll) {} @@ -248,7 +256,30 @@ fn dumpall(constants: &Constants, about: String) -> ResultDumpAll { } } } - ResultDumpAll { entries } + + // Scan for IMPORTANT entries + let important: Vec = entries + .iter() + .filter_map(|entry| { + let title_upper = entry.title.to_uppercase(); + let content_upper = entry.content.to_uppercase(); + if title_upper.contains("IMPORTANT") { + Some(ImportantEntry { + title: entry.title.clone(), + reason: "title contains IMPORTANT".to_string(), + }) + } else if content_upper.contains("IMPORTANT") { + Some(ImportantEntry { + title: entry.title.clone(), + reason: "content contains IMPORTANT".to_string(), + }) + } else { + None + } + }) + .collect(); + + ResultDumpAll { entries, important } } fn item_path(constants: &Constants, title: &String) -> PathBuf { -- cgit