Enforce Rust and Swift ownership boundary
This commit is contained in:
@@ -494,6 +494,22 @@ fileprivate struct FfiConverterInt64: FfiConverterPrimitive {
|
||||
}
|
||||
}
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
fileprivate struct FfiConverterDouble: FfiConverterPrimitive {
|
||||
typealias FfiType = Double
|
||||
typealias SwiftType = Double
|
||||
|
||||
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Double {
|
||||
return try lift(readDouble(&buf))
|
||||
}
|
||||
|
||||
public static func write(_ value: Double, into buf: inout [UInt8]) {
|
||||
writeDouble(&buf, lower(value))
|
||||
}
|
||||
}
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
@@ -605,6 +621,8 @@ public protocol GotchaCoreProtocol: AnyObject, Sendable {
|
||||
|
||||
func issueFilters(owner: String, repository: String) async throws -> IssueFilterOptions
|
||||
|
||||
func issueFiltersActive(owner: String, repository: String) throws -> Bool
|
||||
|
||||
func issues(owner: String, repository: String) async throws -> [IssueRow]
|
||||
|
||||
func milestone(owner: String, repository: String, id: Int64) async throws -> MilestonePage
|
||||
@@ -621,7 +639,7 @@ public protocol GotchaCoreProtocol: AnyObject, Sendable {
|
||||
|
||||
func repositoryContents(owner: String, repository: String, path: String) async throws -> [RepositoryContentRow]
|
||||
|
||||
func repositoryFile(owner: String, repository: String, path: String) async throws -> Data
|
||||
func repositoryFile(owner: String, repository: String, path: String) async throws -> RepositoryFilePage
|
||||
|
||||
func selectServer(index: UInt32) throws
|
||||
|
||||
@@ -819,10 +837,10 @@ open func issue(owner: String, repository: String, number: Int64)async throws -
|
||||
|
||||
open func issueFilters(owner: String, repository: String)async throws -> IssueFilterOptions {
|
||||
return
|
||||
try await uniffiRustCallAsync(
|
||||
try await uniffiRustCallAsync(
|
||||
rustFutureFunc: {
|
||||
uniffi_gotcha_core_fn_method_gotchacore_issue_filters(
|
||||
self.uniffiCloneHandle(), FfiConverterString.lower(owner), FfiConverterString.lower(repository)
|
||||
self.uniffiCloneHandle(),FfiConverterString.lower(owner),FfiConverterString.lower(repository)
|
||||
)
|
||||
},
|
||||
pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer,
|
||||
@@ -833,6 +851,17 @@ open func issueFilters(owner: String, repository: String)async throws -> IssueF
|
||||
)
|
||||
}
|
||||
|
||||
open func issueFiltersActive(owner: String, repository: String)throws -> Bool {
|
||||
return try FfiConverterBool.lift(try rustCallWithError(FfiConverterTypeGotchaError_lift) {
|
||||
uniffiCallStatus in
|
||||
uniffi_gotcha_core_fn_method_gotchacore_issue_filters_active(
|
||||
self.uniffiCloneHandle(),
|
||||
FfiConverterString.lower(owner),
|
||||
FfiConverterString.lower(repository),uniffiCallStatus
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
open func issues(owner: String, repository: String)async throws -> [IssueRow] {
|
||||
return
|
||||
try await uniffiRustCallAsync(
|
||||
@@ -961,7 +990,7 @@ open func repositoryContents(owner: String, repository: String, path: String)asy
|
||||
)
|
||||
}
|
||||
|
||||
open func repositoryFile(owner: String, repository: String, path: String)async throws -> Data {
|
||||
open func repositoryFile(owner: String, repository: String, path: String)async throws -> RepositoryFilePage {
|
||||
return
|
||||
try await uniffiRustCallAsync(
|
||||
rustFutureFunc: {
|
||||
@@ -972,7 +1001,7 @@ open func repositoryFile(owner: String, repository: String, path: String)async t
|
||||
pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer,
|
||||
completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer,
|
||||
freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer,
|
||||
liftFunc: FfiConverterData.lift,
|
||||
liftFunc: FfiConverterTypeRepositoryFilePage_lift,
|
||||
errorHandler: FfiConverterTypeGotchaError_lift
|
||||
)
|
||||
}
|
||||
@@ -1007,11 +1036,11 @@ open func setAppearance(index: UInt32)throws {try rustCallWithError(FfiConvert
|
||||
open func setIssueFilters(owner: String, repository: String, milestone: String, labels: [String])throws {try rustCallWithError(FfiConverterTypeGotchaError_lift) {
|
||||
uniffiCallStatus in
|
||||
uniffi_gotcha_core_fn_method_gotchacore_set_issue_filters(
|
||||
self.uniffiCloneHandle(),
|
||||
self.uniffiCloneHandle(),
|
||||
FfiConverterString.lower(owner),
|
||||
FfiConverterString.lower(repository),
|
||||
FfiConverterString.lower(milestone),
|
||||
FfiConverterSequenceString.lower(labels), uniffiCallStatus
|
||||
FfiConverterSequenceString.lower(labels),uniffiCallStatus
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1312,8 +1341,7 @@ public func FfiConverterTypeCommitPage_lower(_ value: CommitPage) -> RustBuffer
|
||||
public struct CommitRow: Equatable, Hashable {
|
||||
public var sha: String
|
||||
public var title: String
|
||||
public var meta: String
|
||||
public var refs: String
|
||||
public var detail: String
|
||||
public var topLanes: [UInt32]
|
||||
public var bottomLanes: [UInt32]
|
||||
public var nodeLane: UInt32?
|
||||
@@ -1321,11 +1349,10 @@ public struct CommitRow: Equatable, Hashable {
|
||||
|
||||
// Default memberwise initializers are never public by default, so we
|
||||
// declare one manually.
|
||||
public init(sha: String, title: String, meta: String, refs: String, topLanes: [UInt32], bottomLanes: [UInt32], nodeLane: UInt32?, connections: [UInt32]) {
|
||||
public init(sha: String, title: String, detail: String, topLanes: [UInt32], bottomLanes: [UInt32], nodeLane: UInt32?, connections: [UInt32]) {
|
||||
self.sha = sha
|
||||
self.title = title
|
||||
self.meta = meta
|
||||
self.refs = refs
|
||||
self.detail = detail
|
||||
self.topLanes = topLanes
|
||||
self.bottomLanes = bottomLanes
|
||||
self.nodeLane = nodeLane
|
||||
@@ -1350,8 +1377,7 @@ public struct FfiConverterTypeCommitRow: FfiConverterRustBuffer {
|
||||
try CommitRow(
|
||||
sha: FfiConverterString.read(from: &buf),
|
||||
title: FfiConverterString.read(from: &buf),
|
||||
meta: FfiConverterString.read(from: &buf),
|
||||
refs: FfiConverterString.read(from: &buf),
|
||||
detail: FfiConverterString.read(from: &buf),
|
||||
topLanes: FfiConverterSequenceUInt32.read(from: &buf),
|
||||
bottomLanes: FfiConverterSequenceUInt32.read(from: &buf),
|
||||
nodeLane: FfiConverterOptionUInt32.read(from: &buf),
|
||||
@@ -1362,8 +1388,7 @@ public struct FfiConverterTypeCommitRow: FfiConverterRustBuffer {
|
||||
public static func write(_ value: CommitRow, into buf: inout [UInt8]) {
|
||||
FfiConverterString.write(value.sha, into: &buf)
|
||||
FfiConverterString.write(value.title, into: &buf)
|
||||
FfiConverterString.write(value.meta, into: &buf)
|
||||
FfiConverterString.write(value.refs, into: &buf)
|
||||
FfiConverterString.write(value.detail, into: &buf)
|
||||
FfiConverterSequenceUInt32.write(value.topLanes, into: &buf)
|
||||
FfiConverterSequenceUInt32.write(value.bottomLanes, into: &buf)
|
||||
FfiConverterOptionUInt32.write(value.nodeLane, into: &buf)
|
||||
@@ -1562,20 +1587,14 @@ public func FfiConverterTypeFileRow_lower(_ value: FileRow) -> RustBuffer {
|
||||
|
||||
|
||||
public struct HeatCell: Equatable, Hashable {
|
||||
public var week: UInt32
|
||||
public var day: UInt32
|
||||
public var level: UInt32
|
||||
public var timestamp: Int64
|
||||
public var contributions: Int64
|
||||
|
||||
// Default memberwise initializers are never public by default, so we
|
||||
// declare one manually.
|
||||
public init(week: UInt32, day: UInt32, level: UInt32, timestamp: Int64, contributions: Int64) {
|
||||
self.week = week
|
||||
self.day = day
|
||||
public init(level: UInt32, timestamp: Int64) {
|
||||
self.level = level
|
||||
self.timestamp = timestamp
|
||||
self.contributions = contributions
|
||||
}
|
||||
|
||||
|
||||
@@ -1594,20 +1613,14 @@ public struct FfiConverterTypeHeatCell: FfiConverterRustBuffer {
|
||||
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> HeatCell {
|
||||
return
|
||||
try HeatCell(
|
||||
week: FfiConverterUInt32.read(from: &buf),
|
||||
day: FfiConverterUInt32.read(from: &buf),
|
||||
level: FfiConverterUInt32.read(from: &buf),
|
||||
timestamp: FfiConverterInt64.read(from: &buf),
|
||||
contributions: FfiConverterInt64.read(from: &buf)
|
||||
timestamp: FfiConverterInt64.read(from: &buf)
|
||||
)
|
||||
}
|
||||
|
||||
public static func write(_ value: HeatCell, into buf: inout [UInt8]) {
|
||||
FfiConverterUInt32.write(value.week, into: &buf)
|
||||
FfiConverterUInt32.write(value.day, into: &buf)
|
||||
FfiConverterUInt32.write(value.level, into: &buf)
|
||||
FfiConverterInt64.write(value.timestamp, into: &buf)
|
||||
FfiConverterInt64.write(value.contributions, into: &buf)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1630,14 +1643,18 @@ public func FfiConverterTypeHeatCell_lower(_ value: HeatCell) -> RustBuffer {
|
||||
public struct HomePage: Equatable, Hashable {
|
||||
public var serverName: String
|
||||
public var activities: [ActivityRow]
|
||||
public var issueActivities: [ActivityRow]
|
||||
public var pullActivities: [ActivityRow]
|
||||
public var heatCells: [HeatCell]
|
||||
public var contributionCount: Int64
|
||||
|
||||
// Default memberwise initializers are never public by default, so we
|
||||
// declare one manually.
|
||||
public init(serverName: String, activities: [ActivityRow], heatCells: [HeatCell], contributionCount: Int64) {
|
||||
public init(serverName: String, activities: [ActivityRow], issueActivities: [ActivityRow], pullActivities: [ActivityRow], heatCells: [HeatCell], contributionCount: Int64) {
|
||||
self.serverName = serverName
|
||||
self.activities = activities
|
||||
self.issueActivities = issueActivities
|
||||
self.pullActivities = pullActivities
|
||||
self.heatCells = heatCells
|
||||
self.contributionCount = contributionCount
|
||||
}
|
||||
@@ -1660,6 +1677,8 @@ public struct FfiConverterTypeHomePage: FfiConverterRustBuffer {
|
||||
try HomePage(
|
||||
serverName: FfiConverterString.read(from: &buf),
|
||||
activities: FfiConverterSequenceTypeActivityRow.read(from: &buf),
|
||||
issueActivities: FfiConverterSequenceTypeActivityRow.read(from: &buf),
|
||||
pullActivities: FfiConverterSequenceTypeActivityRow.read(from: &buf),
|
||||
heatCells: FfiConverterSequenceTypeHeatCell.read(from: &buf),
|
||||
contributionCount: FfiConverterInt64.read(from: &buf)
|
||||
)
|
||||
@@ -1668,6 +1687,8 @@ public struct FfiConverterTypeHomePage: FfiConverterRustBuffer {
|
||||
public static func write(_ value: HomePage, into buf: inout [UInt8]) {
|
||||
FfiConverterString.write(value.serverName, into: &buf)
|
||||
FfiConverterSequenceTypeActivityRow.write(value.activities, into: &buf)
|
||||
FfiConverterSequenceTypeActivityRow.write(value.issueActivities, into: &buf)
|
||||
FfiConverterSequenceTypeActivityRow.write(value.pullActivities, into: &buf)
|
||||
FfiConverterSequenceTypeHeatCell.write(value.heatCells, into: &buf)
|
||||
FfiConverterInt64.write(value.contributionCount, into: &buf)
|
||||
}
|
||||
@@ -1692,17 +1713,23 @@ public func FfiConverterTypeHomePage_lower(_ value: HomePage) -> RustBuffer {
|
||||
public struct IssueFilterOptions: Equatable, Hashable {
|
||||
public var milestones: [String]
|
||||
public var labels: [String]
|
||||
public var unavailableLabels: [String]
|
||||
public var selectedMilestone: String
|
||||
public var selectedLabels: [String]
|
||||
|
||||
// Default memberwise initializers are never public by default, so we
|
||||
// declare one manually.
|
||||
public init(milestones: [String], labels: [String], selectedMilestone: String, selectedLabels: [String]) {
|
||||
public init(milestones: [String], labels: [String], unavailableLabels: [String], selectedMilestone: String, selectedLabels: [String]) {
|
||||
self.milestones = milestones
|
||||
self.labels = labels
|
||||
self.unavailableLabels = unavailableLabels
|
||||
self.selectedMilestone = selectedMilestone
|
||||
self.selectedLabels = selectedLabels
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#if compiler(>=6)
|
||||
@@ -1718,6 +1745,7 @@ public struct FfiConverterTypeIssueFilterOptions: FfiConverterRustBuffer {
|
||||
try IssueFilterOptions(
|
||||
milestones: FfiConverterSequenceString.read(from: &buf),
|
||||
labels: FfiConverterSequenceString.read(from: &buf),
|
||||
unavailableLabels: FfiConverterSequenceString.read(from: &buf),
|
||||
selectedMilestone: FfiConverterString.read(from: &buf),
|
||||
selectedLabels: FfiConverterSequenceString.read(from: &buf)
|
||||
)
|
||||
@@ -1726,11 +1754,13 @@ public struct FfiConverterTypeIssueFilterOptions: FfiConverterRustBuffer {
|
||||
public static func write(_ value: IssueFilterOptions, into buf: inout [UInt8]) {
|
||||
FfiConverterSequenceString.write(value.milestones, into: &buf)
|
||||
FfiConverterSequenceString.write(value.labels, into: &buf)
|
||||
FfiConverterSequenceString.write(value.unavailableLabels, into: &buf)
|
||||
FfiConverterString.write(value.selectedMilestone, into: &buf)
|
||||
FfiConverterSequenceString.write(value.selectedLabels, into: &buf)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
@@ -2003,18 +2033,20 @@ public struct MilestoneRow: Equatable, Hashable {
|
||||
public var title: String
|
||||
public var description: String
|
||||
public var meta: String
|
||||
public var openIssues: Int64
|
||||
public var closedIssues: Int64
|
||||
public var hasIssues: Bool
|
||||
public var progress: Double
|
||||
public var progressAccessibility: String
|
||||
|
||||
// Default memberwise initializers are never public by default, so we
|
||||
// declare one manually.
|
||||
public init(id: Int64, title: String, description: String, meta: String, openIssues: Int64, closedIssues: Int64) {
|
||||
public init(id: Int64, title: String, description: String, meta: String, hasIssues: Bool, progress: Double, progressAccessibility: String) {
|
||||
self.id = id
|
||||
self.title = title
|
||||
self.description = description
|
||||
self.meta = meta
|
||||
self.openIssues = openIssues
|
||||
self.closedIssues = closedIssues
|
||||
self.hasIssues = hasIssues
|
||||
self.progress = progress
|
||||
self.progressAccessibility = progressAccessibility
|
||||
}
|
||||
|
||||
|
||||
@@ -2037,8 +2069,9 @@ public struct FfiConverterTypeMilestoneRow: FfiConverterRustBuffer {
|
||||
title: FfiConverterString.read(from: &buf),
|
||||
description: FfiConverterString.read(from: &buf),
|
||||
meta: FfiConverterString.read(from: &buf),
|
||||
openIssues: FfiConverterInt64.read(from: &buf),
|
||||
closedIssues: FfiConverterInt64.read(from: &buf)
|
||||
hasIssues: FfiConverterBool.read(from: &buf),
|
||||
progress: FfiConverterDouble.read(from: &buf),
|
||||
progressAccessibility: FfiConverterString.read(from: &buf)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -2047,8 +2080,9 @@ public struct FfiConverterTypeMilestoneRow: FfiConverterRustBuffer {
|
||||
FfiConverterString.write(value.title, into: &buf)
|
||||
FfiConverterString.write(value.description, into: &buf)
|
||||
FfiConverterString.write(value.meta, into: &buf)
|
||||
FfiConverterInt64.write(value.openIssues, into: &buf)
|
||||
FfiConverterInt64.write(value.closedIssues, into: &buf)
|
||||
FfiConverterBool.write(value.hasIssues, into: &buf)
|
||||
FfiConverterDouble.write(value.progress, into: &buf)
|
||||
FfiConverterString.write(value.progressAccessibility, into: &buf)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2270,6 +2304,72 @@ public func FfiConverterTypeRepositoryContentRow_lower(_ value: RepositoryConten
|
||||
}
|
||||
|
||||
|
||||
public struct RepositoryFilePage: Equatable, Hashable {
|
||||
public var name: String
|
||||
public var kind: String
|
||||
public var language: String
|
||||
public var text: String
|
||||
public var data: Data
|
||||
|
||||
// Default memberwise initializers are never public by default, so we
|
||||
// declare one manually.
|
||||
public init(name: String, kind: String, language: String, text: String, data: Data) {
|
||||
self.name = name
|
||||
self.kind = kind
|
||||
self.language = language
|
||||
self.text = text
|
||||
self.data = data
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#if compiler(>=6)
|
||||
extension RepositoryFilePage: Sendable {}
|
||||
#endif
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
public struct FfiConverterTypeRepositoryFilePage: FfiConverterRustBuffer {
|
||||
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RepositoryFilePage {
|
||||
return
|
||||
try RepositoryFilePage(
|
||||
name: FfiConverterString.read(from: &buf),
|
||||
kind: FfiConverterString.read(from: &buf),
|
||||
language: FfiConverterString.read(from: &buf),
|
||||
text: FfiConverterString.read(from: &buf),
|
||||
data: FfiConverterData.read(from: &buf)
|
||||
)
|
||||
}
|
||||
|
||||
public static func write(_ value: RepositoryFilePage, into buf: inout [UInt8]) {
|
||||
FfiConverterString.write(value.name, into: &buf)
|
||||
FfiConverterString.write(value.kind, into: &buf)
|
||||
FfiConverterString.write(value.language, into: &buf)
|
||||
FfiConverterString.write(value.text, into: &buf)
|
||||
FfiConverterData.write(value.data, into: &buf)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
public func FfiConverterTypeRepositoryFilePage_lift(_ buf: RustBuffer) throws -> RepositoryFilePage {
|
||||
return try FfiConverterTypeRepositoryFilePage.lift(buf)
|
||||
}
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
public func FfiConverterTypeRepositoryFilePage_lower(_ value: RepositoryFilePage) -> RustBuffer {
|
||||
return FfiConverterTypeRepositoryFilePage.lower(value)
|
||||
}
|
||||
|
||||
|
||||
public struct RepositoryRow: Equatable, Hashable {
|
||||
public var name: String
|
||||
public var owner: String
|
||||
@@ -3035,6 +3135,9 @@ private let initializationResult: InitializationResult = {
|
||||
if (uniffi_gotcha_core_checksum_method_gotchacore_issue_filters() != 24054) {
|
||||
return InitializationResult.apiChecksumMismatch
|
||||
}
|
||||
if (uniffi_gotcha_core_checksum_method_gotchacore_issue_filters_active() != 51470) {
|
||||
return InitializationResult.apiChecksumMismatch
|
||||
}
|
||||
if (uniffi_gotcha_core_checksum_method_gotchacore_issues() != 1316) {
|
||||
return InitializationResult.apiChecksumMismatch
|
||||
}
|
||||
@@ -3059,7 +3162,7 @@ private let initializationResult: InitializationResult = {
|
||||
if (uniffi_gotcha_core_checksum_method_gotchacore_repository_contents() != 8454) {
|
||||
return InitializationResult.apiChecksumMismatch
|
||||
}
|
||||
if (uniffi_gotcha_core_checksum_method_gotchacore_repository_file() != 27399) {
|
||||
if (uniffi_gotcha_core_checksum_method_gotchacore_repository_file() != 44948) {
|
||||
return InitializationResult.apiChecksumMismatch
|
||||
}
|
||||
if (uniffi_gotcha_core_checksum_method_gotchacore_select_server() != 22721) {
|
||||
@@ -3109,4 +3212,4 @@ public func uniffiEnsureGotchaCoreInitialized() {
|
||||
}
|
||||
}
|
||||
|
||||
// swiftlint:enable all
|
||||
// swiftlint:enable all
|
||||
Reference in New Issue
Block a user