Generalized references and unsized coercion

For anyone interested in how my current solution looks like, it can be found here:

Not sure if it's particularly beautiful, but it seems to do what I want:

  • In standard cases, only one trait (Storable) needs to be implemented to allow using a type for keys or values in databases ⇒ "easy" :sweat_smile:
  • Types which do not require alignment, such as [u8], don't need to be copied when reading them from a database ⇒ fast when reading :star_struck:)
  • Types which require alignment are supported by returning a weird smart-pointer (owning_pointer::Owned), which holds the pointed-to value (basically a Cow which is always Cow::Owned) ⇒ known at compile-time :upside_down_face:
  • Automatic implementations of Storable for tuples (T1, T2, …) are provided where all Tn's implement BorrowStorable and all but the last element have a BorrowStorable::Stored type which has a constant size when being stored ⇒ handy :smiley:
  • Storing values can be done by referencing the value or, in case of tuples, providing a tuple of references to the inner values (see doc of StorableRef), avoiding to create an intermediate tuple when references to the inner values exist ⇒ not unnecessary slow when writing :relieved:

One problem for sure, however, is overall complexity.

:face_with_spiral_eyes: