Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into swift4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kzaher committed Sep 17, 2017
2 parents b34b2ba + 1641fc5 commit efe3af1
Show file tree
Hide file tree
Showing 18 changed files with 1,903 additions and 38 deletions.
1 change: 1 addition & 0 deletions .jazzy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ custom_categories:
- Enumerated
- Error
- Filter
- First
- Generate
- GroupBy
- Just
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file.

## Master

* Adds `materialize()` operator for RxBlocking's `BlockingObservable`. #1383
* Adds `first` operator to ObservableType.

## [4.0.0-alpha.1](https://github.com/ReactiveX/RxSwift/releases/tag/4.0.0-alpha.1)

* Merge of `3.6.1` changes.
Expand Down
29 changes: 28 additions & 1 deletion Documentation/UnitTests.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ It's easy to define `RxTests` extensions so you can write your tests in a readab

It is also possible to write integration tests by using `RxBlocking` operators.

Importing operators from `RxBlocking` library will enable blocking the current thread and wait for sequence results.
Using `RxBlocking`'s `toBlocking()` method, you can block the current thread and wait for the sequence to complete, allowing you to synchronously access its result.

A simple way to test the result of your sequence is using the `toArray` method. It will return an array of all elements emitted once a sequence has completed successfully, or `throw` if an error caused the sequence to terminate.

```swift
let result = try fetchResource(location)
Expand All @@ -95,3 +97,28 @@ let result = try fetchResource(location)

XCTAssertEqual(result, expectedResult)
```

Another option would be to use the `materialize` operator which lets you more granularly examine your sequence. It will return a `MaterializedSequenceResult` enumeration that could be either `.completed` along with the emitted elements if the sequence completed successfully, or `failed` if the sequence terminated with an error, along with the emitted error.

