Open valarauca opened 7 years ago
Added 2 new implementations of ToMdbValue for str and [u8] (the non-sized versions without pointers).
ToMdbValue
str
[u8]
Makes it easier to implement traits like
pub trait GenericLMDBCursor<ActualDBData> { type Key: ActualDBData::Key+?Sized; type Value: ActualDBData::Value; // methods.. } pub trait ActualDBData { type Key: ToMdbValue+?Sized; type Value: Message+MessageStatic; //protobuffers fn get_db_handle<'a>() -> &'a Database; } pub struct DocDB; impl ActualDBData { type Key = str; type Value = DocProto; fn get_db_handle<'a>() -> &'a Database { get_cached_doc_handle() } }
Effectively then I just have one fat trait that does all db stuff on abstract data. And a handful of ZeroSizedTypes which tell me what data I'm using.
Changes
Added 2 new implementations of
ToMdbValue
forstr
and[u8]
(the non-sized versions without pointers).Goals
Makes it easier to implement traits like
Effectively then I just have one fat trait that does all db stuff on abstract data. And a handful of ZeroSizedTypes which tell me what data I'm using.