refactor(tuple): deprecate AsTuple in favor of Encode & ToTupleBuffer
AsTuple
inherits from serde::Serialize
which means it cannot be
implemented for Tuple.
Also the name is bad, because it makes you assume the conversion is
cheap when it's anything but.
Encode
trait inherits from serde::Serialize
and must be implemented
by user types instead of AsTuple
.
ToTupleBuffer
is used (almost) everywhere in the api and is
implemented for all Encode
types. So it can be implemented for
Tuple
.
We need 2 traits, because we can't have a default impl ToTupleBuffer
that relies on serde::Serialize
, and we can't have a blanket impl for
serde::Serialize
, because there are some types we want a different
impl for (e.g. ()
).
Hopefully specialization
feature will be stabilized someday so that we
can get rid of Encode
.
Hopefully...
specialization: https://github.com/rust-lang/rust/issues/31844
Closes #87 (closed)