```swift
let result = try fetchResource(location)
.toBlocking()
.materialize()

// For testing the results or error in the case of terminating with error
switch result {
case .completed:
XCTFail("Expected result to complete with error, but result was successful.")
case .failed(let elements, let error):
XCTAssertEqual(elements, expectedResult)
XCTAssertErrorEqual(error, expectedError)
}

// For testing the results in the case of termination with completion
switch result {
case .completed(let elements):
XCTAssertEqual(elements, expectedResult)
case .failed(_, let error):
XCTFail("Expected result to complete without error, but received \(error).")
}
```
36 changes: 10 additions & 26 deletions Rx.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@
7F600F411C5D0C6E00535B1D /* UIRefreshControl+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F600F3D1C5D0C0100535B1D /* UIRefreshControl+Rx.swift */; };
7FE849471C5D0D6A00845C0E /* UIRefreshControl+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F600F421C5D0D2D00535B1D /* UIRefreshControl+RxTests.swift */; };
7FE849481C5D0D6B00845C0E /* UIRefreshControl+RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F600F421C5D0D2D00535B1D /* UIRefreshControl+RxTests.swift */; };
819C2F091F2FBC7F009104B6 /* First.swift in Sources */ = {isa = PBXBuildFile; fileRef = 819C2F081F2FBC7F009104B6 /* First.swift */; };
819C2F0A1F2FBC88009104B6 /* First.swift in Sources */ = {isa = PBXBuildFile; fileRef = 819C2F081F2FBC7F009104B6 /* First.swift */; };
819C2F0B1F2FBC88009104B6 /* First.swift in Sources */ = {isa = PBXBuildFile; fileRef = 819C2F081F2FBC7F009104B6 /* First.swift */; };
819C2F0C1F2FBC89009104B6 /* First.swift in Sources */ = {isa = PBXBuildFile; fileRef = 819C2F081F2FBC7F009104B6 /* First.swift */; };
842A5A2C1C357F92003568D5 /* NSTextStorage+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 842A5A281C357F7D003568D5 /* NSTextStorage+Rx.swift */; };
842A5A2D1C357F93003568D5 /* NSTextStorage+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 842A5A281C357F7D003568D5 /* NSTextStorage+Rx.swift */; };
842A5A2E1C357F94003568D5 /* NSTextStorage+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 842A5A281C357F7D003568D5 /* NSTextStorage+Rx.swift */; };
Expand Down Expand Up @@ -485,10 +489,6 @@
C820A9291EB4DA5A00D431BC /* CombineLatest+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A8251EB4DA5900D431BC /* CombineLatest+arity.swift */; };
C820A92A1EB4DA5A00D431BC /* CombineLatest+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A8251EB4DA5900D431BC /* CombineLatest+arity.swift */; };
C820A92B1EB4DA5A00D431BC /* CombineLatest+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A8251EB4DA5900D431BC /* CombineLatest+arity.swift */; };
C820A92C1EB4DA5A00D431BC /* CombineLatest+arity.tt in Resources */ = {isa = PBXBuildFile; fileRef = C820A8261EB4DA5900D431BC /* CombineLatest+arity.tt */; };
C820A92D1EB4DA5A00D431BC /* CombineLatest+arity.tt in Resources */ = {isa = PBXBuildFile; fileRef = C820A8261EB4DA5900D431BC /* CombineLatest+arity.tt */; };
C820A92E1EB4DA5A00D431BC /* CombineLatest+arity.tt in Resources */ = {isa = PBXBuildFile; fileRef = C820A8261EB4DA5900D431BC /* CombineLatest+arity.tt */; };
C820A92F1EB4DA5A00D431BC /* CombineLatest+arity.tt in Resources */ = {isa = PBXBuildFile; fileRef = C820A8261EB4DA5900D431BC /* CombineLatest+arity.tt */; };
C820A9301EB4DA5A00D431BC /* Producer.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A8271EB4DA5900D431BC /* Producer.swift */; };
C820A9311EB4DA5A00D431BC /* Producer.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A8271EB4DA5900D431BC /* Producer.swift */; };
C820A9321EB4DA5A00D431BC /* Producer.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A8271EB4DA5900D431BC /* Producer.swift */; };
Expand All @@ -505,10 +505,6 @@
C820A93D1EB4DA5A00D431BC /* Zip+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A82A1EB4DA5900D431BC /* Zip+arity.swift */; };
C820A93E1EB4DA5A00D431BC /* Zip+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A82A1EB4DA5900D431BC /* Zip+arity.swift */; };
C820A93F1EB4DA5A00D431BC /* Zip+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A82A1EB4DA5900D431BC /* Zip+arity.swift */; };
C820A9401EB4DA5A00D431BC /* Zip+arity.tt in Resources */ = {isa = PBXBuildFile; fileRef = C820A82B1EB4DA5900D431BC /* Zip+arity.tt */; };
C820A9411EB4DA5A00D431BC /* Zip+arity.tt in Resources */ = {isa = PBXBuildFile; fileRef = C820A82B1EB4DA5900D431BC /* Zip+arity.tt */; };
C820A9421EB4DA5A00D431BC /* Zip+arity.tt in Resources */ = {isa = PBXBuildFile; fileRef = C820A82B1EB4DA5900D431BC /* Zip+arity.tt */; };
C820A9431EB4DA5A00D431BC /* Zip+arity.tt in Resources */ = {isa = PBXBuildFile; fileRef = C820A82B1EB4DA5900D431BC /* Zip+arity.tt */; };
C820A9451EB4E06800D431BC /* Deprecated.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9441EB4E06800D431BC /* Deprecated.swift */; };
C820A9461EB4E06800D431BC /* Deprecated.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9441EB4E06800D431BC /* Deprecated.swift */; };
C820A9471EB4E06800D431BC /* Deprecated.swift in Sources */ = {isa = PBXBuildFile; fileRef = C820A9441EB4E06800D431BC /* Deprecated.swift */; };
Expand Down Expand Up @@ -993,7 +989,6 @@
C896A68B1E6B7DC60073A3A8 /* Observable+CombineLatestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C896A68A1E6B7DC60073A3A8 /* Observable+CombineLatestTests.swift */; };
C896A68C1E6B7DC60073A3A8 /* Observable+CombineLatestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C896A68A1E6B7DC60073A3A8 /* Observable+CombineLatestTests.swift */; };
C896A68D1E6B7DC60073A3A8 /* Observable+CombineLatestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C896A68A1E6B7DC60073A3A8 /* Observable+CombineLatestTests.swift */; };
C89814761E75A18A0035949C /* PrimitiveSequence+Zip+arity.tt in Resources */ = {isa = PBXBuildFile; fileRef = C89814751E75A18A0035949C /* PrimitiveSequence+Zip+arity.tt */; };
C89814781E75A7D70035949C /* PrimitiveSequence+Zip+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89814771E75A7D70035949C /* PrimitiveSequence+Zip+arity.swift */; };
C89814791E75A7E70035949C /* PrimitiveSequence+Zip+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89814771E75A7D70035949C /* PrimitiveSequence+Zip+arity.swift */; };
C898147A1E75A7E80035949C /* PrimitiveSequence+Zip+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89814771E75A7D70035949C /* PrimitiveSequence+Zip+arity.swift */; };
Expand Down Expand Up @@ -1049,10 +1044,6 @@
C89AB1EB1DAAC3350065FBE6 /* SharedSequence+Operators+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89AB1B61DAAC3350065FBE6 /* SharedSequence+Operators+arity.swift */; };
C89AB1EC1DAAC3350065FBE6 /* SharedSequence+Operators+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89AB1B61DAAC3350065FBE6 /* SharedSequence+Operators+arity.swift */; };
C89AB1ED1DAAC3350065FBE6 /* SharedSequence+Operators+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89AB1B61DAAC3350065FBE6 /* SharedSequence+Operators+arity.swift */; };
C89AB1EE1DAAC3350065FBE6 /* SharedSequence+Operators+arity.tt in Resources */ = {isa = PBXBuildFile; fileRef = C89AB1B71DAAC3350065FBE6 /* SharedSequence+Operators+arity.tt */; };
C89AB1EF1DAAC3350065FBE6 /* SharedSequence+Operators+arity.tt in Resources */ = {isa = PBXBuildFile; fileRef = C89AB1B71DAAC3350065FBE6 /* SharedSequence+Operators+arity.tt */; };
C89AB1F01DAAC3350065FBE6 /* SharedSequence+Operators+arity.tt in Resources */ = {isa = PBXBuildFile; fileRef = C89AB1B71DAAC3350065FBE6 /* SharedSequence+Operators+arity.tt */; };
C89AB1F11DAAC3350065FBE6 /* SharedSequence+Operators+arity.tt in Resources */ = {isa = PBXBuildFile; fileRef = C89AB1B71DAAC3350065FBE6 /* SharedSequence+Operators+arity.tt */; };
C89AB1F21DAAC3350065FBE6 /* SharedSequence+Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89AB1B81DAAC3350065FBE6 /* SharedSequence+Operators.swift */; };
C89AB1F31DAAC3350065FBE6 /* SharedSequence+Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89AB1B81DAAC3350065FBE6 /* SharedSequence+Operators.swift */; };
C89AB1F41DAAC3350065FBE6 /* SharedSequence+Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89AB1B81DAAC3350065FBE6 /* SharedSequence+Operators.swift */; };
Expand Down Expand Up @@ -1757,6 +1748,7 @@
7EDBAEB71C89B9B7006CBE67 /* UITabBarItem+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UITabBarItem+Rx.swift"; sourceTree = "<group>"; };
7F600F3D1C5D0C0100535B1D /* UIRefreshControl+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIRefreshControl+Rx.swift"; sourceTree = "<group>"; };
7F600F421C5D0D2D00535B1D /* UIRefreshControl+RxTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIRefreshControl+RxTests.swift"; sourceTree = "<group>"; };
819C2F081F2FBC7F009104B6 /* First.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = First.swift; sourceTree = "<group>"; };
842A5A281C357F7D003568D5 /* NSTextStorage+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSTextStorage+Rx.swift"; sourceTree = "<group>"; };
844BC8AA1CE4FA5600F5C7CB /* RxPickerViewDelegateProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxPickerViewDelegateProxy.swift; sourceTree = "<group>"; };
844BC8B31CE4FD7500F5C7CB /* UIPickerView+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIPickerView+Rx.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2498,6 +2490,7 @@
C8E390621F379041004FC993 /* Enumerated.swift */,
C820A8141EB4DA5900D431BC /* Error.swift */,
C820A7FB1EB4DA5900D431BC /* Filter.swift */,
819C2F081F2FBC7F009104B6 /* First.swift */,
C820A7F31EB4DA5900D431BC /* Generate.swift */,
C820A7F41EB4DA5900D431BC /* GroupBy.swift */,
C820A8151EB4DA5900D431BC /* Just.swift */,
Expand Down Expand Up @@ -3931,15 +3924,13 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C89AB1EE1DAAC3350065FBE6 /* SharedSequence+Operators+arity.tt in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
C80939E21B8A71840088E94D /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C89AB1EF1DAAC3350065FBE6 /* SharedSequence+Operators+arity.tt in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -3989,8 +3980,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C820A92D1EB4DA5A00D431BC /* CombineLatest+arity.tt in Resources */,
C820A9411EB4DA5A00D431BC /* Zip+arity.tt in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -4026,9 +4015,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C820A92C1EB4DA5A00D431BC /* CombineLatest+arity.tt in Resources */,
C820A9401EB4DA5A00D431BC /* Zip+arity.tt in Resources */,
C89814761E75A18A0035949C /* PrimitiveSequence+Zip+arity.tt in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -4043,16 +4029,13 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C820A92F1EB4DA5A00D431BC /* CombineLatest+arity.tt in Resources */,
C820A9431EB4DA5A00D431BC /* Zip+arity.tt in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
C8F0C0461BBBFBB9001B112F /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C89AB1F11DAAC3350065FBE6 /* SharedSequence+Operators+arity.tt in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -4067,16 +4050,13 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C89AB1F01DAAC3350065FBE6 /* SharedSequence+Operators+arity.tt in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
D2EA280A1BB9B5A200880ED3 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C820A92E1EB4DA5A00D431BC /* CombineLatest+arity.tt in Resources */,
C820A9421EB4DA5A00D431BC /* Zip+arity.tt in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -4793,6 +4773,7 @@
C820A8B91EB4DA5A00D431BC /* Concat.swift in Sources */,
C820A8311EB4DA5900D431BC /* Switch.swift in Sources */,
601AE3DB1EE24E5A00617386 /* SwiftSupport.swift in Sources */,
819C2F0A1F2FBC88009104B6 /* First.swift in Sources */,
C820A8B51EB4DA5A00D431BC /* TakeUntil.swift in Sources */,
C80EEC351D42D06E00131C39 /* DispatchQueueConfiguration.swift in Sources */,
C820A8851EB4DA5A00D431BC /* Dematerialize.swift in Sources */,
Expand Down Expand Up @@ -5032,6 +5013,7 @@
C820A8B81EB4DA5A00D431BC /* Concat.swift in Sources */,
C820A8301EB4DA5900D431BC /* Switch.swift in Sources */,
601AE3DA1EE24E4F00617386 /* SwiftSupport.swift in Sources */,
819C2F091F2FBC7F009104B6 /* First.swift in Sources */,
C820A8B41EB4DA5A00D431BC /* TakeUntil.swift in Sources */,
C80EEC341D42D06E00131C39 /* DispatchQueueConfiguration.swift in Sources */,
C820A8841EB4DA5A00D431BC /* Dematerialize.swift in Sources */,
Expand Down Expand Up @@ -5195,6 +5177,7 @@
C820A8BB1EB4DA5A00D431BC /* Concat.swift in Sources */,
C820A8331EB4DA5900D431BC /* Switch.swift in Sources */,
601AE3DD1EE24E5B00617386 /* SwiftSupport.swift in Sources */,
819C2F0B1F2FBC88009104B6 /* First.swift in Sources */,
C820A8B71EB4DA5A00D431BC /* TakeUntil.swift in Sources */,
C80EEC371D42D06E00131C39 /* DispatchQueueConfiguration.swift in Sources */,
C820A8871EB4DA5A00D431BC /* Dematerialize.swift in Sources */,
Expand Down Expand Up @@ -5566,6 +5549,7 @@
C820A8BA1EB4DA5A00D431BC /* Concat.swift in Sources */,
C820A8321EB4DA5900D431BC /* Switch.swift in Sources */,
601AE3DC1EE24E5B00617386 /* SwiftSupport.swift in Sources */,
819C2F0C1F2FBC89009104B6 /* First.swift in Sources */,
C820A8B61EB4DA5A00D431BC /* TakeUntil.swift in Sources */,
D2EBEAE11BB9B697003A27DC /* ImmediateSchedulerType.swift in Sources */,
C820A8861EB4DA5A00D431BC /* Dematerialize.swift in Sources */,
Expand Down
52 changes: 44 additions & 8 deletions RxBlocking/BlockingObservable+Operators.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,28 @@
import RxSwift
#endif

