connections - Composable numeric casts with Galois connections in Rust
Show HN: Galois connections for composable numeric casts in Rust

connections is a Rust library that replaces unsafe type casting with mathematically proven, composable conversions using Galois connections. It solves the ambiguity of standard `as` casts by providing explicit semantics for rounding, saturation, and lossy conversions between numeric types. Every operation carries property-tested invariants, and complex conversion chains can be composed at compile time to ensure static correctness. With support for fixed-point, time durations, and network addresses, it offers a robust, heap-free solution for safe numeric transformations in systems programming.
"Use them to cast lawfully between numeric types, and compose ladders of conversions whose round-trip behavior is determined by simple inequalities rather than left to chance."