mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-26 09:12:40 +00:00
[Swift] Migrate to swift 6.0 and Implements support gRPC v2 (#8983)
* 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.
This commit is contained in:
@@ -30,7 +30,7 @@ public struct ByteBuffer {
|
||||
enum Blob {
|
||||
#if !os(WASI)
|
||||
case data(Data)
|
||||
case bytes(ContiguousBytes)
|
||||
case bytes(any ContiguousBytes)
|
||||
#endif
|
||||
|
||||
case byteBuffer(_InternalByteBuffer)
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public enum FlexBufferType: UInt64 {
|
||||
public enum FlexBufferType: UInt64, Sendable {
|
||||
case null = 0
|
||||
/// Variable width signed integer: `Int8, Int16, Int32, Int64`
|
||||
case int = 1
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
import Foundation
|
||||
|
||||
@usableFromInline
|
||||
enum BitWidth: UInt64, CaseIterable {
|
||||
enum BitWidth: UInt64, CaseIterable, Sendable {
|
||||
case w8 = 0
|
||||
case w16 = 1
|
||||
case w32 = 2
|
||||
|
||||
@@ -20,10 +20,10 @@ import Foundation
|
||||
import Common
|
||||
#endif
|
||||
|
||||
public struct Value: Equatable {
|
||||
public struct Value: Equatable, Sendable {
|
||||
|
||||
@usableFromInline
|
||||
enum Union: Equatable {
|
||||
enum Union: Equatable, Sendable {
|
||||
case i(Int64)
|
||||
case u(UInt64)
|
||||
case f(Double)
|
||||
|
||||
@@ -977,6 +977,9 @@ fileprivate struct Stack: RandomAccessCollection {
|
||||
mutating func removeAll(keepingCapacity keepCapacity: Bool = false) {
|
||||
count = 0
|
||||
if !keepCapacity {
|
||||
let ptr = storage.memory
|
||||
defer { ptr.deallocate() }
|
||||
|
||||
capacity = Self.initialCapacity
|
||||
storage.memory = UnsafeMutableRawPointer.allocate(
|
||||
byteCount: capacity,
|
||||
|
||||
Reference in New Issue
Block a user