Entirely remove Result type that not only is unneeded with Swift 5 but also was not being used by this library (it was left over from before Poly became its own library). Fix a few redundent public warnings.

This commit is contained in:
Mathew Polzin
2019-04-16 21:56:49 -07:00
parent b1adc60719
commit fb710c397b
2 changed files with 3 additions and 48 deletions
-45
View File
@@ -1,45 +0,0 @@
//
// Result.swift
// JSONAPI
//
// Created by Mathew Polzin on 12/5/18.
//
enum Result<T, E: Swift.Error> {
case success(T)
case failure(E)
var value: T? {
guard case .success(let val) = self else {
return nil
}
return val
}
var error: E? {
guard case .failure(let err) = self else {
return nil
}
return err
}
func map<U>(_ transform: (T) -> U) -> Result<U, E> {
switch self {
case .failure(let err):
return .failure(err)
case .success(let val):
return .success(transform(val))
}
}
}
extension Result: CustomStringConvertible where T: CustomStringConvertible, E: CustomStringConvertible {
var description: String {
switch self {
case .success(let val):
return String(describing: val)
case .failure(let err):
return String(describing: err)
}
}
}
+3 -3
View File
@@ -86,10 +86,10 @@ public extension PolyProxyTests {
public typealias Relationships = NoRelationships
}
public typealias UserA = BasicEntity<UserDescription1>
public typealias UserB = BasicEntity<UserDescription2>
typealias UserA = BasicEntity<UserDescription1>
typealias UserB = BasicEntity<UserDescription2>
public typealias User = Poly2<UserA, UserB>
typealias User = Poly2<UserA, UserB>
}
extension Poly2: EntityProxy, JSONTyped where A == PolyProxyTests.UserA, B == PolyProxyTests.UserB {