mirror of
https://github.com/passepartoutvpn/wireguard-apple.git
synced 2024-12-25 19:12:37 +00:00
90acf2b220
A bit overdue, but better late than never. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
29 lines
629 B
Swift
29 lines
629 B
Swift
// SPDX-License-Identifier: MIT
|
|
// Copyright © 2018-2020 WireGuard LLC. All Rights Reserved.
|
|
|
|
enum WireGuardResult<T> {
|
|
case success(_ value: T)
|
|
case failure(_ error: WireGuardAppError)
|
|
|
|
var value: T? {
|
|
switch self {
|
|
case .success(let value): return value
|
|
case .failure: return nil
|
|
}
|
|
}
|
|
|
|
var error: WireGuardAppError? {
|
|
switch self {
|
|
case .success: return nil
|
|
case .failure(let error): return error
|
|
}
|
|
}
|
|
|
|
var isSuccess: Bool {
|
|
switch self {
|
|
case .success: return true
|
|
case .failure: return false
|
|
}
|
|
}
|
|
}
|