size: Includes a new AbomonationSize trait which provides a method measure which reports the number of bytes that would be required to encode the associated data. The trait is separate from Abomonation so as not to break implementations of the trait that do not know about the new methods. They could be integrated in some future breaking build.
abomonated: includes a new type Abomonated<T, S> for T: Abomonation and S: DerefMut<Target=[u8]>, which performs decode on construction and implements Deref<Target=T> using transmute. This allows us to wrap up owned mutable bytes and treat them as if they were the type T, without constant decode calls that would re-validate all of the data.
This PR adds two new modules
size
: Includes a newAbomonationSize
trait which provides a methodmeasure
which reports the number of bytes that would be required toencode
the associated data. The trait is separate fromAbomonation
so as not to break implementations of the trait that do not know about the new methods. They could be integrated in some future breaking build.abomonated
: includes a new typeAbomonated<T, S>
forT: Abomonation
andS: DerefMut<Target=[u8]>
, which performsdecode
on construction and implementsDeref<Target=T>
usingtransmute
. This allows us to wrap up owned mutable bytes and treat them as if they were the typeT
, without constantdecode
calls that would re-validate all of the data.