add flatbuffers
commit 6da1cf79d90eb242e7da5318241d42279a3df3ba Author: Max Burke <max@urbanlogiq.com> Date: Sun Jan 19 14:47:28 2020 -0800 [rust] Add use declarations to Rust-generated bindings for imported FB definitions (#5645) * Bugfix for Rust generation of union fields named with language keywords
This commit is contained in:
16
flatbuffers/swift/Sources/FlatBuffers/Struct.swift
Normal file
16
flatbuffers/swift/Sources/FlatBuffers/Struct.swift
Normal file
@ -0,0 +1,16 @@
|
||||
import Foundation
|
||||
|
||||
public struct Struct {
|
||||
public private(set) var bb: ByteBuffer
|
||||
public private(set) var postion: Int32
|
||||
|
||||
public init(bb: ByteBuffer, position: Int32 = 0) {
|
||||
self.bb = bb
|
||||
self.postion = position
|
||||
}
|
||||
|
||||
public func readBuffer<T: Scalar>(of type: T.Type, at o: Int32) -> T {
|
||||
let r = bb.read(def: T.self, position: Int(o + postion))
|
||||
return r
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user