wireguard-apple/Sources/WireGuardApp/WireGuardResult.swift
Andrej Mihajlov ec57408570 Move all source files to Sources/ and rename WireGuardKit targets
Signed-off-by: Andrej Mihajlov <and@mullvad.net>
2020-12-03 13:32:24 +01:00

29 lines
629 B
Swift

// SPDX-License-Identifier: MIT
// Copyright © 2018-2019 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
}
}
}