Packages/FoldKit/Sources/FoldFormat/EdgeAssignment.swift
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}