Added SignedNumeric stubs to Failable<SignedNumeric, T> type

This commit is contained in:
Caleb Kleveter 2018-11-28 15:05:34 -06:00
parent 7a59f94624
commit f1bcd4ef2c
No known key found for this signature in database
GPG Key ID: B38DBD5CF2C98D69
1 changed files with 12 additions and 0 deletions

View File

@ -0,0 +1,12 @@
extension Failable where T: SignedNumeric {
/// See [`SignedNumeric.negate()`](https://developer.apple.com/documentation/swift/signednumeric/2883859-negate).
public mutating func negate()throws {
try self = -self
}
/// See [`SignedNumeric.-(_:)`](https://developer.apple.com/documentation/swift/signednumeric/2965579).
public static prefix func - (lhs: Failable<T, Validations>)throws -> Failable<T, Validations> {
return try Failable(-lhs.value)
}
}