docs.rs failed to build safe-bigmath-0.3.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build:
safe-bigmath-0.4.1
safe-bigmath
Safe, non-panicking numeric primitives built on pure-Rust num-bigint. safe-bigmath gives you:
SafeInt: arbitrary-precision integers with ergonomic operator overloads.SafeDec<D>: fixed-scale decimals backed by arbitrary-precisionSafeInt; the const genericDsets how many decimal places are stored exactly.- Parsing helpers for turning strings into safe numeric values.
- No hidden panics: division returns
Option, parsing reports structured errors. stdby default; disable default features forno_std+alloc(works onwasm32-unknown-unknown).
Quick start
[]
= "0.2"
# Optional: go `no_std` + `alloc`
# safe-bigmath = { version = "0.2", default-features = false }
Safe integers
use SafeInt;
let a = from;
let b = from;
assert_eq!; // division is fallible
assert_eq!;
assert_eq!; // no panic on zero div
Fixed-scale decimals
use SafeDec;
let price: = "12.50".parse.unwrap;
let qty: = "3.00".parse.unwrap;
let total = price * qty;
assert_eq!;
Pow of ratios with scaling
Compute (x / (x + dx))^(w1 / w2) scaled to perquintill:
use SafeInt;
let x = from;
let dx = from;
let w1 = from;
let w2 = from;
let perquintill = from;
let result = pow_ratio_scaled.unwrap;
assert_eq!;
Feature flags
std(on by default): enablesstdsupport for downstream crates; disable default features forno_std+alloc.
Supported targets
stdtargets (default).no_stdtargets withallocvia--no-default-features.wasm32-unknown-unknown(CI builds and test-compiles both--no-default-featuresand--all-features).
Testing
License
MIT © sam0x17