Alpha Release v0.5.0
Pre-release
Pre-release
- DilatedInt now takes a generic DilationMethod adapter
<A>instead of<T, D> - The DilationMethod describes the type of dilation, including the inner and outer types involved, wrapper methods to forward to the appropriate dilation functions, and some useful constants
- At the moment, there are two types of DilationMethod impls:
Expand<T, D>is a method which describes the v0.4.0 dilation implementation - the inner type adapts to the combination of T and D, choosing the smallest type that would contain all bits of the outer type D-dilated. There are naturally a limited number of T and D combinations available as the the largest integer type supported isu128Fixed<T, D>is a method adapter which describes the pre-0.4.0 dilation implementation - the inner type is the same as the outer type and a limited subset of bits in the outer type can be dilated. This is useful when you want absolute control over the inner type used and want to fit as many dilated bits into the inner type as possible.
- In both cases, the number of possible dilatable bits is given by
DilationMethod::UNDILATED_BITSand the maximum dilated value is given byDilationMethod::DILATED_MAX(formerly theDilatedMasktrait which was discarded in favour of constants closely mimicking the rust standardT::BITSandT::MAX). - As a result of this change, we are no longer relying on multiple macros to produce implementations for different types - almost everything except the DilationMethod impls use regular trait impls. The code is easier to read as a result.
- We no longer use
From. The use cases ofFromdo not accurately convey what is happening when converting to and from dilated integers. Users should now use the explicitregular_uint.dilate_expand::<D>()orregular_uint.dilate_fixed::<D>()anddilated_int.undilate()methods. Note thatregular_uint.dilate_expand::<D>()returns aDilatedInt<Expand<T, D>>,regular_uint.dilate_fixed()returns aDilatedInt<Fixed<T, D>>anddilated_int.undilate()returns a the original type of the uintT.
Migration Notes
DilatedIntnow takes a DilationMethod adapter<A>in place of<T, D>. This is to allow for different formats of dilation. The 0.4.0 behaviour may be implemented usingDilatedInt<Expand<T, D>>. The old pre-0.4.0 behaviour may be implemented usingDilatedInt<Fixed<T, D>>.- You now convert between ints and DilatedInt using the explicit
regular_uint.dilate_expand::<D>()orregular_uint.dilate_fixed::<D>()anddilated_int.undilate()methods. This is because use cases of the From impls are extremely hard to read at a glance. Explicit methods better show what is happening.
Full Changelog: v0.4.0...v0.5.0