mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-25 13:28:40 +00:00
[Swift] Inline arrays (#8755)
Implements InlineArrays which allow us to use Flatbuffers arrays within Structs natively, and also implements FlatbufferVectors as a secondary API when using mutable Structs Fixes mutations within fixed sizes arrays Adds tests and remove inout and mutating from generated objects in favor of borrowing --------- Co-authored-by: Wouter van Oortmerssen <aardappel@gmail.com>
This commit is contained in:
@@ -36,10 +36,9 @@ internal struct Message: FlatBufferTable, FlatbuffersVectorInitializable, Verifi
|
||||
Message.add(internalMessage: internalMessage, &fbb)
|
||||
return Message.endMessage(&fbb, start: __start)
|
||||
}
|
||||
|
||||
|
||||
internal mutating func unpack() -> MessageT {
|
||||
return MessageT(&self)
|
||||
internal func unpack() -> MessageT {
|
||||
return MessageT(self)
|
||||
}
|
||||
internal static func pack(_ builder: inout FlatBufferBuilder, obj: inout MessageT?) -> Offset {
|
||||
guard var obj = obj else { return Offset() }
|
||||
@@ -81,7 +80,7 @@ internal class MessageT: NativeObject {
|
||||
|
||||
internal var internalMessage: String?
|
||||
|
||||
internal init(_ _t: inout Message) {
|
||||
internal init(_ _t: borrowing Message) {
|
||||
internalMessage = _t.internalMessage
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user