Result (ext)
You’re viewing third-party extensions to Result
, an enum from the Swift standard library.
You can also read the documentation forResult
itself.
extension Result
You’re viewing third-party extensions to Result
, an enum from the Swift standard library.
You can also read the documentation forResult
itself.
extension Result
@frozen enum Result<Success, Failure> where Failure : Error, Success : ~Copyable
A value that represents either a success or a failure, including an associated value in each case.
import CasePathsCore
Case paths bring the power and ergonomics of key paths to enums.
protocol Error : Sendable
A type representing an error value that can be thrown.
static var allCasePaths: AllCasePaths { get }
struct AllCasePaths
subscript<Value>(case keyPath: CaseKeyPath<Self, Value>) -> Value? { get }
Attempts to extract the associated value from a root enum using a case key path.
subscript<Value>(case keyPath: CaseKeyPath<Self, Value>) -> Value { get set }
Replaces the associated value of a root enum at a case key path when the case matches.
subscript(case keyPath: PartialCaseKeyPath<Self>) -> Any? { get }
Attempts to extract the associated value from a root enum using a partial case key path.
subscript<Value>(dynamicMember keyPath: KeyPath<Self.AllCasePaths, AnyCasePath<Self, Value>>) -> Value? { get set }
Extracts the associated value of a case via dynamic member lookup.
subscript<Value>(dynamicMember keyPath: KeyPath<Self.AllCasePaths, AnyCasePath<Self, Value>>) -> Value { get set }
Embeds the associated value of a case via dynamic member lookup.
func `is`(_ keyPath: PartialCaseKeyPath<Self>) -> Bool
Tests the associated value of a case.
mutating func modify<Value>(_ keyPath: CaseKeyPath<Self, Value>, yield: (inout Value) -> Void, fileID: StaticString = #fileID, filePath: StaticString = #filePath, line: UInt = #line, column: UInt = #column)
Unwraps and yields a mutable associated value to a closure.
typealias Cases = Case<Self>
A namespace that can be used to derive case key paths from case-pathable enums.
protocol Copyable
A type whose values can be implicitly or explicitly copied.
protocol Escapable
protocol CasePathIterable : CasePathable where Self.AllCasePaths : Sequence, Self.AllCasePaths.Element == PartialKeyPath<Case<Self>>
A type that provides a collection of all of its case paths.
protocol CasePathable
A type that provides a collection of all of its case paths.