#utilities

clippy-utilities

Utilities funtions for clippy fixing

2 unstable releases

0.2.0 Jun 13, 2022
0.1.0 Feb 19, 2022

#1988 in Command line utilities

Download history 166/week @ 2022-08-10 172/week @ 2022-08-17 121/week @ 2022-08-24 177/week @ 2022-08-31 164/week @ 2022-09-07 263/week @ 2022-09-14 343/week @ 2022-09-21 186/week @ 2022-09-28 170/week @ 2022-10-05 293/week @ 2022-10-12 179/week @ 2022-10-19 382/week @ 2022-10-26 238/week @ 2022-11-02 437/week @ 2022-11-09 403/week @ 2022-11-16 205/week @ 2022-11-23

1,334 downloads per month
Used in 2 crates

MIT license

9KB
187 lines

Cast and Overflow utilities

This utility lib helps for type casting and integer operation overflow checking. The following code block shows examples:

let a: u64 = 10;
let b: i64 = a.numeric_cast();
let a = 1.overflow_add(1);

For the first example, as conversion is not perfect for slicently lossy conversion while try_from and try_into are better. However they're too verbose in most cases, so we wrap it in the cast method and make it panic while these try_xxx methods failed.

For the second example, rust std lib provides overflow checking methods such as overflowing_add. The methods provided in this lib are one step futher, panicing when any overflow happens.


lib.rs:

Traits for datenlord.

Dependencies

~22KB