Skip to content

v0.5.0

Choose a tag to compare

@neogenie neogenie released this 14 Aug 22:44
· 23 commits to master since this release

Added

  • Type conversion traits for integers and decimals:
    • Cast — type-safe, infallible conversion (e.g., widening or lossless transforms).
    • TryCast — checked conversion returning an error on overflow, sign mismatch, or incompatible scale.
    • Supported families: unsigned/signed big integers (U64, U128, U256, U512, U1024, and I64, I128,
      I256, I512, I1024) #42 and decimals (UD64, UD128, UD256, UD512, UD1024, and D64, D128, D256,
      D512, D1024).
    • Common scenarios:
      • Widening cast for integers — via Cast.
      • Checked narrowing cast — via TryCast, with overflow errors.
      • Conversions between unsigned and signed integers — TryCast rejects negative/out-of-range values.
      • Conversions between UD* and D* — proper sign/scale propagation with checks in TryCast.
  • Const-generic “dimensions” for conversion direction checks:
    • Internal Widen/Narrow markers ensure Cast/TryCast correctness without unstable generic const expressions.

Deprecated

  • Decimal .transmute() is now deprecated (since "0.5.0"); removal is planned for a future major release.
    Use .resize() or cast via Cast and TryCast traits instead.

Documentation

  • Minor fixes and clarifications; added usage examples for type conversions.