simplify TotalCountCursor constraints

This commit is contained in:
Ivan Smolin 2018-03-06 15:22:44 +03:00
parent 7ab28068ad
commit de0d556bae
1 changed files with 6 additions and 7 deletions

View File

@ -23,15 +23,14 @@
import RxSwift
import RxCocoa
public final class TotalCountCursor<LT, ET, CC: TotalCountCursorConfiguration>: ResettableCursorDataSource
where CC.ListingType == LT, CC.ElementType == ET {
public final class TotalCountCursor<CC: TotalCountCursorConfiguration>: ResettableCursorDataSource {
public typealias Element = ET
public typealias ResultType = [ET]
public typealias Element = CC.ElementType
public typealias ResultType = [CC.ElementType]
private let configuration: CC
private var elements: [ET] = []
private var elements: [Element] = []
public private(set) var totalCount: Int = .max
@ -45,7 +44,7 @@ public final class TotalCountCursor<LT, ET, CC: TotalCountCursorConfiguration>:
return elements.count
}
public subscript(index: Int) -> ET {
public subscript(index: Int) -> Element {
return elements[index]
}
@ -57,7 +56,7 @@ public final class TotalCountCursor<LT, ET, CC: TotalCountCursorConfiguration>:
self.configuration = other.configuration.reset()
}
public func loadNextBatch() -> Single<[ET]> {
public func loadNextBatch() -> Single<[Element]> {
return configuration.nextBatchObservable()
.map { [configuration] listing in
configuration.getResult(from: listing)