Skip to content

Commit

Permalink
fix: unnecessary suspend modifier was removed from PagesIterator<T>
Browse files Browse the repository at this point in the history
  • Loading branch information
y9vad9 committed Jan 7, 2024
1 parent 3f196ca commit 8d542c3
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@ public interface PagesIterator<T> {
/**
* Returns `true` if there is another page available, `false` otherwise.
*
* **Note**: Even if iterator returns true, it doesn't necessary means that
* there should be new elements. It effectively means that we should query next page (using next)
* and check whether there's new elements.
*
* @return `true` if there is another page, `false` otherwise.
*/
public suspend operator fun hasNext(): Boolean
public operator fun hasNext(): Boolean

/**
* Returns the next page of elements.
Expand Down Expand Up @@ -161,7 +165,7 @@ internal class PagesIteratorImpl<T : TimeMatesEntity>(
/**
* Returns `true` if there is another page available, `false` otherwise.
*/
override suspend fun hasNext(): Boolean {
override fun hasNext(): Boolean {
return state != State.DONE
}

Expand Down Expand Up @@ -214,7 +218,7 @@ internal class MappingPagesIterator<T, R>(
private val source: PagesIterator<T>,
private val mapper: suspend (T) -> R,
) : PagesIterator<R> {
override suspend fun hasNext(): Boolean = source.hasNext()
override fun hasNext(): Boolean = source.hasNext()

override suspend fun next(): Result<List<R>> {
return source.next().map {
Expand Down

0 comments on commit 8d542c3

Please sign in to comment.