Skip to content

Commit 8cef725

Browse files
doc: Comments Val extensions
1 parent ec574df commit 8cef725

File tree

16 files changed

+21
-13
lines changed

16 files changed

+21
-13
lines changed

Sources/Haystack/Coord.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public struct Coord: Val {
2626
}
2727
}
2828

29+
// Coord + Codable
2930
extension Coord: Codable {
3031
static let kindValue = "coord"
3132

Sources/Haystack/Date.swift

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,7 @@ public struct Date: Val {
6161
}
6262
}
6363

64-
/// Singleton Haystack Date formatter
65-
var dateFormatter: ISO8601DateFormatter {
66-
let formatter = ISO8601DateFormatter()
67-
formatter.formatOptions = [.withFullDate, .withColonSeparatorInTime]
68-
return formatter
69-
}
70-
64+
// Date + Codable
7165
extension Date {
7266
static let kindValue = "date"
7367

Sources/Haystack/DateTime.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ public struct DateTime: Val {
193193

194194
var calendar = Calendar(identifier: .gregorian)
195195

196+
// DateTime + Codable
196197
extension DateTime {
197198
static let kindValue = "dateTime"
198199

Sources/Haystack/Dict.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public struct Dict: Val {
4040
}
4141
}
4242

43+
// Dict + Codable
4344
extension Dict {
4445
static let kindValue = "dateTime"
4546

@@ -156,8 +157,8 @@ extension Dict {
156157
}
157158
}
158159

159-
// Dict + ExpressibleByDictionaryLiteral
160160
extension Dict: ExpressibleByDictionaryLiteral {
161+
/// Creates an instance initialized with the given key-value pairs.
161162
public init(dictionaryLiteral elementLiterals: (String, any Val)...) {
162163
var elements = [String: any Val](minimumCapacity: elementLiterals.count)
163164
for (key, value) in elementLiterals {

Sources/Haystack/Grid.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public struct Grid: Val {
5151
}
5252
}
5353

54+
// Grid + Codable
5455
extension Grid {
5556
static let kindValue = "grid"
5657

@@ -100,7 +101,7 @@ extension Grid {
100101
}
101102
}
102103

103-
// Dict + Equatable
104+
// Grid + Equatable
104105
extension Grid {
105106
public static func == (lhs: Grid, rhs: Grid) -> Bool {
106107
guard lhs.meta == rhs.meta else {
@@ -132,7 +133,7 @@ extension Grid {
132133
}
133134
}
134135

135-
// Dict + Hashable
136+
// Grid + Hashable
136137
extension Grid {
137138
public func hash(into hasher: inout Hasher) {
138139
hasher.combine(meta)

Sources/Haystack/List.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public struct List: Val {
2121
}
2222
}
2323

24+
// List + Codable
2425
extension List {
2526

2627
/// Read from decodable data
@@ -84,8 +85,8 @@ extension List {
8485
}
8586
}
8687

87-
// List + ExpressibleByDictionaryLiteral
8888
extension List: ExpressibleByArrayLiteral {
89+
/// Creates an instance initialized with the given elements.
8990
public init(arrayLiteral: any Val...) {
9091
self.elements = arrayLiteral
9192
}

Sources/Haystack/Marker.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public struct Marker: Val {
2222
}
2323
}
2424

25+
// Marker + Codable
2526
extension Marker {
2627
static let kindValue = "marker"
2728

Sources/Haystack/NA.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public struct NA: Val {
2222
}
2323
}
2424

25+
// NA + Codable
2526
extension NA {
2627
static let kindValue = "na"
2728

Sources/Haystack/Null.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public struct Null: Val {
2020
}
2121
}
2222

23+
// Null + Codable
2324
extension Null {
2425

2526
/// Read from decodable data

Sources/Haystack/Number.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public struct Number: Val {
5353
}
5454
}
5555

56+
// Number + Codable
5657
extension Number {
5758
static let kindValue = "number"
5859

@@ -146,7 +147,7 @@ extension Number {
146147
}
147148
}
148149

149-
// List + Equatable
150+
// Number + Equatable
150151
extension Number {
151152
public static func == (lhs: Number, rhs: Number) -> Bool {
152153
guard lhs.unit == rhs.unit else {

0 commit comments

Comments
 (0)