CancellableResult
@frozen
public enum CancellableResult<Value>
Used to represent whether an operation was successful, was cancelled, or encountered an error.
-
The operation was successful, returning the associated value.
Declaration
Swift
case success(Value)
-
The operation failed, with the associated value causing the failure.
Declaration
Swift
case failure(Error)
-
The operation was cancelled.
Declaration
Swift
case cancelled
-
Returns
true
if the result is a success,false
otherwise.Declaration
Swift
public var isSuccess: Bool { get }
-
Returns
true
if the result is a failure,false
otherwise.Declaration
Swift
public var isFailure: Bool { get }
-
Returns
true
if the result indicates a cancellation,false
otherwise.Declaration
Swift
public var isCancelled: Bool { get }
-
Returns the associated value if the result is a success,
nil
otherwise.Declaration
Swift
public var value: Value? { get }
-
Returns the associated error value if the result is a failure,
nil
otherwise.Declaration
Swift
public var error: Error? { get }