splitLast method

Option<(T, Slice<T>)> splitLast()

Returns the last and all the rest of the elements of the slice, or None if it is empty.

Implementation

Option<(T, Slice<T>)> splitLast() {
  if (isEmpty) {
    return None;
  }
  var element = _list[_end - 1];
  _end--;
  return Some((element, Slice(_list, _start, _end)));
}