macro_rules! vecmin {
($min:expr; [$x:expr; $n:expr]) => { ... };
($min:expr; [$($x:expr),+ $(,)?]) => { ... };
($x:expr; $n:expr) => { ... };
($($x:expr),+ $(,)?) => { ... };
}Expand description
Creates a VecMin containing the arguments.
There is a minimum length argument preceding the list, if not included the minimum is inferred as the length. The length must be constant, for non-constant length use checked constructors.
- Create a
VecMinwith a fixed minimum length:
use vecmin::vecmin;
let v = vecmin![5; [1; 6]];
assert!(!v.is_minimum());
assert_eq!(v.minimum(), 5);
let v = vecmin![2; [1, 2, 3]];
assert!(!v.is_minimum());
assert_eq!(v.minimum(), 2);- Create a
VecMinwith a minimum length inferred from the number of elements:
use vecmin::vecmin;
let v = vecmin![1; 6];
assert!(v.is_minimum());
assert_eq!(v.minimum(), 6);
let v = vecmin![1, 2, 3];
assert!(v.is_minimum());
assert_eq!(v.minimum(), 3);