mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-01 19:58:15 +00:00
* Migrate to swift 6.0 & swift-gRPC 2.0 The following migrates to swift 6.0, and also migrate to swift-grpc 2.0 that uses swift-nio under the hood to provide nicer API and async await Adds sendable to enum & update @_implementationOnly imports to use internal imports * Address PR comments regarding misspelling & proper method naming.
410 lines
24 KiB
Swift
410 lines
24 KiB
Swift
// automatically generated by the FlatBuffers compiler, do not modify
|
|
// swiftlint:disable all
|
|
// swiftformat:disable all
|
|
|
|
#if canImport(Common)
|
|
import Common
|
|
#endif
|
|
|
|
import FlatBuffers
|
|
|
|
public enum optional_scalars_OptionalByte: Int8, FlatbuffersVectorInitializable, Enum, Verifiable {
|
|
public typealias T = Int8
|
|
public static var byteSize: Int { return MemoryLayout<Int8>.size }
|
|
public var value: Int8 { return self.rawValue }
|
|
case none_ = 0
|
|
case one = 1
|
|
case two = 2
|
|
|
|
public static var max: optional_scalars_OptionalByte { return .two }
|
|
public static var min: optional_scalars_OptionalByte { return .none_ }
|
|
}
|
|
|
|
extension optional_scalars_OptionalByte: Encodable {
|
|
public func encode(to encoder: Encoder) throws {
|
|
var container = encoder.singleValueContainer()
|
|
switch self {
|
|
case .none_: try container.encode("None")
|
|
case .one: try container.encode("One")
|
|
case .two: try container.encode("Two")
|
|
}
|
|
}
|
|
}
|
|
|
|
public struct optional_scalars_ScalarStuff: FlatBufferVerifiableTable, FlatbuffersVectorInitializable {
|
|
|
|
static func validateVersion() { FlatBuffersVersion_25_12_19() }
|
|
public var __buffer: ByteBuffer! { return _accessor.bb }
|
|
private var _accessor: Table
|
|
|
|
public static var id: String { "NULL" }
|
|
public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: optional_scalars_ScalarStuff.id, addPrefix: prefix) }
|
|
private init(_ t: Table) { _accessor = t }
|
|
public init(_ bb: ByteBuffer, o: Int32) { _accessor = Table(bb: bb, position: o) }
|
|
|
|
private struct VT {
|
|
static let justI8: VOffset = 4
|
|
static let maybeI8: VOffset = 6
|
|
static let defaultI8: VOffset = 8
|
|
static let justU8: VOffset = 10
|
|
static let maybeU8: VOffset = 12
|
|
static let defaultU8: VOffset = 14
|
|
static let justI16: VOffset = 16
|
|
static let maybeI16: VOffset = 18
|
|
static let defaultI16: VOffset = 20
|
|
static let justU16: VOffset = 22
|
|
static let maybeU16: VOffset = 24
|
|
static let defaultU16: VOffset = 26
|
|
static let justI32: VOffset = 28
|
|
static let maybeI32: VOffset = 30
|
|
static let defaultI32: VOffset = 32
|
|
static let justU32: VOffset = 34
|
|
static let maybeU32: VOffset = 36
|
|
static let defaultU32: VOffset = 38
|
|
static let justI64: VOffset = 40
|
|
static let maybeI64: VOffset = 42
|
|
static let defaultI64: VOffset = 44
|
|
static let justU64: VOffset = 46
|
|
static let maybeU64: VOffset = 48
|
|
static let defaultU64: VOffset = 50
|
|
static let justF32: VOffset = 52
|
|
static let maybeF32: VOffset = 54
|
|
static let defaultF32: VOffset = 56
|
|
static let justF64: VOffset = 58
|
|
static let maybeF64: VOffset = 60
|
|
static let defaultF64: VOffset = 62
|
|
static let justBool: VOffset = 64
|
|
static let maybeBool: VOffset = 66
|
|
static let defaultBool: VOffset = 68
|
|
static let justEnum: VOffset = 70
|
|
static let maybeEnum: VOffset = 72
|
|
static let defaultEnum: VOffset = 74
|
|
}
|
|
|
|
public var justI8: Int8 { let o = _accessor.offset(VT.justI8); return o == 0 ? 0 : _accessor.readBuffer(of: Int8.self, at: o) }
|
|
public var maybeI8: Int8? { let o = _accessor.offset(VT.maybeI8); return o == 0 ? nil : _accessor.readBuffer(of: Int8.self, at: o) }
|
|
public var defaultI8: Int8 { let o = _accessor.offset(VT.defaultI8); return o == 0 ? 42 : _accessor.readBuffer(of: Int8.self, at: o) }
|
|
public var justU8: UInt8 { let o = _accessor.offset(VT.justU8); return o == 0 ? 0 : _accessor.readBuffer(of: UInt8.self, at: o) }
|
|
public var maybeU8: UInt8? { let o = _accessor.offset(VT.maybeU8); return o == 0 ? nil : _accessor.readBuffer(of: UInt8.self, at: o) }
|
|
public var defaultU8: UInt8 { let o = _accessor.offset(VT.defaultU8); return o == 0 ? 42 : _accessor.readBuffer(of: UInt8.self, at: o) }
|
|
public var justI16: Int16 { let o = _accessor.offset(VT.justI16); return o == 0 ? 0 : _accessor.readBuffer(of: Int16.self, at: o) }
|
|
public var maybeI16: Int16? { let o = _accessor.offset(VT.maybeI16); return o == 0 ? nil : _accessor.readBuffer(of: Int16.self, at: o) }
|
|
public var defaultI16: Int16 { let o = _accessor.offset(VT.defaultI16); return o == 0 ? 42 : _accessor.readBuffer(of: Int16.self, at: o) }
|
|
public var justU16: UInt16 { let o = _accessor.offset(VT.justU16); return o == 0 ? 0 : _accessor.readBuffer(of: UInt16.self, at: o) }
|
|
public var maybeU16: UInt16? { let o = _accessor.offset(VT.maybeU16); return o == 0 ? nil : _accessor.readBuffer(of: UInt16.self, at: o) }
|
|
public var defaultU16: UInt16 { let o = _accessor.offset(VT.defaultU16); return o == 0 ? 42 : _accessor.readBuffer(of: UInt16.self, at: o) }
|
|
public var justI32: Int32 { let o = _accessor.offset(VT.justI32); return o == 0 ? 0 : _accessor.readBuffer(of: Int32.self, at: o) }
|
|
public var maybeI32: Int32? { let o = _accessor.offset(VT.maybeI32); return o == 0 ? nil : _accessor.readBuffer(of: Int32.self, at: o) }
|
|
public var defaultI32: Int32 { let o = _accessor.offset(VT.defaultI32); return o == 0 ? 42 : _accessor.readBuffer(of: Int32.self, at: o) }
|
|
public var justU32: UInt32 { let o = _accessor.offset(VT.justU32); return o == 0 ? 0 : _accessor.readBuffer(of: UInt32.self, at: o) }
|
|
public var maybeU32: UInt32? { let o = _accessor.offset(VT.maybeU32); return o == 0 ? nil : _accessor.readBuffer(of: UInt32.self, at: o) }
|
|
public var defaultU32: UInt32 { let o = _accessor.offset(VT.defaultU32); return o == 0 ? 42 : _accessor.readBuffer(of: UInt32.self, at: o) }
|
|
public var justI64: Int64 { let o = _accessor.offset(VT.justI64); return o == 0 ? 0 : _accessor.readBuffer(of: Int64.self, at: o) }
|
|
public var maybeI64: Int64? { let o = _accessor.offset(VT.maybeI64); return o == 0 ? nil : _accessor.readBuffer(of: Int64.self, at: o) }
|
|
public var defaultI64: Int64 { let o = _accessor.offset(VT.defaultI64); return o == 0 ? 42 : _accessor.readBuffer(of: Int64.self, at: o) }
|
|
public var justU64: UInt64 { let o = _accessor.offset(VT.justU64); return o == 0 ? 0 : _accessor.readBuffer(of: UInt64.self, at: o) }
|
|
public var maybeU64: UInt64? { let o = _accessor.offset(VT.maybeU64); return o == 0 ? nil : _accessor.readBuffer(of: UInt64.self, at: o) }
|
|
public var defaultU64: UInt64 { let o = _accessor.offset(VT.defaultU64); return o == 0 ? 42 : _accessor.readBuffer(of: UInt64.self, at: o) }
|
|
public var justF32: Float32 { let o = _accessor.offset(VT.justF32); return o == 0 ? 0.0 : _accessor.readBuffer(of: Float32.self, at: o) }
|
|
public var maybeF32: Float32? { let o = _accessor.offset(VT.maybeF32); return o == 0 ? nil : _accessor.readBuffer(of: Float32.self, at: o) }
|
|
public var defaultF32: Float32 { let o = _accessor.offset(VT.defaultF32); return o == 0 ? 42.0 : _accessor.readBuffer(of: Float32.self, at: o) }
|
|
public var justF64: Double { let o = _accessor.offset(VT.justF64); return o == 0 ? 0.0 : _accessor.readBuffer(of: Double.self, at: o) }
|
|
public var maybeF64: Double? { let o = _accessor.offset(VT.maybeF64); return o == 0 ? nil : _accessor.readBuffer(of: Double.self, at: o) }
|
|
public var defaultF64: Double { let o = _accessor.offset(VT.defaultF64); return o == 0 ? 42.0 : _accessor.readBuffer(of: Double.self, at: o) }
|
|
public var justBool: Bool { let o = _accessor.offset(VT.justBool); return o == 0 ? false : _accessor.readBuffer(of: Bool.self, at: o) }
|
|
public var maybeBool: Bool? { let o = _accessor.offset(VT.maybeBool); return o == 0 ? nil : _accessor.readBuffer(of: Bool.self, at: o) }
|
|
public var defaultBool: Bool { let o = _accessor.offset(VT.defaultBool); return o == 0 ? true : _accessor.readBuffer(of: Bool.self, at: o) }
|
|
public var justEnum: optional_scalars_OptionalByte { let o = _accessor.offset(VT.justEnum); return o == 0 ? .none_ : optional_scalars_OptionalByte(rawValue: _accessor.readBuffer(of: Int8.self, at: o)) ?? .none_ }
|
|
public var maybeEnum: optional_scalars_OptionalByte? { let o = _accessor.offset(VT.maybeEnum); return o == 0 ? nil : optional_scalars_OptionalByte(rawValue: _accessor.readBuffer(of: Int8.self, at: o)) ?? nil }
|
|
public var defaultEnum: optional_scalars_OptionalByte { let o = _accessor.offset(VT.defaultEnum); return o == 0 ? .one : optional_scalars_OptionalByte(rawValue: _accessor.readBuffer(of: Int8.self, at: o)) ?? .one }
|
|
public static func startScalarStuff(_ fbb: inout FlatBufferBuilder) -> UOffset { fbb.startTable(with: 36) }
|
|
public static func add(justI8: Int8, _ fbb: inout FlatBufferBuilder) { fbb.add(element: justI8, def: 0, at: VT.justI8) }
|
|
public static func add(maybeI8: Int8?, _ fbb: inout FlatBufferBuilder) { fbb.add(element: maybeI8, at: VT.maybeI8) }
|
|
public static func add(defaultI8: Int8, _ fbb: inout FlatBufferBuilder) { fbb.add(element: defaultI8, def: 42, at: VT.defaultI8) }
|
|
public static func add(justU8: UInt8, _ fbb: inout FlatBufferBuilder) { fbb.add(element: justU8, def: 0, at: VT.justU8) }
|
|
public static func add(maybeU8: UInt8?, _ fbb: inout FlatBufferBuilder) { fbb.add(element: maybeU8, at: VT.maybeU8) }
|
|
public static func add(defaultU8: UInt8, _ fbb: inout FlatBufferBuilder) { fbb.add(element: defaultU8, def: 42, at: VT.defaultU8) }
|
|
public static func add(justI16: Int16, _ fbb: inout FlatBufferBuilder) { fbb.add(element: justI16, def: 0, at: VT.justI16) }
|
|
public static func add(maybeI16: Int16?, _ fbb: inout FlatBufferBuilder) { fbb.add(element: maybeI16, at: VT.maybeI16) }
|
|
public static func add(defaultI16: Int16, _ fbb: inout FlatBufferBuilder) { fbb.add(element: defaultI16, def: 42, at: VT.defaultI16) }
|
|
public static func add(justU16: UInt16, _ fbb: inout FlatBufferBuilder) { fbb.add(element: justU16, def: 0, at: VT.justU16) }
|
|
public static func add(maybeU16: UInt16?, _ fbb: inout FlatBufferBuilder) { fbb.add(element: maybeU16, at: VT.maybeU16) }
|
|
public static func add(defaultU16: UInt16, _ fbb: inout FlatBufferBuilder) { fbb.add(element: defaultU16, def: 42, at: VT.defaultU16) }
|
|
public static func add(justI32: Int32, _ fbb: inout FlatBufferBuilder) { fbb.add(element: justI32, def: 0, at: VT.justI32) }
|
|
public static func add(maybeI32: Int32?, _ fbb: inout FlatBufferBuilder) { fbb.add(element: maybeI32, at: VT.maybeI32) }
|
|
public static func add(defaultI32: Int32, _ fbb: inout FlatBufferBuilder) { fbb.add(element: defaultI32, def: 42, at: VT.defaultI32) }
|
|
public static func add(justU32: UInt32, _ fbb: inout FlatBufferBuilder) { fbb.add(element: justU32, def: 0, at: VT.justU32) }
|
|
public static func add(maybeU32: UInt32?, _ fbb: inout FlatBufferBuilder) { fbb.add(element: maybeU32, at: VT.maybeU32) }
|
|
public static func add(defaultU32: UInt32, _ fbb: inout FlatBufferBuilder) { fbb.add(element: defaultU32, def: 42, at: VT.defaultU32) }
|
|
public static func add(justI64: Int64, _ fbb: inout FlatBufferBuilder) { fbb.add(element: justI64, def: 0, at: VT.justI64) }
|
|
public static func add(maybeI64: Int64?, _ fbb: inout FlatBufferBuilder) { fbb.add(element: maybeI64, at: VT.maybeI64) }
|
|
public static func add(defaultI64: Int64, _ fbb: inout FlatBufferBuilder) { fbb.add(element: defaultI64, def: 42, at: VT.defaultI64) }
|
|
public static func add(justU64: UInt64, _ fbb: inout FlatBufferBuilder) { fbb.add(element: justU64, def: 0, at: VT.justU64) }
|
|
public static func add(maybeU64: UInt64?, _ fbb: inout FlatBufferBuilder) { fbb.add(element: maybeU64, at: VT.maybeU64) }
|
|
public static func add(defaultU64: UInt64, _ fbb: inout FlatBufferBuilder) { fbb.add(element: defaultU64, def: 42, at: VT.defaultU64) }
|
|
public static func add(justF32: Float32, _ fbb: inout FlatBufferBuilder) { fbb.add(element: justF32, def: 0.0, at: VT.justF32) }
|
|
public static func add(maybeF32: Float32?, _ fbb: inout FlatBufferBuilder) { fbb.add(element: maybeF32, at: VT.maybeF32) }
|
|
public static func add(defaultF32: Float32, _ fbb: inout FlatBufferBuilder) { fbb.add(element: defaultF32, def: 42.0, at: VT.defaultF32) }
|
|
public static func add(justF64: Double, _ fbb: inout FlatBufferBuilder) { fbb.add(element: justF64, def: 0.0, at: VT.justF64) }
|
|
public static func add(maybeF64: Double?, _ fbb: inout FlatBufferBuilder) { fbb.add(element: maybeF64, at: VT.maybeF64) }
|
|
public static func add(defaultF64: Double, _ fbb: inout FlatBufferBuilder) { fbb.add(element: defaultF64, def: 42.0, at: VT.defaultF64) }
|
|
public static func add(justBool: Bool, _ fbb: inout FlatBufferBuilder) { fbb.add(element: justBool, def: false,
|
|
at: VT.justBool) }
|
|
public static func add(maybeBool: Bool?, _ fbb: inout FlatBufferBuilder) { fbb.add(element: maybeBool, at: VT.maybeBool) }
|
|
public static func add(defaultBool: Bool, _ fbb: inout FlatBufferBuilder) { fbb.add(element: defaultBool, def: true,
|
|
at: VT.defaultBool) }
|
|
public static func add(justEnum: optional_scalars_OptionalByte, _ fbb: inout FlatBufferBuilder) { fbb.add(element: justEnum.rawValue, def: 0, at: VT.justEnum) }
|
|
public static func add(maybeEnum: optional_scalars_OptionalByte?, _ fbb: inout FlatBufferBuilder) { fbb.add(element: maybeEnum?.rawValue, at: VT.maybeEnum) }
|
|
public static func add(defaultEnum: optional_scalars_OptionalByte, _ fbb: inout FlatBufferBuilder) { fbb.add(element: defaultEnum.rawValue, def: 1, at: VT.defaultEnum) }
|
|
public static func endScalarStuff(_ fbb: inout FlatBufferBuilder, start: UOffset) -> Offset { let end = Offset(offset: fbb.endTable(at: start)); return end }
|
|
public static func createScalarStuff(
|
|
_ fbb: inout FlatBufferBuilder,
|
|
justI8: Int8 = 0,
|
|
maybeI8: Int8? = nil,
|
|
defaultI8: Int8 = 42,
|
|
justU8: UInt8 = 0,
|
|
maybeU8: UInt8? = nil,
|
|
defaultU8: UInt8 = 42,
|
|
justI16: Int16 = 0,
|
|
maybeI16: Int16? = nil,
|
|
defaultI16: Int16 = 42,
|
|
justU16: UInt16 = 0,
|
|
maybeU16: UInt16? = nil,
|
|
defaultU16: UInt16 = 42,
|
|
justI32: Int32 = 0,
|
|
maybeI32: Int32? = nil,
|
|
defaultI32: Int32 = 42,
|
|
justU32: UInt32 = 0,
|
|
maybeU32: UInt32? = nil,
|
|
defaultU32: UInt32 = 42,
|
|
justI64: Int64 = 0,
|
|
maybeI64: Int64? = nil,
|
|
defaultI64: Int64 = 42,
|
|
justU64: UInt64 = 0,
|
|
maybeU64: UInt64? = nil,
|
|
defaultU64: UInt64 = 42,
|
|
justF32: Float32 = 0.0,
|
|
maybeF32: Float32? = nil,
|
|
defaultF32: Float32 = 42.0,
|
|
justF64: Double = 0.0,
|
|
maybeF64: Double? = nil,
|
|
defaultF64: Double = 42.0,
|
|
justBool: Bool = false,
|
|
maybeBool: Bool? = nil,
|
|
defaultBool: Bool = true,
|
|
justEnum: optional_scalars_OptionalByte = .none_,
|
|
maybeEnum: optional_scalars_OptionalByte? = nil,
|
|
defaultEnum: optional_scalars_OptionalByte = .one
|
|
) -> Offset {
|
|
let __start = optional_scalars_ScalarStuff.startScalarStuff(&fbb)
|
|
optional_scalars_ScalarStuff.add(justI8: justI8, &fbb)
|
|
optional_scalars_ScalarStuff.add(maybeI8: maybeI8, &fbb)
|
|
optional_scalars_ScalarStuff.add(defaultI8: defaultI8, &fbb)
|
|
optional_scalars_ScalarStuff.add(justU8: justU8, &fbb)
|
|
optional_scalars_ScalarStuff.add(maybeU8: maybeU8, &fbb)
|
|
optional_scalars_ScalarStuff.add(defaultU8: defaultU8, &fbb)
|
|
optional_scalars_ScalarStuff.add(justI16: justI16, &fbb)
|
|
optional_scalars_ScalarStuff.add(maybeI16: maybeI16, &fbb)
|
|
optional_scalars_ScalarStuff.add(defaultI16: defaultI16, &fbb)
|
|
optional_scalars_ScalarStuff.add(justU16: justU16, &fbb)
|
|
optional_scalars_ScalarStuff.add(maybeU16: maybeU16, &fbb)
|
|
optional_scalars_ScalarStuff.add(defaultU16: defaultU16, &fbb)
|
|
optional_scalars_ScalarStuff.add(justI32: justI32, &fbb)
|
|
optional_scalars_ScalarStuff.add(maybeI32: maybeI32, &fbb)
|
|
optional_scalars_ScalarStuff.add(defaultI32: defaultI32, &fbb)
|
|
optional_scalars_ScalarStuff.add(justU32: justU32, &fbb)
|
|
optional_scalars_ScalarStuff.add(maybeU32: maybeU32, &fbb)
|
|
optional_scalars_ScalarStuff.add(defaultU32: defaultU32, &fbb)
|
|
optional_scalars_ScalarStuff.add(justI64: justI64, &fbb)
|
|
optional_scalars_ScalarStuff.add(maybeI64: maybeI64, &fbb)
|
|
optional_scalars_ScalarStuff.add(defaultI64: defaultI64, &fbb)
|
|
optional_scalars_ScalarStuff.add(justU64: justU64, &fbb)
|
|
optional_scalars_ScalarStuff.add(maybeU64: maybeU64, &fbb)
|
|
optional_scalars_ScalarStuff.add(defaultU64: defaultU64, &fbb)
|
|
optional_scalars_ScalarStuff.add(justF32: justF32, &fbb)
|
|
optional_scalars_ScalarStuff.add(maybeF32: maybeF32, &fbb)
|
|
optional_scalars_ScalarStuff.add(defaultF32: defaultF32, &fbb)
|
|
optional_scalars_ScalarStuff.add(justF64: justF64, &fbb)
|
|
optional_scalars_ScalarStuff.add(maybeF64: maybeF64, &fbb)
|
|
optional_scalars_ScalarStuff.add(defaultF64: defaultF64, &fbb)
|
|
optional_scalars_ScalarStuff.add(justBool: justBool, &fbb)
|
|
optional_scalars_ScalarStuff.add(maybeBool: maybeBool, &fbb)
|
|
optional_scalars_ScalarStuff.add(defaultBool: defaultBool, &fbb)
|
|
optional_scalars_ScalarStuff.add(justEnum: justEnum, &fbb)
|
|
optional_scalars_ScalarStuff.add(maybeEnum: maybeEnum, &fbb)
|
|
optional_scalars_ScalarStuff.add(defaultEnum: defaultEnum, &fbb)
|
|
return optional_scalars_ScalarStuff.endScalarStuff(&fbb, start: __start)
|
|
}
|
|
|
|
public static func verify<T>(_ verifier: inout Verifier, at position: Int, of type: T.Type) throws where T: Verifiable {
|
|
var _v = try verifier.visitTable(at: position)
|
|
try _v.visit(field: VT.justI8, fieldName: "justI8", required: false, type: Int8.self)
|
|
try _v.visit(field: VT.maybeI8, fieldName: "maybeI8", required: false, type: Int8.self)
|
|
try _v.visit(field: VT.defaultI8, fieldName: "defaultI8", required: false, type: Int8.self)
|
|
try _v.visit(field: VT.justU8, fieldName: "justU8", required: false, type: UInt8.self)
|
|
try _v.visit(field: VT.maybeU8, fieldName: "maybeU8", required: false, type: UInt8.self)
|
|
try _v.visit(field: VT.defaultU8, fieldName: "defaultU8", required: false, type: UInt8.self)
|
|
try _v.visit(field: VT.justI16, fieldName: "justI16", required: false, type: Int16.self)
|
|
try _v.visit(field: VT.maybeI16, fieldName: "maybeI16", required: false, type: Int16.self)
|
|
try _v.visit(field: VT.defaultI16, fieldName: "defaultI16", required: false, type: Int16.self)
|
|
try _v.visit(field: VT.justU16, fieldName: "justU16", required: false, type: UInt16.self)
|
|
try _v.visit(field: VT.maybeU16, fieldName: "maybeU16", required: false, type: UInt16.self)
|
|
try _v.visit(field: VT.defaultU16, fieldName: "defaultU16", required: false, type: UInt16.self)
|
|
try _v.visit(field: VT.justI32, fieldName: "justI32", required: false, type: Int32.self)
|
|
try _v.visit(field: VT.maybeI32, fieldName: "maybeI32", required: false, type: Int32.self)
|
|
try _v.visit(field: VT.defaultI32, fieldName: "defaultI32", required: false, type: Int32.self)
|
|
try _v.visit(field: VT.justU32, fieldName: "justU32", required: false, type: UInt32.self)
|
|
try _v.visit(field: VT.maybeU32, fieldName: "maybeU32", required: false, type: UInt32.self)
|
|
try _v.visit(field: VT.defaultU32, fieldName: "defaultU32", required: false, type: UInt32.self)
|
|
try _v.visit(field: VT.justI64, fieldName: "justI64", required: false, type: Int64.self)
|
|
try _v.visit(field: VT.maybeI64, fieldName: "maybeI64", required: false, type: Int64.self)
|
|
try _v.visit(field: VT.defaultI64, fieldName: "defaultI64", required: false, type: Int64.self)
|
|
try _v.visit(field: VT.justU64, fieldName: "justU64", required: false, type: UInt64.self)
|
|
try _v.visit(field: VT.maybeU64, fieldName: "maybeU64", required: false, type: UInt64.self)
|
|
try _v.visit(field: VT.defaultU64, fieldName: "defaultU64", required: false, type: UInt64.self)
|
|
try _v.visit(field: VT.justF32, fieldName: "justF32", required: false, type: Float32.self)
|
|
try _v.visit(field: VT.maybeF32, fieldName: "maybeF32", required: false, type: Float32.self)
|
|
try _v.visit(field: VT.defaultF32, fieldName: "defaultF32", required: false, type: Float32.self)
|
|
try _v.visit(field: VT.justF64, fieldName: "justF64", required: false, type: Double.self)
|
|
try _v.visit(field: VT.maybeF64, fieldName: "maybeF64", required: false, type: Double.self)
|
|
try _v.visit(field: VT.defaultF64, fieldName: "defaultF64", required: false, type: Double.self)
|
|
try _v.visit(field: VT.justBool, fieldName: "justBool", required: false, type: Bool.self)
|
|
try _v.visit(field: VT.maybeBool, fieldName: "maybeBool", required: false, type: Bool.self)
|
|
try _v.visit(field: VT.defaultBool, fieldName: "defaultBool", required: false, type: Bool.self)
|
|
try _v.visit(field: VT.justEnum, fieldName: "justEnum", required: false, type: optional_scalars_OptionalByte.self)
|
|
try _v.visit(field: VT.maybeEnum, fieldName: "maybeEnum", required: false, type: optional_scalars_OptionalByte.self)
|
|
try _v.visit(field: VT.defaultEnum, fieldName: "defaultEnum", required: false, type: optional_scalars_OptionalByte.self)
|
|
_v.finish()
|
|
}
|
|
}
|
|
|
|
extension optional_scalars_ScalarStuff: Encodable {
|
|
enum CodingKeys: String, CodingKey {
|
|
case justI8 = "just_i8"
|
|
case maybeI8 = "maybe_i8"
|
|
case defaultI8 = "default_i8"
|
|
case justU8 = "just_u8"
|
|
case maybeU8 = "maybe_u8"
|
|
case defaultU8 = "default_u8"
|
|
case justI16 = "just_i16"
|
|
case maybeI16 = "maybe_i16"
|
|
case defaultI16 = "default_i16"
|
|
case justU16 = "just_u16"
|
|
case maybeU16 = "maybe_u16"
|
|
case defaultU16 = "default_u16"
|
|
case justI32 = "just_i32"
|
|
case maybeI32 = "maybe_i32"
|
|
case defaultI32 = "default_i32"
|
|
case justU32 = "just_u32"
|
|
case maybeU32 = "maybe_u32"
|
|
case defaultU32 = "default_u32"
|
|
case justI64 = "just_i64"
|
|
case maybeI64 = "maybe_i64"
|
|
case defaultI64 = "default_i64"
|
|
case justU64 = "just_u64"
|
|
case maybeU64 = "maybe_u64"
|
|
case defaultU64 = "default_u64"
|
|
case justF32 = "just_f32"
|
|
case maybeF32 = "maybe_f32"
|
|
case defaultF32 = "default_f32"
|
|
case justF64 = "just_f64"
|
|
case maybeF64 = "maybe_f64"
|
|
case defaultF64 = "default_f64"
|
|
case justBool = "just_bool"
|
|
case maybeBool = "maybe_bool"
|
|
case defaultBool = "default_bool"
|
|
case justEnum = "just_enum"
|
|
case maybeEnum = "maybe_enum"
|
|
case defaultEnum = "default_enum"
|
|
}
|
|
|
|
public func encode(to encoder: Encoder) throws {
|
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
|
if justI8 != 0 {
|
|
try container.encodeIfPresent(justI8, forKey: .justI8)
|
|
}
|
|
try container.encodeIfPresent(maybeI8, forKey: .maybeI8)
|
|
if defaultI8 != 42 {
|
|
try container.encodeIfPresent(defaultI8, forKey: .defaultI8)
|
|
}
|
|
if justU8 != 0 {
|
|
try container.encodeIfPresent(justU8, forKey: .justU8)
|
|
}
|
|
try container.encodeIfPresent(maybeU8, forKey: .maybeU8)
|
|
if defaultU8 != 42 {
|
|
try container.encodeIfPresent(defaultU8, forKey: .defaultU8)
|
|
}
|
|
if justI16 != 0 {
|
|
try container.encodeIfPresent(justI16, forKey: .justI16)
|
|
}
|
|
try container.encodeIfPresent(maybeI16, forKey: .maybeI16)
|
|
if defaultI16 != 42 {
|
|
try container.encodeIfPresent(defaultI16, forKey: .defaultI16)
|
|
}
|
|
if justU16 != 0 {
|
|
try container.encodeIfPresent(justU16, forKey: .justU16)
|
|
}
|
|
try container.encodeIfPresent(maybeU16, forKey: .maybeU16)
|
|
if defaultU16 != 42 {
|
|
try container.encodeIfPresent(defaultU16, forKey: .defaultU16)
|
|
}
|
|
if justI32 != 0 {
|
|
try container.encodeIfPresent(justI32, forKey: .justI32)
|
|
}
|
|
try container.encodeIfPresent(maybeI32, forKey: .maybeI32)
|
|
if defaultI32 != 42 {
|
|
try container.encodeIfPresent(defaultI32, forKey: .defaultI32)
|
|
}
|
|
if justU32 != 0 {
|
|
try container.encodeIfPresent(justU32, forKey: .justU32)
|
|
}
|
|
try container.encodeIfPresent(maybeU32, forKey: .maybeU32)
|
|
if defaultU32 != 42 {
|
|
try container.encodeIfPresent(defaultU32, forKey: .defaultU32)
|
|
}
|
|
if justI64 != 0 {
|
|
try container.encodeIfPresent(justI64, forKey: .justI64)
|
|
}
|
|
try container.encodeIfPresent(maybeI64, forKey: .maybeI64)
|
|
if defaultI64 != 42 {
|
|
try container.encodeIfPresent(defaultI64, forKey: .defaultI64)
|
|
}
|
|
if justU64 != 0 {
|
|
try container.encodeIfPresent(justU64, forKey: .justU64)
|
|
}
|
|
try container.encodeIfPresent(maybeU64, forKey: .maybeU64)
|
|
if defaultU64 != 42 {
|
|
try container.encodeIfPresent(defaultU64, forKey: .defaultU64)
|
|
}
|
|
if justF32 != 0.0 {
|
|
try container.encodeIfPresent(justF32, forKey: .justF32)
|
|
}
|
|
try container.encodeIfPresent(maybeF32, forKey: .maybeF32)
|
|
if defaultF32 != 42.0 {
|
|
try container.encodeIfPresent(defaultF32, forKey: .defaultF32)
|
|
}
|
|
if justF64 != 0.0 {
|
|
try container.encodeIfPresent(justF64, forKey: .justF64)
|
|
}
|
|
try container.encodeIfPresent(maybeF64, forKey: .maybeF64)
|
|
if defaultF64 != 42.0 {
|
|
try container.encodeIfPresent(defaultF64, forKey: .defaultF64)
|
|
}
|
|
if justBool != false {
|
|
try container.encodeIfPresent(justBool, forKey: .justBool)
|
|
}
|
|
try container.encodeIfPresent(maybeBool, forKey: .maybeBool)
|
|
if defaultBool != true {
|
|
try container.encodeIfPresent(defaultBool, forKey: .defaultBool)
|
|
}
|
|
if justEnum != .none_ {
|
|
try container.encodeIfPresent(justEnum, forKey: .justEnum)
|
|
}
|
|
try container.encodeIfPresent(maybeEnum, forKey: .maybeEnum)
|
|
if defaultEnum != .one {
|
|
try container.encodeIfPresent(defaultEnum, forKey: .defaultEnum)
|
|
}
|
|
}
|
|
}
|
|
|