Function konst::slice::first_mut [−][src]
pub const fn first_mut<T>(slice: &mut [T]) -> Option<&mut T>
This is supported on crate features
mut_refs
or nightly_mut_refs
only.Expand description
A const equivalent of
<[T]>::first_mut
Example
use konst::slice;
assert_eq!(slice::first_mut(&mut [8, 5, 3]), Some(&mut 8));
assert_eq!(slice::first_mut(&mut [5, 3]), Some(&mut 5));
assert_eq!(slice::first_mut(&mut [3]), Some(&mut 3));
assert_eq!(slice::first_mut::<u8>(&mut []), None);