Show HN: LinkedIn Data Extraction Services (twitter.com)
2 points by arcknighttech 2h ago 1 comments
Show HN: I Built an Interactive Spreadsheet (reasonyx.com)
2 points by Kushal6070 11h ago 0 comments
Safe-math-rs – write normal math expressions safely(overflow-checked, no panics)
1 gotenjbz 1 6/16/2025, 3:02:53 AM github.com ↗
It uses a simple procedural macro: #[safe_math], which rewrites standard math into its checked_* equivalents behind the scenes.
Example: use safe_math_rs::safe_math;
#[safe_math] fn calculate(a: u8, b: u8) -> Result<u8, ()> { Ok((a + b * 2) / 3) }
assert_eq!(calculate(9, 3), Ok(5)); assert!(calculate(255, 1).is_err()); // overflow Under the hood: Your code:
#[safe_math] fn add(a: u8, b: u8) -> Result<u8, ()> { Ok(a + b) } Becomes:
fn add(a: u8, b: u8) -> Result<u8, ()> { Ok(self.checked_add(rhs).ok_or(())?) } Looking for: Feedback on the macro's usability, syntax, and integration into real-world code
Bug reports
GitHub: https://github.com/GotenJBZ/safe-math-rs
So long, and thanks for all the fish