From f1069c659301b99ba620a5b3c5291bff7f4ac9e9 Mon Sep 17 00:00:00 2001 From: "crashkeys.dev" Date: Tue, 24 Mar 2026 21:38:33 +0100 Subject: [PATCH] actor storage: `QuoteFilter` has a new constructor and better docs. --- src/storage.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/storage.rs b/src/storage.rs index 7f98f5e..6070817 100644 --- a/src/storage.rs +++ b/src/storage.rs @@ -131,12 +131,29 @@ pub mod source { #[derive(Clone, Debug)] pub struct QuoteFilter { + /// "glob-like" pattern of files containing quotes to be read. path: String, + + /// Regular expression to further filter the files matched by [path] + /// based on their *contents*. content: String, + + /// Currently unused. Intended for future functionality. _dates: Vec, } impl QuoteFilter { + /// Creates a new [QuoteFilter] from a "glob"-like pattern provided as input. + /// No filtering is applied based on matching files' contents. + pub fn new_from_glob(glob: String) -> Self { + Self { + path: glob, + // The following regex matches *any* string: + content: ".*".to_string(), + _dates: vec![], + } + } + // TODO: actually leverage async I/O fn read_files(&self) -> Result, ()> { use glob::glob; -- 2.51.2