Function konst::slice::first[][src]

pub const fn first<T>(slice: &[T]) -> Option<&T>
Expand description

A const equivalent of <[T]>::first

Example

use konst::slice;

assert_eq!(slice::first(&[8, 5, 3]), Some(&8));

assert_eq!(slice::first(&[5, 3]), Some(&5));

assert_eq!(slice::first(&[3]), Some(&3));

assert_eq!(slice::first::<u8>(&[]), None);