Skip to content

Commit f09391f

Browse files
authored
Added more sweeping conformances to Sendable and Hashable; made "shortcuts" concurrency-safe (#56)
* Update Chord.swift Added `Hashable` conformance to `Chord`. * Update Key.swift Added `Hashable` conformance to `Key`. * Update Accidental.swift Added `Sendable` conformance to `Accidental`. * Update Letter.swift Added `Sendable` conformance to `Letter`. * Update NoteClass.swift Added `Sendable` conformance to `NoteClass`. * Update ChordType.swift Added `Sendable` conformance to `ChordType`. * Update Chord.swift Added `Sendable` conformance to `Chord`. * Update Interval.swift Added `Sendable` conformance to `Interval`. * Update Scale.swift Added `Sendable` conformance to `Scale`. * Update BitSet.swift Added `Sendable` conformance to `BitSet` protocol. * Update BitSet.swift Added `Sendable` conformance to `BitSetAdapter`. * Update Key.swift Added `Sendable` conformance to `Key`. * Update Note.swift Added `Sendable` conformance to `Note`. * Update Note+MiddleCStandard.swift Added `Sendable` conformance to `Note.MiddleCStandard`. * Update Octave.swift Added `Sendable` conformance to `Octave`. * Update Pitch.swift Added `Sendable` conformance to `Pitch`. * Update PitchColor.swift Added `Sendable` conformance to `PitchColor`. * Update NoteClass+Shortcuts.swift Changed static variable to static constant, as it shouldn't be mutable. * Update NoteClass+Shortcuts.swift Changed remaining `NoteClass` static variable "shortcuts" to static constants. This ensures that they're concurrency-safe. They shouldn't be mutable anyway. * Update Chord+Shortcuts.swift Changed remaining `Chord` static variable "shortcuts" to static constants. This ensures that they're concurrency-safe. They shouldn't be mutable anyway. * Update Note+Shortcuts.swift Changed remaining `Note` static variable "shortcuts" to static constants. This ensures that they're concurrency-safe. They shouldn't be mutable anyway.
1 parent 76d61ce commit f09391f

17 files changed

+169
-169
lines changed

Sources/Tonic/Accidental.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Foundation
55
/// A way to describe modification to a ``Note`` or ``NoteClass``
66
///
77
/// A semitone offset applied to a note that does not change the letter of the note, just the pitch.
8-
public enum Accidental: Int8, CaseIterable, Equatable, Hashable, Codable {
8+
public enum Accidental: Int8, Sendable, CaseIterable, Equatable, Hashable, Codable {
99
static var count: Int { Accidental.allCases.count }
1010
static var naturalIndex: Int { count / 2 }
1111

Sources/Tonic/BitSet.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import Foundation
44

55
/// Interface to bit sets used to represent sets of pitches and sets of notes.
6-
public protocol BitSet: Hashable, Codable {
6+
public protocol BitSet: Hashable, Codable, Sendable {
77
init()
88
func isSet(bit: Int) -> Bool
99
mutating func add(bit: Int)
@@ -195,7 +195,7 @@ public protocol IntRepresentable {
195195
var intValue: Int { get }
196196
}
197197

198-
public struct BitSetAdapter<T: IntRepresentable, B: BitSet>: Hashable, Codable {
198+
public struct BitSetAdapter<T: IntRepresentable, B: BitSet>: Sendable, Hashable, Codable {
199199
public var bits: B
200200

201201
public init() {

0 commit comments

Comments
 (0)