Packages/FoldKit/Sources/FoldFormat/EdgeAssignment.swift

00ea029d0652da12d0f4237769e7020b72cfa7f3
fold/Packages/FoldKit/Sources/FoldFormat/EdgeAssignment.swift history · blame · raw

15 lines · 468 bytes

1 symbol in this file
 1public enum EdgeAssignment: String, Codable, Sendable {
 2    case boundary = "B"
 3    case mountain = "M"
 4    case valley = "V"
 5    case flat = "F"
 6    case unassigned = "U"
 7
 8    public init(from decoder: any Decoder) throws {
 9        let code = try decoder.singleValueContainer().decode(String.self)
10        guard let assignment = EdgeAssignment(rawValue: code) else {
11            throw FoldError.unsupportedAssignment(code)
12        }
13        self = assignment
14    }
15}