splitLastOpt method

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

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

Implementation

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