/// The `MaterializedSequenceResult` enum represents the materialized
/// output of a BlockingObservable.
///
/// If the sequence terminates successfully, the result is represented
/// by `.completed` with the array of elements.
///
/// If the sequence terminates with error, the result is represented
/// by `.failed` with both the array of elements and the terminating error.
public enum MaterializedSequenceResult<T> {
case completed(elements: [T])
case failed(elements: [T], error: Error)
}

extension BlockingObservable {
/// Blocks current thread until sequence terminates.
///
/// If sequence terminates with error, terminating error will be thrown.
///
/// - returns: All elements of sequence.
public func toArray() throws -> [E] {
return try convertToArray()
let results = materializeResult()
return try elementsOrThrow(results)
}
}

Expand All @@ -28,7 +42,8 @@ extension BlockingObservable {
///
/// - returns: First element of sequence. If sequence is empty `nil` is returned.
public func first() throws -> E? {
return try convertToArray(max: 1).first
let results = materializeResult(max: 1)
return try elementsOrThrow(results).first
}
}

Expand All @@ -39,7 +54,8 @@ extension BlockingObservable {
///
/// - returns: Last element in the sequence. If sequence is empty `nil` is returned.
public func last() throws -> E? {
return try convertToArray().last
let results = materializeResult()
return try elementsOrThrow(results).last
}
}

