Function slice_max_usize

Source
pub const fn slice_max_usize(slice: &[usize]) -> usize
Expand description

Gets the maximum value in slice, returns 0 if the slice is empty.

ยงExample

use const_panic::utils::slice_max_usize;

assert_eq!(slice_max_usize(&[]), 0);
assert_eq!(slice_max_usize(&[3]), 3);
assert_eq!(slice_max_usize(&[5, 3]), 5);
assert_eq!(slice_max_usize(&[5, 8, 3]), 8);
assert_eq!(slice_max_usize(&[5, 13, 8, 3]), 13);