Closed valarauca closed 7 years ago
It is rather painful to write a trait which abstracts over types.
The use case I'm attempting to fix is:
trait ApplicationDBs { type Key: ToMdbValue; type Protobuffer: Message+MessageStatic; fn get_db_handle<'a>(&'a self) -> &'a DbHandle; } trait CommonDBActions: DBTrans { type Key: ToMdbValue; type ProtoBuffer: Message+MessageStatic; //library boiler plate } impl<T: ApplicationDB> CommonDBAction for MyType { type Key = T::Key; type ProtoBuffer = T::ProtoBuffer; }
This works great for integers + protobuffers. But I have to expand to strings, byte arrays.
It is rather painful to write a trait which abstracts over types.
The use case I'm attempting to fix is:
This works great for integers + protobuffers. But I have to expand to strings, byte arrays.