Files
feldspar e0efea91d0 Nested types fix
commit_hash:0e61cb86c4ecce349d6b76477d5f025a5896aa81
2026-02-26 13:21:52 +03:00

58 lines
1.6 KiB
Swift

// Generated code. Do not modify.
import Foundation
import Serialization
import VGSL
@frozen
public enum DivTextRangeBackground: Sendable {
case divSolidBackground(DivSolidBackground)
case divCloudBackground(DivCloudBackground)
public var value: Serializable {
switch self {
case let .divSolidBackground(value):
return value
case let .divCloudBackground(value):
return value
}
}
}
extension DivTextRangeBackground {
public init(dictionary: [String: Any], context: ParsingContext) throws {
let dictionary = context.templateResolver?(dictionary) ?? dictionary
let blockType = try dictionary.getField("type") as String
switch blockType {
case DivSolidBackground.type:
self = .divSolidBackground(try DivSolidBackground(dictionary: dictionary, context: context))
case DivCloudBackground.type:
self = .divCloudBackground(try DivCloudBackground(dictionary: dictionary, context: context))
default:
throw DeserializationError.requiredFieldIsMissing(field: "type")
}
}
}
#if DEBUG
extension DivTextRangeBackground: Equatable {
public static func ==(lhs: DivTextRangeBackground, rhs: DivTextRangeBackground) -> Bool {
switch (lhs, rhs) {
case let (.divSolidBackground(l), .divSolidBackground(r)):
return l == r
case let (.divCloudBackground(l), .divCloudBackground(r)):
return l == r
default:
return false
}
}
}
#endif
extension DivTextRangeBackground: Serializable {
@_optimize(size)
public func toDictionary() -> [String: ValidSerializationValue] {
return value.toDictionary()
}
}