public extension PureYAML.Tagged { struct Pair: Equatable, Sendable { /// The key as a full node, carrying its tag, anchor, presentation /// style, and alias-ness, so anchored, styled, and alias keys /// round-trip instead of collapsing to a bare string (issues #12 /// and #13). public var keyNode: Node public var value: Node public init( keyNode: Node, value: Node, ) { self.keyNode = keyNode self.value = value } /// Convenience for the overwhelmingly common plain string key. public init( key: String, keyTag: Tag? = nil, value: Node, ) { self.init( keyNode: .scalar(.init(rawValue: key, value: .string(key), tag: keyTag)), value: value, ) } /// The key's resolved raw text: an alias key reads through to its /// anchored scalar, matching `parse(_:)`'s alias-key semantics. public var key: String { guard case let .scalar(scalar) = keyNode.resolved else { return "" } return scalar.rawValue } /// The key's tag, read through an alias to its resolution. public var keyTag: Tag? { keyNode.resolved.tag } } }