From 13aa4328cc62640e4a3c535eacc453b6c542f8e9 Mon Sep 17 00:00:00 2001 From: Jeff Baskin Date: Tue, 17 Jan 2023 13:02:43 -0500 Subject: [PATCH] Added a database cache type. --- src/morethantext/cachetype.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/morethantext/cachetype.rs b/src/morethantext/cachetype.rs index 9b68078..6a18eaf 100644 --- a/src/morethantext/cachetype.rs +++ b/src/morethantext/cachetype.rs @@ -14,6 +14,7 @@ impl Databases { pub enum CacheType { Raw(String), DBMap(Databases), + TableMap, } impl CacheType { @@ -21,6 +22,7 @@ impl CacheType { match self { CacheType::Raw(_) => "Raw".to_string(), CacheType::DBMap(_) => "DBMap".to_string(), + CacheType::TableMap => "TableMap".to_string(), } } @@ -30,6 +32,7 @@ impl CacheType { match self { CacheType::Raw(s) => output.append(&mut s.as_bytes().to_vec()), CacheType::DBMap(_) => (), + CacheType::TableMap => (), } return output; } @@ -69,6 +72,7 @@ impl fmt::Display for CacheType { match self { CacheType::Raw(s) => write!(f, "{}", s), CacheType::DBMap(_) => todo!(), + CacheType::TableMap => todo!(), } } } @@ -168,4 +172,10 @@ mod enum_ctype { let output = CacheType::from_bytes(data).unwrap(); assert_eq!(output.entry_type(), "DBMap"); } + + #[test] + fn get_tablemap_type() { + let holder = CacheType::TableMap; + assert_eq!(holder.entry_type(), "TableMap"); + } }