Expand All @@ -60,7 +76,8 @@ extension BlockingObservable {
/// - parameter predicate: A function to test each source element for a condition.
/// - returns: Returns the only element of an sequence that satisfies the condition in the predicate, and reports an error if there is not exactly one element in the sequence.
public func single(_ predicate: @escaping (E) throws -> Bool) throws -> E? {
let elements = try convertToArray(max: 2, predicate: predicate)
let results = materializeResult(max: 2, predicate: predicate)
let elements = try elementsOrThrow(results)

switch elements.count {
case 0:
Expand All @@ -74,9 +91,19 @@ extension BlockingObservable {
}

extension BlockingObservable {
fileprivate func convertToArray(max: Int? = nil, predicate: @escaping (E) throws -> Bool = { _ in true }) throws -> [E] {
/// Blocks current thread until sequence terminates.
///
/// The sequence is materialized as a result type capturing how the sequence terminated (completed or error), along with any elements up to that point.
///
/// - returns: On completion, returns the list of elements in the sequence. On error, returns the list of elements up to that point, along with the error itself.
public func materialize() -> MaterializedSequenceResult<E> {
return materializeResult()
}
}

extension BlockingObservable {
fileprivate func materializeResult(max: Int? = nil, predicate: @escaping (E) throws -> Bool = { _ in true }) -> MaterializedSequenceResult<E> {
var elements: [E] = Array<E>()

var error: Swift.Error?

let lock = RunLoopLock(timeout: timeout)
Expand Down Expand Up @@ -127,9 +154,18 @@ extension BlockingObservable {
}

if let error = error {
throw error
return MaterializedSequenceResult.failed(elements: elements, error: error)
}

return elements
return MaterializedSequenceResult.completed(elements: elements)
}

fileprivate func elementsOrThrow(_ results: MaterializedSequenceResult<E>) throws -> [E] {
switch results {
case .failed(_, let error):
throw error
case .completed(let elements):
return elements
}
}
}
Loading

0 comments on commit efe3af1

Please sign in to comment.