pub fn only_or_err<T>(slice: &[T]) -> Result<&T>
Expand description

Returns the first (and only) element in a slice, or an error

Arguments

  • slice - The slice to extract from

Return value

The first element, or an error