#standard

nomore

Personal Standard Rust Lib Publics for reuse and to avoid redefinition

3 unstable releases

Uses new Rust 2021

0.2.1 Feb 19, 2022
0.2.0 Feb 19, 2022
0.1.4 Feb 13, 2022

#459 in Rust patterns


Used in spongmock

GPL-2.0 license

10KB
125 lines

Examples

const MEM_LIMIT: u128 = power(2, 15);

let (rand_products_0, rand_products_1): (u128, u128) = (product!([1, 2, 3, 4]), product!(vec![5, 6, 7, 8, 9]));

if rand_bool() { println!("I'm lucky!"); }

if !is_even(n) {
    die(false, 0, "n is not even");
}

if !is_executable(cmd) {
    die(true, -1, "cmd is not executable");
}

assert_eq!(any_to_string(0), "0".to_string());
assert_eq!(any_to_string("0".to_string()), "0".to_string());
assert_eq!(any_to_string(0u8), "0".to_string());
assert_eq!(any_to_string(0u16), "0".to_string());
assert_eq!(any_to_string(0u32), "0".to_string());
assert_eq!(any_to_string(0u64), "0".to_string());
assert_eq!(any_to_string(0u128), "0".to_string());
assert_eq!(any_to_string(0usize), "0".to_string());
assert_eq!(any_to_string(0i8), "0".to_string());
assert_eq!(any_to_string(0i16), "0".to_string());
assert_eq!(any_to_string(0i32), "0".to_string());
assert_eq!(any_to_string(0i64), "0".to_string());
assert_eq!(any_to_string(0i128), "0".to_string());
assert_eq!(any_to_string(0isize), "0".to_string());
assert_eq!(any_to_string(0.0f32), "0".to_string());
assert_eq!(any_to_string(0.0f64), "0".to_string());

Dependencies

~21KB