Merge pull request #9 from ensan-hcl/refactoring/concurrency

Add Sendable Conformances
This commit is contained in:
Miwa / Ensan
2023-08-02 18:42:47 +09:00
committed by GitHub
10 changed files with 25 additions and 25 deletions

View File

@ -8,7 +8,7 @@
import Foundation
public enum CIDData {
public enum CIDData: Sendable {
static var totalCount: Int {
1319
}

View File

@ -62,13 +62,13 @@ struct CandidateData {
}
}
public enum CompleteAction {
public enum CompleteAction: Sendable {
/// 調
case moveCursor(Int)
}
///
public struct Candidate {
public struct Candidate: Sendable {
///
public var text: String
///

View File

@ -14,7 +14,7 @@ import SwiftUtils
/// `
///
/// inputStyle`input` / `delete` / `moveCursor` / `complete`
public struct ComposingText {
public struct ComposingText: Sendable {
public init(convertTargetCursorPosition: Int = 0, input: [ComposingText.InputElement] = [], convertTarget: String = "") {
self.convertTargetCursorPosition = convertTargetCursorPosition
self.input = input
@ -29,7 +29,7 @@ public struct ComposingText {
public private(set) var convertTarget: String = ""
///
public struct InputElement {
public struct InputElement: Sendable {
///
public var character: Character
/// ( / )

View File

@ -8,7 +8,7 @@
import Foundation
public struct ConvertRequestOptions {
public struct ConvertRequestOptions: Sendable {
///
///
/// - parameters:
@ -91,7 +91,7 @@ public struct ConvertRequestOptions {
)
}
public struct Metadata {
public struct Metadata: Sendable {
/// - parameters:
/// - appVersionString: `KanaKanjiCovnerter.toVersionCandidate(_:)`
public init(appVersionString: String) {

View File

@ -8,7 +8,7 @@
import Foundation
public struct DicdataElement: Equatable, Hashable {
public struct DicdataElement: Equatable, Hashable, Sendable {
static let BOSData = Self(word: "", ruby: "", cid: CIDData.BOS.cid, mid: MIDData.BOS.mid, value: 0, adjust: 0)
static let EOSData = Self(word: "", ruby: "", cid: CIDData.EOS.cid, mid: MIDData.EOS.mid, value: 0, adjust: 0)

View File

@ -8,7 +8,7 @@
import Foundation
public enum MIDData {
public enum MIDData: Sendable {
static var totalCount: Int {
503
}

View File

@ -74,7 +74,7 @@ public struct TextReplacer {
return results
}
public struct SearchResultItem {
public struct SearchResultItem: Sendable {
public var query: String
public var text: String
public var inputable: Bool {
@ -113,7 +113,7 @@ public struct TextReplacer {
}
}
public struct ReplacementCandidate {
public struct ReplacementCandidate: Sendable {
public var target: String
public var replace: String
public var base: String

View File

@ -5,7 +5,7 @@
// Created by ensan on 2023/04/30.
//
public enum InputStyle: String {
public enum InputStyle: String, Sendable {
///
case direct = "direct"
///
@ -19,7 +19,7 @@ public enum KeyboardLanguage: String, Codable, Equatable, Sendable {
case none
}
public enum LearningType: Int, CaseIterable {
public enum LearningType: Int, CaseIterable, Sendable {
case inputAndOutput
case onlyOutput
case nothing
@ -33,13 +33,13 @@ public enum LearningType: Int, CaseIterable {
}
}
public enum ConverterBehaviorSemantics {
public enum ConverterBehaviorSemantics: Sendable {
///
case conversion
/// iOS
case replacement([ReplacementTarget])
public enum ReplacementTarget: UInt8 {
public enum ReplacementTarget: UInt8, Sendable {
case emoji
}
}

View File

@ -9,7 +9,7 @@
import Foundation
import SwiftUtils
public struct TemplateData: Codable {
public struct TemplateData: Codable, Sendable {
public var name: String
public var literal: any TemplateLiteralProtocol
public var type: TemplateLiteralType
@ -92,13 +92,13 @@ public struct TemplateData: Codable {
}
}
public protocol TemplateLiteralProtocol {
public protocol TemplateLiteralProtocol: Sendable {
func export() -> String
func previewString() -> String
}
public enum TemplateLiteralType {
public enum TemplateLiteralType: Sendable {
case date
case random
}
@ -113,7 +113,7 @@ public extension TemplateLiteralProtocol {
}
}
public struct DateTemplateLiteral: TemplateLiteralProtocol, Equatable {
public struct DateTemplateLiteral: TemplateLiteralProtocol, Equatable, Sendable {
public init(format: String, type: DateTemplateLiteral.CalendarType, language: DateTemplateLiteral.Language, delta: String, deltaUnit: Int) {
self.format = format
self.type = type
@ -129,7 +129,7 @@ public struct DateTemplateLiteral: TemplateLiteralProtocol, Equatable {
public var delta: String
public var deltaUnit: Int
public enum CalendarType: String {
public enum CalendarType: String, Sendable {
case western
case japanese
@ -143,7 +143,7 @@ public struct DateTemplateLiteral: TemplateLiteralProtocol, Equatable {
}
}
public enum Language: String {
public enum Language: String, Sendable {
case english = "en_US"
case japanese = "ja_JP"
@ -183,7 +183,7 @@ public struct DateTemplateLiteral: TemplateLiteralProtocol, Equatable {
}
}
public struct RandomTemplateLiteral: TemplateLiteralProtocol, Equatable {
public struct RandomTemplateLiteral: TemplateLiteralProtocol, Equatable, Sendable {
public init(value: RandomTemplateLiteral.Value) {
self.value = value
}
@ -192,12 +192,12 @@ public struct RandomTemplateLiteral: TemplateLiteralProtocol, Equatable {
lhs.value == rhs.value
}
public enum ValueType: String {
public enum ValueType: String, Sendable {
case int
case double
case string
}
public enum Value: Equatable {
public enum Value: Equatable, Sendable {
case int(from: Int, to: Int)
case double(from: Double, to: Double)
case string([String])

View File

@ -13,7 +13,7 @@ import Foundation
/// It is initialized with a string that represents a version of an app.
/// The string must be in the format of "major.minor.patch".
/// The string must not contain any other characters than numbers and dots.
public struct AppVersion: Codable, Equatable, Comparable, Hashable, LosslessStringConvertible, CustomStringConvertible {
public struct AppVersion: Codable, Equatable, Comparable, Hashable, LosslessStringConvertible, CustomStringConvertible, Sendable {
/// ParseError is an enum that represents an error that occurs when parsing a string to an AppVersion.
private enum ParseError: Error {