Often it isn't needed to own the Key type, such as when querying a View. The Key type is often dropped after serializing, which means that in many cases when serializing a value, we can get away with borrowed versions. However, due to the Key trait only being implemented for String, for example, it is impossible to pass an &str to be used as a Key.
The goal of this issue is to allow queries to use borrowed representations of String and Vec<u8> when listing collection contents and performing view queries. By only implementing from_ord_bytes for the owned version and having a separate trait for to_ord_bytes, we can allow a wider range of types to be used.
Often it isn't needed to own the Key type, such as when querying a View. The
Key
type is often dropped after serializing, which means that in many cases when serializing a value, we can get away with borrowed versions. However, due to the Key trait only being implemented forString
, for example, it is impossible to pass an&str
to be used as aKey
.The goal of this issue is to allow queries to use borrowed representations of
String
andVec<u8>
when listing collection contents and performing view queries. By only implementingfrom_ord_bytes
for the owned version and having a separate trait forto_ord_bytes
, we can allow a wider range of types to be used.