mirror of
https://github.com/passepartoutvpn/wireguard-apple.git
synced 2025-01-17 05:59:02 +00:00
782dd2ea4e
Signed-off-by: Roopesh Chander <roop@roopc.net>
29 lines
608 B
Swift
29 lines
608 B
Swift
// SPDX-License-Identifier: MIT
|
|
// Copyright © 2018 WireGuard LLC. All Rights Reserved.
|
|
|
|
enum WireGuardResult<T> {
|
|
case success(T)
|
|
case failure(WireGuardAppError)
|
|
|
|
var value: T? {
|
|
switch (self) {
|
|
case .success(let v): return v
|
|
case .failure(_): return nil
|
|
}
|
|
}
|
|
|
|
var error: WireGuardAppError? {
|
|
switch (self) {
|
|
case .success(_): return nil
|
|
case .failure(let e): return e
|
|
}
|
|
}
|
|
|
|
var isSuccess: Bool {
|
|
switch (self) {
|
|
case .success(_): return true
|
|
case .failure(_): return false
|
|
}
|
|
}
|
|
}
|