swiftlang/swift
View on GitHub[SR-12930] Add protocol extension to "Result where Success == Void" so that we can use .success()
Open
#55,376 opened on Jun 3, 2020
good first issueimprovementstandard libraryswift evolution proposal needed
Repository metrics
- Stars
- (69,989 stars)
- PR merge metrics
- (Avg merge 8d 17h) (510 merged PRs in 30d)
Description
| Previous ID | SR-12930 |
| Radar | None |
| Original Reporter | ronyfadel (JIRA User) |
| Type | Improvement |
| Votes | 0 |
| Component/s | Standard Library |
| Labels | Improvement, StarterProposal |
| Assignee | None |
| Priority | Medium |
md5: 176bf2fbbef4e6b7e54e92d66bdb68aa
Issue Description:
Currently, to signal a success of type Result<Void, Swift.Error>, we need to use:
.success(())
Combine, for example, special-cases Subject for when the Output is of type Void:
extension Subject where Self.Output == Void {
/// Signals subscribers.
public func send()
}
A similar extension could be added for `Result` so that we can use .success(()) instead:
extension Result where Success == Void {
static func success() -> Self {
return .success(())
}
}
I'd be happy to contribute a patch if someone can point me to the proper PR policy.