feat: update mustget behavior
This commit is contained in:
@@ -43,12 +43,12 @@ func (i Iterator[T]) Get() (T, error) {
|
||||
|
||||
// MustGet is a version of Get, that panics if the datum cannot be returned.
|
||||
func (i Iterator[T]) MustGet() T {
|
||||
var null T
|
||||
if i.Done() {
|
||||
return null
|
||||
t, err := i.Get()
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("cannot get current token: %w", err))
|
||||
}
|
||||
|
||||
return i.items[i.index]
|
||||
return t
|
||||
}
|
||||
|
||||
// Forward increments the iterator if the iterator is not yet at the end of the
|
||||
|
||||
Reference in New Issue
Block a user