[swift6] Add checked Sendable conformance to Validation structs (#20150)

This commit is contained in:
Lennard Sprong 2024-11-21 12:23:54 +01:00 committed by GitHub
parent c06db15750
commit 2b891f6da9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 60 additions and 45 deletions

View File

@ -6,21 +6,22 @@
import Foundation import Foundation
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct StringRule: @unchecked Sendable { {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct StringRule: Sendable {
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var minLength: Int? {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var minLength: Int?
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var maxLength: Int? {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var maxLength: Int?
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var pattern: String? {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var pattern: String?
} }
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct NumericRule<T: Comparable & Numeric>: @unchecked Sendable { {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct NumericRule<T: Comparable & Numeric> {
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var minimum: T? {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var minimum: T?
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var exclusiveMinimum = false {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var exclusiveMinimum = false
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var maximum: T? {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var maximum: T?
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var exclusiveMaximum = false {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var exclusiveMaximum = false
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var multipleOf: T? {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var multipleOf: T?
} }
extension NumericRule: Sendable where T: Sendable {}
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct ArrayRule: @unchecked Sendable { {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct ArrayRule: Sendable {
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var minItems: Int? {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var minItems: Int?
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var maxItems: Int? {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var maxItems: Int?
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var uniqueItems: Bool {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var uniqueItems: Bool

View File

@ -6,21 +6,22 @@
import Foundation import Foundation
public struct StringRule: @unchecked Sendable { public struct StringRule: Sendable {
public var minLength: Int? public var minLength: Int?
public var maxLength: Int? public var maxLength: Int?
public var pattern: String? public var pattern: String?
} }
public struct NumericRule<T: Comparable & Numeric>: @unchecked Sendable { public struct NumericRule<T: Comparable & Numeric> {
public var minimum: T? public var minimum: T?
public var exclusiveMinimum = false public var exclusiveMinimum = false
public var maximum: T? public var maximum: T?
public var exclusiveMaximum = false public var exclusiveMaximum = false
public var multipleOf: T? public var multipleOf: T?
} }
extension NumericRule: Sendable where T: Sendable {}
public struct ArrayRule: @unchecked Sendable { public struct ArrayRule: Sendable {
public var minItems: Int? public var minItems: Int?
public var maxItems: Int? public var maxItems: Int?
public var uniqueItems: Bool public var uniqueItems: Bool

View File

@ -6,21 +6,22 @@
import Foundation import Foundation
public struct StringRule: @unchecked Sendable { public struct StringRule: Sendable {
public var minLength: Int? public var minLength: Int?
public var maxLength: Int? public var maxLength: Int?
public var pattern: String? public var pattern: String?
} }
public struct NumericRule<T: Comparable & Numeric>: @unchecked Sendable { public struct NumericRule<T: Comparable & Numeric> {
public var minimum: T? public var minimum: T?
public var exclusiveMinimum = false public var exclusiveMinimum = false
public var maximum: T? public var maximum: T?
public var exclusiveMaximum = false public var exclusiveMaximum = false
public var multipleOf: T? public var multipleOf: T?
} }
extension NumericRule: Sendable where T: Sendable {}
public struct ArrayRule: @unchecked Sendable { public struct ArrayRule: Sendable {
public var minItems: Int? public var minItems: Int?
public var maxItems: Int? public var maxItems: Int?
public var uniqueItems: Bool public var uniqueItems: Bool

View File

@ -6,21 +6,22 @@
import Foundation import Foundation
public struct StringRule: @unchecked Sendable { public struct StringRule: Sendable {
public var minLength: Int? public var minLength: Int?
public var maxLength: Int? public var maxLength: Int?
public var pattern: String? public var pattern: String?
} }
public struct NumericRule<T: Comparable & Numeric>: @unchecked Sendable { public struct NumericRule<T: Comparable & Numeric> {
public var minimum: T? public var minimum: T?
public var exclusiveMinimum = false public var exclusiveMinimum = false
public var maximum: T? public var maximum: T?
public var exclusiveMaximum = false public var exclusiveMaximum = false
public var multipleOf: T? public var multipleOf: T?
} }
extension NumericRule: Sendable where T: Sendable {}
public struct ArrayRule: @unchecked Sendable { public struct ArrayRule: Sendable {
public var minItems: Int? public var minItems: Int?
public var maxItems: Int? public var maxItems: Int?
public var uniqueItems: Bool public var uniqueItems: Bool

View File

@ -6,21 +6,22 @@
import Foundation import Foundation
public struct StringRule: @unchecked Sendable { public struct StringRule: Sendable {
public var minLength: Int? public var minLength: Int?
public var maxLength: Int? public var maxLength: Int?
public var pattern: String? public var pattern: String?
} }
public struct NumericRule<T: Comparable & Numeric>: @unchecked Sendable { public struct NumericRule<T: Comparable & Numeric> {
public var minimum: T? public var minimum: T?
public var exclusiveMinimum = false public var exclusiveMinimum = false
public var maximum: T? public var maximum: T?
public var exclusiveMaximum = false public var exclusiveMaximum = false
public var multipleOf: T? public var multipleOf: T?
} }
extension NumericRule: Sendable where T: Sendable {}
public struct ArrayRule: @unchecked Sendable { public struct ArrayRule: Sendable {
public var minItems: Int? public var minItems: Int?
public var maxItems: Int? public var maxItems: Int?
public var uniqueItems: Bool public var uniqueItems: Bool

View File

@ -6,21 +6,22 @@
import Foundation import Foundation
public struct StringRule: @unchecked Sendable { public struct StringRule: Sendable {
public var minLength: Int? public var minLength: Int?
public var maxLength: Int? public var maxLength: Int?
public var pattern: String? public var pattern: String?
} }
public struct NumericRule<T: Comparable & Numeric>: @unchecked Sendable { public struct NumericRule<T: Comparable & Numeric> {
public var minimum: T? public var minimum: T?
public var exclusiveMinimum = false public var exclusiveMinimum = false
public var maximum: T? public var maximum: T?
public var exclusiveMaximum = false public var exclusiveMaximum = false
public var multipleOf: T? public var multipleOf: T?
} }
extension NumericRule: Sendable where T: Sendable {}
public struct ArrayRule: @unchecked Sendable { public struct ArrayRule: Sendable {
public var minItems: Int? public var minItems: Int?
public var maxItems: Int? public var maxItems: Int?
public var uniqueItems: Bool public var uniqueItems: Bool

View File

@ -6,21 +6,22 @@
import Foundation import Foundation
public struct StringRule: @unchecked Sendable { public struct StringRule: Sendable {
public var minLength: Int? public var minLength: Int?
public var maxLength: Int? public var maxLength: Int?
public var pattern: String? public var pattern: String?
} }
public struct NumericRule<T: Comparable & Numeric>: @unchecked Sendable { public struct NumericRule<T: Comparable & Numeric> {
public var minimum: T? public var minimum: T?
public var exclusiveMinimum = false public var exclusiveMinimum = false
public var maximum: T? public var maximum: T?
public var exclusiveMaximum = false public var exclusiveMaximum = false
public var multipleOf: T? public var multipleOf: T?
} }
extension NumericRule: Sendable where T: Sendable {}
public struct ArrayRule: @unchecked Sendable { public struct ArrayRule: Sendable {
public var minItems: Int? public var minItems: Int?
public var maxItems: Int? public var maxItems: Int?
public var uniqueItems: Bool public var uniqueItems: Bool

View File

@ -6,21 +6,22 @@
import Foundation import Foundation
public struct StringRule: @unchecked Sendable { public struct StringRule: Sendable {
public var minLength: Int? public var minLength: Int?
public var maxLength: Int? public var maxLength: Int?
public var pattern: String? public var pattern: String?
} }
public struct NumericRule<T: Comparable & Numeric>: @unchecked Sendable { public struct NumericRule<T: Comparable & Numeric> {
public var minimum: T? public var minimum: T?
public var exclusiveMinimum = false public var exclusiveMinimum = false
public var maximum: T? public var maximum: T?
public var exclusiveMaximum = false public var exclusiveMaximum = false
public var multipleOf: T? public var multipleOf: T?
} }
extension NumericRule: Sendable where T: Sendable {}
public struct ArrayRule: @unchecked Sendable { public struct ArrayRule: Sendable {
public var minItems: Int? public var minItems: Int?
public var maxItems: Int? public var maxItems: Int?
public var uniqueItems: Bool public var uniqueItems: Bool

View File

@ -6,21 +6,22 @@
import Foundation import Foundation
public struct StringRule: @unchecked Sendable { public struct StringRule: Sendable {
public var minLength: Int? public var minLength: Int?
public var maxLength: Int? public var maxLength: Int?
public var pattern: String? public var pattern: String?
} }
public struct NumericRule<T: Comparable & Numeric>: @unchecked Sendable { public struct NumericRule<T: Comparable & Numeric> {
public var minimum: T? public var minimum: T?
public var exclusiveMinimum = false public var exclusiveMinimum = false
public var maximum: T? public var maximum: T?
public var exclusiveMaximum = false public var exclusiveMaximum = false
public var multipleOf: T? public var multipleOf: T?
} }
extension NumericRule: Sendable where T: Sendable {}
public struct ArrayRule: @unchecked Sendable { public struct ArrayRule: Sendable {
public var minItems: Int? public var minItems: Int?
public var maxItems: Int? public var maxItems: Int?
public var uniqueItems: Bool public var uniqueItems: Bool

View File

@ -6,21 +6,22 @@
import Foundation import Foundation
public struct StringRule: @unchecked Sendable { public struct StringRule: Sendable {
public var minLength: Int? public var minLength: Int?
public var maxLength: Int? public var maxLength: Int?
public var pattern: String? public var pattern: String?
} }
public struct NumericRule<T: Comparable & Numeric>: @unchecked Sendable { public struct NumericRule<T: Comparable & Numeric> {
public var minimum: T? public var minimum: T?
public var exclusiveMinimum = false public var exclusiveMinimum = false
public var maximum: T? public var maximum: T?
public var exclusiveMaximum = false public var exclusiveMaximum = false
public var multipleOf: T? public var multipleOf: T?
} }
extension NumericRule: Sendable where T: Sendable {}
public struct ArrayRule: @unchecked Sendable { public struct ArrayRule: Sendable {
public var minItems: Int? public var minItems: Int?
public var maxItems: Int? public var maxItems: Int?
public var uniqueItems: Bool public var uniqueItems: Bool

View File

@ -6,21 +6,22 @@
import Foundation import Foundation
internal struct StringRule: @unchecked Sendable { internal struct StringRule: Sendable {
internal var minLength: Int? internal var minLength: Int?
internal var maxLength: Int? internal var maxLength: Int?
internal var pattern: String? internal var pattern: String?
} }
internal struct NumericRule<T: Comparable & Numeric>: @unchecked Sendable { internal struct NumericRule<T: Comparable & Numeric> {
internal var minimum: T? internal var minimum: T?
internal var exclusiveMinimum = false internal var exclusiveMinimum = false
internal var maximum: T? internal var maximum: T?
internal var exclusiveMaximum = false internal var exclusiveMaximum = false
internal var multipleOf: T? internal var multipleOf: T?
} }
extension NumericRule: Sendable where T: Sendable {}
internal struct ArrayRule: @unchecked Sendable { internal struct ArrayRule: Sendable {
internal var minItems: Int? internal var minItems: Int?
internal var maxItems: Int? internal var maxItems: Int?
internal var uniqueItems: Bool internal var uniqueItems: Bool

View File

@ -6,21 +6,22 @@
import Foundation import Foundation
public struct StringRule: @unchecked Sendable { public struct StringRule: Sendable {
public var minLength: Int? public var minLength: Int?
public var maxLength: Int? public var maxLength: Int?
public var pattern: String? public var pattern: String?
} }
public struct NumericRule<T: Comparable & Numeric>: @unchecked Sendable { public struct NumericRule<T: Comparable & Numeric> {
public var minimum: T? public var minimum: T?
public var exclusiveMinimum = false public var exclusiveMinimum = false
public var maximum: T? public var maximum: T?
public var exclusiveMaximum = false public var exclusiveMaximum = false
public var multipleOf: T? public var multipleOf: T?
} }
extension NumericRule: Sendable where T: Sendable {}
public struct ArrayRule: @unchecked Sendable { public struct ArrayRule: Sendable {
public var minItems: Int? public var minItems: Int?
public var maxItems: Int? public var maxItems: Int?
public var uniqueItems: Bool public var uniqueItems: Bool

View File

@ -6,21 +6,22 @@
import Foundation import Foundation
public struct StringRule: @unchecked Sendable { public struct StringRule: Sendable {
public var minLength: Int? public var minLength: Int?
public var maxLength: Int? public var maxLength: Int?
public var pattern: String? public var pattern: String?
} }
public struct NumericRule<T: Comparable & Numeric>: @unchecked Sendable { public struct NumericRule<T: Comparable & Numeric> {
public var minimum: T? public var minimum: T?
public var exclusiveMinimum = false public var exclusiveMinimum = false
public var maximum: T? public var maximum: T?
public var exclusiveMaximum = false public var exclusiveMaximum = false
public var multipleOf: T? public var multipleOf: T?
} }
extension NumericRule: Sendable where T: Sendable {}
public struct ArrayRule: @unchecked Sendable { public struct ArrayRule: Sendable {
public var minItems: Int? public var minItems: Int?
public var maxItems: Int? public var maxItems: Int?
public var uniqueItems: Bool public var uniqueItems: Bool

View File

@ -6,21 +6,22 @@
import Foundation import Foundation
public struct StringRule: @unchecked Sendable { public struct StringRule: Sendable {
public var minLength: Int? public var minLength: Int?
public var maxLength: Int? public var maxLength: Int?
public var pattern: String? public var pattern: String?
} }
public struct NumericRule<T: Comparable & Numeric>: @unchecked Sendable { public struct NumericRule<T: Comparable & Numeric> {
public var minimum: T? public var minimum: T?
public var exclusiveMinimum = false public var exclusiveMinimum = false
public var maximum: T? public var maximum: T?
public var exclusiveMaximum = false public var exclusiveMaximum = false
public var multipleOf: T? public var multipleOf: T?
} }
extension NumericRule: Sendable where T: Sendable {}
public struct ArrayRule: @unchecked Sendable { public struct ArrayRule: Sendable {
public var minItems: Int? public var minItems: Int?
public var maxItems: Int? public var maxItems: Int?
public var uniqueItems: Bool public var uniqueItems: Bool

View File

@ -6,21 +6,22 @@
import Foundation import Foundation
public struct StringRule: @unchecked Sendable { public struct StringRule: Sendable {
public var minLength: Int? public var minLength: Int?
public var maxLength: Int? public var maxLength: Int?
public var pattern: String? public var pattern: String?
} }
public struct NumericRule<T: Comparable & Numeric>: @unchecked Sendable { public struct NumericRule<T: Comparable & Numeric> {
public var minimum: T? public var minimum: T?
public var exclusiveMinimum = false public var exclusiveMinimum = false
public var maximum: T? public var maximum: T?
public var exclusiveMaximum = false public var exclusiveMaximum = false
public var multipleOf: T? public var multipleOf: T?
} }
extension NumericRule: Sendable where T: Sendable {}
public struct ArrayRule: @unchecked Sendable { public struct ArrayRule: Sendable {
public var minItems: Int? public var minItems: Int?
public var maxItems: Int? public var maxItems: Int?
public var uniqueItems: Bool public var uniqueItems: Bool