mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-23 09:00:04 +00:00
Implements verifier and code gen for swift (#6373)
Updates test cases on linux Adhere to new protocol naming Adds fuzzing Adds documentation Adds support for string unions Updated fuzzer generated code
This commit is contained in:
@@ -16,6 +16,9 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
/// NativeObject is a protocol that all of the `Object-API` generated code should be
|
||||
/// conforming to since it allows developers the ease of use to pack and unpack their
|
||||
/// Flatbuffers objects
|
||||
public protocol NativeObject {}
|
||||
|
||||
extension NativeObject {
|
||||
@@ -36,7 +39,10 @@ extension NativeObject {
|
||||
/// - Returns: returns the encoded sized ByteBuffer
|
||||
/// - Note: The `serialize(builder:type)` can be considered as a function that allows you to create smaller builder instead of the default `1024`.
|
||||
/// It can be considered less expensive in terms of memory allocation
|
||||
public func serialize<T: ObjectAPIPacker>(builder: inout FlatBufferBuilder, type: T.Type) -> ByteBuffer where T.T == Self {
|
||||
public func serialize<T: ObjectAPIPacker>(
|
||||
builder: inout FlatBufferBuilder,
|
||||
type: T.Type) -> ByteBuffer where T.T == Self
|
||||
{
|
||||
var s = self
|
||||
let root = type.pack(&builder, obj: &s)
|
||||
builder.finish(offset: root)
|
||||
|
||||
Reference in New Issue
Block a user