Given any slice, for example:
let words = &["one", "one", "one", "two"];
How to know if all elements are the same?
Even further, if all elements are the same, how to return a reference to the first one?
Essentially, I'm trying to write a function like:
fn are_all_elements_equal<T>(elems: &[T]) -> Option<&T> {
// ... ?
}