Change `Pair` to generic
This commit is contained in:
parent
37de487637
commit
499831cd26
|
@ -10,15 +10,15 @@ import Foundation
|
|||
|
||||
public enum Node {
|
||||
case scalar(String, Tag)
|
||||
case mapping([Pair], Tag)
|
||||
case mapping([Pair<Node>], Tag)
|
||||
case sequence([Node], Tag)
|
||||
}
|
||||
|
||||
public struct Pair: Equatable {
|
||||
let key: Node
|
||||
let value: Node
|
||||
public struct Pair<Value: Equatable>: Equatable {
|
||||
let key: Value
|
||||
let value: Value
|
||||
|
||||
init(_ key: Node, _ value: Node) {
|
||||
init(_ key: Value, _ value: Value) {
|
||||
self.key = key
|
||||
self.value = value
|
||||
}
|
||||
|
|
|
@ -167,7 +167,7 @@ extension Parser {
|
|||
}
|
||||
|
||||
private func loadMapping(from firstEvent: Event) throws -> Node {
|
||||
var pairs = [Pair]()
|
||||
var pairs = [Pair<Node>]()
|
||||
var event = try parse()
|
||||
while event.type != YAML_MAPPING_END_EVENT {
|
||||
let key = try loadNode(from: event)
|
||||
|
|
Loading…
Reference in New Issue