aboutsummaryrefslogtreecommitdiffstats
path: root/log_db/benches
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2025-02-21 14:16:24 +0200
committerJan Tuomi <jan@jantuomi.fi>2025-02-21 14:16:24 +0200
commitbea37e2834a5265035b960277ff27e5f8d74d079 (patch)
tree9a48f8d0fc926e9fe5dcc232dee7ba287cfac126 /log_db/benches
parentcdc78ce436459047b06163f98fc661df9f2026f4 (diff)
Start working in new schema logic to core
Diffstat (limited to 'log_db/benches')
-rw-r--r--log_db/benches/utils.rs18
1 files changed, 17 insertions, 1 deletions
diff --git a/log_db/benches/utils.rs b/log_db/benches/utils.rs
index 3a949ae..d25a5af 100644
--- a/log_db/benches/utils.rs
+++ b/log_db/benches/utils.rs
@@ -17,6 +17,22 @@ pub struct Inst {
pub data: Vec<u8>,
}
+impl AsRef<str> for Field {
+ fn as_ref(&self) -> &str {
+ match self {
+ Field::Id => "id",
+ Field::Name => "name",
+ Field::Data => "data",
+ }
+ }
+}
+
+impl Into<String> for Field {
+ fn into(self) -> String {
+ self.as_ref().to_string()
+ }
+}
+
impl Inst {
pub fn fields() -> Vec<Field> {
vec![Field::Id, Field::Name, Field::Data]
@@ -82,7 +98,7 @@ pub fn random_inst(from_id: i64, to_id: i64) -> Inst {
}
pub fn prefill_db(
- db: &mut DB<Inst, Field>,
+ db: &mut DB<Inst>,
insts: &mut Vec<Inst>,
n_records: usize,
compact: bool,