diff options
| -rw-r--r-- | log_db/src/common.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/log_db/src/common.rs b/log_db/src/common.rs index d86e6c6..3590cf9 100644 --- a/log_db/src/common.rs +++ b/log_db/src/common.rs @@ -476,6 +476,14 @@ impl Record { } } +/// A trait that describes how to convert a data structure into a database `Record` and vice versa. +pub trait Recordable { + /// Convert the data structure implementing the `Recordable` trait into a database `Record`. + fn to_record(&self) -> Record; + /// Convert a database `Record` into the data structure implementing the `Recordable` trait. + fn from_record(record: &Record) -> Self; +} + pub fn get_secondary_memtable_index_by_field<Field: Eq>( sks: &Vec<Field>, field: &Field, |
