From 103cba0c27897efafbac03dc8296d2f82c1e3e7c Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 30 Nov 2015 19:50:24 +0100 Subject: [PATCH] Add File::matches_with(&Regex) --- src/storage/file.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/storage/file.rs b/src/storage/file.rs index 10a4e218..aca195c4 100644 --- a/src/storage/file.rs +++ b/src/storage/file.rs @@ -285,6 +285,10 @@ impl<'a> File<'a> { self.owning_module } + pub fn matches_with(&self, r: &Regex) -> bool { + r.is_match(&self.data[..]) || self.header.matches_with(r) + } + fn get_new_file_id() -> FileID { use uuid::Uuid; Uuid::new_v4().to_hyphenated_string()