diff --git a/.agents/interfaces/.gitkeep b/.agents/interfaces/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/.agents/interfaces/macos/KeyPathMapping.swiftinterface b/.agents/interfaces/macos/KeyPathMapping.swiftinterface new file mode 100644 index 0000000..0972b39 --- /dev/null +++ b/.agents/interfaces/macos/KeyPathMapping.swiftinterface @@ -0,0 +1,1280 @@ +// swift-interface-format-version: 1.0 +// swift-compiler-version: Apple Swift version 6.4 (swiftlang-6.4.0.25.4 clang-2100.3.25.1) +// swift-module-flags: -target arm64-apple-macos12.0 -enable-objc-interop -language-mode 6 -O -enable-experimental-feature DebugDescriptionMacro -module-name KeyPathMapping -package-name swift_keypath_mapping +// swift-module-flags-ignorable: -formal-cxx-interoperability-mode=off -interface-compiler-version 6.4 +import Foundation +import Swift +import SwiftMarkerProtocols +import _Concurrency +import _StringProcessing +import _SwiftConcurrencyShims +extension KeyPathMapping::_ReadonlyConversions { + public struct AnyConversion : KeyPathMapping::_ReadonlyConversions.KeyPathMapping::ConversionProtocol { + @inlinable public static func == (lhs: KeyPathMapping::_ReadonlyConversions.KeyPathMapping::AnyConversion, rhs: KeyPathMapping::_ReadonlyConversions.KeyPathMapping::AnyConversion) -> Swift::Bool { + lhs.underlying._swift_keypath_mapper_isEqual(to: rhs.underlying) + } + @usableFromInline + internal let underlying: any KeyPathMapping::_ReadonlyConversions.KeyPathMapping::ConversionProtocol + @inlinable public init(getter: KeyPathMapping::_Getters.KeyPathMapping::AnyGetter) { + self.init(Conversion(getter: getter)) + } + public init(_ underlying: any KeyPathMapping::_ReadonlyConversions.KeyPathMapping::ConversionProtocol) + @inlinable public func extract(from root: Root) -> Member { + underlying.extract(from: root) + } + @inlinable public func hash(into hasher: inout Swift::Hasher) { + underlying.hash(into: &hasher) + } + public var hashValue: Swift::Int { + get + } + } +} +extension KeyPathMapping::_MutatingConversions { + public struct AnyConversion : KeyPathMapping::_MutatingConversions.KeyPathMapping::ConversionProtocol { + @inlinable public static func == (lhs: KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion, rhs: KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion) -> Swift::Bool { + lhs.underlying._swift_keypath_mapper_isEqual(to: rhs.underlying) + } + @usableFromInline + internal let underlying: any KeyPathMapping::_MutatingConversions.KeyPathMapping::ConversionProtocol + @inlinable public init(getter: KeyPathMapping::_Getters.KeyPathMapping::AnyGetter, setter: KeyPathMapping::_MutatingSetters.KeyPathMapping::AnySetter) { + self.init(Conversion( + getter: getter, + setter: setter + )) + } + public init(_ underlying: any KeyPathMapping::_MutatingConversions.KeyPathMapping::ConversionProtocol) + @inlinable public func extract(from root: Root) -> Member { + underlying.extract(from: root) + } + @inlinable public func embed(_ member: Member, in root: inout Root) { + underlying.embed(member, in: &root) + } + @inlinable public func hash(into hasher: inout Swift::Hasher) { + underlying.hash(into: &hasher) + } + public var hashValue: Swift::Int { + get + } + } +} +extension KeyPathMapping::_NonMutatingConversions { + public struct AnyConversion : KeyPathMapping::_NonMutatingConversions.KeyPathMapping::ConversionProtocol { + @inlinable public static func == (lhs: KeyPathMapping::_NonMutatingConversions.KeyPathMapping::AnyConversion, rhs: KeyPathMapping::_NonMutatingConversions.KeyPathMapping::AnyConversion) -> Swift::Bool { + lhs.underlying._swift_keypath_mapper_isEqual(to: rhs.underlying) + } + @usableFromInline + internal let underlying: any KeyPathMapping::_NonMutatingConversions.KeyPathMapping::ConversionProtocol + @inlinable public init(getter: KeyPathMapping::_Getters.KeyPathMapping::AnyGetter, setter: KeyPathMapping::_NonMutatingSetters.KeyPathMapping::AnySetter) { + self.init(Conversion( + getter: getter, + setter: setter + )) + } + public init(_ underlying: any KeyPathMapping::_NonMutatingConversions.KeyPathMapping::ConversionProtocol) + @inlinable public func extract(from root: Root) -> Member { + underlying.extract(from: root) + } + @inlinable public func embed(_ member: Member, in root: Root) { + underlying.embed(member, in: root) + } + @inlinable public func hash(into hasher: inout Swift::Hasher) { + underlying.hash(into: &hasher) + } + public var hashValue: Swift::Int { + get + } + } +} +extension KeyPathMapping::_ReadonlyConversions.KeyPathMapping::AnyConversion { + @inlinable public static func readonly(_ conversion: KeyPathMapping::_ReadonlyConversions.KeyPathMapping::AnyConversion) -> KeyPathMapping::_ReadonlyConversions.KeyPathMapping::AnyConversion { + return conversion + } +} +extension KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion { + @inlinable public static func mutating(_ conversion: KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion) -> KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion { + return conversion + } +} +extension KeyPathMapping::_NonMutatingConversions.KeyPathMapping::AnyConversion { + @inlinable public static func nonmutating(_ conversion: KeyPathMapping::_NonMutatingConversions.KeyPathMapping::AnyConversion) -> KeyPathMapping::_NonMutatingConversions.KeyPathMapping::AnyConversion { + return conversion + } +} +extension KeyPathMapping::_ReadonlyConversions.KeyPathMapping::AnyConversion { + @inlinable public static func inline(extract: @escaping (Root) -> Member) -> KeyPathMapping::_ReadonlyConversions.KeyPathMapping::AnyConversion { + .init( + getter: .inline(extract: extract) + ) + } +} +extension KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion { + @inlinable public static func inline(extract: @escaping (Root) -> Member, embed: @escaping (inout Root, Member) -> Swift::Void) -> KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion { + .init( + getter: .inline(extract: extract), + setter: .inline(embed: embed) + ) + } +} +extension KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion { + @inlinable public static func inline(extract: @escaping (Root) -> Member, embed: @escaping (Member) -> Root) -> KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion { + .init( + getter: .inline(extract: extract), + setter: .inline(embed: embed) + ) + } +} +extension KeyPathMapping::_NonMutatingConversions.KeyPathMapping::AnyConversion { + @inlinable public static func inline(extract: @escaping (Root) -> Member, embed: @escaping (Root, Member) -> Swift::Void) -> KeyPathMapping::_NonMutatingConversions.KeyPathMapping::AnyConversion { + .init( + getter: .inline(extract: extract), + setter: .inline(embed: embed) + ) + } +} +extension KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion where Root == Member { + @inlinable public static func inline(embed: @escaping (inout Root, Member) -> Swift::Void) -> KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion { + .init( + getter: .inline(extract: \.self), + setter: .inline(embed: embed) + ) + } +} +extension KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion where Root == Member { + @inlinable public static func inline(embed: @escaping (Member) -> Root) -> KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion { + .init( + getter: .inline(extract: \.self), + setter: .inline(embed: embed) + ) + } +} +extension KeyPathMapping::_NonMutatingConversions.KeyPathMapping::AnyConversion where Root == Member { + @inlinable public static func inline(embed: @escaping (Root, Member) -> Swift::Void) -> KeyPathMapping::_NonMutatingConversions.KeyPathMapping::AnyConversion { + .init( + getter: .inline(extract: \.self), + setter: .inline(embed: embed) + ) + } +} +extension KeyPathMapping::_ReadonlyConversions { + public struct Concat : KeyPathMapping::_ReadonlyConversions.KeyPathMapping::ConversionProtocol where First : KeyPathMapping::_ReadonlyConversions.KeyPathMapping::ConversionProtocol, Second : KeyPathMapping::_ReadonlyConversions.KeyPathMapping::ConversionProtocol, First.Member == Second.Root { + public typealias Root = First.Root + public typealias Member = Second.Member + @usableFromInline + internal let first: First + @usableFromInline + internal let second: Second + public init(_ first: First, _ second: Second) + @inlinable public func extract(from root: KeyPathMapping::_ReadonlyConversions.KeyPathMapping::Concat.Root) -> KeyPathMapping::_ReadonlyConversions.KeyPathMapping::Concat.Member { + second.extract(from: first.extract(from: root)) + } + @_implements(Swift::Equatable, ==(_:_:)) public static func __derived_struct_equals(_ a: KeyPathMapping::_ReadonlyConversions.KeyPathMapping::Concat, _ b: KeyPathMapping::_ReadonlyConversions.KeyPathMapping::Concat) -> Swift::Bool + public func hash(into hasher: inout Swift::Hasher) + public var hashValue: Swift::Int { + get + } + } +} +extension KeyPathMapping::_ReadonlyConversions.KeyPathMapping::AnyConversion { + @inlinable public func appending(_ other: KeyPathMapping::_ReadonlyConversions.KeyPathMapping::AnyConversion) -> KeyPathMapping::_ReadonlyConversions.KeyPathMapping::AnyConversion { + return .init(_ReadonlyConversions.Concat( + self, + other + )) + } +} +extension KeyPathMapping::_ReadonlyConversions.KeyPathMapping::AnyConversion { + @inlinable public static func concat(_ c0: KeyPathMapping::_ReadonlyConversions.KeyPathMapping::AnyConversion, _ c1: KeyPathMapping::_ReadonlyConversions.KeyPathMapping::AnyConversion) -> KeyPathMapping::_ReadonlyConversions.KeyPathMapping::AnyConversion { + c0 + .appending(c1) + } + @inlinable public static func concat(_ c0: KeyPathMapping::_ReadonlyConversions.KeyPathMapping::AnyConversion, _ c1: KeyPathMapping::_ReadonlyConversions.KeyPathMapping::AnyConversion, _ c2: KeyPathMapping::_ReadonlyConversions.KeyPathMapping::AnyConversion) -> KeyPathMapping::_ReadonlyConversions.KeyPathMapping::AnyConversion { + c0 + .appending(c1) + .appending(c2) + } + @inlinable public static func concat(_ c0: KeyPathMapping::_ReadonlyConversions.KeyPathMapping::AnyConversion, _ c1: KeyPathMapping::_ReadonlyConversions.KeyPathMapping::AnyConversion, _ c2: KeyPathMapping::_ReadonlyConversions.KeyPathMapping::AnyConversion, _ c3: KeyPathMapping::_ReadonlyConversions.KeyPathMapping::AnyConversion) -> KeyPathMapping::_ReadonlyConversions.KeyPathMapping::AnyConversion { + c0 + .appending(c1) + .appending(c2) + .appending(c3) + } + @inlinable public static func concat(_ c0: KeyPathMapping::_ReadonlyConversions.KeyPathMapping::AnyConversion, _ c1: KeyPathMapping::_ReadonlyConversions.KeyPathMapping::AnyConversion, _ c2: KeyPathMapping::_ReadonlyConversions.KeyPathMapping::AnyConversion, _ c3: KeyPathMapping::_ReadonlyConversions.KeyPathMapping::AnyConversion, _ c4: KeyPathMapping::_ReadonlyConversions.KeyPathMapping::AnyConversion) -> KeyPathMapping::_ReadonlyConversions.KeyPathMapping::AnyConversion { + c0 + .appending(c1) + .appending(c2) + .appending(c3) + .appending(c4) + } +} +extension KeyPathMapping::_MutatingConversions { + public struct Concat : KeyPathMapping::_MutatingConversions.KeyPathMapping::ConversionProtocol where First : KeyPathMapping::_MutatingConversions.KeyPathMapping::ConversionProtocol, Second : KeyPathMapping::_MutatingConversions.KeyPathMapping::ConversionProtocol, First.Member == Second.Root { + public typealias Root = First.Root + public typealias Member = Second.Member + @usableFromInline + internal let first: First + @usableFromInline + internal let second: Second + public init(_ first: First, _ second: Second) + @inlinable public func extract(from root: KeyPathMapping::_MutatingConversions.KeyPathMapping::Concat.Root) -> KeyPathMapping::_MutatingConversions.KeyPathMapping::Concat.Member { + second.extract(from: first.extract(from: root)) + } + @inlinable public func embed(_ member: KeyPathMapping::_MutatingConversions.KeyPathMapping::Concat.Member, in root: inout KeyPathMapping::_MutatingConversions.KeyPathMapping::Concat.Root) { + var intermediateRoot: First.Member = first.extract(from: root) + second.embed(member, in: &intermediateRoot) + first.embed(intermediateRoot, in: &root) + } + @usableFromInline + internal func embed(_ member: Second.Member, in root: inout Second.Root) + @_implements(Swift::Equatable, ==(_:_:)) public static func __derived_struct_equals(_ a: KeyPathMapping::_MutatingConversions.KeyPathMapping::Concat, _ b: KeyPathMapping::_MutatingConversions.KeyPathMapping::Concat) -> Swift::Bool + public func hash(into hasher: inout Swift::Hasher) + public var hashValue: Swift::Int { + get + } + } +} +extension KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion { + @inlinable public func appending(_ other: KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion) -> KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion { + return .init(_MutatingConversions.Concat( + self, + other + )) + } +} +extension KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion { + @inlinable public static func concat(_ c0: KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion, _ c1: KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion) -> KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion { + c0 + .appending(c1) + } + @inlinable public static func concat(_ c0: KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion, _ c1: KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion, _ c2: KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion) -> KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion { + c0 + .appending(c1) + .appending(c2) + } + @inlinable public static func concat(_ c0: KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion, _ c1: KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion, _ c2: KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion, _ c3: KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion) -> KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion { + c0 + .appending(c1) + .appending(c2) + .appending(c3) + } + @inlinable public static func concat(_ c0: KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion, _ c1: KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion, _ c2: KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion, _ c3: KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion, _ c4: KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion) -> KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion { + c0 + .appending(c1) + .appending(c2) + .appending(c3) + .appending(c4) + } +} +extension KeyPathMapping::_NonMutatingConversions { + public struct Concat : KeyPathMapping::_NonMutatingConversions.KeyPathMapping::ConversionProtocol where First : KeyPathMapping::_NonMutatingConversions.KeyPathMapping::ConversionProtocol, Second : KeyPathMapping::_NonMutatingConversions.KeyPathMapping::ConversionProtocol, First.Member == Second.Root { + public typealias Root = First.Root + public typealias Member = Second.Member + @usableFromInline + internal let first: First + @usableFromInline + internal let second: Second + public init(_ first: First, _ second: Second) + @inlinable public func extract(from root: KeyPathMapping::_NonMutatingConversions.KeyPathMapping::Concat.Root) -> KeyPathMapping::_NonMutatingConversions.KeyPathMapping::Concat.Member { + second.extract(from: first.extract(from: root)) + } + @inlinable public func embed(_ member: KeyPathMapping::_NonMutatingConversions.KeyPathMapping::Concat.Member, in root: KeyPathMapping::_NonMutatingConversions.KeyPathMapping::Concat.Root) { + let intermediateRoot: First.Member = first.extract(from: root) + second.embed(member, in: intermediateRoot) + first.embed(intermediateRoot, in: root) + } + @_implements(Swift::Equatable, ==(_:_:)) public static func __derived_struct_equals(_ a: KeyPathMapping::_NonMutatingConversions.KeyPathMapping::Concat, _ b: KeyPathMapping::_NonMutatingConversions.KeyPathMapping::Concat) -> Swift::Bool + public func hash(into hasher: inout Swift::Hasher) + public var hashValue: Swift::Int { + get + } + } +} +extension KeyPathMapping::_NonMutatingConversions.KeyPathMapping::AnyConversion { + @inlinable public func appending(_ other: KeyPathMapping::_NonMutatingConversions.KeyPathMapping::AnyConversion) -> KeyPathMapping::_NonMutatingConversions.KeyPathMapping::AnyConversion { + return .init(_NonMutatingConversions.Concat( + self, + other + )) + } +} +extension KeyPathMapping::_NonMutatingConversions.KeyPathMapping::AnyConversion { + @inlinable public static func concat(_ c0: KeyPathMapping::_NonMutatingConversions.KeyPathMapping::AnyConversion, _ c1: KeyPathMapping::_NonMutatingConversions.KeyPathMapping::AnyConversion) -> KeyPathMapping::_NonMutatingConversions.KeyPathMapping::AnyConversion { + c0 + .appending(c1) + } + @inlinable public static func concat(_ c0: KeyPathMapping::_NonMutatingConversions.KeyPathMapping::AnyConversion, _ c1: KeyPathMapping::_NonMutatingConversions.KeyPathMapping::AnyConversion, _ c2: KeyPathMapping::_NonMutatingConversions.KeyPathMapping::AnyConversion) -> KeyPathMapping::_NonMutatingConversions.KeyPathMapping::AnyConversion { + c0 + .appending(c1) + .appending(c2) + } + @inlinable public static func concat(_ c0: KeyPathMapping::_NonMutatingConversions.KeyPathMapping::AnyConversion, _ c1: KeyPathMapping::_NonMutatingConversions.KeyPathMapping::AnyConversion, _ c2: KeyPathMapping::_NonMutatingConversions.KeyPathMapping::AnyConversion, _ c3: KeyPathMapping::_NonMutatingConversions.KeyPathMapping::AnyConversion) -> KeyPathMapping::_NonMutatingConversions.KeyPathMapping::AnyConversion { + c0 + .appending(c1) + .appending(c2) + .appending(c3) + } + @inlinable public static func concat(_ c0: KeyPathMapping::_NonMutatingConversions.KeyPathMapping::AnyConversion, _ c1: KeyPathMapping::_NonMutatingConversions.KeyPathMapping::AnyConversion, _ c2: KeyPathMapping::_NonMutatingConversions.KeyPathMapping::AnyConversion, _ c3: KeyPathMapping::_NonMutatingConversions.KeyPathMapping::AnyConversion, _ c4: KeyPathMapping::_NonMutatingConversions.KeyPathMapping::AnyConversion) -> KeyPathMapping::_NonMutatingConversions.KeyPathMapping::AnyConversion { + c0 + .appending(c1) + .appending(c2) + .appending(c3) + .appending(c4) + } +} +public enum _ReadonlyConversions { +} +public enum _MutatingConversions { +} +public enum _NonMutatingConversions { +} +extension KeyPathMapping::_ReadonlyConversions { + public protocol ConversionProtocol : KeyPathMapping::_Getters.KeyPathMapping::Getter { + associatedtype Root + associatedtype Member + } +} +extension KeyPathMapping::_MutatingConversions { + public protocol ConversionProtocol : KeyPathMapping::_Getters.KeyPathMapping::Getter, KeyPathMapping::_MutatingSetters.KeyPathMapping::Setter { + associatedtype Root + associatedtype Member + } +} +extension KeyPathMapping::_NonMutatingConversions { + public protocol ConversionProtocol : KeyPathMapping::_Getters.KeyPathMapping::Getter, KeyPathMapping::_NonMutatingSetters.KeyPathMapping::Setter { + associatedtype Root + associatedtype Member + } +} +extension KeyPathMapping::_ReadonlyConversions { + public struct Conversion : KeyPathMapping::_ReadonlyConversions.KeyPathMapping::ConversionProtocol where Getter : KeyPathMapping::_Getters.KeyPathMapping::Getter { + public typealias Root = Getter.Root + public typealias Member = Getter.Member + @usableFromInline + internal var getter: Getter + public init(getter: Getter) + @inlinable public func extract(from root: KeyPathMapping::_ReadonlyConversions.KeyPathMapping::Conversion.Root) -> KeyPathMapping::_ReadonlyConversions.KeyPathMapping::Conversion.Member { + getter.extract(from: root) + } + @_implements(Swift::Equatable, ==(_:_:)) public static func __derived_struct_equals(_ a: KeyPathMapping::_ReadonlyConversions.KeyPathMapping::Conversion, _ b: KeyPathMapping::_ReadonlyConversions.KeyPathMapping::Conversion) -> Swift::Bool + public func hash(into hasher: inout Swift::Hasher) + public var hashValue: Swift::Int { + get + } + } +} +extension KeyPathMapping::_MutatingConversions { + public struct Conversion : KeyPathMapping::_MutatingConversions.KeyPathMapping::ConversionProtocol where Getter : KeyPathMapping::_Getters.KeyPathMapping::Getter, Setter : KeyPathMapping::_MutatingSetters.KeyPathMapping::Setter, Getter.Member == Setter.Member, Getter.Root == Setter.Root { + public typealias Root = Getter.Root + public typealias Member = Getter.Member + @usableFromInline + internal var getter: Getter + @usableFromInline + internal var setter: Setter + public init(getter: Getter, setter: Setter) + @inlinable public func extract(from root: KeyPathMapping::_MutatingConversions.KeyPathMapping::Conversion.Root) -> KeyPathMapping::_MutatingConversions.KeyPathMapping::Conversion.Member { + getter.extract(from: root) + } + @inlinable public func embed(_ member: KeyPathMapping::_MutatingConversions.KeyPathMapping::Conversion.Member, in root: inout KeyPathMapping::_MutatingConversions.KeyPathMapping::Conversion.Root) { + setter.embed(member, in: &root) + } + @_implements(Swift::Equatable, ==(_:_:)) public static func __derived_struct_equals(_ a: KeyPathMapping::_MutatingConversions.KeyPathMapping::Conversion, _ b: KeyPathMapping::_MutatingConversions.KeyPathMapping::Conversion) -> Swift::Bool + public func hash(into hasher: inout Swift::Hasher) + public var hashValue: Swift::Int { + get + } + } +} +extension KeyPathMapping::_NonMutatingConversions { + public struct Conversion : KeyPathMapping::_NonMutatingConversions.KeyPathMapping::ConversionProtocol where Getter : KeyPathMapping::_Getters.KeyPathMapping::Getter, Setter : KeyPathMapping::_NonMutatingSetters.KeyPathMapping::Setter, Getter.Member == Setter.Member, Getter.Root == Setter.Root { + public typealias Root = Getter.Root + public typealias Member = Getter.Member + @usableFromInline + internal var getter: Getter + @usableFromInline + internal var setter: Setter + public init(getter: Getter, setter: Setter) + @inlinable public func extract(from root: KeyPathMapping::_NonMutatingConversions.KeyPathMapping::Conversion.Root) -> KeyPathMapping::_NonMutatingConversions.KeyPathMapping::Conversion.Member { + getter.extract(from: root) + } + @inlinable public func embed(_ member: KeyPathMapping::_NonMutatingConversions.KeyPathMapping::Conversion.Member, in root: KeyPathMapping::_NonMutatingConversions.KeyPathMapping::Conversion.Root) { + setter.embed(member, in: root) + } + @_implements(Swift::Equatable, ==(_:_:)) public static func __derived_struct_equals(_ a: KeyPathMapping::_NonMutatingConversions.KeyPathMapping::Conversion, _ b: KeyPathMapping::_NonMutatingConversions.KeyPathMapping::Conversion) -> Swift::Bool + public func hash(into hasher: inout Swift::Hasher) + public var hashValue: Swift::Int { + get + } + } +} +extension Swift::Equatable { + @_disfavoredOverload @inlinable public subscript(_map conversion: Conversion) -> Conversion.Member where Self == Conversion.Root, Conversion : KeyPathMapping::_ReadonlyConversions.KeyPathMapping::ConversionProtocol { + get { conversion.extract(from: self) } + } + @_disfavoredOverload @inlinable public subscript(_convert conversion: Conversion) -> Conversion.Member where Self == Conversion.Root, Conversion : KeyPathMapping::_MutatingConversions.KeyPathMapping::ConversionProtocol { + get { conversion.extract(from: self) } + set { conversion.embed(newValue, in: &self) } + } + @_disfavoredOverload @inlinable public subscript(_convert conversion: Conversion) -> Conversion.Member where Self == Conversion.Root, Conversion : KeyPathMapping::_NonMutatingConversions.KeyPathMapping::ConversionProtocol { + get { conversion.extract(from: self) } + nonmutating set { conversion.embed(newValue, in: self) } + } +} +extension Swift::Equatable { + @_disfavoredOverload @inlinable public subscript(map conversion: KeyPathMapping::_ReadonlyConversions.KeyPathMapping::AnyConversion) -> T { + get { conversion.extract(from: self) } + } + @_disfavoredOverload @inlinable public subscript(convert conversion: KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion) -> T { + get { conversion.extract(from: self) } + set { conversion.embed(newValue, in: &self) } + } + @_disfavoredOverload @inlinable public subscript(convert conversion: KeyPathMapping::_NonMutatingConversions.KeyPathMapping::AnyConversion) -> T { + get { conversion.extract(from: self) } + nonmutating set { conversion.embed(newValue, in: self) } + } +} +extension Swift::Equatable { + @_disfavoredOverload @inlinable public subscript(_getter getter: Getter) -> Getter.Member where Self == Getter.Root, Getter : KeyPathMapping::_Getters.KeyPathMapping::Getter { + get { getter.extract(from: self) } + } + @_disfavoredOverload @inlinable public subscript(_getter getter: Getter, _setter setter: Setter) -> Getter.Member where Self == Getter.Root, Getter : KeyPathMapping::_Getters.KeyPathMapping::Getter, Setter : KeyPathMapping::_MutatingSetters.KeyPathMapping::Setter, Getter.Member == Setter.Member, Getter.Root == Setter.Root { + get { getter.extract(from: self) } + set { setter.embed(newValue, in: &self) } + } + @_disfavoredOverload @inlinable public subscript(_setter setter: Setter) -> Self where Self == Setter.Member, Setter : KeyPathMapping::_MutatingSetters.KeyPathMapping::Setter, Setter.Member == Setter.Root { + get { self } + set { setter.embed(newValue, in: &self) } + } + @_disfavoredOverload @inlinable public subscript(_getter getter: Getter, _setter setter: Setter) -> Getter.Member where Self == Getter.Root, Getter : KeyPathMapping::_Getters.KeyPathMapping::Getter, Setter : KeyPathMapping::_NonMutatingSetters.KeyPathMapping::Setter, Getter.Member == Setter.Member, Getter.Root == Setter.Root { + get { getter.extract(from: self) } + nonmutating set { setter.embed(newValue, in: self) } + } + @_disfavoredOverload @inlinable public subscript(_setter setter: Setter) -> Self where Self == Setter.Member, Setter : KeyPathMapping::_NonMutatingSetters.KeyPathMapping::Setter, Setter.Member == Setter.Root { + get { self } + set { setter.embed(newValue, in: self) } + } +} +extension Swift::Equatable { + @_disfavoredOverload @inlinable public subscript(getter getter: KeyPathMapping::KeyPathMapper.KeyPathMapping::Getter) -> T { + get { getter.extract(from: self) } + } + @_disfavoredOverload @inlinable public subscript(getter getter: KeyPathMapping::KeyPathMapper.KeyPathMapping::Getter, setter setter: KeyPathMapping::KeyPathMapper.KeyPathMapping::MutatingSetter) -> T { + get { getter.extract(from: self) } + set { setter.embed(newValue, in: &self) } + } + @_disfavoredOverload @inlinable public subscript(setter setter: KeyPathMapping::KeyPathMapper.KeyPathMapping::MutatingSetter) -> Self { + get { self } + set { setter.embed(newValue, in: &self) } + } + @_disfavoredOverload @inlinable public subscript(getter getter: KeyPathMapping::KeyPathMapper.KeyPathMapping::Getter, setter setter: KeyPathMapping::KeyPathMapper.KeyPathMapping::NonMutatingSetter) -> T { + get { getter.extract(from: self) } + nonmutating set { setter.embed(newValue, in: self) } + } + @_disfavoredOverload @inlinable public subscript(setter setter: KeyPathMapping::KeyPathMapper.KeyPathMapping::NonMutatingSetter) -> Self { + get { self } + nonmutating set { setter.embed(newValue, in: self) } + } +} +extension KeyPathMapping::_Getters { + public struct AnyGetter : KeyPathMapping::_Getters.KeyPathMapping::Getter { + @inlinable public static func == (lhs: KeyPathMapping::_Getters.KeyPathMapping::AnyGetter, rhs: KeyPathMapping::_Getters.KeyPathMapping::AnyGetter) -> Swift::Bool { + lhs.underlying._swift_keypath_mapper_isEqual(to: rhs.underlying) + } + @usableFromInline + internal let underlying: any KeyPathMapping::_Getters.KeyPathMapping::Getter + public init(_ underlying: any KeyPathMapping::_Getters.KeyPathMapping::Getter) + @inlinable public func extract(from root: Root) -> Member { + underlying.extract(from: root) + } + @inlinable public func hash(into hasher: inout Swift::Hasher) { + underlying.hash(into: &hasher) + } + public var hashValue: Swift::Int { + get + } + } +} +extension KeyPathMapping::_MutatingSetters { + public struct AnySetter : KeyPathMapping::_MutatingSetters.KeyPathMapping::Setter { + @inlinable public static func == (lhs: KeyPathMapping::_MutatingSetters.KeyPathMapping::AnySetter, rhs: KeyPathMapping::_MutatingSetters.KeyPathMapping::AnySetter) -> Swift::Bool { + lhs.underlying._swift_keypath_mapper_isEqual(to: rhs.underlying) + } + @usableFromInline + internal let underlying: any KeyPathMapping::_MutatingSetters.KeyPathMapping::Setter + public init(_ underlying: any KeyPathMapping::_MutatingSetters.KeyPathMapping::Setter) + @inlinable public func embed(_ member: Member, in root: inout Root) { + underlying.embed(member, in: &root) + } + @inlinable public func hash(into hasher: inout Swift::Hasher) { + underlying.hash(into: &hasher) + } + public var hashValue: Swift::Int { + get + } + } +} +extension KeyPathMapping::_NonMutatingSetters { + public struct AnySetter : KeyPathMapping::_NonMutatingSetters.KeyPathMapping::Setter { + @inlinable public static func == (lhs: KeyPathMapping::_NonMutatingSetters.KeyPathMapping::AnySetter, rhs: KeyPathMapping::_NonMutatingSetters.KeyPathMapping::AnySetter) -> Swift::Bool { + lhs.underlying._swift_keypath_mapper_isEqual(to: rhs.underlying) + } + @usableFromInline + internal let underlying: any KeyPathMapping::_NonMutatingSetters.KeyPathMapping::Setter + public init(_ underlying: any KeyPathMapping::_NonMutatingSetters.KeyPathMapping::Setter) + @inlinable public func embed(_ member: Member, in root: Root) { + underlying.embed(member, in: root) + } + @inlinable public func hash(into hasher: inout Swift::Hasher) { + underlying.hash(into: &hasher) + } + public var hashValue: Swift::Int { + get + } + } +} +extension KeyPathMapping::_MutatingSetters.KeyPathMapping::AnySetter { + @usableFromInline + internal struct DisableMutations : KeyPathMapping::_NonMutatingSetters.KeyPathMapping::Setter { + @usableFromInline + internal static func == (lhs: KeyPathMapping::_MutatingSetters.KeyPathMapping::AnySetter.KeyPathMapping::DisableMutations, rhs: KeyPathMapping::_MutatingSetters.KeyPathMapping::AnySetter.KeyPathMapping::DisableMutations) -> Swift::Bool + @usableFromInline + internal let underlying: any KeyPathMapping::_MutatingSetters.KeyPathMapping::Setter + @usableFromInline + internal init(for underlying: any KeyPathMapping::_MutatingSetters.KeyPathMapping::Setter) + @usableFromInline + internal func embed(_ member: Member, in root: Root) + @usableFromInline + internal func hash(into hasher: inout Swift::Hasher) + @usableFromInline + internal var hashValue: Swift::Int { + @usableFromInline + get + } + } + @inlinable public func _withMutationsDisabled() -> KeyPathMapping::_NonMutatingSetters.KeyPathMapping::AnySetter { + .init(DisableMutations(for: underlying)) + } +} +extension KeyPathMapping::_Getters.KeyPathMapping::Getter { + @inlinable public func eraseToAnyGetter() -> KeyPathMapping::_Getters.KeyPathMapping::AnyGetter { + .init(self) + } +} +extension KeyPathMapping::_MutatingSetters.KeyPathMapping::Setter { + @inlinable public func eraseToAnyMutatingSetter() -> KeyPathMapping::_MutatingSetters.KeyPathMapping::AnySetter { + .init(self) + } +} +extension KeyPathMapping::_NonMutatingSetters.KeyPathMapping::Setter { + @inlinable public func eraseToAnyNonMutatingSetter() -> KeyPathMapping::_NonMutatingSetters.KeyPathMapping::AnySetter { + .init(self) + } +} +extension KeyPathMapping::_Getters.KeyPathMapping::AnyGetter { + @inlinable public static func inline(id: any Swift::Hashable = ObjectIdentifier(Self.self), extract: @escaping (Root) -> Member) -> KeyPathMapping::_Getters.KeyPathMapping::AnyGetter { + .init(_Getters.Inline(id: id, extract: extract)) + } +} +extension KeyPathMapping::_MutatingSetters.KeyPathMapping::AnySetter { + @inlinable public static func inline(id: any Swift::Hashable = ObjectIdentifier(Self.self), embed: @escaping (inout Root, Member) -> Swift::Void) -> KeyPathMapping::_MutatingSetters.KeyPathMapping::AnySetter { + .init(_MutatingSetters.Inline(id: id, embed: embed)) + } + @inlinable public static func inline(id: any Swift::Hashable = ObjectIdentifier(Self.self), embed: @escaping (Member) -> Root) -> KeyPathMapping::_MutatingSetters.KeyPathMapping::AnySetter { + .inline(id: id) { $0 = embed($1) } + } +} +extension KeyPathMapping::_NonMutatingSetters.KeyPathMapping::AnySetter { + @inlinable public static func inline(id: any Swift::Hashable = ObjectIdentifier(Self.self), embed: @escaping (Root, Member) -> Swift::Void) -> KeyPathMapping::_NonMutatingSetters.KeyPathMapping::AnySetter { + .init(_NonMutatingSetters.Inline(id: id, embed: embed)) + } +} +extension KeyPathMapping::_MutatingSetters.KeyPathMapping::AnySetter where Root == Member { + @inlinable public static func perform(id: any Swift::Hashable = ObjectIdentifier(Self.self), onWillSet: ((Member) -> Swift::Void)? = nil, onDidSet: ((Member) -> Swift::Void)? = nil) -> KeyPathMapping::_MutatingSetters.KeyPathMapping::AnySetter { + return .inline(id: id) { + onWillSet?($1) + $0 = $1 + onDidSet?($1) + } + } + @inlinable public static func perform(id: any Swift::Hashable = ObjectIdentifier(Self.self), onWillSet: ((Root, Member) -> Swift::Void)? = nil, onDidSet: ((Root, Member) -> Swift::Void)? = nil) -> KeyPathMapping::_MutatingSetters.KeyPathMapping::AnySetter { + return .inline(id: id) { + onWillSet?($0, $1) + $0 = $1 + onDidSet?($0, $1) + } + } + @inlinable public static func onWillSet(id: any Swift::Hashable = ObjectIdentifier(Self.self), perform operation: @escaping (Member) -> Swift::Void) -> KeyPathMapping::_MutatingSetters.KeyPathMapping::AnySetter { + return .inline(id: id) { + operation($1) + $0 = $1 + } + } + @inlinable public static func onWillSet(id: any Swift::Hashable = ObjectIdentifier(Self.self), perform operation: @escaping (Root, Member) -> Swift::Void) -> KeyPathMapping::_MutatingSetters.KeyPathMapping::AnySetter { + return .inline(id: id) { + operation($0, $1) + $0 = $1 + } + } + @inlinable public static func onDidSet(id: any Swift::Hashable = ObjectIdentifier(Self.self), perform operation: @escaping (Member) -> Swift::Void) -> KeyPathMapping::_MutatingSetters.KeyPathMapping::AnySetter { + return .inline(id: id) { + $0 = $1 + operation($1) + } + } + @inlinable public static func onDidSet(id: any Swift::Hashable = ObjectIdentifier(Self.self), perform operation: @escaping (Root, Member) -> Swift::Void) -> KeyPathMapping::_MutatingSetters.KeyPathMapping::AnySetter { + return .inline(id: id) { + $0 = $1 + operation($0, $1) + } + } +} +extension KeyPathMapping::_MutatingSetters.KeyPathMapping::AnySetter where Root == Member { + @inlinable public static func perform(id: any Swift::Hashable = ObjectIdentifier(Self.self), operation: @escaping (Root, Member) -> Swift::Void) -> KeyPathMapping::_MutatingSetters.KeyPathMapping::AnySetter { + return .inline(id: id) { operation($0, $1) } + } +} +extension KeyPathMapping::_NonMutatingSetters.KeyPathMapping::AnySetter where Root == Member { + @inlinable public static func perform(id: any Swift::Hashable = ObjectIdentifier(Self.self), operation: @escaping (Root, Member) -> Swift::Void) -> KeyPathMapping::_NonMutatingSetters.KeyPathMapping::AnySetter { + return .inline(id: id, embed: operation) + } +} +extension KeyPathMapping::_Getters { + public struct Inline : KeyPathMapping::_Getters.KeyPathMapping::Getter { + @inlinable public static func == (lhs: KeyPathMapping::_Getters.KeyPathMapping::Inline, rhs: KeyPathMapping::_Getters.KeyPathMapping::Inline) -> Swift::Bool { + lhs.id._swift_keypath_mapper_isEqual(to: rhs.id) + } + @usableFromInline + internal let id: any Swift::Hashable + @usableFromInline + internal let _extract: (Root) -> Member + public init(id: any Swift::Hashable = ObjectIdentifier(Self.self), extract: @escaping (Root) -> Member) + @inlinable public func extract(from root: Root) -> Member { + self._extract(root) + } + @inlinable public func hash(into hasher: inout Swift::Hasher) { + id.hash(into: &hasher) + } + public var hashValue: Swift::Int { + get + } + } +} +extension KeyPathMapping::_MutatingSetters { + public struct Inline : KeyPathMapping::_MutatingSetters.KeyPathMapping::Setter { + @inlinable public static func == (lhs: KeyPathMapping::_MutatingSetters.KeyPathMapping::Inline, rhs: KeyPathMapping::_MutatingSetters.KeyPathMapping::Inline) -> Swift::Bool { + lhs.id._swift_keypath_mapper_isEqual(to: rhs.id) + } + @usableFromInline + internal let id: any Swift::Hashable + @usableFromInline + internal let _embed: (inout Root, Member) -> Swift::Void + public init(id: any Swift::Hashable = ObjectIdentifier(Self.self), embed: @escaping (inout Root, Member) -> Swift::Void) + @inlinable public func embed(_ member: Member, in root: inout Root) { + self._embed(&root, member) + } + @inlinable public func hash(into hasher: inout Swift::Hasher) { + id.hash(into: &hasher) + } + public var hashValue: Swift::Int { + get + } + } +} +extension KeyPathMapping::_NonMutatingSetters { + public struct Inline : KeyPathMapping::_NonMutatingSetters.KeyPathMapping::Setter { + @inlinable public static func == (lhs: KeyPathMapping::_NonMutatingSetters.KeyPathMapping::Inline, rhs: KeyPathMapping::_NonMutatingSetters.KeyPathMapping::Inline) -> Swift::Bool { + lhs.id._swift_keypath_mapper_isEqual(to: rhs.id) + } + @usableFromInline + internal let id: any Swift::Hashable + @usableFromInline + internal let _embed: (Root, Member) -> Swift::Void + public init(id: any Swift::Hashable = ObjectIdentifier(Self.self), embed: @escaping (Root, Member) -> Swift::Void) + @inlinable public func embed(_ member: Member, in root: Root) { + self._embed(root, member) + } + @inlinable public func hash(into hasher: inout Swift::Hasher) { + id.hash(into: &hasher) + } + public var hashValue: Swift::Int { + get + } + } +} +extension KeyPathMapping::_Getters { + public struct Never : KeyPathMapping::_Getters.KeyPathMapping::Getter { + public static func == (lhs: KeyPathMapping::_Getters.KeyPathMapping::Never, rhs: KeyPathMapping::_Getters.KeyPathMapping::Never) -> Swift::Bool + @usableFromInline + internal let message: Swift::String? + @usableFromInline + internal let file: Swift::StaticString + @usableFromInline + internal let line: Swift::UInt + public init(message: Swift::String? = nil, file: Swift::StaticString = #file, line: Swift::UInt = #line) + @inlinable public func extract(from root: Root) -> Member { + fatalError( + message ?? """ + This getter should've never been called. + """, + file: file, + line: line + ) + } + @inlinable public func hash(into hasher: inout Swift::Hasher) { + message.hash(into: &hasher) + file.description.hash(into: &hasher) + line.hash(into: &hasher) + } + public var hashValue: Swift::Int { + get + } + } +} +extension KeyPathMapping::_Getters.KeyPathMapping::AnyGetter { + @inlinable public static func never(message: Swift::String? = nil, file: Swift::StaticString = #file, line: Swift::UInt = #line) -> KeyPathMapping::_Getters.KeyPathMapping::AnyGetter { + return .init(_Getters.Never( + message: message, + file: file, + line: line + )) + } +} +extension KeyPathMapping::_MutatingSetters { + public struct Never : KeyPathMapping::_MutatingSetters.KeyPathMapping::Setter { + public static func == (lhs: KeyPathMapping::_MutatingSetters.KeyPathMapping::Never, rhs: KeyPathMapping::_MutatingSetters.KeyPathMapping::Never) -> Swift::Bool + @usableFromInline + internal let message: Swift::String? + @usableFromInline + internal let file: Swift::StaticString + @usableFromInline + internal let line: Swift::UInt + public init(message: Swift::String? = nil, file: Swift::StaticString = #file, line: Swift::UInt = #line) + @inlinable public func embed(_ member: Member, in root: inout Root) { + fatalError( + message ?? """ + This setter should've never been called. + """, + file: file, + line: line + ) + } + @inlinable public func hash(into hasher: inout Swift::Hasher) { + message.hash(into: &hasher) + file.description.hash(into: &hasher) + line.hash(into: &hasher) + } + public var hashValue: Swift::Int { + get + } + } +} +extension KeyPathMapping::_MutatingSetters.KeyPathMapping::AnySetter { + @inlinable public static func never(message: Swift::String? = nil, file: Swift::StaticString = #file, line: Swift::UInt = #line) -> KeyPathMapping::_MutatingSetters.KeyPathMapping::AnySetter { + return .init(_MutatingSetters.Never( + message: message, + file: file, + line: line + )) + } +} +extension KeyPathMapping::_NonMutatingSetters { + public struct Never : KeyPathMapping::_NonMutatingSetters.KeyPathMapping::Setter { + public static func == (lhs: KeyPathMapping::_NonMutatingSetters.KeyPathMapping::Never, rhs: KeyPathMapping::_NonMutatingSetters.KeyPathMapping::Never) -> Swift::Bool + @usableFromInline + internal let message: Swift::String? + @usableFromInline + internal let file: Swift::StaticString + @usableFromInline + internal let line: Swift::UInt + public init(message: Swift::String? = nil, file: Swift::StaticString = #file, line: Swift::UInt = #line) + @inlinable public func embed(_ member: Member, in root: Root) { + fatalError( + message ?? """ + This setter should've never been called. + """, + file: file, + line: line + ) + } + @inlinable public func hash(into hasher: inout Swift::Hasher) { + message.hash(into: &hasher) + file.description.hash(into: &hasher) + line.hash(into: &hasher) + } + public var hashValue: Swift::Int { + get + } + } +} +extension KeyPathMapping::_NonMutatingSetters.KeyPathMapping::AnySetter { + @inlinable public static func never(message: Swift::String? = nil, file: Swift::StaticString = #file, line: Swift::UInt = #line) -> KeyPathMapping::_NonMutatingSetters.KeyPathMapping::AnySetter { + return .init(_NonMutatingSetters.Never( + message: message, + file: file, + line: line + )) + } +} +@available(iOS, deprecated: 9999, message: "This namespace is not actually deprecated, but intended for internal use. Deprecation lowers autocomplete priority.") +@available(macOS, deprecated: 9999, message: "This namespace is not actually deprecated, but intended for internal use. Deprecation lowers autocomplete priority.") +@available(tvOS, deprecated: 9999, message: "This namespace is not actually deprecated, but intended for internal use. Deprecation lowers autocomplete priority.") +@available(watchOS, deprecated: 9999, message: "This namespace is not actually deprecated, but intended for internal use. Deprecation lowers autocomplete priority.") +@available(visionOS, deprecated: 9999, message: "This namespace is not actually deprecated, but intended for internal use. Deprecation lowers autocomplete priority.") +public enum _Getters { +} +@available(iOS, deprecated: 9999, message: "This namespace is not actually deprecated, but intended for internal use. Deprecation lowers autocomplete priority.") +@available(macOS, deprecated: 9999, message: "This namespace is not actually deprecated, but intended for internal use. Deprecation lowers autocomplete priority.") +@available(tvOS, deprecated: 9999, message: "This namespace is not actually deprecated, but intended for internal use. Deprecation lowers autocomplete priority.") +@available(watchOS, deprecated: 9999, message: "This namespace is not actually deprecated, but intended for internal use. Deprecation lowers autocomplete priority.") +@available(visionOS, deprecated: 9999, message: "This namespace is not actually deprecated, but intended for internal use. Deprecation lowers autocomplete priority.") +public enum _MutatingSetters { +} +@available(iOS, deprecated: 9999, message: "This namespace is not actually deprecated, but intended for internal use. Deprecation lowers autocomplete priority.") +@available(macOS, deprecated: 9999, message: "This namespace is not actually deprecated, but intended for internal use. Deprecation lowers autocomplete priority.") +@available(tvOS, deprecated: 9999, message: "This namespace is not actually deprecated, but intended for internal use. Deprecation lowers autocomplete priority.") +@available(watchOS, deprecated: 9999, message: "This namespace is not actually deprecated, but intended for internal use. Deprecation lowers autocomplete priority.") +@available(visionOS, deprecated: 9999, message: "This namespace is not actually deprecated, but intended for internal use. Deprecation lowers autocomplete priority.") +public enum _NonMutatingSetters { +} +extension KeyPathMapping::_Getters { + public protocol Getter : Swift::Hashable { + associatedtype Root + associatedtype Member + func extract(from root: Self.Root) -> Self.Member + } +} +extension KeyPathMapping::_MutatingSetters { + public protocol Setter : Swift::Hashable { + associatedtype Root + associatedtype Member + func embed(_ member: Self.Member, in root: inout Self.Root) + } +} +extension KeyPathMapping::_NonMutatingSetters { + public protocol Setter : Swift::Hashable { + associatedtype Root + associatedtype Member + func embed(_ member: Self.Member, in root: Self.Root) + } +} +extension KeyPathMapping::KeyPathMappable { + @inlinable public subscript(_getter getter: Getter) -> Getter.Member where Self == Getter.Root, Getter : KeyPathMapping::_Getters.KeyPathMapping::Getter { + get { getter.extract(from: self) } + } + @inlinable public subscript(_getter getter: Getter, _setter setter: Setter) -> Getter.Member where Self == Getter.Root, Getter : KeyPathMapping::_Getters.KeyPathMapping::Getter, Setter : KeyPathMapping::_MutatingSetters.KeyPathMapping::Setter, Getter.Member == Setter.Member, Getter.Root == Setter.Root { + get { getter.extract(from: self) } + set { setter.embed(newValue, in: &self) } + } + @inlinable public subscript(_setter setter: Setter) -> Self where Self == Setter.Member, Setter : KeyPathMapping::_MutatingSetters.KeyPathMapping::Setter, Setter.Member == Setter.Root { + get { self } + set { setter.embed(newValue, in: &self) } + } + @inlinable public subscript(_getter getter: Getter, _setter setter: Setter) -> Getter.Member where Self == Getter.Root, Getter : KeyPathMapping::_Getters.KeyPathMapping::Getter, Setter : KeyPathMapping::_NonMutatingSetters.KeyPathMapping::Setter, Getter.Member == Setter.Member, Getter.Root == Setter.Root { + get { getter.extract(from: self) } + nonmutating set { setter.embed(newValue, in: self) } + } + @inlinable public subscript(_setter setter: Setter) -> Self where Self == Setter.Member, Setter : KeyPathMapping::_NonMutatingSetters.KeyPathMapping::Setter, Setter.Member == Setter.Root { + get { self } + nonmutating set { setter.embed(newValue, in: self) } + } +} +extension KeyPathMapping::KeyPathMappable { + @inlinable public subscript(getter getter: KeyPathMapping::KeyPathMapper.KeyPathMapping::Getter) -> T { + get { getter.extract(from: self) } + } + @inlinable public subscript(setter setter: KeyPathMapping::KeyPathMapper.KeyPathMapping::MutatingSetter) -> Self { + get { self } + set { setter.embed(newValue, in: &self) } + } + @inlinable public subscript(getter getter: KeyPathMapping::KeyPathMapper.KeyPathMapping::Getter, setter setter: KeyPathMapping::KeyPathMapper.KeyPathMapping::MutatingSetter) -> T { + get { getter.extract(from: self) } + set { setter.embed(newValue, in: &self) } + } + @inlinable public subscript(getter getter: KeyPathMapping::KeyPathMapper.KeyPathMapping::Getter, setter setter: KeyPathMapping::KeyPathMapper.KeyPathMapping::NonMutatingSetter) -> T { + get { getter.extract(from: self) } + nonmutating set { setter.embed(newValue, in: self) } + } + @inlinable public subscript(setter setter: KeyPathMapping::KeyPathMapper.KeyPathMapping::NonMutatingSetter) -> Self { + get { self } + nonmutating set { setter.embed(newValue, in: self) } + } +} +extension KeyPathMapping::KeyPathMapper { + public typealias GetterProtocol = KeyPathMapping::_Getters.KeyPathMapping::Getter + public typealias MutatingSetterProtocol = KeyPathMapping::_MutatingSetters.KeyPathMapping::Setter + public typealias NonMutatingSetterProtocol = KeyPathMapping::_NonMutatingSetters.KeyPathMapping::Setter +} +extension KeyPathMapping::KeyPathMapper { + public typealias Getter = KeyPathMapping::_Getters.KeyPathMapping::AnyGetter + public typealias MutatingSetter = KeyPathMapping::_MutatingSetters.KeyPathMapping::AnySetter + public typealias NonMutatingSetter = KeyPathMapping::_NonMutatingSetters.KeyPathMapping::AnySetter +} +extension KeyPathMapping::KeyPathMapper { + @inlinable public subscript(_getter getter: Getter) -> KeyPathMapping::KeyPathMapper where Value == Getter.Root, Getter : KeyPathMapping::_Getters.KeyPathMapping::Getter { + get { .init(getter.extract(from: value)) } + } + @inlinable public subscript(_getter getter: Getter, _setter setter: Setter) -> KeyPathMapping::KeyPathMapper where Value == Getter.Root, Getter : KeyPathMapping::_Getters.KeyPathMapping::Getter, Setter : KeyPathMapping::_MutatingSetters.KeyPathMapping::Setter, Getter.Member == Setter.Member, Getter.Root == Setter.Root { + get { .init(getter.extract(from: value)) } + set { setter.embed(newValue.value, in: &value) } + } + @inlinable public subscript(_setter setter: Setter) -> KeyPathMapping::KeyPathMapper where Setter : KeyPathMapping::_MutatingSetters.KeyPathMapping::Setter, Setter.Member == KeyPathMapping::KeyPathMapper, Setter.Root == KeyPathMapping::KeyPathMapper { + get { self } + set { setter.embed(newValue, in: &self) } + } + @inlinable public subscript(_getter getter: Getter, _setter setter: Setter) -> KeyPathMapping::KeyPathMapper where Value == Getter.Root, Getter : KeyPathMapping::_Getters.KeyPathMapping::Getter, Setter : KeyPathMapping::_NonMutatingSetters.KeyPathMapping::Setter, Getter.Member == Setter.Member, Getter.Root == Setter.Root { + get { .init(getter.extract(from: value)) } + nonmutating set { setter.embed(newValue.value, in: value) } + } + @inlinable public subscript(_setter setter: Setter) -> KeyPathMapping::KeyPathMapper where Setter : KeyPathMapping::_NonMutatingSetters.KeyPathMapping::Setter, Setter.Member == KeyPathMapping::KeyPathMapper, Setter.Root == KeyPathMapping::KeyPathMapper { + get { self } + set { setter.embed(newValue, in: self) } + } +} +extension KeyPathMapping::KeyPathMapper { + @inlinable public subscript(getter getter: KeyPathMapping::KeyPathMapper.KeyPathMapping::Getter) -> KeyPathMapping::KeyPathMapper { + get { .init(getter.extract(from: value)) } + } + @inlinable public subscript(getter getter: KeyPathMapping::KeyPathMapper.KeyPathMapping::Getter, setter setter: KeyPathMapping::KeyPathMapper.KeyPathMapping::MutatingSetter) -> KeyPathMapping::KeyPathMapper { + get { .init(getter.extract(from: value)) } + set { setter.embed(newValue.value, in: &value) } + } + @inlinable public subscript(setter setter: KeyPathMapping::KeyPathMapper>.KeyPathMapping::MutatingSetter>) -> KeyPathMapping::KeyPathMapper { + get { self } + set { setter.embed(newValue, in: &self) } + } + @inlinable public subscript(getter getter: KeyPathMapping::KeyPathMapper.KeyPathMapping::Getter, setter setter: KeyPathMapping::KeyPathMapper.KeyPathMapping::NonMutatingSetter) -> KeyPathMapping::KeyPathMapper { + get { .init(getter.extract(from: value)) } + nonmutating set { setter.embed(newValue.value, in: value) } + } + @inlinable public subscript(setter setter: KeyPathMapping::KeyPathMapper>.KeyPathMapping::NonMutatingSetter>) -> KeyPathMapping::KeyPathMapper { + get { self } + nonmutating set { setter.embed(newValue, in: self) } + } +} +extension KeyPathMapping::KeyPathMappable { + @inlinable public subscript(_map conversion: Conversion) -> Conversion.Member where Self == Conversion.Root, Conversion : KeyPathMapping::_ReadonlyConversions.KeyPathMapping::ConversionProtocol { + get { conversion.extract(from: self) } + } + @inlinable public subscript(_convert conversion: Conversion) -> Conversion.Member where Self == Conversion.Root, Conversion : KeyPathMapping::_MutatingConversions.KeyPathMapping::ConversionProtocol { + get { conversion.extract(from: self) } + set { conversion.embed(newValue, in: &self) } + } + @inlinable public subscript(_convert conversion: Conversion) -> Conversion.Member where Self == Conversion.Root, Conversion : KeyPathMapping::_NonMutatingConversions.KeyPathMapping::ConversionProtocol { + get { conversion.extract(from: self) } + nonmutating set { conversion.embed(newValue, in: self) } + } +} +extension KeyPathMapping::KeyPathMappable { + @inlinable public subscript(map conversion: KeyPathMapping::_ReadonlyConversions.KeyPathMapping::AnyConversion) -> T { + get { conversion.extract(from: self) } + } + @inlinable public subscript(convert conversion: KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion) -> T { + get { conversion.extract(from: self) } + set { conversion.embed(newValue, in: &self) } + } + @inlinable public subscript(convert conversion: KeyPathMapping::_NonMutatingConversions.KeyPathMapping::AnyConversion) -> T { + get { conversion.extract(from: self) } + nonmutating set { conversion.embed(newValue, in: self) } + } +} +extension KeyPathMapping::KeyPathMapper { + public typealias ReadonlyConversionProtocol = KeyPathMapping::_ReadonlyConversions.KeyPathMapping::ConversionProtocol + public typealias MutatingConversionProtocol = KeyPathMapping::_MutatingConversions.KeyPathMapping::ConversionProtocol + public typealias NonMutatingConversionProtocol = KeyPathMapping::_NonMutatingConversions.KeyPathMapping::ConversionProtocol +} +extension KeyPathMapping::KeyPathMapper { + public typealias ReadonlyConversionTo = KeyPathMapping::_ReadonlyConversions.KeyPathMapping::AnyConversion + public typealias MutatingConversionTo = KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion + public typealias NonMutatingConversionTo = KeyPathMapping::_NonMutatingConversions.KeyPathMapping::AnyConversion +} +extension KeyPathMapping::KeyPathMapper { + @inlinable public subscript(_map conversion: Conversion) -> KeyPathMapping::KeyPathMapper where Value == Conversion.Root, Conversion : KeyPathMapping::_ReadonlyConversions.KeyPathMapping::ConversionProtocol { + get { .init(conversion.extract(from: value)) } + } + @inlinable public subscript(_convert conversion: Conversion) -> KeyPathMapping::KeyPathMapper where Value == Conversion.Root, Conversion : KeyPathMapping::_MutatingConversions.KeyPathMapping::ConversionProtocol { + get { .init(conversion.extract(from: value)) } + set { conversion.embed(newValue.value, in: &value) } + } + @inlinable public subscript(_convert conversion: Conversion) -> KeyPathMapping::KeyPathMapper where Value == Conversion.Root, Conversion : KeyPathMapping::_NonMutatingConversions.KeyPathMapping::ConversionProtocol { + get { .init(conversion.extract(from: value)) } + nonmutating set { conversion.embed(newValue.value, in: value) } + } +} +extension KeyPathMapping::KeyPathMapper { + @inlinable public subscript(map conversion: KeyPathMapping::KeyPathMapper.KeyPathMapping::ReadonlyConversionTo) -> KeyPathMapping::KeyPathMapper { + get { .init(conversion.extract(from: value)) } + } + @inlinable public subscript(convert conversion: KeyPathMapping::KeyPathMapper.KeyPathMapping::MutatingConversionTo) -> KeyPathMapping::KeyPathMapper { + get { .init(conversion.extract(from: value)) } + set { conversion.embed(newValue.value, in: &value) } + } + @inlinable public subscript(convert conversion: KeyPathMapping::KeyPathMapper.KeyPathMapping::NonMutatingConversionTo) -> KeyPathMapping::KeyPathMapper { + get { .init(conversion.extract(from: value)) } + nonmutating set { conversion.embed(newValue.value, in: value) } + } +} +extension KeyPathMapping::KeyPathMapper where Value : Swift::Collection { + @available(iOS, deprecated: 9999, message: "This subscript has a conversion equivalent that is preferred for autocomplete via this deprecation.") + @available(macOS, deprecated: 9999, message: "This subscript has a conversion equivalent that is preferred for autocomplete via this deprecation.") + @available(tvOS, deprecated: 9999, message: "This subscript has a conversion equivalent that is preferred for autocomplete via this deprecation.") + @available(watchOS, deprecated: 9999, message: "This subscript has a conversion equivalent that is preferred for autocomplete via this deprecation.") + @available(visionOS, deprecated: 9999, message: "This subscript has a conversion equivalent that is preferred for autocomplete via this deprecation.") + @inlinable public subscript(unsafeIndex index: Value.Index) -> KeyPathMapping::KeyPathMapper { + get { .init(self.value[index]) } + } + @available(iOS, deprecated: 9999, message: "This subscript has a conversion equivalent that is preferred for autocomplete via this deprecation.") + @available(macOS, deprecated: 9999, message: "This subscript has a conversion equivalent that is preferred for autocomplete via this deprecation.") + @available(tvOS, deprecated: 9999, message: "This subscript has a conversion equivalent that is preferred for autocomplete via this deprecation.") + @available(watchOS, deprecated: 9999, message: "This subscript has a conversion equivalent that is preferred for autocomplete via this deprecation.") + @available(visionOS, deprecated: 9999, message: "This subscript has a conversion equivalent that is preferred for autocomplete via this deprecation.") + @inlinable public subscript(safeIndex index: Value.Index) -> KeyPathMapping::KeyPathMapper { + get { + guard self.value.indices.contains(index) + else { return .init(nil) } + + return .init(self.value[index]) + } + } +} +extension KeyPathMapping::KeyPathMapper where Value : Swift::MutableCollection { + @available(iOS, deprecated: 9999, message: "This subscript has a conversion equivalent that is preferred for autocomplete via this deprecation.") + @available(macOS, deprecated: 9999, message: "This subscript has a conversion equivalent that is preferred for autocomplete via this deprecation.") + @available(tvOS, deprecated: 9999, message: "This subscript has a conversion equivalent that is preferred for autocomplete via this deprecation.") + @available(watchOS, deprecated: 9999, message: "This subscript has a conversion equivalent that is preferred for autocomplete via this deprecation.") + @available(visionOS, deprecated: 9999, message: "This subscript has a conversion equivalent that is preferred for autocomplete via this deprecation.") + @inlinable public subscript(unsafeIndex index: Value.Index) -> KeyPathMapping::KeyPathMapper { + get { .init(self.value[index]) } + set { self.value[index] = newValue.value } + } + @available(iOS, deprecated: 9999, message: "This subscript has a conversion equivalent that is preferred for autocomplete via this deprecation.") + @available(macOS, deprecated: 9999, message: "This subscript has a conversion equivalent that is preferred for autocomplete via this deprecation.") + @available(tvOS, deprecated: 9999, message: "This subscript has a conversion equivalent that is preferred for autocomplete via this deprecation.") + @available(watchOS, deprecated: 9999, message: "This subscript has a conversion equivalent that is preferred for autocomplete via this deprecation.") + @available(visionOS, deprecated: 9999, message: "This subscript has a conversion equivalent that is preferred for autocomplete via this deprecation.") + @inlinable public subscript(safeIndex index: Value.Index) -> KeyPathMapping::KeyPathMapper { + get { + guard self.value.indices.contains(index) + else { return .init(nil) } + + return .init(self.value[index]) + } + set { + guard + let value = newValue.value, + self.value.indices.contains(index) + else { return } + + self.value[index] = value + } + } +} +extension KeyPathMapping::KeyPathMapper where Value : SwiftMarkerProtocols::_OptionalProtocol { + @available(iOS, deprecated: 9999, message: "This subscript has a conversion equivalent that is preferred for autocomplete via this deprecation.") + @available(macOS, deprecated: 9999, message: "This subscript has a conversion equivalent that is preferred for autocomplete via this deprecation.") + @available(tvOS, deprecated: 9999, message: "This subscript has a conversion equivalent that is preferred for autocomplete via this deprecation.") + @available(watchOS, deprecated: 9999, message: "This subscript has a conversion equivalent that is preferred for autocomplete via this deprecation.") + @available(visionOS, deprecated: 9999, message: "This subscript has a conversion equivalent that is preferred for autocomplete via this deprecation.") + public subscript(unwrappedWith defaultValue: Value.Wrapped, aggressive aggressive: Swift::Bool = false) -> KeyPathMapping::KeyPathMapper { + get + set + } +} +extension Swift::Equatable { + @usableFromInline + internal func _swift_keypath_mapper_isEqual(to other: any Swift::Equatable) -> Swift::Bool +} +extension Swift::Optional : KeyPathMapping::KeyPathMappable { + public subscript(mapPath keyPath: KeyPathMapping::MappingKeyPath, T>) -> T { + get + } + public subscript(mapPath keyPath: KeyPathMapping::WritableMappingKeyPath, T>) -> T { + get + set + } +} +extension Swift::Result : KeyPathMapping::KeyPathMappable { + public subscript(mapPath keyPath: KeyPathMapping::MappingKeyPath, T>) -> T { + get + } + public subscript(mapPath keyPath: KeyPathMapping::WritableMappingKeyPath, T>) -> T { + get + set + } +} +extension Swift::Array : KeyPathMapping::KeyPathMappable { + public subscript(mapPath keyPath: KeyPathMapping::MappingKeyPath, T>) -> T { + get + } + public subscript(mapPath keyPath: KeyPathMapping::WritableMappingKeyPath, T>) -> T { + get + set + } +} +extension Swift::Dictionary : KeyPathMapping::KeyPathMappable { + public subscript(mapPath keyPath: KeyPathMapping::MappingKeyPath, T>) -> T { + get + } + public subscript(mapPath keyPath: KeyPathMapping::WritableMappingKeyPath, T>) -> T { + get + set + } +} +extension Swift::Set : KeyPathMapping::KeyPathMappable { + public subscript(mapPath keyPath: KeyPathMapping::MappingKeyPath, T>) -> T { + get + } + public subscript(mapPath keyPath: KeyPathMapping::WritableMappingKeyPath, T>) -> T { + get + set + } +} +extension Swift::Equatable { + @_disfavoredOverload public subscript(mapPath keyPath: KeyPathMapping::MappingKeyPath) -> T { + get + } + @_disfavoredOverload public subscript(mapPath keyPath: KeyPathMapping::WritableMappingKeyPath) -> T { + get + set + } +} +public protocol KeyPathMappable { +} +public typealias MappingKeyPath = Swift::KeyPath, KeyPathMapping::KeyPathMapper> +public typealias WritableMappingKeyPath = Swift::WritableKeyPath, KeyPathMapping::KeyPathMapper> +extension KeyPathMapping::KeyPathMappable { + public subscript(mapPath keyPath: KeyPathMapping::MappingKeyPath) -> T { + get + } + public subscript(mapPath keyPath: KeyPathMapping::WritableMappingKeyPath) -> T { + get + set + } +} +public protocol KeyPathMapperProtocol { + associatedtype Value + var value: Self.Value { get set } +} +public struct KeyPathMapper : KeyPathMapping::KeyPathMapperProtocol { + public var value: Value + @inlinable public init(_ value: Value) { + self.value = value + } + @inlinable public subscript() -> Value { + get { value } + set { self.value = newValue } + } + @inlinable public mutating func callAsFunction(_ value: Value) { + self.value = value + } + @inlinable public subscript(map keyPath: Swift::KeyPath, T>) -> T { + get { self[keyPath: keyPath] } + } + @inlinable public subscript(map keyPath: Swift::WritableKeyPath, T>) -> T { + get { self[keyPath: keyPath] } + set { self[keyPath: keyPath] = newValue } + } +} +extension KeyPathMapping::KeyPathMapper : Swift::Sendable where Value : Swift::Sendable { +} +extension KeyPathMapping::KeyPathMapper : Swift::Equatable where Value : Swift::Equatable { + @_implements(Swift::Equatable, ==(_:_:)) public static func __derived_struct_equals(_ a: KeyPathMapping::KeyPathMapper, _ b: KeyPathMapping::KeyPathMapper) -> Swift::Bool +} +extension KeyPathMapping::KeyPathMapper : Swift::Hashable where Value : Swift::Hashable { + public func hash(into hasher: inout Swift::Hasher) + public var hashValue: Swift::Int { + get + } +} +extension KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion where Root : Swift::BinaryFloatingPoint { + public static func to(_ type: Member.Type = Member.self) -> KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion where Member : Swift::BinaryFloatingPoint + public static func to(_ type: Member.Type = Member.self) -> KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion where Member : Swift::BinaryInteger +} +extension KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion where Root : Swift::BinaryInteger { + public static func to(_ type: Member.Type = Member.self) -> KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion where Member : Swift::BinaryFloatingPoint + public static func to(_ type: Member.Type = Member.self) -> KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion where Member : Swift::BinaryInteger +} +extension KeyPathMapping::_Getters.KeyPathMapping::AnyGetter where Root : Swift::Collection { + public static func unsafeIndex(_ index: Root.Index) -> KeyPathMapping::_Getters.KeyPathMapping::AnyGetter where Member == Root.Element + public static func safeIndex(_ index: Root.Index) -> KeyPathMapping::_Getters.KeyPathMapping::AnyGetter where Member == Root.Element? +} +extension KeyPathMapping::_ReadonlyConversions.KeyPathMapping::AnyConversion where Root : Swift::Collection { + @inlinable public static func unsafeIndex(_ index: Root.Index) -> KeyPathMapping::_ReadonlyConversions.KeyPathMapping::AnyConversion where Member == Root.Element { + .init(getter: .unsafeIndex(index)) + } + @inlinable public static func safeIndex(_ index: Root.Index) -> KeyPathMapping::_ReadonlyConversions.KeyPathMapping::AnyConversion where Member == Root.Element? { + .init(getter: .safeIndex(index)) + } +} +extension KeyPathMapping::_Getters.KeyPathMapping::AnyGetter where Root : Swift::MutableCollection { + public static func unsafeIndex(_ index: Root.Index) -> KeyPathMapping::_Getters.KeyPathMapping::AnyGetter where Member == Root.Element + public static func safeIndex(_ index: Root.Index) -> KeyPathMapping::_Getters.KeyPathMapping::AnyGetter where Member == Root.Element? +} +extension KeyPathMapping::_MutatingSetters.KeyPathMapping::AnySetter where Root : Swift::MutableCollection { + public static func unsafeIndex(_ index: Root.Index) -> KeyPathMapping::_MutatingSetters.KeyPathMapping::AnySetter where Member == Root.Element + public static func safeIndex(_ index: Root.Index) -> KeyPathMapping::_MutatingSetters.KeyPathMapping::AnySetter where Member == Root.Element? +} +extension KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion where Root : Swift::MutableCollection { + @inlinable public static func unsafeIndex(_ index: Root.Index) -> KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion where Member == Root.Element { + .init( + getter: .unsafeIndex(index), + setter: .unsafeIndex(index) + ) + } + @inlinable public static func safeIndex(_ index: Root.Index) -> KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion where Member == Root.Element? { + .init( + getter: .safeIndex(index), + setter: .safeIndex(index) + ) + } +} +extension KeyPathMapping::_Getters.KeyPathMapping::AnyGetter where Member == Root? { + @inlinable public static var optional: KeyPathMapping::_Getters.KeyPathMapping::AnyGetter> { + get { + .inline { $0 } + } + } +} +extension KeyPathMapping::_MutatingSetters.KeyPathMapping::AnySetter where Member == Root? { + @inlinable public static var optional: KeyPathMapping::_MutatingSetters.KeyPathMapping::AnySetter> { + get { + .inline { v, t in t.map { v = $0 } } + } + } +} +extension KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion where Member == Root? { + @inlinable public static var optional: KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion> { + get { + return .init( + getter: .optional, + setter: .optional + ) + } + } +} +extension KeyPathMapping::_Getters.KeyPathMapping::AnyGetter where Root : SwiftMarkerProtocols::_OptionalProtocol, Member == Root.Wrapped { + @inlinable public static func unwrappedWith(_ defaultValue: @autoclosure @escaping () -> Root.Wrapped) -> KeyPathMapping::_Getters.KeyPathMapping::AnyGetter { + .inline { $0._optional ?? defaultValue() } + } +} +extension KeyPathMapping::_MutatingSetters.KeyPathMapping::AnySetter where Root : SwiftMarkerProtocols::_OptionalProtocol, Member == Root.Wrapped { + @inlinable public static func aggressive(_ aggressive: Swift::Bool = true) -> KeyPathMapping::_MutatingSetters.KeyPathMapping::AnySetter { + .inline { + if aggressive || $0._optional != nil { + $0._optional = $1 + } + } + } +} +extension KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion where Root : SwiftMarkerProtocols::_OptionalProtocol, Member == Root.Wrapped { + @inlinable public static func unwrapped(with defaultValue: @autoclosure @escaping () -> Root.Wrapped, aggressive: Swift::Bool = false) -> KeyPathMapping::_MutatingConversions.KeyPathMapping::AnyConversion { + return .init( + getter: .unwrappedWith(defaultValue()), + setter: .aggressive(aggressive) + ) + } +} +extension KeyPathMapping::KeyPathMapper { + @inlinable public var optional: KeyPathMapping::KeyPathMapper { + get { .init(value) } + set { newValue.value.map { self.value = $0 } } + } +} diff --git a/.github/workflows/generate-swiftinterface.yml b/.github/workflows/generate-swiftinterface.yml new file mode 100644 index 0000000..a7a4239 --- /dev/null +++ b/.github/workflows/generate-swiftinterface.yml @@ -0,0 +1,120 @@ +name: Generate Swift interface +run-name: Generate ${{ inputs.platform }} interfaces + +on: + workflow_dispatch: + inputs: + platform: + description: Normalized platform name (macos, ios, linux, windows, wasi, ...) + required: true + type: string + target_branch: + description: Branch that receives the generated-interface PR (defaults to the dispatched branch) + required: false + default: "" + type: string + workflow_call: + inputs: + platform: + required: true + type: string + target_branch: + required: true + type: string + +permissions: + contents: write + pull-requests: write + +jobs: + generate: + name: Generate ${{ inputs.platform }} + runs-on: ${{ (inputs.platform == 'linux' || inputs.platform == 'wasi') && 'ubuntu-latest' || inputs.platform == 'windows' && 'windows-latest' || 'macos-latest' }} + env: + GH_TOKEN: ${{ github.token }} + INPUT_TARGET_BRANCH: ${{ inputs.target_branch }} + PLATFORM: ${{ inputs.platform }} + steps: + - name: Validate request + shell: bash + run: | + if [[ ! "$PLATFORM" =~ ^[a-z0-9][a-z0-9._-]*$ ]]; then + echo "Platform must be a normalized lowercase directory name: $PLATFORM" >&2 + exit 1 + fi + + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + ref: ${{ inputs.target_branch != '' && inputs.target_branch || github.ref_name }} + + - name: Set up Swift outside Xcode + if: runner.os != 'macOS' + uses: SwiftyLab/setup-swift@v1 + with: + swift-version: "6" + sdks: ${{ inputs.platform == 'wasi' && 'wasm' || '' }} + + - name: Prepare generation branch + shell: bash + run: | + target_branch="${INPUT_TARGET_BRANCH:-$GITHUB_REF_NAME}" + interface_branch="automation/swiftinterfaces/$GITHUB_RUN_ID/$PLATFORM" + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git switch -C "$interface_branch" + echo "TARGET_BRANCH=$target_branch" >> "$GITHUB_ENV" + echo "INTERFACE_BRANCH=$interface_branch" >> "$GITHUB_ENV" + + - name: Select WASI SDK + if: inputs.platform == 'wasi' + shell: bash + run: | + swift_sdk="$(swift sdk list | sed -nE '/(_wasm|wasi)/ { s/^[[:space:]]*([^[:space:]]+).*/\1/p; q; }')" + if [[ -z "$swift_sdk" ]]; then + echo "No installed WASI Swift SDK was found" >&2 + swift sdk list >&2 || true + exit 1 + fi + echo "SWIFT_SDK=$swift_sdk" >> "$GITHUB_ENV" + + - name: Generate interface + shell: bash + run: | + interface_dir=".agents/interfaces/$PLATFORM" + if [[ -d "$interface_dir" ]]; then + find "$interface_dir" -maxdepth 1 -type f -name '*.swiftinterface' -delete + fi + if [[ -n "${SWIFT_SDK:-}" ]]; then + make swiftinterface platform="$PLATFORM" swift_sdk="$SWIFT_SDK" + else + make swiftinterface platform="$PLATFORM" + fi + + - name: Commit and push interface + id: commit + shell: bash + run: | + git add --all -- ".agents/interfaces/$PLATFORM" + if git diff --cached --quiet; then + echo "changed=false" >> "$GITHUB_OUTPUT" + echo "No $PLATFORM interface changes" >> "$GITHUB_STEP_SUMMARY" + exit 0 + fi + git commit -m "Update $PLATFORM Swift interfaces" + git push --force-with-lease --set-upstream origin "$INTERFACE_BRANCH" + echo "changed=true" >> "$GITHUB_OUTPUT" + + - name: Open platform PR + if: steps.commit.outputs.changed == 'true' + shell: bash + run: | + pr_url="$(gh pr list --state open --base "$TARGET_BRANCH" --head "$INTERFACE_BRANCH" --json url --jq '.[0].url')" + if [[ -z "$pr_url" ]]; then + pr_url="$(gh pr create \ + --base "$TARGET_BRANCH" \ + --head "$INTERFACE_BRANCH" \ + --title "chore: update $PLATFORM Swift interfaces" \ + --body "Generated from \`$TARGET_BRANCH\` by workflow run $GITHUB_RUN_ID. Merge this PR into the aggregation branch after reviewing the platform-specific API snapshot.")" + fi + echo "$pr_url" >> "$GITHUB_STEP_SUMMARY" diff --git a/.github/workflows/update-swiftinterfaces.yml b/.github/workflows/update-swiftinterfaces.yml new file mode 100644 index 0000000..27fc7c9 --- /dev/null +++ b/.github/workflows/update-swiftinterfaces.yml @@ -0,0 +1,85 @@ +name: Update Swift interfaces +run-name: Update Swift interfaces from ${{ github.ref_name }} + +on: + workflow_dispatch: + inputs: + platforms: + description: JSON array of independently generated platforms + required: true + default: '["macos","ios","tvos","watchos","maccatalyst"]' + type: string + +permissions: + contents: write + pull-requests: write + +jobs: + prepare: + name: Create aggregation branch + runs-on: ubuntu-latest + outputs: + update_branch: ${{ steps.branch.outputs.update_branch }} + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + ref: ${{ github.ref_name }} + + - name: Push aggregation branch + id: branch + shell: bash + run: | + update_branch="automation/swiftinterfaces/$GITHUB_RUN_ID" + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git switch -C "$update_branch" + git commit --allow-empty -m "Prepare Swift interface update" + git push --force-with-lease --set-upstream origin "$update_branch" + echo "update_branch=$update_branch" >> "$GITHUB_OUTPUT" + + generate: + name: Generate ${{ matrix.platform }} + needs: prepare + strategy: + fail-fast: false + matrix: + platform: ${{ fromJSON(inputs.platforms) }} + permissions: + contents: write + pull-requests: write + uses: ./.github/workflows/generate-swiftinterface.yml + with: + platform: ${{ matrix.platform }} + target_branch: ${{ needs.prepare.outputs.update_branch }} + + finalize: + name: Open draft aggregation PR + if: always() && needs.prepare.result == 'success' + needs: + - prepare + - generate + runs-on: ubuntu-latest + env: + GH_TOKEN: ${{ github.token }} + TARGET_BRANCH: ${{ github.ref_name }} + UPDATE_BRANCH: ${{ needs.prepare.outputs.update_branch }} + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + ref: ${{ github.ref_name }} + + - name: Open draft PR + shell: bash + run: | + pr_url="$(gh pr list --state open --base "$TARGET_BRANCH" --head "$UPDATE_BRANCH" --json url --jq '.[0].url')" + if [[ -z "$pr_url" ]]; then + pr_url="$(gh pr create \ + --draft \ + --base "$TARGET_BRANCH" \ + --head "$UPDATE_BRANCH" \ + --title "chore: update platform Swift interfaces" \ + --body "Aggregation PR for workflow run $GITHUB_RUN_ID. Merge the successful platform PRs into \`$UPDATE_BRANCH\`; failed platform jobs remain visible in the workflow and can be fixed or intentionally ignored. Matrix result: \`${{ needs.generate.result }}\`.")" + fi + echo "$pr_url" >> "$GITHUB_STEP_SUMMARY" diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c9eab41 --- /dev/null +++ b/Makefile @@ -0,0 +1,7 @@ +output ?= .agents/interfaces +platform ?= host +swift_sdk ?= + +.PHONY: swiftinterface +swiftinterface: + @./scripts/generate-swiftinterfaces.sh --package-path . --output "$(output)" --platform "$(platform)" $(if $(swift_sdk),--swift-sdk "$(swift_sdk)") diff --git a/scripts/generate-swiftinterfaces.sh b/scripts/generate-swiftinterfaces.sh new file mode 100755 index 0000000..b028e55 --- /dev/null +++ b/scripts/generate-swiftinterfaces.sh @@ -0,0 +1,364 @@ +#!/usr/bin/env bash + +set -euo pipefail + +script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)" +package_path="." +output_path=".agents/interfaces" +configuration="release" +include_tests=false +list_declared_platforms=false +platform="" +triple="" +sdk="" +swift_sdk="" +scratch_path="" +declare -a selected_targets=() +declare -a build_arguments=() + +usage() { + sed -n '1,$p' <<'USAGE' +Generate public Swift interfaces for one SwiftPM platform. + +Usage: + generate-swiftinterfaces.sh --platform [options] + generate-swiftinterfaces.sh --list-declared-platforms [options] + +Options: + --package-path Package root (default: .) + --output Platform-parent destination, relative to the package root + unless absolute (default: .agents/interfaces) + --platform Output/build platform, for example macos, ios, linux, + windows, or wasi; host resolves to the current platform + --list-declared-platforms Print the Apple/custom platforms declared by Package.swift + --configuration debug or release (default: release) + --include-tests Include Swift test targets + --target Generate one target; repeat to select several + --triple Forward a target triple to SwiftPM + --sdk Forward an SDK path to SwiftPM + --swift-sdk Forward an installed Swift SDK name to SwiftPM + --scratch-path Use a specific SwiftPM scratch directory + --build-arg Forward one additional argument to `swift build`; repeatable + -h, --help Show this help + +The platform name becomes an output directory. For example, --platform ios writes +/ios/.swiftinterface. Generate platforms in separate invocations so +one unsupported platform does not suppress successful platform snapshots. +USAGE +} + +fail() { + printf 'swiftinterfaces: %s\n' "$*" >&2 + exit 1 +} + +require_value() { + [[ $# -ge 2 ]] || fail "$1 requires a value" +} + +host_platform() { + case "$(uname -s)" in + Darwin) printf 'macos\n' ;; + Linux) printf 'linux\n' ;; + MINGW*|MSYS*|CYGWIN*|Windows_NT) printf 'windows\n' ;; + *) fail "cannot infer a platform from host $(uname -s); pass --platform explicitly" ;; + esac +} + +normalize_platform() { + local value + value="$(printf '%s' "$1" | tr '[:upper:]' '[:lower:]')" + case "$value" in + osx|macosx) value="macos" ;; + iphoneos|iphonesimulator) value="ios" ;; + appletvos|appletvsimulator) value="tvos" ;; + watchsimulator) value="watchos" ;; + xros|xrsimulator) value="visionos" ;; + catalyst|mac-catalyst|mac_catalyst) value="maccatalyst" ;; + wasm|webassembly) value="wasi" ;; + host) value="$(host_platform)" ;; + esac + [[ "$value" =~ ^[a-z0-9][a-z0-9._-]*$ ]] || fail "invalid platform name: $1" + printf '%s\n' "$value" +} + +while [[ $# -gt 0 ]]; do + case "$1" in + --package-path) + require_value "$@" + package_path="$2" + shift 2 + ;; + --output) + require_value "$@" + output_path="$2" + shift 2 + ;; + --platform) + require_value "$@" + [[ -z "$platform" ]] || fail "--platform may be passed only once" + platform="$2" + shift 2 + ;; + --list-declared-platforms) + list_declared_platforms=true + shift + ;; + --configuration) + require_value "$@" + configuration="$2" + shift 2 + ;; + --include-tests) + include_tests=true + shift + ;; + --target) + require_value "$@" + selected_targets+=("$2") + shift 2 + ;; + --triple) + require_value "$@" + triple="$2" + shift 2 + ;; + --sdk) + require_value "$@" + sdk="$2" + shift 2 + ;; + --swift-sdk) + require_value "$@" + swift_sdk="$2" + shift 2 + ;; + --scratch-path) + require_value "$@" + scratch_path="$2" + shift 2 + ;; + --build-arg) + require_value "$@" + build_arguments+=("$2") + shift 2 + ;; + -h|--help) + usage + exit 0 + ;; + *) + fail "unknown option: $1" + ;; + esac +done + +case "$configuration" in + debug|release) ;; + *) fail "--configuration must be debug or release" ;; +esac + +[[ "$list_declared_platforms" == false || -z "$platform" ]] || \ + fail "--platform and --list-declared-platforms are separate operations" +[[ "$list_declared_platforms" == true || -n "$platform" ]] || \ + fail "--platform is required; use --list-declared-platforms to inspect Package.swift" + +command -v swift >/dev/null 2>&1 || fail "Swift is required" +[[ -f "$script_dir/list-swift-targets.swift" ]] || fail "missing package parser beside generator" +[[ -d "$package_path" ]] || fail "package path does not exist: $package_path" + +package_root="$(cd "$package_path" && pwd -P)" +[[ -f "$package_root/Package.swift" ]] || fail "no Package.swift at $package_root" +package_identity="$(basename "$package_root" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9_]/_/g')" + +if [[ -n "$platform" ]]; then + platform="$(normalize_platform "$platform")" +fi + +if [[ -z "$scratch_path" ]]; then + scratch_root="$package_root/.build/swiftinterfaces/${platform:-metadata}/$configuration" +elif [[ "$scratch_path" = /* ]]; then + scratch_root="$scratch_path" +else + scratch_root="$package_root/$scratch_path" +fi + +mkdir -p "$scratch_root/module-cache" + +description_file="$(mktemp "${TMPDIR:-/tmp}/swiftinterfaces-description.XXXXXX")" +targets_file="$(mktemp "${TMPDIR:-/tmp}/swiftinterfaces-targets.XXXXXX")" +platforms_file="$(mktemp "${TMPDIR:-/tmp}/swiftinterfaces-platforms.XXXXXX")" +build_log="$(mktemp "${TMPDIR:-/tmp}/swiftinterfaces-build.XXXXXX")" +cleanup() { + rm -f "$description_file" "$targets_file" "$platforms_file" "$build_log" +} +trap cleanup EXIT INT TERM + +( + cd "$package_root" + swift package describe --type json >"$description_file" +) + +CLANG_MODULE_CACHE_PATH="$scratch_root/module-cache" \ +SWIFT_MODULECACHE_PATH="$scratch_root/module-cache" \ + swift "$script_dir/list-swift-targets.swift" \ + --list-platforms "$description_file" >"$platforms_file" + +if [[ "$list_declared_platforms" == true ]]; then + if [[ -s "$platforms_file" ]]; then + cat "$platforms_file" + else + printf 'swiftinterfaces: Package.swift declares no platforms; support must be proven by a platform build\n' >&2 + fi + exit 0 +fi + +host="$(host_platform)" +if [[ -z "$swift_sdk" ]]; then + sdk_name="" + default_triple="" + case "$platform" in + macos) + [[ "$host" == "macos" || -n "$triple" || -n "$sdk" ]] || \ + fail "macos generation requires a macOS host or explicit cross-compilation options" + ;; + ios) + sdk_name="iphonesimulator" + default_triple="arm64-apple-ios-simulator" + ;; + tvos) + sdk_name="appletvsimulator" + default_triple="arm64-apple-tvos-simulator" + ;; + watchos) + sdk_name="watchsimulator" + default_triple="arm64-apple-watchos-simulator" + ;; + visionos) + sdk_name="xrsimulator" + default_triple="arm64-apple-xros-simulator" + ;; + maccatalyst) + sdk_name="macosx" + default_triple="arm64-apple-ios-macabi" + ;; + driverkit) + sdk_name="driverkit" + default_triple="arm64-apple-driverkit" + ;; + linux|windows) + [[ "$host" == "$platform" || -n "$triple" || -n "$sdk" ]] || \ + fail "$platform generation requires a $platform host or explicit cross-compilation options" + ;; + wasi) + [[ -n "$triple" || -n "$sdk" ]] || \ + fail "wasi generation requires --swift-sdk (recommended) or explicit --triple/--sdk options" + ;; + *) + [[ -n "$triple" || -n "$sdk" ]] || \ + fail "custom platform $platform requires --swift-sdk or explicit --triple/--sdk options" + ;; + esac + + if [[ -n "$sdk_name" ]]; then + [[ "$host" == "macos" ]] || fail "$platform generation requires Xcode on macOS" + command -v xcrun >/dev/null 2>&1 || fail "xcrun is required for $platform generation" + [[ -n "$sdk" ]] || sdk="$(xcrun --sdk "$sdk_name" --show-sdk-path)" + [[ -n "$triple" ]] || triple="$default_triple" + fi +fi + +if [[ "$output_path" = /* ]]; then + output_parent="$output_path" +else + output_parent="$package_root/$output_path" +fi +output_root="$output_parent/$platform" +mkdir -p "$output_root" + +declare -a parser_arguments=("$description_file") +if [[ "$include_tests" == true ]]; then + parser_arguments+=(--include-tests) +fi +if (( ${#selected_targets[@]} > 0 )); then + for target in "${selected_targets[@]}"; do + parser_arguments+=(--target "$target") + done +fi + +CLANG_MODULE_CACHE_PATH="$scratch_root/module-cache" \ +SWIFT_MODULECACHE_PATH="$scratch_root/module-cache" \ + swift "$script_dir/list-swift-targets.swift" "${parser_arguments[@]}" >"$targets_file" + +generated_count=0 +while IFS=$'\t' read -r target_name module_name target_type package_name; do + [[ -n "$target_name" && -n "$module_name" ]] || continue + + printf 'Generating %s (%s) for %s...\n' "$module_name" "$target_name" "$platform" + + declare -a common_command=( + swift build + --package-path "$package_root" + --scratch-path "$scratch_root" + --configuration "$configuration" + --enable-parseable-module-interfaces + ) + + [[ -z "$triple" ]] || common_command+=(--triple "$triple") + [[ -z "$sdk" ]] || common_command+=(--sdk "$sdk") + [[ -z "$swift_sdk" ]] || common_command+=(--swift-sdk "$swift_sdk") + if (( ${#build_arguments[@]} > 0 )); then + common_command+=("${build_arguments[@]}") + fi + + declare -a command=("${common_command[@]}") + if [[ "$target_type" == "test" ]]; then + command+=(--build-tests -Xswiftc -enable-testing) + else + command+=(--target "$target_name") + fi + + : >"$build_log" + if ! CLANG_MODULE_CACHE_PATH="$scratch_root/module-cache" \ + SWIFT_MODULECACHE_PATH="$scratch_root/module-cache" \ + "${command[@]}" 2>&1 | tee "$build_log"; then + if [[ "$target_type" != "test" ]] && \ + grep -Eiq 'multiple targets.*(name|named)' "$build_log"; then + printf 'Target name is ambiguous; building root package products instead...\n' + : >"$build_log" + CLANG_MODULE_CACHE_PATH="$scratch_root/module-cache" \ + SWIFT_MODULECACHE_PATH="$scratch_root/module-cache" \ + "${common_command[@]}" 2>&1 | tee "$build_log" + else + fail "SwiftPM could not build target $target_name for $platform" + fi + fi + + interface_path="$( + find "$scratch_root" -type f -name "$module_name.swiftinterface" \ + -path "*/$package_name.build/*" -exec ls -t {} + 2>/dev/null | head -n 1 || true + )" + if [[ -z "$interface_path" ]]; then + interface_path="$( + find "$scratch_root" -type f -name "$module_name.swiftinterface" \ + -exec grep -F -l -- "-package-name $package_identity" {} + 2>/dev/null | head -n 1 || true + )" + fi + if [[ -z "$interface_path" ]]; then + interface_path="$( + find "$scratch_root" -type f -name "$module_name.swiftinterface" \ + -exec ls -t {} + 2>/dev/null | head -n 1 || true + )" + fi + [[ -n "$interface_path" && -f "$interface_path" ]] || \ + fail "build succeeded but no public interface was found for $target_name ($module_name) on $platform" + + temporary_output="$output_root/.$module_name.swiftinterface.$$" + cp "$interface_path" "$temporary_output" + chmod 0644 "$temporary_output" + mv "$temporary_output" "$output_root/$module_name.swiftinterface" + generated_count=$((generated_count + 1)) +done <"$targets_file" + +[[ $generated_count -gt 0 ]] || fail "no interfaces were generated for $platform" +printf 'Generated %d interface(s) in %s\n' "$generated_count" "$output_root" diff --git a/scripts/list-swift-targets.swift b/scripts/list-swift-targets.swift new file mode 100755 index 0000000..b66371d --- /dev/null +++ b/scripts/list-swift-targets.swift @@ -0,0 +1,100 @@ +#!/usr/bin/env swift + +import Foundation + +private struct PackageDescription: Decodable { + let name: String + let platforms: [Platform] + let targets: [Target] + + struct Platform: Decodable { + let name: String + let version: String + } +} + +private struct Target: Decodable { + let c99Name: String? + let moduleType: String? + let name: String + let type: String + + enum CodingKeys: String, CodingKey { + case c99Name = "c99name" + case moduleType = "module_type" + case name + case type + } +} + +private struct Options { + var includeTests = false + var listPlatforms = false + var selectedTargets = Set() + var jsonPath: String? +} + +private func fail(_ message: String) -> Never { + FileHandle.standardError.write(Data("swiftinterfaces: \(message)\n".utf8)) + exit(1) +} + +private var options = Options() +private var arguments = Array(CommandLine.arguments.dropFirst()) + +while !arguments.isEmpty { + let argument = arguments.removeFirst() + switch argument { + case "--include-tests": + options.includeTests = true + case "--list-platforms": + options.listPlatforms = true + case "--target": + guard !arguments.isEmpty else { fail("--target requires a value") } + options.selectedTargets.insert(arguments.removeFirst()) + default: + guard !argument.hasPrefix("-") else { fail("unknown parser option: \(argument)") } + guard options.jsonPath == nil else { fail("expected exactly one package-description JSON file") } + options.jsonPath = argument + } +} + +guard let jsonPath = options.jsonPath else { fail("missing package-description JSON file") } + +do { + let data = try Data(contentsOf: URL(fileURLWithPath: jsonPath)) + let package = try JSONDecoder().decode(PackageDescription.self, from: data) + if options.listPlatforms { + guard options.selectedTargets.isEmpty, !options.includeTests else { + fail("--list-platforms cannot be combined with target-selection options") + } + for platform in package.platforms.sorted(by: { $0.name < $1.name }) { + print("\(platform.name)\t\(platform.version)") + } + exit(0) + } + let swiftTargets = package.targets.filter { target in + target.moduleType == "SwiftTarget" && (options.includeTests || target.type != "test") + } + let availableNames = Set(swiftTargets.map(\.name)) + let unknownTargets = options.selectedTargets.subtracting(availableNames).sorted() + + guard unknownTargets.isEmpty else { + fail("unknown or excluded Swift target(s): \(unknownTargets.joined(separator: ", "))") + } + + let selected = swiftTargets + .filter { options.selectedTargets.isEmpty || options.selectedTargets.contains($0.name) } + .sorted { $0.name.localizedStandardCompare($1.name) == .orderedAscending } + + guard !selected.isEmpty else { fail("the package has no matching Swift targets") } + + for target in selected { + guard let moduleName = target.c99Name, !moduleName.isEmpty else { + fail("target \(target.name) does not have a Swift module name") + } + print("\(target.name)\t\(moduleName)\t\(target.type)\t\(package.name)") + } +} catch { + fail("could not decode package description: \(error)") +}