Added Rust proton_mail_uniffi library + first integration

This commit is contained in:
Xavi Gil
2024-03-12 11:47:47 +01:00
parent 72872823ee
commit aad6f0b2b1
40 changed files with 13364 additions and 66 deletions
+137
View File
@@ -0,0 +1,137 @@
// Copyright (c) 2024 Proton Technologies AG
//
// This file is part of Proton Mail.
//
// Proton Mail is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Proton Mail is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Proton Mail. If not, see https://www.gnu.org/licenses/.
import SwiftUI
final class AppDelegate: NSObject, UIApplicationDelegate {
private let appDelegateManager = AppDelegateWrapper()
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil
) -> Bool {
return appDelegateManager.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
import proton_mail_uniffi
struct AppDelegateWrapper {
private let dependencies: Dependencies
init(dependencies: Dependencies = .init()) {
self.dependencies = dependencies
}
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]?
) -> Bool {
do {
try dependencies.appContext.start()
return true
} catch {
print("❌ error launching the app \(error)")
return false
}
}
}
extension AppDelegateWrapper {
struct Dependencies {
let appContext: AppContext = .shared
}
}
//final class AppContext {
// let appSession: AppSession
//
// init() throws {
// self.appSession = try AppSession()
// }
//}
class Dummy {
func start(email: String, password: String) async throws {
print("email: \(email)")
guard let applicationSupport = FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask).first else {
throw AppSessionError.applicationSupportDirectoryNotAccessible
}
let applicationSupportPath = applicationSupport.path()
// TODO: exclude application support from iCloud backup
let mailContext = try MailContext(
sessionDir: applicationSupportPath,
userDir: applicationSupportPath,
logDir: applicationSupportPath,
logDebug: true,
keyChain: Keychain.shared,
networkCallback: NetworkStatusManager.shared
)
let flow = try mailContext.newLoginFlow(cb: SessionDelegate.shared)
try await flow.login(email: email, password: password)
// .isAwaiting2fa has a bug
// if flow.isAwaiting2fa() {
// print(" WAITING 2FA!")
// try await flow.submitTotp(code: "")
// }
// if flow.isLoggedIn() {
// let userContext = try flow.toUserContext() // flow object can now be discarded.
// }
// For an existing session
let sessions = try mailContext.storedSessions()
guard let activeSession = sessions.first else {
print("❌ No active session")
return
}
let userContext = try mailContext.userContextFromSession(session: activeSession, cb: SessionDelegate.shared)
try await userContext.initialize(cb: UserContextInitializationDelegate.shared)
let mailbox = try Mailbox(ctx: userContext)
let conversations = try mailbox.conversations(count: 50)
print(conversations)
}
}
enum AppSessionError: Error {
case applicationSupportDirectoryNotAccessible
}
enum Keys: String {
case session
}
+3 -2
View File
@@ -20,14 +20,15 @@ import DesignSystem
@main
struct ProtonMail: App {
let appState = AppState()
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
let appUIState = AppUIState(isSidebarOpen: false)
let userSettings = UserSettings(mailboxViewMode: .conversation)
var body: some Scene {
WindowGroup {
Root()
.environmentObject(appState)
.environmentObject(AppContext.shared.appState)
.environmentObject(appUIState)
.environmentObject(userSettings)
}
+2 -2
View File
@@ -30,7 +30,7 @@ enum PreviewData {
.init(id: UUID().uuidString, name: "Settings", icon: DS.Icon.icCogWheel, badge: "", route: .settings),
])
static var mailboxConversationScreenModel: MailboxConversationScreenModel {
static var mailboxConversations: [MailboxConversationCellUIModel] {
let conversations: [MailboxConversationCellUIModel] = (1..<100).map { value in
let randomSenderSubject = randomSenderSubject()
@@ -50,7 +50,7 @@ enum PreviewData {
expirationDate: expirationDate ? .init(text: "Expires in < 5 minutes", color: DS.Color.notificationError) : .init(text: "", color: .clear)
)
}
return .init(conversations: conversations)
return conversations
}
static let mailboxLabels: [MailboxLabelUIModel] = [
+172
View File
@@ -0,0 +1,172 @@
// Copyright (c) 2024 Proton Technologies AG
//
// This file is part of Proton Mail.
//
// Proton Mail is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Proton Mail is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Proton Mail. If not, see https://www.gnu.org/licenses/.
import Foundation
import proton_mail_uniffi
protocol AppContextService {
init(dependencies: AppContext.Dependencies)
func start() async throws
func loginFlow() throws -> LoginFlow
func userContextForActiveSession() async throws -> MailUserContext?
}
final class AppContext: AppContextService {
static let shared: AppContext = .init()
private var _mailContext: MailContext!
private let dependencies: AppContext.Dependencies
private var mailContext: MailContext {
guard let mailContext = _mailContext else {
fatalError("AppSession.start was not called")
}
return mailContext
}
private (set) var appState: AppState
var activeSession: StoredSession? {
do {
return try mailContext.storedSessions().first
} catch {
print("❌ mailContext.storedSessions error: \(error)")
return nil
}
}
init(dependencies: Dependencies = .init()) {
self.dependencies = dependencies
self.appState = AppState()
}
func start() throws {
guard let applicationSupport = FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask).first else {
throw AppSessionError.applicationSupportDirectoryNotAccessible
}
// TODO: exclude application support from iCloud backup
let applicationSupportPath = applicationSupport.path()
_mailContext = try MailContext(
sessionDir: applicationSupportPath,
userDir: applicationSupportPath,
logDir: applicationSupportPath,
logDebug: true,
keyChain: dependencies.keychain,
networkCallback: dependencies.networkStatus
)
appState.appContext = self
Task {
await refreshAppState()
}
}
func removeSession() async {
try? dependencies.keychain.delete()
await refreshAppState()
}
func loginFlow() throws -> LoginFlow {
try mailContext.newLoginFlow(cb: SessionDelegate.shared)
}
func userContextForActiveSession() async throws -> MailUserContext? {
guard let activeSession else { return nil }
let userContext = try mailContext.userContextFromSession(session: activeSession, cb: SessionDelegate.shared)
try await userContext.initialize(cb: UserContextInitializationDelegate.shared)
return userContext
}
func refreshAppState() async {
await appState.refresh()
}
}
extension AppContext {
struct Dependencies {
let fileManager: FileManager = .default
let keychain: OsKeyChain = Keychain.shared
let networkStatus: NetworkStatusChanged = NetworkStatusManager.shared
}
}
final class Keychain: OsKeyChain {
static let shared = Keychain()
// TODO: use the keychain
func store(key: String) throws {
print("KeychainWrapper.store key:\(key)")
UserDefaults.standard.setValue(key, forKey: Keys.session.rawValue)
}
func delete() throws {
let existingKey: String = (try? get()) ?? ""
print("KeychainWrapper.delete, existing value: \(existingKey)")
UserDefaults.standard.removeObject(forKey: Keys.session.rawValue)
}
func get() throws -> String? {
let value = UserDefaults.standard.string(forKey: Keys.session.rawValue)
print("KeychainWrapper.get \(value ?? "-")")
return value
}
}
final class NetworkStatusManager: NetworkStatusChanged {
static let shared = NetworkStatusManager()
func onNetworkStatusChanged(online: Bool) {
print("onNetworkStatusChanged online: \(online)")
}
}
final class SessionDelegate: SessionCallback {
static let shared = SessionDelegate()
func onSessionRefresh() {
print("onSessionRefresh")
}
func onSessionDeleted() {
print("onSessionDeleted")
}
func onRefreshFailed(e: proton_mail_uniffi.SessionError) {
print("onRefreshFailed error: \(e)")
}
func onError(err: proton_mail_uniffi.SessionError) {
print("onError error: \(err)")
}
}
final class UserContextInitializationDelegate: MailUserContextInitializationCallback {
static let shared = UserContextInitializationDelegate()
func onStage(stage: proton_mail_uniffi.MailUserContextInitializationStage) {
print("UserContextInitializationDelegate.onStage stage: \(stage)")
}
func onStageErr(stage: proton_mail_uniffi.MailUserContextInitializationStage, err: proton_mail_uniffi.MailContextError) {
print("UserContextInitializationDelegate.onStageError stage: \(stage) error: \(err)")
}
}
+13 -10
View File
@@ -16,23 +16,26 @@
// along with Proton Mail. If not, see https://www.gnu.org/licenses/.
import Foundation
import proton_mail_uniffi
final class AppState: ObservableObject {
@Published private (set) var activeSession: MailSession?
@Published private (set) var activeSession: Bool = false
weak var appContext: AppContext?
var hasAuthenticatedSession: Bool {
activeSession != nil
appContext?.activeSession != nil
}
func addActiveSession(_ session: MailSession) {
activeSession = session
@MainActor
func refresh() {
activeSession = hasAuthenticatedSession
}
func removeSession() {
activeSession = nil
func removeActiveSession() {
guard let appContext else { return }
Task {
await appContext.removeSession()
}
}
}
struct MailSession {
}
@@ -34,7 +34,7 @@ struct MailboxConversationCell: View {
HStack(spacing: 16.0) {
AvatarCheckboxView(
isSelected: uiModel.isSelected,
isSelected: uiModel.isSelected.value,
avatar: uiModel.avatar,
onDidChangeSelection: { onEvent(.onSelectedChange(isSelected: $0)) }
)
@@ -94,12 +94,12 @@ struct MailboxConversationCell: View {
}
}
.padding(14)
.background(uiModel.isSelected ? DS.Color.backgroundSecondary : Color(UIColor.systemBackground))
.background(uiModel.isSelected.value ? DS.Color.backgroundSecondary : Color(UIColor.systemBackground))
}
}
@Observable
final class MailboxConversationCellUIModel: Identifiable {
final class MailboxConversationCellUIModel: Identifiable, Sendable {
let id: String
let avatar: AvatarUIModel
let senders: String
@@ -108,7 +108,7 @@ final class MailboxConversationCellUIModel: Identifiable {
let isRead: Bool
let isStarred: Bool
var isSelected: Bool = false
let isSelected = SendableBool(false)
let isSenderProtonOfficial: Bool
let numMessages: Int
@@ -169,7 +169,7 @@ enum MailboxConversationCellEvent {
)
}
let model1 = model
model1.isSelected = true
model1.isSelected.set(true)
return VStack {
@@ -22,40 +22,60 @@ struct MailboxConversationScreen: View {
@State var model: MailboxConversationScreenModel
var body: some View {
List {
ForEach(model.conversations) { conversation in
MailboxConversationCell(
uiModel: conversation,
onEvent: { [weak model] event in
switch event {
case .onSelectedChange(let isSelected):
model?.onConversationSelectionChange(id: conversation.id, isSelected: isSelected)
case .onStarredChange(let isStarred):
model?.onConversationStarChange(id: conversation.id, isStarred: isStarred)
case .onAttachmentTap(let attachmentId):
model?.onAttachmentTap(attachmentId: attachmentId)
}
ZStack {
switch model.state {
case .loading:
VStack {
Spacer()
ProgressView()
Spacer()
}
case .empty:
VStack {
Text("No conversations")
}
case .data(let conversations):
List {
ForEach(conversations) { conversation in
MailboxConversationCell(
uiModel: conversation,
onEvent: { [weak model] event in
switch event {
case .onSelectedChange(let isSelected):
model?.onConversationSelectionChange(id: conversation.id, isSelected: isSelected)
case .onStarredChange(let isStarred):
model?.onConversationStarChange(id: conversation.id, isStarred: isStarred)
case .onAttachmentTap(let attachmentId):
model?.onAttachmentTap(attachmentId: attachmentId)
}
}
)
.listRowInsets(
.init(top: 1, leading: 1, bottom: 1, trailing: 0)
)
.listRowSeparator(.hidden)
.compositingGroup()
.clipShape(
.rect(
topLeadingRadius: 20,
bottomLeadingRadius: 20,
bottomTrailingRadius: 0,
topTrailingRadius: 0
)
)
}
)
.listRowInsets(
.init(top: 1, leading: 1, bottom: 1, trailing: 0)
)
.listRowSeparator(.hidden)
.compositingGroup()
.clipShape(
.rect(
topLeadingRadius: 20,
bottomLeadingRadius: 20,
bottomTrailingRadius: 0,
topTrailingRadius: 0
)
)
}
.listStyle(.plain)
}
}
.onAppear {
Task {
await model.fecthConversations()
}
}
.listStyle(.plain)
}
}
#Preview {
return MailboxConversationScreen(model: PreviewData.mailboxConversationScreenModel)
return MailboxConversationScreen(model: .init(conversations: PreviewData.mailboxConversations))
}
@@ -17,15 +17,74 @@
import Foundation
import struct SwiftUI.Color
import proton_mail_uniffi
typealias ConversationId = String
enum MailboxConversationScreenState: Sendable {
case loading
case empty
case data([MailboxConversationCellUIModel])
var isEmpty: Bool {
switch self {
case .empty: return true
case .loading, .data: return false
}
}
var isLoading: Bool {
switch self {
case .loading: return true
case .empty, .data: return false
}
}
var conversations: [MailboxConversationCellUIModel] {
switch self {
case .data(let conversations): return conversations
case .empty, .loading: return []
}
}
}
@Observable
final class MailboxConversationScreenModel {
private(set) var conversations: [MailboxConversationCellUIModel]
private let dependencies: Dependencies
private(set) var state: MailboxConversationScreenState = .loading
init(conversations: [MailboxConversationCellUIModel]) {
self.conversations = conversations
var conversations: [MailboxConversationCellUIModel] {
state.conversations
}
var isLoading: Bool {
state.isLoading
}
var isEmpty: Bool {
state.isEmpty
}
init(conversations: [MailboxConversationCellUIModel] = [], dependencies: Dependencies = .init()) {
self.state = conversations.isEmpty ? .empty : .data(conversations)
self.dependencies = dependencies
}
func fecthConversations() async {
do {
await updateState(.loading)
guard let userContext = try await dependencies.appContext.userContextForActiveSession() else {
return
}
let mailbox = try Mailbox(ctx: userContext)
let conversations = try mailbox.conversations(count: 50)
await updateState(.data(conversations.map { $0.toMailboxConversationCellUIModel() }))
} catch {
print("❌ fetchConversations error: \(error)")
}
}
@MainActor
private func updateState(_ state: MailboxConversationScreenState) {
self.state = state
}
@MainActor
@@ -33,7 +92,7 @@ final class MailboxConversationScreenModel {
guard let index = conversations.firstIndex(where: { $0.id == id }) else {
return
}
conversations[index].isSelected = isSelected
conversations[index].isSelected.set(isSelected)
}
func onConversationStarChange(id: String, isStarred: Bool) {
@@ -47,3 +106,62 @@ final class MailboxConversationScreenModel {
print("Attachment tapped \(attachmentId)")
}
}
extension MailboxConversationScreenModel {
struct Dependencies {
let appContext: AppContext = .shared
}
}
extension LocalConversation {
var initials: String {
(senders.first?.senderName.prefix(2) ?? "P").uppercased()
}
func toLabel() -> MailboxLabelUIModel {
guard
let labels = self.labels,
let firstLabel = labels.first
else { return .init() }
return .init(
id: String(firstLabel.id),
color: Color(hex: firstLabel.color),
text: firstLabel.name,
numExtraLabels: labels.count
)
}
func toMailboxConversationCellUIModel() -> MailboxConversationCellUIModel {
.init(
id: remoteId ?? String(id),
avatar: .init(initials: initials),
senders: senders.map(\.senderName).joined(separator: ", "),
subject: subject,
date: Date(timeIntervalSince1970: TimeInterval(time)),
isRead: numUnread == 0,
isStarred: false, // TODO:
isSenderProtonOfficial: senders.first?.isProton.isTrue ?? false,
numMessages: numMessages > 1 ? Int(numMessages) : 0,
labelUIModel: toLabel(),
expirationDate: .init(text: "", color: .black)
)
}
}
extension MessageAddress {
var senderName: String {
!name.isEmpty ? name : address
}
}
extension ProtonBoolean {
var isTrue: Bool {
switch self {
case .true: return true
case .false: return false
}
}
}
+1 -1
View File
@@ -26,7 +26,7 @@ struct MailboxScreen: View {
NavigationStack {
ZStack {
if userSettings.mailboxViewMode == .conversation {
MailboxConversationScreen(model: PreviewData.mailboxConversationScreenModel)
MailboxConversationScreen(model: .init())
} else {
Text("message list mailbox")
}
+1 -1
View File
@@ -34,7 +34,7 @@ struct MailboxToolbar: ViewModifier {
}
ToolbarItem(placement: .navigationBarTrailing) {
Button(action: {
appState.removeSession()
appState.removeActiveSession()
}, label: {
Text("sign out")
.font(.footnote)
+29 -11
View File
@@ -24,6 +24,8 @@ struct SignIn: View {
@State private var email: String = ""
@State private var password: String = ""
private let screenModel: SignInScreenModel = .init()
var body: some View {
VStack(spacing: 28) {
Spacer()
@@ -39,6 +41,8 @@ struct SignIn: View {
.frame(height: 44)
.padding(.horizontal, 12)
.background(Color.white)
.textInputAutocapitalization(.never)
.keyboardType(.emailAddress)
}
VStack(alignment: .leading, spacing: 11) {
@@ -54,18 +58,32 @@ struct SignIn: View {
.background(Color.white)
}
Button {
hideKeyboard()
print("\(email) \(password)")
appState.addActiveSession(MailSession())
} label: {
Text("Sign In")
.foregroundColor(.white)
.frame(width: 215, height: 44, alignment: .center)
if screenModel.isLoading {
HStack {
Spacer()
ProgressView()
Spacer()
}
} else {
Button {
hideKeyboard()
screenModel.login(email: email, password: password)
} label: {
Text("Sign In")
.foregroundColor(.white)
.frame(width: 215, height: 44, alignment: .center)
}
.background(.secondary)
.cornerRadius(4)
.padding(.top, 36)
.alert(screenModel.errorMessage, isPresented: screenModel.isErrorPresented) {
Button("OK") {
screenModel.showError = false
}
}
}
.background(.secondary)
.cornerRadius(4)
.padding(.top, 36)
Spacer()
}
@@ -0,0 +1,66 @@
// Copyright (c) 2024 Proton Technologies AG
//
// This file is part of Proton Mail.
//
// Proton Mail is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Proton Mail is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Proton Mail. If not, see https://www.gnu.org/licenses/.
import proton_mail_uniffi
import SwiftUI
@Observable
final class SignInScreenModel: Sendable {
private let dependencies: Dependencies
private(set) var isLoading = false
private(set) var errorMessage: String = "" {
didSet {
showError = !errorMessage.isEmpty
}
}
var showError: Bool = false
var isErrorPresented: Binding<Bool> {
Binding(get: {
self.showError
}, set: {
self.showError = $0
})
}
init(dependencies: Dependencies = .init()) {
self.dependencies = dependencies
}
func login(email: String, password: String) {
Task {
isLoading = true
let flow = try dependencies.appContext.loginFlow()
do {
try await flow.login(email: email, password: password)
await dependencies.appContext.refreshAppState()
} catch {
errorMessage = error.localizedDescription
}
isLoading = false
}
}
}
extension SignInScreenModel {
struct Dependencies: Sendable {
let appContext: AppContext = .shared
}
}
extension AppContext: @unchecked Sendable {}
+39
View File
@@ -0,0 +1,39 @@
// Copyright (c) 2024 Proton Technologies AG
//
// This file is part of Proton Mail.
//
// Proton Mail is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Proton Mail is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Proton Mail. If not, see https://www.gnu.org/licenses/.
import Foundation
/**
Bolean representation for Sendable objects that need mutation.
A common example would be a UI cell model that needs to be selected.
Notice that @unchecked Sendable is ensured by the @MainActor annotation in the setter function
*/
@Observable
final class SendableBool: @unchecked Sendable {
private(set) var value: Bool
init(_ value: Bool) {
self.value = value
}
@MainActor
func set(_ value: Bool) {
self.value = value
}
}
@@ -0,0 +1,32 @@
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "proton_mail_uniffi",
platforms: [
.iOS(.v15),
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "proton_mail_uniffi",
targets: ["proton_mail_uniffi", "proton_mail_uniffi_ffi"]
),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "proton_mail_uniffi",
dependencies: ["proton_mail_uniffi_ffi"]
),
.binaryTarget(name: "proton_mail_uniffi_ffi", path: "Sources/proton_mail_uniffi_ffi.xcframework"),
]
)
@@ -0,0 +1,366 @@
// This file was autogenerated by some hot garbage in the `uniffi` crate.
// Trust me, you don't want to mess with it!
import Foundation
// Depending on the consumer's build setup, the low-level FFI code
// might be in a separate module, or it might be compiled inline into
// this module. This is a bit of light hackery to work with both.
#if canImport(proton_mail_uniffi_ffi)
import proton_mail_uniffi_ffi
#endif
fileprivate extension RustBuffer {
// Allocate a new buffer, copying the contents of a `UInt8` array.
init(bytes: [UInt8]) {
let rbuf = bytes.withUnsafeBufferPointer { ptr in
RustBuffer.from(ptr)
}
self.init(capacity: rbuf.capacity, len: rbuf.len, data: rbuf.data)
}
static func from(_ ptr: UnsafeBufferPointer<UInt8>) -> RustBuffer {
try! rustCall { ffi_proton_core_common_rustbuffer_from_bytes(ForeignBytes(bufferPointer: ptr), $0) }
}
// Frees the buffer in place.
// The buffer must not be used after this is called.
func deallocate() {
try! rustCall { ffi_proton_core_common_rustbuffer_free(self, $0) }
}
}
fileprivate extension ForeignBytes {
init(bufferPointer: UnsafeBufferPointer<UInt8>) {
self.init(len: Int32(bufferPointer.count), data: bufferPointer.baseAddress)
}
}
// For every type used in the interface, we provide helper methods for conveniently
// lifting and lowering that type from C-compatible data, and for reading and writing
// values of that type in a buffer.
// Helper classes/extensions that don't change.
// Someday, this will be in a library of its own.
fileprivate extension Data {
init(rustBuffer: RustBuffer) {
// TODO: This copies the buffer. Can we read directly from a
// Rust buffer?
self.init(bytes: rustBuffer.data!, count: Int(rustBuffer.len))
}
}
// Define reader functionality. Normally this would be defined in a class or
// struct, but we use standalone functions instead in order to make external
// types work.
//
// With external types, one swift source file needs to be able to call the read
// method on another source file's FfiConverter, but then what visibility
// should Reader have?
// - If Reader is fileprivate, then this means the read() must also
// be fileprivate, which doesn't work with external types.
// - If Reader is internal/public, we'll get compile errors since both source
// files will try define the same type.
//
// Instead, the read() method and these helper functions input a tuple of data
fileprivate func createReader(data: Data) -> (data: Data, offset: Data.Index) {
(data: data, offset: 0)
}
// Reads an integer at the current offset, in big-endian order, and advances
// the offset on success. Throws if reading the integer would move the
// offset past the end of the buffer.
fileprivate func readInt<T: FixedWidthInteger>(_ reader: inout (data: Data, offset: Data.Index)) throws -> T {
let range = reader.offset..<reader.offset + MemoryLayout<T>.size
guard reader.data.count >= range.upperBound else {
throw UniffiInternalError.bufferOverflow
}
if T.self == UInt8.self {
let value = reader.data[reader.offset]
reader.offset += 1
return value as! T
}
var value: T = 0
let _ = withUnsafeMutableBytes(of: &value, { reader.data.copyBytes(to: $0, from: range)})
reader.offset = range.upperBound
return value.bigEndian
}
// Reads an arbitrary number of bytes, to be used to read
// raw bytes, this is useful when lifting strings
fileprivate func readBytes(_ reader: inout (data: Data, offset: Data.Index), count: Int) throws -> Array<UInt8> {
let range = reader.offset..<(reader.offset+count)
guard reader.data.count >= range.upperBound else {
throw UniffiInternalError.bufferOverflow
}
var value = [UInt8](repeating: 0, count: count)
value.withUnsafeMutableBufferPointer({ buffer in
reader.data.copyBytes(to: buffer, from: range)
})
reader.offset = range.upperBound
return value
}
// Reads a float at the current offset.
fileprivate func readFloat(_ reader: inout (data: Data, offset: Data.Index)) throws -> Float {
return Float(bitPattern: try readInt(&reader))
}
// Reads a float at the current offset.
fileprivate func readDouble(_ reader: inout (data: Data, offset: Data.Index)) throws -> Double {
return Double(bitPattern: try readInt(&reader))
}
// Indicates if the offset has reached the end of the buffer.
fileprivate func hasRemaining(_ reader: (data: Data, offset: Data.Index)) -> Bool {
return reader.offset < reader.data.count
}
// Define writer functionality. Normally this would be defined in a class or
// struct, but we use standalone functions instead in order to make external
// types work. See the above discussion on Readers for details.
fileprivate func createWriter() -> [UInt8] {
return []
}
fileprivate func writeBytes<S>(_ writer: inout [UInt8], _ byteArr: S) where S: Sequence, S.Element == UInt8 {
writer.append(contentsOf: byteArr)
}
// Writes an integer in big-endian order.
//
// Warning: make sure what you are trying to write
// is in the correct type!
fileprivate func writeInt<T: FixedWidthInteger>(_ writer: inout [UInt8], _ value: T) {
var value = value.bigEndian
withUnsafeBytes(of: &value) { writer.append(contentsOf: $0) }
}
fileprivate func writeFloat(_ writer: inout [UInt8], _ value: Float) {
writeInt(&writer, value.bitPattern)
}
fileprivate func writeDouble(_ writer: inout [UInt8], _ value: Double) {
writeInt(&writer, value.bitPattern)
}
// Protocol for types that transfer other types across the FFI. This is
// analogous go the Rust trait of the same name.
fileprivate protocol FfiConverter {
associatedtype FfiType
associatedtype SwiftType
static func lift(_ value: FfiType) throws -> SwiftType
static func lower(_ value: SwiftType) -> FfiType
static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType
static func write(_ value: SwiftType, into buf: inout [UInt8])
}
// Types conforming to `Primitive` pass themselves directly over the FFI.
fileprivate protocol FfiConverterPrimitive: FfiConverter where FfiType == SwiftType { }
extension FfiConverterPrimitive {
public static func lift(_ value: FfiType) throws -> SwiftType {
return value
}
public static func lower(_ value: SwiftType) -> FfiType {
return value
}
}
// Types conforming to `FfiConverterRustBuffer` lift and lower into a `RustBuffer`.
// Used for complex types where it's hard to write a custom lift/lower.
fileprivate protocol FfiConverterRustBuffer: FfiConverter where FfiType == RustBuffer {}
extension FfiConverterRustBuffer {
public static func lift(_ buf: RustBuffer) throws -> SwiftType {
var reader = createReader(data: Data(rustBuffer: buf))
let value = try read(from: &reader)
if hasRemaining(reader) {
throw UniffiInternalError.incompleteData
}
buf.deallocate()
return value
}
public static func lower(_ value: SwiftType) -> RustBuffer {
var writer = createWriter()
write(value, into: &writer)
return RustBuffer(bytes: writer)
}
}
// An error type for FFI errors. These errors occur at the UniFFI level, not
// the library level.
fileprivate enum UniffiInternalError: LocalizedError {
case bufferOverflow
case incompleteData
case unexpectedOptionalTag
case unexpectedEnumCase
case unexpectedNullPointer
case unexpectedRustCallStatusCode
case unexpectedRustCallError
case unexpectedStaleHandle
case rustPanic(_ message: String)
public var errorDescription: String? {
switch self {
case .bufferOverflow: return "Reading the requested value would read past the end of the buffer"
case .incompleteData: return "The buffer still has data after lifting its containing value"
case .unexpectedOptionalTag: return "Unexpected optional tag; should be 0 or 1"
case .unexpectedEnumCase: return "Raw enum value doesn't match any cases"
case .unexpectedNullPointer: return "Raw pointer value was null"
case .unexpectedRustCallStatusCode: return "Unexpected RustCallStatus code"
case .unexpectedRustCallError: return "CALL_ERROR but no errorClass specified"
case .unexpectedStaleHandle: return "The object in the handle map has been dropped already"
case let .rustPanic(message): return message
}
}
}
fileprivate let CALL_SUCCESS: Int8 = 0
fileprivate let CALL_ERROR: Int8 = 1
fileprivate let CALL_PANIC: Int8 = 2
fileprivate let CALL_CANCELLED: Int8 = 3
fileprivate extension RustCallStatus {
init() {
self.init(
code: CALL_SUCCESS,
errorBuf: RustBuffer.init(
capacity: 0,
len: 0,
data: nil
)
)
}
}
private func rustCall<T>(_ callback: (UnsafeMutablePointer<RustCallStatus>) -> T) throws -> T {
try makeRustCall(callback, errorHandler: nil)
}
private func rustCallWithError<T>(
_ errorHandler: @escaping (RustBuffer) throws -> Error,
_ callback: (UnsafeMutablePointer<RustCallStatus>) -> T) throws -> T {
try makeRustCall(callback, errorHandler: errorHandler)
}
private func makeRustCall<T>(
_ callback: (UnsafeMutablePointer<RustCallStatus>) -> T,
errorHandler: ((RustBuffer) throws -> Error)?
) throws -> T {
uniffiEnsureInitialized()
var callStatus = RustCallStatus.init()
let returnedVal = callback(&callStatus)
try uniffiCheckCallStatus(callStatus: callStatus, errorHandler: errorHandler)
return returnedVal
}
private func uniffiCheckCallStatus(
callStatus: RustCallStatus,
errorHandler: ((RustBuffer) throws -> Error)?
) throws {
switch callStatus.code {
case CALL_SUCCESS:
return
case CALL_ERROR:
if let errorHandler = errorHandler {
throw try errorHandler(callStatus.errorBuf)
} else {
callStatus.errorBuf.deallocate()
throw UniffiInternalError.unexpectedRustCallError
}
case CALL_PANIC:
// When the rust code sees a panic, it tries to construct a RustBuffer
// with the message. But if that code panics, then it just sends back
// an empty buffer.
if callStatus.errorBuf.len > 0 {
throw UniffiInternalError.rustPanic(try FfiConverterString.lift(callStatus.errorBuf))
} else {
callStatus.errorBuf.deallocate()
throw UniffiInternalError.rustPanic("Rust panic")
}
case CALL_CANCELLED:
fatalError("Cancellation not supported yet")
default:
throw UniffiInternalError.unexpectedRustCallStatusCode
}
}
// Public interface members begin here.
fileprivate struct FfiConverterString: FfiConverter {
typealias SwiftType = String
typealias FfiType = RustBuffer
public static func lift(_ value: RustBuffer) throws -> String {
defer {
value.deallocate()
}
if value.data == nil {
return String()
}
let bytes = UnsafeBufferPointer<UInt8>(start: value.data!, count: Int(value.len))
return String(bytes: bytes, encoding: String.Encoding.utf8)!
}
public static func lower(_ value: String) -> RustBuffer {
return value.utf8CString.withUnsafeBufferPointer { ptr in
// The swift string gives us int8_t, we want uint8_t.
ptr.withMemoryRebound(to: UInt8.self) { ptr in
// The swift string gives us a trailing null byte, we don't want it.
let buf = UnsafeBufferPointer(rebasing: ptr.prefix(upTo: ptr.count - 1))
return RustBuffer.from(buf)
}
}
}
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> String {
let len: Int32 = try readInt(&buf)
return String(bytes: try readBytes(&buf, count: Int(len)), encoding: String.Encoding.utf8)!
}
public static func write(_ value: String, into buf: inout [UInt8]) {
let len = Int32(value.utf8.count)
writeInt(&buf, len)
writeBytes(&buf, value.utf8)
}
}
private enum InitializationResult {
case ok
case contractVersionMismatch
case apiChecksumMismatch
}
// Use a global variables to perform the versioning checks. Swift ensures that
// the code inside is only computed once.
private var initializationResult: InitializationResult {
// Get the bindings contract version from our ComponentInterface
let bindings_contract_version = 25
// Get the scaffolding contract version by calling the into the dylib
let scaffolding_contract_version = ffi_proton_core_common_uniffi_contract_version()
if bindings_contract_version != scaffolding_contract_version {
return InitializationResult.contractVersionMismatch
}
return InitializationResult.ok
}
private func uniffiEnsureInitialized() {
switch initializationResult {
case .ok:
break
case .contractVersionMismatch:
fatalError("UniFFI contract version mismatch: try cleaning and rebuilding your project")
case .apiChecksumMismatch:
fatalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
}
@@ -0,0 +1,366 @@
// This file was autogenerated by some hot garbage in the `uniffi` crate.
// Trust me, you don't want to mess with it!
import Foundation
// Depending on the consumer's build setup, the low-level FFI code
// might be in a separate module, or it might be compiled inline into
// this module. This is a bit of light hackery to work with both.
#if canImport(proton_mail_uniffi_ffi)
import proton_mail_uniffi_ffi
#endif
fileprivate extension RustBuffer {
// Allocate a new buffer, copying the contents of a `UInt8` array.
init(bytes: [UInt8]) {
let rbuf = bytes.withUnsafeBufferPointer { ptr in
RustBuffer.from(ptr)
}
self.init(capacity: rbuf.capacity, len: rbuf.len, data: rbuf.data)
}
static func from(_ ptr: UnsafeBufferPointer<UInt8>) -> RustBuffer {
try! rustCall { ffi_proton_core_db_rustbuffer_from_bytes(ForeignBytes(bufferPointer: ptr), $0) }
}
// Frees the buffer in place.
// The buffer must not be used after this is called.
func deallocate() {
try! rustCall { ffi_proton_core_db_rustbuffer_free(self, $0) }
}
}
fileprivate extension ForeignBytes {
init(bufferPointer: UnsafeBufferPointer<UInt8>) {
self.init(len: Int32(bufferPointer.count), data: bufferPointer.baseAddress)
}
}
// For every type used in the interface, we provide helper methods for conveniently
// lifting and lowering that type from C-compatible data, and for reading and writing
// values of that type in a buffer.
// Helper classes/extensions that don't change.
// Someday, this will be in a library of its own.
fileprivate extension Data {
init(rustBuffer: RustBuffer) {
// TODO: This copies the buffer. Can we read directly from a
// Rust buffer?
self.init(bytes: rustBuffer.data!, count: Int(rustBuffer.len))
}
}
// Define reader functionality. Normally this would be defined in a class or
// struct, but we use standalone functions instead in order to make external
// types work.
//
// With external types, one swift source file needs to be able to call the read
// method on another source file's FfiConverter, but then what visibility
// should Reader have?
// - If Reader is fileprivate, then this means the read() must also
// be fileprivate, which doesn't work with external types.
// - If Reader is internal/public, we'll get compile errors since both source
// files will try define the same type.
//
// Instead, the read() method and these helper functions input a tuple of data
fileprivate func createReader(data: Data) -> (data: Data, offset: Data.Index) {
(data: data, offset: 0)
}
// Reads an integer at the current offset, in big-endian order, and advances
// the offset on success. Throws if reading the integer would move the
// offset past the end of the buffer.
fileprivate func readInt<T: FixedWidthInteger>(_ reader: inout (data: Data, offset: Data.Index)) throws -> T {
let range = reader.offset..<reader.offset + MemoryLayout<T>.size
guard reader.data.count >= range.upperBound else {
throw UniffiInternalError.bufferOverflow
}
if T.self == UInt8.self {
let value = reader.data[reader.offset]
reader.offset += 1
return value as! T
}
var value: T = 0
let _ = withUnsafeMutableBytes(of: &value, { reader.data.copyBytes(to: $0, from: range)})
reader.offset = range.upperBound
return value.bigEndian
}
// Reads an arbitrary number of bytes, to be used to read
// raw bytes, this is useful when lifting strings
fileprivate func readBytes(_ reader: inout (data: Data, offset: Data.Index), count: Int) throws -> Array<UInt8> {
let range = reader.offset..<(reader.offset+count)
guard reader.data.count >= range.upperBound else {
throw UniffiInternalError.bufferOverflow
}
var value = [UInt8](repeating: 0, count: count)
value.withUnsafeMutableBufferPointer({ buffer in
reader.data.copyBytes(to: buffer, from: range)
})
reader.offset = range.upperBound
return value
}
// Reads a float at the current offset.
fileprivate func readFloat(_ reader: inout (data: Data, offset: Data.Index)) throws -> Float {
return Float(bitPattern: try readInt(&reader))
}
// Reads a float at the current offset.
fileprivate func readDouble(_ reader: inout (data: Data, offset: Data.Index)) throws -> Double {
return Double(bitPattern: try readInt(&reader))
}
// Indicates if the offset has reached the end of the buffer.
fileprivate func hasRemaining(_ reader: (data: Data, offset: Data.Index)) -> Bool {
return reader.offset < reader.data.count
}
// Define writer functionality. Normally this would be defined in a class or
// struct, but we use standalone functions instead in order to make external
// types work. See the above discussion on Readers for details.
fileprivate func createWriter() -> [UInt8] {
return []
}
fileprivate func writeBytes<S>(_ writer: inout [UInt8], _ byteArr: S) where S: Sequence, S.Element == UInt8 {
writer.append(contentsOf: byteArr)
}
// Writes an integer in big-endian order.
//
// Warning: make sure what you are trying to write
// is in the correct type!
fileprivate func writeInt<T: FixedWidthInteger>(_ writer: inout [UInt8], _ value: T) {
var value = value.bigEndian
withUnsafeBytes(of: &value) { writer.append(contentsOf: $0) }
}
fileprivate func writeFloat(_ writer: inout [UInt8], _ value: Float) {
writeInt(&writer, value.bitPattern)
}
fileprivate func writeDouble(_ writer: inout [UInt8], _ value: Double) {
writeInt(&writer, value.bitPattern)
}
// Protocol for types that transfer other types across the FFI. This is
// analogous go the Rust trait of the same name.
fileprivate protocol FfiConverter {
associatedtype FfiType
associatedtype SwiftType
static func lift(_ value: FfiType) throws -> SwiftType
static func lower(_ value: SwiftType) -> FfiType
static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType
static func write(_ value: SwiftType, into buf: inout [UInt8])
}
// Types conforming to `Primitive` pass themselves directly over the FFI.
fileprivate protocol FfiConverterPrimitive: FfiConverter where FfiType == SwiftType { }
extension FfiConverterPrimitive {
public static func lift(_ value: FfiType) throws -> SwiftType {
return value
}
public static func lower(_ value: SwiftType) -> FfiType {
return value
}
}
// Types conforming to `FfiConverterRustBuffer` lift and lower into a `RustBuffer`.
// Used for complex types where it's hard to write a custom lift/lower.
fileprivate protocol FfiConverterRustBuffer: FfiConverter where FfiType == RustBuffer {}
extension FfiConverterRustBuffer {
public static func lift(_ buf: RustBuffer) throws -> SwiftType {
var reader = createReader(data: Data(rustBuffer: buf))
let value = try read(from: &reader)
if hasRemaining(reader) {
throw UniffiInternalError.incompleteData
}
buf.deallocate()
return value
}
public static func lower(_ value: SwiftType) -> RustBuffer {
var writer = createWriter()
write(value, into: &writer)
return RustBuffer(bytes: writer)
}
}
// An error type for FFI errors. These errors occur at the UniFFI level, not
// the library level.
fileprivate enum UniffiInternalError: LocalizedError {
case bufferOverflow
case incompleteData
case unexpectedOptionalTag
case unexpectedEnumCase
case unexpectedNullPointer
case unexpectedRustCallStatusCode
case unexpectedRustCallError
case unexpectedStaleHandle
case rustPanic(_ message: String)
public var errorDescription: String? {
switch self {
case .bufferOverflow: return "Reading the requested value would read past the end of the buffer"
case .incompleteData: return "The buffer still has data after lifting its containing value"
case .unexpectedOptionalTag: return "Unexpected optional tag; should be 0 or 1"
case .unexpectedEnumCase: return "Raw enum value doesn't match any cases"
case .unexpectedNullPointer: return "Raw pointer value was null"
case .unexpectedRustCallStatusCode: return "Unexpected RustCallStatus code"
case .unexpectedRustCallError: return "CALL_ERROR but no errorClass specified"
case .unexpectedStaleHandle: return "The object in the handle map has been dropped already"
case let .rustPanic(message): return message
}
}
}
fileprivate let CALL_SUCCESS: Int8 = 0
fileprivate let CALL_ERROR: Int8 = 1
fileprivate let CALL_PANIC: Int8 = 2
fileprivate let CALL_CANCELLED: Int8 = 3
fileprivate extension RustCallStatus {
init() {
self.init(
code: CALL_SUCCESS,
errorBuf: RustBuffer.init(
capacity: 0,
len: 0,
data: nil
)
)
}
}
private func rustCall<T>(_ callback: (UnsafeMutablePointer<RustCallStatus>) -> T) throws -> T {
try makeRustCall(callback, errorHandler: nil)
}
private func rustCallWithError<T>(
_ errorHandler: @escaping (RustBuffer) throws -> Error,
_ callback: (UnsafeMutablePointer<RustCallStatus>) -> T) throws -> T {
try makeRustCall(callback, errorHandler: errorHandler)
}
private func makeRustCall<T>(
_ callback: (UnsafeMutablePointer<RustCallStatus>) -> T,
errorHandler: ((RustBuffer) throws -> Error)?
) throws -> T {
uniffiEnsureInitialized()
var callStatus = RustCallStatus.init()
let returnedVal = callback(&callStatus)
try uniffiCheckCallStatus(callStatus: callStatus, errorHandler: errorHandler)
return returnedVal
}
private func uniffiCheckCallStatus(
callStatus: RustCallStatus,
errorHandler: ((RustBuffer) throws -> Error)?
) throws {
switch callStatus.code {
case CALL_SUCCESS:
return
case CALL_ERROR:
if let errorHandler = errorHandler {
throw try errorHandler(callStatus.errorBuf)
} else {
callStatus.errorBuf.deallocate()
throw UniffiInternalError.unexpectedRustCallError
}
case CALL_PANIC:
// When the rust code sees a panic, it tries to construct a RustBuffer
// with the message. But if that code panics, then it just sends back
// an empty buffer.
if callStatus.errorBuf.len > 0 {
throw UniffiInternalError.rustPanic(try FfiConverterString.lift(callStatus.errorBuf))
} else {
callStatus.errorBuf.deallocate()
throw UniffiInternalError.rustPanic("Rust panic")
}
case CALL_CANCELLED:
fatalError("Cancellation not supported yet")
default:
throw UniffiInternalError.unexpectedRustCallStatusCode
}
}
// Public interface members begin here.
fileprivate struct FfiConverterString: FfiConverter {
typealias SwiftType = String
typealias FfiType = RustBuffer
public static func lift(_ value: RustBuffer) throws -> String {
defer {
value.deallocate()
}
if value.data == nil {
return String()
}
let bytes = UnsafeBufferPointer<UInt8>(start: value.data!, count: Int(value.len))
return String(bytes: bytes, encoding: String.Encoding.utf8)!
}
public static func lower(_ value: String) -> RustBuffer {
return value.utf8CString.withUnsafeBufferPointer { ptr in
// The swift string gives us int8_t, we want uint8_t.
ptr.withMemoryRebound(to: UInt8.self) { ptr in
// The swift string gives us a trailing null byte, we don't want it.
let buf = UnsafeBufferPointer(rebasing: ptr.prefix(upTo: ptr.count - 1))
return RustBuffer.from(buf)
}
}
}
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> String {
let len: Int32 = try readInt(&buf)
return String(bytes: try readBytes(&buf, count: Int(len)), encoding: String.Encoding.utf8)!
}
public static func write(_ value: String, into buf: inout [UInt8]) {
let len = Int32(value.utf8.count)
writeInt(&buf, len)
writeBytes(&buf, value.utf8)
}
}
private enum InitializationResult {
case ok
case contractVersionMismatch
case apiChecksumMismatch
}
// Use a global variables to perform the versioning checks. Swift ensures that
// the code inside is only computed once.
private var initializationResult: InitializationResult {
// Get the bindings contract version from our ComponentInterface
let bindings_contract_version = 25
// Get the scaffolding contract version by calling the into the dylib
let scaffolding_contract_version = ffi_proton_core_db_uniffi_contract_version()
if bindings_contract_version != scaffolding_contract_version {
return InitializationResult.contractVersionMismatch
}
return InitializationResult.ok
}
private func uniffiEnsureInitialized() {
switch initializationResult {
case .ok:
break
case .contractVersionMismatch:
fatalError("UniFFI contract version mismatch: try cleaning and rebuilding your project")
case .apiChecksumMismatch:
fatalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
}
@@ -0,0 +1,366 @@
// This file was autogenerated by some hot garbage in the `uniffi` crate.
// Trust me, you don't want to mess with it!
import Foundation
// Depending on the consumer's build setup, the low-level FFI code
// might be in a separate module, or it might be compiled inline into
// this module. This is a bit of light hackery to work with both.
#if canImport(proton_mail_uniffi_ffi)
import proton_mail_uniffi_ffi
#endif
fileprivate extension RustBuffer {
// Allocate a new buffer, copying the contents of a `UInt8` array.
init(bytes: [UInt8]) {
let rbuf = bytes.withUnsafeBufferPointer { ptr in
RustBuffer.from(ptr)
}
self.init(capacity: rbuf.capacity, len: rbuf.len, data: rbuf.data)
}
static func from(_ ptr: UnsafeBufferPointer<UInt8>) -> RustBuffer {
try! rustCall { ffi_proton_mail_common_rustbuffer_from_bytes(ForeignBytes(bufferPointer: ptr), $0) }
}
// Frees the buffer in place.
// The buffer must not be used after this is called.
func deallocate() {
try! rustCall { ffi_proton_mail_common_rustbuffer_free(self, $0) }
}
}
fileprivate extension ForeignBytes {
init(bufferPointer: UnsafeBufferPointer<UInt8>) {
self.init(len: Int32(bufferPointer.count), data: bufferPointer.baseAddress)
}
}
// For every type used in the interface, we provide helper methods for conveniently
// lifting and lowering that type from C-compatible data, and for reading and writing
// values of that type in a buffer.
// Helper classes/extensions that don't change.
// Someday, this will be in a library of its own.
fileprivate extension Data {
init(rustBuffer: RustBuffer) {
// TODO: This copies the buffer. Can we read directly from a
// Rust buffer?
self.init(bytes: rustBuffer.data!, count: Int(rustBuffer.len))
}
}
// Define reader functionality. Normally this would be defined in a class or
// struct, but we use standalone functions instead in order to make external
// types work.
//
// With external types, one swift source file needs to be able to call the read
// method on another source file's FfiConverter, but then what visibility
// should Reader have?
// - If Reader is fileprivate, then this means the read() must also
// be fileprivate, which doesn't work with external types.
// - If Reader is internal/public, we'll get compile errors since both source
// files will try define the same type.
//
// Instead, the read() method and these helper functions input a tuple of data
fileprivate func createReader(data: Data) -> (data: Data, offset: Data.Index) {
(data: data, offset: 0)
}
// Reads an integer at the current offset, in big-endian order, and advances
// the offset on success. Throws if reading the integer would move the
// offset past the end of the buffer.
fileprivate func readInt<T: FixedWidthInteger>(_ reader: inout (data: Data, offset: Data.Index)) throws -> T {
let range = reader.offset..<reader.offset + MemoryLayout<T>.size
guard reader.data.count >= range.upperBound else {
throw UniffiInternalError.bufferOverflow
}
if T.self == UInt8.self {
let value = reader.data[reader.offset]
reader.offset += 1
return value as! T
}
var value: T = 0
let _ = withUnsafeMutableBytes(of: &value, { reader.data.copyBytes(to: $0, from: range)})
reader.offset = range.upperBound
return value.bigEndian
}
// Reads an arbitrary number of bytes, to be used to read
// raw bytes, this is useful when lifting strings
fileprivate func readBytes(_ reader: inout (data: Data, offset: Data.Index), count: Int) throws -> Array<UInt8> {
let range = reader.offset..<(reader.offset+count)
guard reader.data.count >= range.upperBound else {
throw UniffiInternalError.bufferOverflow
}
var value = [UInt8](repeating: 0, count: count)
value.withUnsafeMutableBufferPointer({ buffer in
reader.data.copyBytes(to: buffer, from: range)
})
reader.offset = range.upperBound
return value
}
// Reads a float at the current offset.
fileprivate func readFloat(_ reader: inout (data: Data, offset: Data.Index)) throws -> Float {
return Float(bitPattern: try readInt(&reader))
}
// Reads a float at the current offset.
fileprivate func readDouble(_ reader: inout (data: Data, offset: Data.Index)) throws -> Double {
return Double(bitPattern: try readInt(&reader))
}
// Indicates if the offset has reached the end of the buffer.
fileprivate func hasRemaining(_ reader: (data: Data, offset: Data.Index)) -> Bool {
return reader.offset < reader.data.count
}
// Define writer functionality. Normally this would be defined in a class or
// struct, but we use standalone functions instead in order to make external
// types work. See the above discussion on Readers for details.
fileprivate func createWriter() -> [UInt8] {
return []
}
fileprivate func writeBytes<S>(_ writer: inout [UInt8], _ byteArr: S) where S: Sequence, S.Element == UInt8 {
writer.append(contentsOf: byteArr)
}
// Writes an integer in big-endian order.
//
// Warning: make sure what you are trying to write
// is in the correct type!
fileprivate func writeInt<T: FixedWidthInteger>(_ writer: inout [UInt8], _ value: T) {
var value = value.bigEndian
withUnsafeBytes(of: &value) { writer.append(contentsOf: $0) }
}
fileprivate func writeFloat(_ writer: inout [UInt8], _ value: Float) {
writeInt(&writer, value.bitPattern)
}
fileprivate func writeDouble(_ writer: inout [UInt8], _ value: Double) {
writeInt(&writer, value.bitPattern)
}
// Protocol for types that transfer other types across the FFI. This is
// analogous go the Rust trait of the same name.
fileprivate protocol FfiConverter {
associatedtype FfiType
associatedtype SwiftType
static func lift(_ value: FfiType) throws -> SwiftType
static func lower(_ value: SwiftType) -> FfiType
static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType
static func write(_ value: SwiftType, into buf: inout [UInt8])
}
// Types conforming to `Primitive` pass themselves directly over the FFI.
fileprivate protocol FfiConverterPrimitive: FfiConverter where FfiType == SwiftType { }
extension FfiConverterPrimitive {
public static func lift(_ value: FfiType) throws -> SwiftType {
return value
}
public static func lower(_ value: SwiftType) -> FfiType {
return value
}
}
// Types conforming to `FfiConverterRustBuffer` lift and lower into a `RustBuffer`.
// Used for complex types where it's hard to write a custom lift/lower.
fileprivate protocol FfiConverterRustBuffer: FfiConverter where FfiType == RustBuffer {}
extension FfiConverterRustBuffer {
public static func lift(_ buf: RustBuffer) throws -> SwiftType {
var reader = createReader(data: Data(rustBuffer: buf))
let value = try read(from: &reader)
if hasRemaining(reader) {
throw UniffiInternalError.incompleteData
}
buf.deallocate()
return value
}
public static func lower(_ value: SwiftType) -> RustBuffer {
var writer = createWriter()
write(value, into: &writer)
return RustBuffer(bytes: writer)
}
}
// An error type for FFI errors. These errors occur at the UniFFI level, not
// the library level.
fileprivate enum UniffiInternalError: LocalizedError {
case bufferOverflow
case incompleteData
case unexpectedOptionalTag
case unexpectedEnumCase
case unexpectedNullPointer
case unexpectedRustCallStatusCode
case unexpectedRustCallError
case unexpectedStaleHandle
case rustPanic(_ message: String)
public var errorDescription: String? {
switch self {
case .bufferOverflow: return "Reading the requested value would read past the end of the buffer"
case .incompleteData: return "The buffer still has data after lifting its containing value"
case .unexpectedOptionalTag: return "Unexpected optional tag; should be 0 or 1"
case .unexpectedEnumCase: return "Raw enum value doesn't match any cases"
case .unexpectedNullPointer: return "Raw pointer value was null"
case .unexpectedRustCallStatusCode: return "Unexpected RustCallStatus code"
case .unexpectedRustCallError: return "CALL_ERROR but no errorClass specified"
case .unexpectedStaleHandle: return "The object in the handle map has been dropped already"
case let .rustPanic(message): return message
}
}
}
fileprivate let CALL_SUCCESS: Int8 = 0
fileprivate let CALL_ERROR: Int8 = 1
fileprivate let CALL_PANIC: Int8 = 2
fileprivate let CALL_CANCELLED: Int8 = 3
fileprivate extension RustCallStatus {
init() {
self.init(
code: CALL_SUCCESS,
errorBuf: RustBuffer.init(
capacity: 0,
len: 0,
data: nil
)
)
}
}
private func rustCall<T>(_ callback: (UnsafeMutablePointer<RustCallStatus>) -> T) throws -> T {
try makeRustCall(callback, errorHandler: nil)
}
private func rustCallWithError<T>(
_ errorHandler: @escaping (RustBuffer) throws -> Error,
_ callback: (UnsafeMutablePointer<RustCallStatus>) -> T) throws -> T {
try makeRustCall(callback, errorHandler: errorHandler)
}
private func makeRustCall<T>(
_ callback: (UnsafeMutablePointer<RustCallStatus>) -> T,
errorHandler: ((RustBuffer) throws -> Error)?
) throws -> T {
uniffiEnsureInitialized()
var callStatus = RustCallStatus.init()
let returnedVal = callback(&callStatus)
try uniffiCheckCallStatus(callStatus: callStatus, errorHandler: errorHandler)
return returnedVal
}
private func uniffiCheckCallStatus(
callStatus: RustCallStatus,
errorHandler: ((RustBuffer) throws -> Error)?
) throws {
switch callStatus.code {
case CALL_SUCCESS:
return
case CALL_ERROR:
if let errorHandler = errorHandler {
throw try errorHandler(callStatus.errorBuf)
} else {
callStatus.errorBuf.deallocate()
throw UniffiInternalError.unexpectedRustCallError
}
case CALL_PANIC:
// When the rust code sees a panic, it tries to construct a RustBuffer
// with the message. But if that code panics, then it just sends back
// an empty buffer.
if callStatus.errorBuf.len > 0 {
throw UniffiInternalError.rustPanic(try FfiConverterString.lift(callStatus.errorBuf))
} else {
callStatus.errorBuf.deallocate()
throw UniffiInternalError.rustPanic("Rust panic")
}
case CALL_CANCELLED:
fatalError("Cancellation not supported yet")
default:
throw UniffiInternalError.unexpectedRustCallStatusCode
}
}
// Public interface members begin here.
fileprivate struct FfiConverterString: FfiConverter {
typealias SwiftType = String
typealias FfiType = RustBuffer
public static func lift(_ value: RustBuffer) throws -> String {
defer {
value.deallocate()
}
if value.data == nil {
return String()
}
let bytes = UnsafeBufferPointer<UInt8>(start: value.data!, count: Int(value.len))
return String(bytes: bytes, encoding: String.Encoding.utf8)!
}
public static func lower(_ value: String) -> RustBuffer {
return value.utf8CString.withUnsafeBufferPointer { ptr in
// The swift string gives us int8_t, we want uint8_t.
ptr.withMemoryRebound(to: UInt8.self) { ptr in
// The swift string gives us a trailing null byte, we don't want it.
let buf = UnsafeBufferPointer(rebasing: ptr.prefix(upTo: ptr.count - 1))
return RustBuffer.from(buf)
}
}
}
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> String {
let len: Int32 = try readInt(&buf)
return String(bytes: try readBytes(&buf, count: Int(len)), encoding: String.Encoding.utf8)!
}
public static func write(_ value: String, into buf: inout [UInt8]) {
let len = Int32(value.utf8.count)
writeInt(&buf, len)
writeBytes(&buf, value.utf8)
}
}
private enum InitializationResult {
case ok
case contractVersionMismatch
case apiChecksumMismatch
}
// Use a global variables to perform the versioning checks. Swift ensures that
// the code inside is only computed once.
private var initializationResult: InitializationResult {
// Get the bindings contract version from our ComponentInterface
let bindings_contract_version = 25
// Get the scaffolding contract version by calling the into the dylib
let scaffolding_contract_version = ffi_proton_mail_common_uniffi_contract_version()
if bindings_contract_version != scaffolding_contract_version {
return InitializationResult.contractVersionMismatch
}
return InitializationResult.ok
}
private func uniffiEnsureInitialized() {
switch initializationResult {
case .ok:
break
case .contractVersionMismatch:
fatalError("UniFFI contract version mismatch: try cleaning and rebuilding your project")
case .apiChecksumMismatch:
fatalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,169 @@
// This file was autogenerated by some hot garbage in the `uniffi` crate.
// Trust me, you don't want to mess with it!
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
// The following structs are used to implement the lowest level
// of the FFI, and thus useful to multiple uniffied crates.
// We ensure they are declared exactly once, with a header guard, UNIFFI_SHARED_H.
#ifdef UNIFFI_SHARED_H
// We also try to prevent mixing versions of shared uniffi header structs.
// If you add anything to the #else block, you must increment the version suffix in UNIFFI_SHARED_HEADER_V4
#ifndef UNIFFI_SHARED_HEADER_V4
#error Combining helper code from multiple versions of uniffi is not supported
#endif // ndef UNIFFI_SHARED_HEADER_V4
#else
#define UNIFFI_SHARED_H
#define UNIFFI_SHARED_HEADER_V4
// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️
typedef struct RustBuffer
{
int32_t capacity;
int32_t len;
uint8_t *_Nullable data;
} RustBuffer;
typedef int32_t (*ForeignCallback)(uint64_t, int32_t, const uint8_t *_Nonnull, int32_t, RustBuffer *_Nonnull);
typedef struct ForeignBytes
{
int32_t len;
const uint8_t *_Nullable data;
} ForeignBytes;
// Error definitions
typedef struct RustCallStatus {
int8_t code;
RustBuffer errorBuf;
} RustCallStatus;
// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️
#endif // def UNIFFI_SHARED_H
// Continuation callback for UniFFI Futures
typedef void (*UniFfiRustFutureContinuation)(void * _Nonnull, int8_t);
// Scaffolding functions
RustBuffer ffi_proton_api_core_rustbuffer_alloc(int32_t size, RustCallStatus *_Nonnull out_status
);
RustBuffer ffi_proton_api_core_rustbuffer_from_bytes(ForeignBytes bytes, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_core_rustbuffer_free(RustBuffer buf, RustCallStatus *_Nonnull out_status
);
RustBuffer ffi_proton_api_core_rustbuffer_reserve(RustBuffer buf, int32_t additional, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_core_rust_future_poll_u8(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_core_rust_future_cancel_u8(void* _Nonnull handle
);
void ffi_proton_api_core_rust_future_free_u8(void* _Nonnull handle
);
uint8_t ffi_proton_api_core_rust_future_complete_u8(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_core_rust_future_poll_i8(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_core_rust_future_cancel_i8(void* _Nonnull handle
);
void ffi_proton_api_core_rust_future_free_i8(void* _Nonnull handle
);
int8_t ffi_proton_api_core_rust_future_complete_i8(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_core_rust_future_poll_u16(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_core_rust_future_cancel_u16(void* _Nonnull handle
);
void ffi_proton_api_core_rust_future_free_u16(void* _Nonnull handle
);
uint16_t ffi_proton_api_core_rust_future_complete_u16(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_core_rust_future_poll_i16(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_core_rust_future_cancel_i16(void* _Nonnull handle
);
void ffi_proton_api_core_rust_future_free_i16(void* _Nonnull handle
);
int16_t ffi_proton_api_core_rust_future_complete_i16(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_core_rust_future_poll_u32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_core_rust_future_cancel_u32(void* _Nonnull handle
);
void ffi_proton_api_core_rust_future_free_u32(void* _Nonnull handle
);
uint32_t ffi_proton_api_core_rust_future_complete_u32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_core_rust_future_poll_i32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_core_rust_future_cancel_i32(void* _Nonnull handle
);
void ffi_proton_api_core_rust_future_free_i32(void* _Nonnull handle
);
int32_t ffi_proton_api_core_rust_future_complete_i32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_core_rust_future_poll_u64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_core_rust_future_cancel_u64(void* _Nonnull handle
);
void ffi_proton_api_core_rust_future_free_u64(void* _Nonnull handle
);
uint64_t ffi_proton_api_core_rust_future_complete_u64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_core_rust_future_poll_i64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_core_rust_future_cancel_i64(void* _Nonnull handle
);
void ffi_proton_api_core_rust_future_free_i64(void* _Nonnull handle
);
int64_t ffi_proton_api_core_rust_future_complete_i64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_core_rust_future_poll_f32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_core_rust_future_cancel_f32(void* _Nonnull handle
);
void ffi_proton_api_core_rust_future_free_f32(void* _Nonnull handle
);
float ffi_proton_api_core_rust_future_complete_f32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_core_rust_future_poll_f64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_core_rust_future_cancel_f64(void* _Nonnull handle
);
void ffi_proton_api_core_rust_future_free_f64(void* _Nonnull handle
);
double ffi_proton_api_core_rust_future_complete_f64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_core_rust_future_poll_pointer(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_core_rust_future_cancel_pointer(void* _Nonnull handle
);
void ffi_proton_api_core_rust_future_free_pointer(void* _Nonnull handle
);
void*_Nonnull ffi_proton_api_core_rust_future_complete_pointer(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_core_rust_future_poll_rust_buffer(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_core_rust_future_cancel_rust_buffer(void* _Nonnull handle
);
void ffi_proton_api_core_rust_future_free_rust_buffer(void* _Nonnull handle
);
RustBuffer ffi_proton_api_core_rust_future_complete_rust_buffer(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_core_rust_future_poll_void(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_core_rust_future_cancel_void(void* _Nonnull handle
);
void ffi_proton_api_core_rust_future_free_void(void* _Nonnull handle
);
void ffi_proton_api_core_rust_future_complete_void(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
uint32_t ffi_proton_api_core_uniffi_contract_version(void
);
@@ -0,0 +1,169 @@
// This file was autogenerated by some hot garbage in the `uniffi` crate.
// Trust me, you don't want to mess with it!
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
// The following structs are used to implement the lowest level
// of the FFI, and thus useful to multiple uniffied crates.
// We ensure they are declared exactly once, with a header guard, UNIFFI_SHARED_H.
#ifdef UNIFFI_SHARED_H
// We also try to prevent mixing versions of shared uniffi header structs.
// If you add anything to the #else block, you must increment the version suffix in UNIFFI_SHARED_HEADER_V4
#ifndef UNIFFI_SHARED_HEADER_V4
#error Combining helper code from multiple versions of uniffi is not supported
#endif // ndef UNIFFI_SHARED_HEADER_V4
#else
#define UNIFFI_SHARED_H
#define UNIFFI_SHARED_HEADER_V4
// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️
typedef struct RustBuffer
{
int32_t capacity;
int32_t len;
uint8_t *_Nullable data;
} RustBuffer;
typedef int32_t (*ForeignCallback)(uint64_t, int32_t, const uint8_t *_Nonnull, int32_t, RustBuffer *_Nonnull);
typedef struct ForeignBytes
{
int32_t len;
const uint8_t *_Nullable data;
} ForeignBytes;
// Error definitions
typedef struct RustCallStatus {
int8_t code;
RustBuffer errorBuf;
} RustCallStatus;
// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️
#endif // def UNIFFI_SHARED_H
// Continuation callback for UniFFI Futures
typedef void (*UniFfiRustFutureContinuation)(void * _Nonnull, int8_t);
// Scaffolding functions
RustBuffer ffi_proton_api_mail_rustbuffer_alloc(int32_t size, RustCallStatus *_Nonnull out_status
);
RustBuffer ffi_proton_api_mail_rustbuffer_from_bytes(ForeignBytes bytes, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_mail_rustbuffer_free(RustBuffer buf, RustCallStatus *_Nonnull out_status
);
RustBuffer ffi_proton_api_mail_rustbuffer_reserve(RustBuffer buf, int32_t additional, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_mail_rust_future_poll_u8(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_mail_rust_future_cancel_u8(void* _Nonnull handle
);
void ffi_proton_api_mail_rust_future_free_u8(void* _Nonnull handle
);
uint8_t ffi_proton_api_mail_rust_future_complete_u8(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_mail_rust_future_poll_i8(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_mail_rust_future_cancel_i8(void* _Nonnull handle
);
void ffi_proton_api_mail_rust_future_free_i8(void* _Nonnull handle
);
int8_t ffi_proton_api_mail_rust_future_complete_i8(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_mail_rust_future_poll_u16(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_mail_rust_future_cancel_u16(void* _Nonnull handle
);
void ffi_proton_api_mail_rust_future_free_u16(void* _Nonnull handle
);
uint16_t ffi_proton_api_mail_rust_future_complete_u16(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_mail_rust_future_poll_i16(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_mail_rust_future_cancel_i16(void* _Nonnull handle
);
void ffi_proton_api_mail_rust_future_free_i16(void* _Nonnull handle
);
int16_t ffi_proton_api_mail_rust_future_complete_i16(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_mail_rust_future_poll_u32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_mail_rust_future_cancel_u32(void* _Nonnull handle
);
void ffi_proton_api_mail_rust_future_free_u32(void* _Nonnull handle
);
uint32_t ffi_proton_api_mail_rust_future_complete_u32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_mail_rust_future_poll_i32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_mail_rust_future_cancel_i32(void* _Nonnull handle
);
void ffi_proton_api_mail_rust_future_free_i32(void* _Nonnull handle
);
int32_t ffi_proton_api_mail_rust_future_complete_i32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_mail_rust_future_poll_u64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_mail_rust_future_cancel_u64(void* _Nonnull handle
);
void ffi_proton_api_mail_rust_future_free_u64(void* _Nonnull handle
);
uint64_t ffi_proton_api_mail_rust_future_complete_u64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_mail_rust_future_poll_i64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_mail_rust_future_cancel_i64(void* _Nonnull handle
);
void ffi_proton_api_mail_rust_future_free_i64(void* _Nonnull handle
);
int64_t ffi_proton_api_mail_rust_future_complete_i64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_mail_rust_future_poll_f32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_mail_rust_future_cancel_f32(void* _Nonnull handle
);
void ffi_proton_api_mail_rust_future_free_f32(void* _Nonnull handle
);
float ffi_proton_api_mail_rust_future_complete_f32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_mail_rust_future_poll_f64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_mail_rust_future_cancel_f64(void* _Nonnull handle
);
void ffi_proton_api_mail_rust_future_free_f64(void* _Nonnull handle
);
double ffi_proton_api_mail_rust_future_complete_f64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_mail_rust_future_poll_pointer(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_mail_rust_future_cancel_pointer(void* _Nonnull handle
);
void ffi_proton_api_mail_rust_future_free_pointer(void* _Nonnull handle
);
void*_Nonnull ffi_proton_api_mail_rust_future_complete_pointer(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_mail_rust_future_poll_rust_buffer(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_mail_rust_future_cancel_rust_buffer(void* _Nonnull handle
);
void ffi_proton_api_mail_rust_future_free_rust_buffer(void* _Nonnull handle
);
RustBuffer ffi_proton_api_mail_rust_future_complete_rust_buffer(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_mail_rust_future_poll_void(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_mail_rust_future_cancel_void(void* _Nonnull handle
);
void ffi_proton_api_mail_rust_future_free_void(void* _Nonnull handle
);
void ffi_proton_api_mail_rust_future_complete_void(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
uint32_t ffi_proton_api_mail_uniffi_contract_version(void
);
@@ -0,0 +1,169 @@
// This file was autogenerated by some hot garbage in the `uniffi` crate.
// Trust me, you don't want to mess with it!
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
// The following structs are used to implement the lowest level
// of the FFI, and thus useful to multiple uniffied crates.
// We ensure they are declared exactly once, with a header guard, UNIFFI_SHARED_H.
#ifdef UNIFFI_SHARED_H
// We also try to prevent mixing versions of shared uniffi header structs.
// If you add anything to the #else block, you must increment the version suffix in UNIFFI_SHARED_HEADER_V4
#ifndef UNIFFI_SHARED_HEADER_V4
#error Combining helper code from multiple versions of uniffi is not supported
#endif // ndef UNIFFI_SHARED_HEADER_V4
#else
#define UNIFFI_SHARED_H
#define UNIFFI_SHARED_HEADER_V4
// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️
typedef struct RustBuffer
{
int32_t capacity;
int32_t len;
uint8_t *_Nullable data;
} RustBuffer;
typedef int32_t (*ForeignCallback)(uint64_t, int32_t, const uint8_t *_Nonnull, int32_t, RustBuffer *_Nonnull);
typedef struct ForeignBytes
{
int32_t len;
const uint8_t *_Nullable data;
} ForeignBytes;
// Error definitions
typedef struct RustCallStatus {
int8_t code;
RustBuffer errorBuf;
} RustCallStatus;
// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️
#endif // def UNIFFI_SHARED_H
// Continuation callback for UniFFI Futures
typedef void (*UniFfiRustFutureContinuation)(void * _Nonnull, int8_t);
// Scaffolding functions
RustBuffer ffi_proton_core_common_rustbuffer_alloc(int32_t size, RustCallStatus *_Nonnull out_status
);
RustBuffer ffi_proton_core_common_rustbuffer_from_bytes(ForeignBytes bytes, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_common_rustbuffer_free(RustBuffer buf, RustCallStatus *_Nonnull out_status
);
RustBuffer ffi_proton_core_common_rustbuffer_reserve(RustBuffer buf, int32_t additional, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_common_rust_future_poll_u8(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_common_rust_future_cancel_u8(void* _Nonnull handle
);
void ffi_proton_core_common_rust_future_free_u8(void* _Nonnull handle
);
uint8_t ffi_proton_core_common_rust_future_complete_u8(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_common_rust_future_poll_i8(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_common_rust_future_cancel_i8(void* _Nonnull handle
);
void ffi_proton_core_common_rust_future_free_i8(void* _Nonnull handle
);
int8_t ffi_proton_core_common_rust_future_complete_i8(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_common_rust_future_poll_u16(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_common_rust_future_cancel_u16(void* _Nonnull handle
);
void ffi_proton_core_common_rust_future_free_u16(void* _Nonnull handle
);
uint16_t ffi_proton_core_common_rust_future_complete_u16(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_common_rust_future_poll_i16(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_common_rust_future_cancel_i16(void* _Nonnull handle
);
void ffi_proton_core_common_rust_future_free_i16(void* _Nonnull handle
);
int16_t ffi_proton_core_common_rust_future_complete_i16(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_common_rust_future_poll_u32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_common_rust_future_cancel_u32(void* _Nonnull handle
);
void ffi_proton_core_common_rust_future_free_u32(void* _Nonnull handle
);
uint32_t ffi_proton_core_common_rust_future_complete_u32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_common_rust_future_poll_i32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_common_rust_future_cancel_i32(void* _Nonnull handle
);
void ffi_proton_core_common_rust_future_free_i32(void* _Nonnull handle
);
int32_t ffi_proton_core_common_rust_future_complete_i32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_common_rust_future_poll_u64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_common_rust_future_cancel_u64(void* _Nonnull handle
);
void ffi_proton_core_common_rust_future_free_u64(void* _Nonnull handle
);
uint64_t ffi_proton_core_common_rust_future_complete_u64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_common_rust_future_poll_i64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_common_rust_future_cancel_i64(void* _Nonnull handle
);
void ffi_proton_core_common_rust_future_free_i64(void* _Nonnull handle
);
int64_t ffi_proton_core_common_rust_future_complete_i64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_common_rust_future_poll_f32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_common_rust_future_cancel_f32(void* _Nonnull handle
);
void ffi_proton_core_common_rust_future_free_f32(void* _Nonnull handle
);
float ffi_proton_core_common_rust_future_complete_f32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_common_rust_future_poll_f64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_common_rust_future_cancel_f64(void* _Nonnull handle
);
void ffi_proton_core_common_rust_future_free_f64(void* _Nonnull handle
);
double ffi_proton_core_common_rust_future_complete_f64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_common_rust_future_poll_pointer(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_common_rust_future_cancel_pointer(void* _Nonnull handle
);
void ffi_proton_core_common_rust_future_free_pointer(void* _Nonnull handle
);
void*_Nonnull ffi_proton_core_common_rust_future_complete_pointer(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_common_rust_future_poll_rust_buffer(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_common_rust_future_cancel_rust_buffer(void* _Nonnull handle
);
void ffi_proton_core_common_rust_future_free_rust_buffer(void* _Nonnull handle
);
RustBuffer ffi_proton_core_common_rust_future_complete_rust_buffer(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_common_rust_future_poll_void(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_common_rust_future_cancel_void(void* _Nonnull handle
);
void ffi_proton_core_common_rust_future_free_void(void* _Nonnull handle
);
void ffi_proton_core_common_rust_future_complete_void(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
uint32_t ffi_proton_core_common_uniffi_contract_version(void
);
@@ -0,0 +1,169 @@
// This file was autogenerated by some hot garbage in the `uniffi` crate.
// Trust me, you don't want to mess with it!
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
// The following structs are used to implement the lowest level
// of the FFI, and thus useful to multiple uniffied crates.
// We ensure they are declared exactly once, with a header guard, UNIFFI_SHARED_H.
#ifdef UNIFFI_SHARED_H
// We also try to prevent mixing versions of shared uniffi header structs.
// If you add anything to the #else block, you must increment the version suffix in UNIFFI_SHARED_HEADER_V4
#ifndef UNIFFI_SHARED_HEADER_V4
#error Combining helper code from multiple versions of uniffi is not supported
#endif // ndef UNIFFI_SHARED_HEADER_V4
#else
#define UNIFFI_SHARED_H
#define UNIFFI_SHARED_HEADER_V4
// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️
typedef struct RustBuffer
{
int32_t capacity;
int32_t len;
uint8_t *_Nullable data;
} RustBuffer;
typedef int32_t (*ForeignCallback)(uint64_t, int32_t, const uint8_t *_Nonnull, int32_t, RustBuffer *_Nonnull);
typedef struct ForeignBytes
{
int32_t len;
const uint8_t *_Nullable data;
} ForeignBytes;
// Error definitions
typedef struct RustCallStatus {
int8_t code;
RustBuffer errorBuf;
} RustCallStatus;
// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️
#endif // def UNIFFI_SHARED_H
// Continuation callback for UniFFI Futures
typedef void (*UniFfiRustFutureContinuation)(void * _Nonnull, int8_t);
// Scaffolding functions
RustBuffer ffi_proton_core_db_rustbuffer_alloc(int32_t size, RustCallStatus *_Nonnull out_status
);
RustBuffer ffi_proton_core_db_rustbuffer_from_bytes(ForeignBytes bytes, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_db_rustbuffer_free(RustBuffer buf, RustCallStatus *_Nonnull out_status
);
RustBuffer ffi_proton_core_db_rustbuffer_reserve(RustBuffer buf, int32_t additional, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_db_rust_future_poll_u8(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_db_rust_future_cancel_u8(void* _Nonnull handle
);
void ffi_proton_core_db_rust_future_free_u8(void* _Nonnull handle
);
uint8_t ffi_proton_core_db_rust_future_complete_u8(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_db_rust_future_poll_i8(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_db_rust_future_cancel_i8(void* _Nonnull handle
);
void ffi_proton_core_db_rust_future_free_i8(void* _Nonnull handle
);
int8_t ffi_proton_core_db_rust_future_complete_i8(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_db_rust_future_poll_u16(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_db_rust_future_cancel_u16(void* _Nonnull handle
);
void ffi_proton_core_db_rust_future_free_u16(void* _Nonnull handle
);
uint16_t ffi_proton_core_db_rust_future_complete_u16(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_db_rust_future_poll_i16(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_db_rust_future_cancel_i16(void* _Nonnull handle
);
void ffi_proton_core_db_rust_future_free_i16(void* _Nonnull handle
);
int16_t ffi_proton_core_db_rust_future_complete_i16(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_db_rust_future_poll_u32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_db_rust_future_cancel_u32(void* _Nonnull handle
);
void ffi_proton_core_db_rust_future_free_u32(void* _Nonnull handle
);
uint32_t ffi_proton_core_db_rust_future_complete_u32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_db_rust_future_poll_i32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_db_rust_future_cancel_i32(void* _Nonnull handle
);
void ffi_proton_core_db_rust_future_free_i32(void* _Nonnull handle
);
int32_t ffi_proton_core_db_rust_future_complete_i32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_db_rust_future_poll_u64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_db_rust_future_cancel_u64(void* _Nonnull handle
);
void ffi_proton_core_db_rust_future_free_u64(void* _Nonnull handle
);
uint64_t ffi_proton_core_db_rust_future_complete_u64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_db_rust_future_poll_i64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_db_rust_future_cancel_i64(void* _Nonnull handle
);
void ffi_proton_core_db_rust_future_free_i64(void* _Nonnull handle
);
int64_t ffi_proton_core_db_rust_future_complete_i64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_db_rust_future_poll_f32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_db_rust_future_cancel_f32(void* _Nonnull handle
);
void ffi_proton_core_db_rust_future_free_f32(void* _Nonnull handle
);
float ffi_proton_core_db_rust_future_complete_f32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_db_rust_future_poll_f64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_db_rust_future_cancel_f64(void* _Nonnull handle
);
void ffi_proton_core_db_rust_future_free_f64(void* _Nonnull handle
);
double ffi_proton_core_db_rust_future_complete_f64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_db_rust_future_poll_pointer(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_db_rust_future_cancel_pointer(void* _Nonnull handle
);
void ffi_proton_core_db_rust_future_free_pointer(void* _Nonnull handle
);
void*_Nonnull ffi_proton_core_db_rust_future_complete_pointer(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_db_rust_future_poll_rust_buffer(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_db_rust_future_cancel_rust_buffer(void* _Nonnull handle
);
void ffi_proton_core_db_rust_future_free_rust_buffer(void* _Nonnull handle
);
RustBuffer ffi_proton_core_db_rust_future_complete_rust_buffer(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_db_rust_future_poll_void(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_db_rust_future_cancel_void(void* _Nonnull handle
);
void ffi_proton_core_db_rust_future_free_void(void* _Nonnull handle
);
void ffi_proton_core_db_rust_future_complete_void(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
uint32_t ffi_proton_core_db_uniffi_contract_version(void
);
@@ -0,0 +1,169 @@
// This file was autogenerated by some hot garbage in the `uniffi` crate.
// Trust me, you don't want to mess with it!
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
// The following structs are used to implement the lowest level
// of the FFI, and thus useful to multiple uniffied crates.
// We ensure they are declared exactly once, with a header guard, UNIFFI_SHARED_H.
#ifdef UNIFFI_SHARED_H
// We also try to prevent mixing versions of shared uniffi header structs.
// If you add anything to the #else block, you must increment the version suffix in UNIFFI_SHARED_HEADER_V4
#ifndef UNIFFI_SHARED_HEADER_V4
#error Combining helper code from multiple versions of uniffi is not supported
#endif // ndef UNIFFI_SHARED_HEADER_V4
#else
#define UNIFFI_SHARED_H
#define UNIFFI_SHARED_HEADER_V4
// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️
typedef struct RustBuffer
{
int32_t capacity;
int32_t len;
uint8_t *_Nullable data;
} RustBuffer;
typedef int32_t (*ForeignCallback)(uint64_t, int32_t, const uint8_t *_Nonnull, int32_t, RustBuffer *_Nonnull);
typedef struct ForeignBytes
{
int32_t len;
const uint8_t *_Nullable data;
} ForeignBytes;
// Error definitions
typedef struct RustCallStatus {
int8_t code;
RustBuffer errorBuf;
} RustCallStatus;
// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️
#endif // def UNIFFI_SHARED_H
// Continuation callback for UniFFI Futures
typedef void (*UniFfiRustFutureContinuation)(void * _Nonnull, int8_t);
// Scaffolding functions
RustBuffer ffi_proton_mail_common_rustbuffer_alloc(int32_t size, RustCallStatus *_Nonnull out_status
);
RustBuffer ffi_proton_mail_common_rustbuffer_from_bytes(ForeignBytes bytes, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_common_rustbuffer_free(RustBuffer buf, RustCallStatus *_Nonnull out_status
);
RustBuffer ffi_proton_mail_common_rustbuffer_reserve(RustBuffer buf, int32_t additional, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_common_rust_future_poll_u8(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_common_rust_future_cancel_u8(void* _Nonnull handle
);
void ffi_proton_mail_common_rust_future_free_u8(void* _Nonnull handle
);
uint8_t ffi_proton_mail_common_rust_future_complete_u8(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_common_rust_future_poll_i8(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_common_rust_future_cancel_i8(void* _Nonnull handle
);
void ffi_proton_mail_common_rust_future_free_i8(void* _Nonnull handle
);
int8_t ffi_proton_mail_common_rust_future_complete_i8(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_common_rust_future_poll_u16(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_common_rust_future_cancel_u16(void* _Nonnull handle
);
void ffi_proton_mail_common_rust_future_free_u16(void* _Nonnull handle
);
uint16_t ffi_proton_mail_common_rust_future_complete_u16(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_common_rust_future_poll_i16(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_common_rust_future_cancel_i16(void* _Nonnull handle
);
void ffi_proton_mail_common_rust_future_free_i16(void* _Nonnull handle
);
int16_t ffi_proton_mail_common_rust_future_complete_i16(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_common_rust_future_poll_u32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_common_rust_future_cancel_u32(void* _Nonnull handle
);
void ffi_proton_mail_common_rust_future_free_u32(void* _Nonnull handle
);
uint32_t ffi_proton_mail_common_rust_future_complete_u32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_common_rust_future_poll_i32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_common_rust_future_cancel_i32(void* _Nonnull handle
);
void ffi_proton_mail_common_rust_future_free_i32(void* _Nonnull handle
);
int32_t ffi_proton_mail_common_rust_future_complete_i32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_common_rust_future_poll_u64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_common_rust_future_cancel_u64(void* _Nonnull handle
);
void ffi_proton_mail_common_rust_future_free_u64(void* _Nonnull handle
);
uint64_t ffi_proton_mail_common_rust_future_complete_u64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_common_rust_future_poll_i64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_common_rust_future_cancel_i64(void* _Nonnull handle
);
void ffi_proton_mail_common_rust_future_free_i64(void* _Nonnull handle
);
int64_t ffi_proton_mail_common_rust_future_complete_i64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_common_rust_future_poll_f32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_common_rust_future_cancel_f32(void* _Nonnull handle
);
void ffi_proton_mail_common_rust_future_free_f32(void* _Nonnull handle
);
float ffi_proton_mail_common_rust_future_complete_f32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_common_rust_future_poll_f64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_common_rust_future_cancel_f64(void* _Nonnull handle
);
void ffi_proton_mail_common_rust_future_free_f64(void* _Nonnull handle
);
double ffi_proton_mail_common_rust_future_complete_f64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_common_rust_future_poll_pointer(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_common_rust_future_cancel_pointer(void* _Nonnull handle
);
void ffi_proton_mail_common_rust_future_free_pointer(void* _Nonnull handle
);
void*_Nonnull ffi_proton_mail_common_rust_future_complete_pointer(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_common_rust_future_poll_rust_buffer(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_common_rust_future_cancel_rust_buffer(void* _Nonnull handle
);
void ffi_proton_mail_common_rust_future_free_rust_buffer(void* _Nonnull handle
);
RustBuffer ffi_proton_mail_common_rust_future_complete_rust_buffer(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_common_rust_future_poll_void(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_common_rust_future_cancel_void(void* _Nonnull handle
);
void ffi_proton_mail_common_rust_future_free_void(void* _Nonnull handle
);
void ffi_proton_mail_common_rust_future_complete_void(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
uint32_t ffi_proton_mail_common_uniffi_contract_version(void
);
@@ -0,0 +1,169 @@
// This file was autogenerated by some hot garbage in the `uniffi` crate.
// Trust me, you don't want to mess with it!
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
// The following structs are used to implement the lowest level
// of the FFI, and thus useful to multiple uniffied crates.
// We ensure they are declared exactly once, with a header guard, UNIFFI_SHARED_H.
#ifdef UNIFFI_SHARED_H
// We also try to prevent mixing versions of shared uniffi header structs.
// If you add anything to the #else block, you must increment the version suffix in UNIFFI_SHARED_HEADER_V4
#ifndef UNIFFI_SHARED_HEADER_V4
#error Combining helper code from multiple versions of uniffi is not supported
#endif // ndef UNIFFI_SHARED_HEADER_V4
#else
#define UNIFFI_SHARED_H
#define UNIFFI_SHARED_HEADER_V4
// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️
typedef struct RustBuffer
{
int32_t capacity;
int32_t len;
uint8_t *_Nullable data;
} RustBuffer;
typedef int32_t (*ForeignCallback)(uint64_t, int32_t, const uint8_t *_Nonnull, int32_t, RustBuffer *_Nonnull);
typedef struct ForeignBytes
{
int32_t len;
const uint8_t *_Nullable data;
} ForeignBytes;
// Error definitions
typedef struct RustCallStatus {
int8_t code;
RustBuffer errorBuf;
} RustCallStatus;
// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️
#endif // def UNIFFI_SHARED_H
// Continuation callback for UniFFI Futures
typedef void (*UniFfiRustFutureContinuation)(void * _Nonnull, int8_t);
// Scaffolding functions
RustBuffer ffi_proton_mail_db_rustbuffer_alloc(int32_t size, RustCallStatus *_Nonnull out_status
);
RustBuffer ffi_proton_mail_db_rustbuffer_from_bytes(ForeignBytes bytes, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_db_rustbuffer_free(RustBuffer buf, RustCallStatus *_Nonnull out_status
);
RustBuffer ffi_proton_mail_db_rustbuffer_reserve(RustBuffer buf, int32_t additional, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_db_rust_future_poll_u8(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_db_rust_future_cancel_u8(void* _Nonnull handle
);
void ffi_proton_mail_db_rust_future_free_u8(void* _Nonnull handle
);
uint8_t ffi_proton_mail_db_rust_future_complete_u8(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_db_rust_future_poll_i8(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_db_rust_future_cancel_i8(void* _Nonnull handle
);
void ffi_proton_mail_db_rust_future_free_i8(void* _Nonnull handle
);
int8_t ffi_proton_mail_db_rust_future_complete_i8(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_db_rust_future_poll_u16(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_db_rust_future_cancel_u16(void* _Nonnull handle
);
void ffi_proton_mail_db_rust_future_free_u16(void* _Nonnull handle
);
uint16_t ffi_proton_mail_db_rust_future_complete_u16(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_db_rust_future_poll_i16(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_db_rust_future_cancel_i16(void* _Nonnull handle
);
void ffi_proton_mail_db_rust_future_free_i16(void* _Nonnull handle
);
int16_t ffi_proton_mail_db_rust_future_complete_i16(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_db_rust_future_poll_u32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_db_rust_future_cancel_u32(void* _Nonnull handle
);
void ffi_proton_mail_db_rust_future_free_u32(void* _Nonnull handle
);
uint32_t ffi_proton_mail_db_rust_future_complete_u32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_db_rust_future_poll_i32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_db_rust_future_cancel_i32(void* _Nonnull handle
);
void ffi_proton_mail_db_rust_future_free_i32(void* _Nonnull handle
);
int32_t ffi_proton_mail_db_rust_future_complete_i32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_db_rust_future_poll_u64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_db_rust_future_cancel_u64(void* _Nonnull handle
);
void ffi_proton_mail_db_rust_future_free_u64(void* _Nonnull handle
);
uint64_t ffi_proton_mail_db_rust_future_complete_u64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_db_rust_future_poll_i64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_db_rust_future_cancel_i64(void* _Nonnull handle
);
void ffi_proton_mail_db_rust_future_free_i64(void* _Nonnull handle
);
int64_t ffi_proton_mail_db_rust_future_complete_i64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_db_rust_future_poll_f32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_db_rust_future_cancel_f32(void* _Nonnull handle
);
void ffi_proton_mail_db_rust_future_free_f32(void* _Nonnull handle
);
float ffi_proton_mail_db_rust_future_complete_f32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_db_rust_future_poll_f64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_db_rust_future_cancel_f64(void* _Nonnull handle
);
void ffi_proton_mail_db_rust_future_free_f64(void* _Nonnull handle
);
double ffi_proton_mail_db_rust_future_complete_f64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_db_rust_future_poll_pointer(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_db_rust_future_cancel_pointer(void* _Nonnull handle
);
void ffi_proton_mail_db_rust_future_free_pointer(void* _Nonnull handle
);
void*_Nonnull ffi_proton_mail_db_rust_future_complete_pointer(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_db_rust_future_poll_rust_buffer(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_db_rust_future_cancel_rust_buffer(void* _Nonnull handle
);
void ffi_proton_mail_db_rust_future_free_rust_buffer(void* _Nonnull handle
);
RustBuffer ffi_proton_mail_db_rust_future_complete_rust_buffer(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_db_rust_future_poll_void(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_db_rust_future_cancel_void(void* _Nonnull handle
);
void ffi_proton_mail_db_rust_future_free_void(void* _Nonnull handle
);
void ffi_proton_mail_db_rust_future_complete_void(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
uint32_t ffi_proton_mail_db_uniffi_contract_version(void
);
@@ -0,0 +1,407 @@
// This file was autogenerated by some hot garbage in the `uniffi` crate.
// Trust me, you don't want to mess with it!
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
// The following structs are used to implement the lowest level
// of the FFI, and thus useful to multiple uniffied crates.
// We ensure they are declared exactly once, with a header guard, UNIFFI_SHARED_H.
#ifdef UNIFFI_SHARED_H
// We also try to prevent mixing versions of shared uniffi header structs.
// If you add anything to the #else block, you must increment the version suffix in UNIFFI_SHARED_HEADER_V4
#ifndef UNIFFI_SHARED_HEADER_V4
#error Combining helper code from multiple versions of uniffi is not supported
#endif // ndef UNIFFI_SHARED_HEADER_V4
#else
#define UNIFFI_SHARED_H
#define UNIFFI_SHARED_HEADER_V4
// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️
typedef struct RustBuffer
{
int32_t capacity;
int32_t len;
uint8_t *_Nullable data;
} RustBuffer;
typedef int32_t (*ForeignCallback)(uint64_t, int32_t, const uint8_t *_Nonnull, int32_t, RustBuffer *_Nonnull);
typedef struct ForeignBytes
{
int32_t len;
const uint8_t *_Nullable data;
} ForeignBytes;
// Error definitions
typedef struct RustCallStatus {
int8_t code;
RustBuffer errorBuf;
} RustCallStatus;
// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️
#endif // def UNIFFI_SHARED_H
// Continuation callback for UniFFI Futures
typedef void (*UniFfiRustFutureContinuation)(void * _Nonnull, int8_t);
// Scaffolding functions
void*_Nonnull uniffi_proton_mail_uniffi_fn_clone_loginflow(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void uniffi_proton_mail_uniffi_fn_free_loginflow(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
int8_t uniffi_proton_mail_uniffi_fn_method_loginflow_is_awaiting_2fa(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
int8_t uniffi_proton_mail_uniffi_fn_method_loginflow_is_logged_in(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void* _Nonnull uniffi_proton_mail_uniffi_fn_method_loginflow_login(void*_Nonnull ptr, RustBuffer email, RustBuffer password
);
void* _Nonnull uniffi_proton_mail_uniffi_fn_method_loginflow_submit_totp(void*_Nonnull ptr, RustBuffer code
);
void*_Nonnull uniffi_proton_mail_uniffi_fn_method_loginflow_to_user_context(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void*_Nonnull uniffi_proton_mail_uniffi_fn_clone_mailcontext(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void uniffi_proton_mail_uniffi_fn_free_mailcontext(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void*_Nonnull uniffi_proton_mail_uniffi_fn_constructor_mailcontext_new(RustBuffer session_dir, RustBuffer user_dir, RustBuffer log_dir, int8_t log_debug, uint64_t key_chain, RustBuffer network_callback, RustCallStatus *_Nonnull out_status
);
int8_t uniffi_proton_mail_uniffi_fn_method_mailcontext_is_network_connected(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void*_Nonnull uniffi_proton_mail_uniffi_fn_method_mailcontext_new_login_flow(void*_Nonnull ptr, RustBuffer cb, RustCallStatus *_Nonnull out_status
);
void uniffi_proton_mail_uniffi_fn_method_mailcontext_set_network_connected(void*_Nonnull ptr, int8_t online, RustCallStatus *_Nonnull out_status
);
RustBuffer uniffi_proton_mail_uniffi_fn_method_mailcontext_stored_sessions(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void*_Nonnull uniffi_proton_mail_uniffi_fn_method_mailcontext_user_context_from_session(void*_Nonnull ptr, void*_Nonnull session, RustBuffer cb, RustCallStatus *_Nonnull out_status
);
void*_Nonnull uniffi_proton_mail_uniffi_fn_clone_mailusercontext(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void uniffi_proton_mail_uniffi_fn_free_mailusercontext(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void* _Nonnull uniffi_proton_mail_uniffi_fn_method_mailusercontext_initialize(void*_Nonnull ptr, uint64_t cb
);
void* _Nonnull uniffi_proton_mail_uniffi_fn_method_mailusercontext_logout(void*_Nonnull ptr
);
RustBuffer uniffi_proton_mail_uniffi_fn_method_mailusercontext_mail_settings(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void* _Nonnull uniffi_proton_mail_uniffi_fn_method_mailusercontext_poll_events(void*_Nonnull ptr
);
void*_Nonnull uniffi_proton_mail_uniffi_fn_clone_mailbox(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void uniffi_proton_mail_uniffi_fn_free_mailbox(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void*_Nonnull uniffi_proton_mail_uniffi_fn_constructor_mailbox_new(void*_Nonnull ctx, RustCallStatus *_Nonnull out_status
);
RustBuffer uniffi_proton_mail_uniffi_fn_method_mailbox_active_label(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
RustBuffer uniffi_proton_mail_uniffi_fn_method_mailbox_conversations(void*_Nonnull ptr, int64_t count, RustCallStatus *_Nonnull out_status
);
RustBuffer uniffi_proton_mail_uniffi_fn_method_mailbox_labels_by_type(void*_Nonnull ptr, RustBuffer label_type, RustCallStatus *_Nonnull out_status
);
void*_Nonnull uniffi_proton_mail_uniffi_fn_method_mailbox_new_conversation_observed_query(void*_Nonnull ptr, int64_t limit, uint64_t cb, RustCallStatus *_Nonnull out_status
);
void*_Nonnull uniffi_proton_mail_uniffi_fn_method_mailbox_new_folder_labels_observed_query(void*_Nonnull ptr, uint64_t cb, RustCallStatus *_Nonnull out_status
);
void*_Nonnull uniffi_proton_mail_uniffi_fn_method_mailbox_new_label_labels_observed_query(void*_Nonnull ptr, uint64_t cb, RustCallStatus *_Nonnull out_status
);
void*_Nonnull uniffi_proton_mail_uniffi_fn_method_mailbox_new_system_labels_observed_query(void*_Nonnull ptr, uint64_t cb, RustCallStatus *_Nonnull out_status
);
void uniffi_proton_mail_uniffi_fn_method_mailbox_switch_label(void*_Nonnull ptr, uint64_t label_id, int64_t message_count, RustBuffer cb, RustCallStatus *_Nonnull out_status
);
void*_Nonnull uniffi_proton_mail_uniffi_fn_clone_mailboxconversationlivequery(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void uniffi_proton_mail_uniffi_fn_free_mailboxconversationlivequery(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void uniffi_proton_mail_uniffi_fn_method_mailboxconversationlivequery_disconnect(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
RustBuffer uniffi_proton_mail_uniffi_fn_method_mailboxconversationlivequery_value(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void*_Nonnull uniffi_proton_mail_uniffi_fn_clone_mailboxlabelslivequery(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void uniffi_proton_mail_uniffi_fn_free_mailboxlabelslivequery(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void uniffi_proton_mail_uniffi_fn_method_mailboxlabelslivequery_disconnect(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
RustBuffer uniffi_proton_mail_uniffi_fn_method_mailboxlabelslivequery_value(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void*_Nonnull uniffi_proton_mail_uniffi_fn_clone_storedsession(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void uniffi_proton_mail_uniffi_fn_free_storedsession(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
RustBuffer uniffi_proton_mail_uniffi_fn_method_storedsession_email(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
RustBuffer uniffi_proton_mail_uniffi_fn_method_storedsession_name(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
RustBuffer uniffi_proton_mail_uniffi_fn_method_storedsession_session_id(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
RustBuffer uniffi_proton_mail_uniffi_fn_method_storedsession_user_id(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void uniffi_proton_mail_uniffi_fn_init_callback_mailusercontextinitializationcallback(ForeignCallback _Nonnull handle
);
void uniffi_proton_mail_uniffi_fn_init_callback_mailboxbackgroundresult(ForeignCallback _Nonnull handle
);
void uniffi_proton_mail_uniffi_fn_init_callback_mailboxlivequeryupdatedcallback(ForeignCallback _Nonnull handle
);
void uniffi_proton_mail_uniffi_fn_init_callback_networkstatuschanged(ForeignCallback _Nonnull handle
);
void uniffi_proton_mail_uniffi_fn_init_callback_oskeychain(ForeignCallback _Nonnull handle
);
void uniffi_proton_mail_uniffi_fn_init_callback_sessioncallback(ForeignCallback _Nonnull handle
);
RustBuffer uniffi_proton_mail_uniffi_fn_func_locate_blockquote(RustBuffer input, RustCallStatus *_Nonnull out_status
);
RustBuffer ffi_proton_mail_uniffi_rustbuffer_alloc(int32_t size, RustCallStatus *_Nonnull out_status
);
RustBuffer ffi_proton_mail_uniffi_rustbuffer_from_bytes(ForeignBytes bytes, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_uniffi_rustbuffer_free(RustBuffer buf, RustCallStatus *_Nonnull out_status
);
RustBuffer ffi_proton_mail_uniffi_rustbuffer_reserve(RustBuffer buf, int32_t additional, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_uniffi_rust_future_poll_u8(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_uniffi_rust_future_cancel_u8(void* _Nonnull handle
);
void ffi_proton_mail_uniffi_rust_future_free_u8(void* _Nonnull handle
);
uint8_t ffi_proton_mail_uniffi_rust_future_complete_u8(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_uniffi_rust_future_poll_i8(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_uniffi_rust_future_cancel_i8(void* _Nonnull handle
);
void ffi_proton_mail_uniffi_rust_future_free_i8(void* _Nonnull handle
);
int8_t ffi_proton_mail_uniffi_rust_future_complete_i8(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_uniffi_rust_future_poll_u16(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_uniffi_rust_future_cancel_u16(void* _Nonnull handle
);
void ffi_proton_mail_uniffi_rust_future_free_u16(void* _Nonnull handle
);
uint16_t ffi_proton_mail_uniffi_rust_future_complete_u16(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_uniffi_rust_future_poll_i16(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_uniffi_rust_future_cancel_i16(void* _Nonnull handle
);
void ffi_proton_mail_uniffi_rust_future_free_i16(void* _Nonnull handle
);
int16_t ffi_proton_mail_uniffi_rust_future_complete_i16(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_uniffi_rust_future_poll_u32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_uniffi_rust_future_cancel_u32(void* _Nonnull handle
);
void ffi_proton_mail_uniffi_rust_future_free_u32(void* _Nonnull handle
);
uint32_t ffi_proton_mail_uniffi_rust_future_complete_u32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_uniffi_rust_future_poll_i32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_uniffi_rust_future_cancel_i32(void* _Nonnull handle
);
void ffi_proton_mail_uniffi_rust_future_free_i32(void* _Nonnull handle
);
int32_t ffi_proton_mail_uniffi_rust_future_complete_i32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_uniffi_rust_future_poll_u64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_uniffi_rust_future_cancel_u64(void* _Nonnull handle
);
void ffi_proton_mail_uniffi_rust_future_free_u64(void* _Nonnull handle
);
uint64_t ffi_proton_mail_uniffi_rust_future_complete_u64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_uniffi_rust_future_poll_i64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_uniffi_rust_future_cancel_i64(void* _Nonnull handle
);
void ffi_proton_mail_uniffi_rust_future_free_i64(void* _Nonnull handle
);
int64_t ffi_proton_mail_uniffi_rust_future_complete_i64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_uniffi_rust_future_poll_f32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_uniffi_rust_future_cancel_f32(void* _Nonnull handle
);
void ffi_proton_mail_uniffi_rust_future_free_f32(void* _Nonnull handle
);
float ffi_proton_mail_uniffi_rust_future_complete_f32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_uniffi_rust_future_poll_f64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_uniffi_rust_future_cancel_f64(void* _Nonnull handle
);
void ffi_proton_mail_uniffi_rust_future_free_f64(void* _Nonnull handle
);
double ffi_proton_mail_uniffi_rust_future_complete_f64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_uniffi_rust_future_poll_pointer(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_uniffi_rust_future_cancel_pointer(void* _Nonnull handle
);
void ffi_proton_mail_uniffi_rust_future_free_pointer(void* _Nonnull handle
);
void*_Nonnull ffi_proton_mail_uniffi_rust_future_complete_pointer(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_uniffi_rust_future_poll_rust_buffer(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_uniffi_rust_future_cancel_rust_buffer(void* _Nonnull handle
);
void ffi_proton_mail_uniffi_rust_future_free_rust_buffer(void* _Nonnull handle
);
RustBuffer ffi_proton_mail_uniffi_rust_future_complete_rust_buffer(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_uniffi_rust_future_poll_void(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_uniffi_rust_future_cancel_void(void* _Nonnull handle
);
void ffi_proton_mail_uniffi_rust_future_free_void(void* _Nonnull handle
);
void ffi_proton_mail_uniffi_rust_future_complete_void(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
uint16_t uniffi_proton_mail_uniffi_checksum_func_locate_blockquote(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_loginflow_is_awaiting_2fa(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_loginflow_is_logged_in(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_loginflow_login(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_loginflow_submit_totp(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_loginflow_to_user_context(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailcontext_is_network_connected(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailcontext_new_login_flow(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailcontext_set_network_connected(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailcontext_stored_sessions(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailcontext_user_context_from_session(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailusercontext_initialize(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailusercontext_logout(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailusercontext_mail_settings(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailusercontext_poll_events(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailbox_active_label(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailbox_conversations(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailbox_labels_by_type(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailbox_new_conversation_observed_query(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailbox_new_folder_labels_observed_query(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailbox_new_label_labels_observed_query(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailbox_new_system_labels_observed_query(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailbox_switch_label(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailboxconversationlivequery_disconnect(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailboxconversationlivequery_value(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailboxlabelslivequery_disconnect(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailboxlabelslivequery_value(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_storedsession_email(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_storedsession_name(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_storedsession_session_id(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_storedsession_user_id(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_constructor_mailcontext_new(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_constructor_mailbox_new(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailusercontextinitializationcallback_on_stage(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailboxbackgroundresult_on_background_result(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailboxlivequeryupdatedcallback_on_updated(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_networkstatuschanged_on_network_status_changed(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_oskeychain_store(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_oskeychain_delete(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_oskeychain_get(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_sessioncallback_on_session_refresh(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_sessioncallback_on_session_deleted(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_sessioncallback_on_refresh_failed(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_sessioncallback_on_error(void
);
uint32_t ffi_proton_mail_uniffi_uniffi_contract_version(void
);
@@ -0,0 +1,10 @@
framework module proton_mail_uniffi_ffi {
header "proton_api_coreFFI.h"
header "proton_api_mailFFI.h"
header "proton_core_commonFFI.h"
header "proton_core_dbFFI.h"
header "proton_mail_commonFFI.h"
header "proton_mail_dbFFI.h"
header "proton_mail_uniffiFFI.h"
export *
}
@@ -0,0 +1,169 @@
// This file was autogenerated by some hot garbage in the `uniffi` crate.
// Trust me, you don't want to mess with it!
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
// The following structs are used to implement the lowest level
// of the FFI, and thus useful to multiple uniffied crates.
// We ensure they are declared exactly once, with a header guard, UNIFFI_SHARED_H.
#ifdef UNIFFI_SHARED_H
// We also try to prevent mixing versions of shared uniffi header structs.
// If you add anything to the #else block, you must increment the version suffix in UNIFFI_SHARED_HEADER_V4
#ifndef UNIFFI_SHARED_HEADER_V4
#error Combining helper code from multiple versions of uniffi is not supported
#endif // ndef UNIFFI_SHARED_HEADER_V4
#else
#define UNIFFI_SHARED_H
#define UNIFFI_SHARED_HEADER_V4
// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️
typedef struct RustBuffer
{
int32_t capacity;
int32_t len;
uint8_t *_Nullable data;
} RustBuffer;
typedef int32_t (*ForeignCallback)(uint64_t, int32_t, const uint8_t *_Nonnull, int32_t, RustBuffer *_Nonnull);
typedef struct ForeignBytes
{
int32_t len;
const uint8_t *_Nullable data;
} ForeignBytes;
// Error definitions
typedef struct RustCallStatus {
int8_t code;
RustBuffer errorBuf;
} RustCallStatus;
// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️
#endif // def UNIFFI_SHARED_H
// Continuation callback for UniFFI Futures
typedef void (*UniFfiRustFutureContinuation)(void * _Nonnull, int8_t);
// Scaffolding functions
RustBuffer ffi_proton_api_core_rustbuffer_alloc(int32_t size, RustCallStatus *_Nonnull out_status
);
RustBuffer ffi_proton_api_core_rustbuffer_from_bytes(ForeignBytes bytes, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_core_rustbuffer_free(RustBuffer buf, RustCallStatus *_Nonnull out_status
);
RustBuffer ffi_proton_api_core_rustbuffer_reserve(RustBuffer buf, int32_t additional, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_core_rust_future_poll_u8(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_core_rust_future_cancel_u8(void* _Nonnull handle
);
void ffi_proton_api_core_rust_future_free_u8(void* _Nonnull handle
);
uint8_t ffi_proton_api_core_rust_future_complete_u8(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_core_rust_future_poll_i8(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_core_rust_future_cancel_i8(void* _Nonnull handle
);
void ffi_proton_api_core_rust_future_free_i8(void* _Nonnull handle
);
int8_t ffi_proton_api_core_rust_future_complete_i8(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_core_rust_future_poll_u16(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_core_rust_future_cancel_u16(void* _Nonnull handle
);
void ffi_proton_api_core_rust_future_free_u16(void* _Nonnull handle
);
uint16_t ffi_proton_api_core_rust_future_complete_u16(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_core_rust_future_poll_i16(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_core_rust_future_cancel_i16(void* _Nonnull handle
);
void ffi_proton_api_core_rust_future_free_i16(void* _Nonnull handle
);
int16_t ffi_proton_api_core_rust_future_complete_i16(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_core_rust_future_poll_u32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_core_rust_future_cancel_u32(void* _Nonnull handle
);
void ffi_proton_api_core_rust_future_free_u32(void* _Nonnull handle
);
uint32_t ffi_proton_api_core_rust_future_complete_u32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_core_rust_future_poll_i32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_core_rust_future_cancel_i32(void* _Nonnull handle
);
void ffi_proton_api_core_rust_future_free_i32(void* _Nonnull handle
);
int32_t ffi_proton_api_core_rust_future_complete_i32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_core_rust_future_poll_u64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_core_rust_future_cancel_u64(void* _Nonnull handle
);
void ffi_proton_api_core_rust_future_free_u64(void* _Nonnull handle
);
uint64_t ffi_proton_api_core_rust_future_complete_u64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_core_rust_future_poll_i64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_core_rust_future_cancel_i64(void* _Nonnull handle
);
void ffi_proton_api_core_rust_future_free_i64(void* _Nonnull handle
);
int64_t ffi_proton_api_core_rust_future_complete_i64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_core_rust_future_poll_f32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_core_rust_future_cancel_f32(void* _Nonnull handle
);
void ffi_proton_api_core_rust_future_free_f32(void* _Nonnull handle
);
float ffi_proton_api_core_rust_future_complete_f32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_core_rust_future_poll_f64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_core_rust_future_cancel_f64(void* _Nonnull handle
);
void ffi_proton_api_core_rust_future_free_f64(void* _Nonnull handle
);
double ffi_proton_api_core_rust_future_complete_f64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_core_rust_future_poll_pointer(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_core_rust_future_cancel_pointer(void* _Nonnull handle
);
void ffi_proton_api_core_rust_future_free_pointer(void* _Nonnull handle
);
void*_Nonnull ffi_proton_api_core_rust_future_complete_pointer(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_core_rust_future_poll_rust_buffer(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_core_rust_future_cancel_rust_buffer(void* _Nonnull handle
);
void ffi_proton_api_core_rust_future_free_rust_buffer(void* _Nonnull handle
);
RustBuffer ffi_proton_api_core_rust_future_complete_rust_buffer(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_core_rust_future_poll_void(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_core_rust_future_cancel_void(void* _Nonnull handle
);
void ffi_proton_api_core_rust_future_free_void(void* _Nonnull handle
);
void ffi_proton_api_core_rust_future_complete_void(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
uint32_t ffi_proton_api_core_uniffi_contract_version(void
);
@@ -0,0 +1,169 @@
// This file was autogenerated by some hot garbage in the `uniffi` crate.
// Trust me, you don't want to mess with it!
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
// The following structs are used to implement the lowest level
// of the FFI, and thus useful to multiple uniffied crates.
// We ensure they are declared exactly once, with a header guard, UNIFFI_SHARED_H.
#ifdef UNIFFI_SHARED_H
// We also try to prevent mixing versions of shared uniffi header structs.
// If you add anything to the #else block, you must increment the version suffix in UNIFFI_SHARED_HEADER_V4
#ifndef UNIFFI_SHARED_HEADER_V4
#error Combining helper code from multiple versions of uniffi is not supported
#endif // ndef UNIFFI_SHARED_HEADER_V4
#else
#define UNIFFI_SHARED_H
#define UNIFFI_SHARED_HEADER_V4
// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️
typedef struct RustBuffer
{
int32_t capacity;
int32_t len;
uint8_t *_Nullable data;
} RustBuffer;
typedef int32_t (*ForeignCallback)(uint64_t, int32_t, const uint8_t *_Nonnull, int32_t, RustBuffer *_Nonnull);
typedef struct ForeignBytes
{
int32_t len;
const uint8_t *_Nullable data;
} ForeignBytes;
// Error definitions
typedef struct RustCallStatus {
int8_t code;
RustBuffer errorBuf;
} RustCallStatus;
// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️
#endif // def UNIFFI_SHARED_H
// Continuation callback for UniFFI Futures
typedef void (*UniFfiRustFutureContinuation)(void * _Nonnull, int8_t);
// Scaffolding functions
RustBuffer ffi_proton_api_mail_rustbuffer_alloc(int32_t size, RustCallStatus *_Nonnull out_status
);
RustBuffer ffi_proton_api_mail_rustbuffer_from_bytes(ForeignBytes bytes, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_mail_rustbuffer_free(RustBuffer buf, RustCallStatus *_Nonnull out_status
);
RustBuffer ffi_proton_api_mail_rustbuffer_reserve(RustBuffer buf, int32_t additional, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_mail_rust_future_poll_u8(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_mail_rust_future_cancel_u8(void* _Nonnull handle
);
void ffi_proton_api_mail_rust_future_free_u8(void* _Nonnull handle
);
uint8_t ffi_proton_api_mail_rust_future_complete_u8(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_mail_rust_future_poll_i8(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_mail_rust_future_cancel_i8(void* _Nonnull handle
);
void ffi_proton_api_mail_rust_future_free_i8(void* _Nonnull handle
);
int8_t ffi_proton_api_mail_rust_future_complete_i8(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_mail_rust_future_poll_u16(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_mail_rust_future_cancel_u16(void* _Nonnull handle
);
void ffi_proton_api_mail_rust_future_free_u16(void* _Nonnull handle
);
uint16_t ffi_proton_api_mail_rust_future_complete_u16(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_mail_rust_future_poll_i16(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_mail_rust_future_cancel_i16(void* _Nonnull handle
);
void ffi_proton_api_mail_rust_future_free_i16(void* _Nonnull handle
);
int16_t ffi_proton_api_mail_rust_future_complete_i16(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_mail_rust_future_poll_u32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_mail_rust_future_cancel_u32(void* _Nonnull handle
);
void ffi_proton_api_mail_rust_future_free_u32(void* _Nonnull handle
);
uint32_t ffi_proton_api_mail_rust_future_complete_u32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_mail_rust_future_poll_i32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_mail_rust_future_cancel_i32(void* _Nonnull handle
);
void ffi_proton_api_mail_rust_future_free_i32(void* _Nonnull handle
);
int32_t ffi_proton_api_mail_rust_future_complete_i32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_mail_rust_future_poll_u64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_mail_rust_future_cancel_u64(void* _Nonnull handle
);
void ffi_proton_api_mail_rust_future_free_u64(void* _Nonnull handle
);
uint64_t ffi_proton_api_mail_rust_future_complete_u64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_mail_rust_future_poll_i64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_mail_rust_future_cancel_i64(void* _Nonnull handle
);
void ffi_proton_api_mail_rust_future_free_i64(void* _Nonnull handle
);
int64_t ffi_proton_api_mail_rust_future_complete_i64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_mail_rust_future_poll_f32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_mail_rust_future_cancel_f32(void* _Nonnull handle
);
void ffi_proton_api_mail_rust_future_free_f32(void* _Nonnull handle
);
float ffi_proton_api_mail_rust_future_complete_f32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_mail_rust_future_poll_f64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_mail_rust_future_cancel_f64(void* _Nonnull handle
);
void ffi_proton_api_mail_rust_future_free_f64(void* _Nonnull handle
);
double ffi_proton_api_mail_rust_future_complete_f64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_mail_rust_future_poll_pointer(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_mail_rust_future_cancel_pointer(void* _Nonnull handle
);
void ffi_proton_api_mail_rust_future_free_pointer(void* _Nonnull handle
);
void*_Nonnull ffi_proton_api_mail_rust_future_complete_pointer(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_mail_rust_future_poll_rust_buffer(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_mail_rust_future_cancel_rust_buffer(void* _Nonnull handle
);
void ffi_proton_api_mail_rust_future_free_rust_buffer(void* _Nonnull handle
);
RustBuffer ffi_proton_api_mail_rust_future_complete_rust_buffer(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_api_mail_rust_future_poll_void(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_api_mail_rust_future_cancel_void(void* _Nonnull handle
);
void ffi_proton_api_mail_rust_future_free_void(void* _Nonnull handle
);
void ffi_proton_api_mail_rust_future_complete_void(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
uint32_t ffi_proton_api_mail_uniffi_contract_version(void
);
@@ -0,0 +1,169 @@
// This file was autogenerated by some hot garbage in the `uniffi` crate.
// Trust me, you don't want to mess with it!
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
// The following structs are used to implement the lowest level
// of the FFI, and thus useful to multiple uniffied crates.
// We ensure they are declared exactly once, with a header guard, UNIFFI_SHARED_H.
#ifdef UNIFFI_SHARED_H
// We also try to prevent mixing versions of shared uniffi header structs.
// If you add anything to the #else block, you must increment the version suffix in UNIFFI_SHARED_HEADER_V4
#ifndef UNIFFI_SHARED_HEADER_V4
#error Combining helper code from multiple versions of uniffi is not supported
#endif // ndef UNIFFI_SHARED_HEADER_V4
#else
#define UNIFFI_SHARED_H
#define UNIFFI_SHARED_HEADER_V4
// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️
typedef struct RustBuffer
{
int32_t capacity;
int32_t len;
uint8_t *_Nullable data;
} RustBuffer;
typedef int32_t (*ForeignCallback)(uint64_t, int32_t, const uint8_t *_Nonnull, int32_t, RustBuffer *_Nonnull);
typedef struct ForeignBytes
{
int32_t len;
const uint8_t *_Nullable data;
} ForeignBytes;
// Error definitions
typedef struct RustCallStatus {
int8_t code;
RustBuffer errorBuf;
} RustCallStatus;
// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️
#endif // def UNIFFI_SHARED_H
// Continuation callback for UniFFI Futures
typedef void (*UniFfiRustFutureContinuation)(void * _Nonnull, int8_t);
// Scaffolding functions
RustBuffer ffi_proton_core_common_rustbuffer_alloc(int32_t size, RustCallStatus *_Nonnull out_status
);
RustBuffer ffi_proton_core_common_rustbuffer_from_bytes(ForeignBytes bytes, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_common_rustbuffer_free(RustBuffer buf, RustCallStatus *_Nonnull out_status
);
RustBuffer ffi_proton_core_common_rustbuffer_reserve(RustBuffer buf, int32_t additional, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_common_rust_future_poll_u8(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_common_rust_future_cancel_u8(void* _Nonnull handle
);
void ffi_proton_core_common_rust_future_free_u8(void* _Nonnull handle
);
uint8_t ffi_proton_core_common_rust_future_complete_u8(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_common_rust_future_poll_i8(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_common_rust_future_cancel_i8(void* _Nonnull handle
);
void ffi_proton_core_common_rust_future_free_i8(void* _Nonnull handle
);
int8_t ffi_proton_core_common_rust_future_complete_i8(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_common_rust_future_poll_u16(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_common_rust_future_cancel_u16(void* _Nonnull handle
);
void ffi_proton_core_common_rust_future_free_u16(void* _Nonnull handle
);
uint16_t ffi_proton_core_common_rust_future_complete_u16(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_common_rust_future_poll_i16(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_common_rust_future_cancel_i16(void* _Nonnull handle
);
void ffi_proton_core_common_rust_future_free_i16(void* _Nonnull handle
);
int16_t ffi_proton_core_common_rust_future_complete_i16(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_common_rust_future_poll_u32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_common_rust_future_cancel_u32(void* _Nonnull handle
);
void ffi_proton_core_common_rust_future_free_u32(void* _Nonnull handle
);
uint32_t ffi_proton_core_common_rust_future_complete_u32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_common_rust_future_poll_i32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_common_rust_future_cancel_i32(void* _Nonnull handle
);
void ffi_proton_core_common_rust_future_free_i32(void* _Nonnull handle
);
int32_t ffi_proton_core_common_rust_future_complete_i32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_common_rust_future_poll_u64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_common_rust_future_cancel_u64(void* _Nonnull handle
);
void ffi_proton_core_common_rust_future_free_u64(void* _Nonnull handle
);
uint64_t ffi_proton_core_common_rust_future_complete_u64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_common_rust_future_poll_i64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_common_rust_future_cancel_i64(void* _Nonnull handle
);
void ffi_proton_core_common_rust_future_free_i64(void* _Nonnull handle
);
int64_t ffi_proton_core_common_rust_future_complete_i64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_common_rust_future_poll_f32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_common_rust_future_cancel_f32(void* _Nonnull handle
);
void ffi_proton_core_common_rust_future_free_f32(void* _Nonnull handle
);
float ffi_proton_core_common_rust_future_complete_f32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_common_rust_future_poll_f64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_common_rust_future_cancel_f64(void* _Nonnull handle
);
void ffi_proton_core_common_rust_future_free_f64(void* _Nonnull handle
);
double ffi_proton_core_common_rust_future_complete_f64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_common_rust_future_poll_pointer(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_common_rust_future_cancel_pointer(void* _Nonnull handle
);
void ffi_proton_core_common_rust_future_free_pointer(void* _Nonnull handle
);
void*_Nonnull ffi_proton_core_common_rust_future_complete_pointer(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_common_rust_future_poll_rust_buffer(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_common_rust_future_cancel_rust_buffer(void* _Nonnull handle
);
void ffi_proton_core_common_rust_future_free_rust_buffer(void* _Nonnull handle
);
RustBuffer ffi_proton_core_common_rust_future_complete_rust_buffer(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_common_rust_future_poll_void(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_common_rust_future_cancel_void(void* _Nonnull handle
);
void ffi_proton_core_common_rust_future_free_void(void* _Nonnull handle
);
void ffi_proton_core_common_rust_future_complete_void(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
uint32_t ffi_proton_core_common_uniffi_contract_version(void
);
@@ -0,0 +1,169 @@
// This file was autogenerated by some hot garbage in the `uniffi` crate.
// Trust me, you don't want to mess with it!
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
// The following structs are used to implement the lowest level
// of the FFI, and thus useful to multiple uniffied crates.
// We ensure they are declared exactly once, with a header guard, UNIFFI_SHARED_H.
#ifdef UNIFFI_SHARED_H
// We also try to prevent mixing versions of shared uniffi header structs.
// If you add anything to the #else block, you must increment the version suffix in UNIFFI_SHARED_HEADER_V4
#ifndef UNIFFI_SHARED_HEADER_V4
#error Combining helper code from multiple versions of uniffi is not supported
#endif // ndef UNIFFI_SHARED_HEADER_V4
#else
#define UNIFFI_SHARED_H
#define UNIFFI_SHARED_HEADER_V4
// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️
typedef struct RustBuffer
{
int32_t capacity;
int32_t len;
uint8_t *_Nullable data;
} RustBuffer;
typedef int32_t (*ForeignCallback)(uint64_t, int32_t, const uint8_t *_Nonnull, int32_t, RustBuffer *_Nonnull);
typedef struct ForeignBytes
{
int32_t len;
const uint8_t *_Nullable data;
} ForeignBytes;
// Error definitions
typedef struct RustCallStatus {
int8_t code;
RustBuffer errorBuf;
} RustCallStatus;
// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️
#endif // def UNIFFI_SHARED_H
// Continuation callback for UniFFI Futures
typedef void (*UniFfiRustFutureContinuation)(void * _Nonnull, int8_t);
// Scaffolding functions
RustBuffer ffi_proton_core_db_rustbuffer_alloc(int32_t size, RustCallStatus *_Nonnull out_status
);
RustBuffer ffi_proton_core_db_rustbuffer_from_bytes(ForeignBytes bytes, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_db_rustbuffer_free(RustBuffer buf, RustCallStatus *_Nonnull out_status
);
RustBuffer ffi_proton_core_db_rustbuffer_reserve(RustBuffer buf, int32_t additional, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_db_rust_future_poll_u8(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_db_rust_future_cancel_u8(void* _Nonnull handle
);
void ffi_proton_core_db_rust_future_free_u8(void* _Nonnull handle
);
uint8_t ffi_proton_core_db_rust_future_complete_u8(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_db_rust_future_poll_i8(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_db_rust_future_cancel_i8(void* _Nonnull handle
);
void ffi_proton_core_db_rust_future_free_i8(void* _Nonnull handle
);
int8_t ffi_proton_core_db_rust_future_complete_i8(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_db_rust_future_poll_u16(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_db_rust_future_cancel_u16(void* _Nonnull handle
);
void ffi_proton_core_db_rust_future_free_u16(void* _Nonnull handle
);
uint16_t ffi_proton_core_db_rust_future_complete_u16(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_db_rust_future_poll_i16(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_db_rust_future_cancel_i16(void* _Nonnull handle
);
void ffi_proton_core_db_rust_future_free_i16(void* _Nonnull handle
);
int16_t ffi_proton_core_db_rust_future_complete_i16(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_db_rust_future_poll_u32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_db_rust_future_cancel_u32(void* _Nonnull handle
);
void ffi_proton_core_db_rust_future_free_u32(void* _Nonnull handle
);
uint32_t ffi_proton_core_db_rust_future_complete_u32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_db_rust_future_poll_i32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_db_rust_future_cancel_i32(void* _Nonnull handle
);
void ffi_proton_core_db_rust_future_free_i32(void* _Nonnull handle
);
int32_t ffi_proton_core_db_rust_future_complete_i32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_db_rust_future_poll_u64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_db_rust_future_cancel_u64(void* _Nonnull handle
);
void ffi_proton_core_db_rust_future_free_u64(void* _Nonnull handle
);
uint64_t ffi_proton_core_db_rust_future_complete_u64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_db_rust_future_poll_i64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_db_rust_future_cancel_i64(void* _Nonnull handle
);
void ffi_proton_core_db_rust_future_free_i64(void* _Nonnull handle
);
int64_t ffi_proton_core_db_rust_future_complete_i64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_db_rust_future_poll_f32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_db_rust_future_cancel_f32(void* _Nonnull handle
);
void ffi_proton_core_db_rust_future_free_f32(void* _Nonnull handle
);
float ffi_proton_core_db_rust_future_complete_f32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_db_rust_future_poll_f64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_db_rust_future_cancel_f64(void* _Nonnull handle
);
void ffi_proton_core_db_rust_future_free_f64(void* _Nonnull handle
);
double ffi_proton_core_db_rust_future_complete_f64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_db_rust_future_poll_pointer(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_db_rust_future_cancel_pointer(void* _Nonnull handle
);
void ffi_proton_core_db_rust_future_free_pointer(void* _Nonnull handle
);
void*_Nonnull ffi_proton_core_db_rust_future_complete_pointer(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_db_rust_future_poll_rust_buffer(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_db_rust_future_cancel_rust_buffer(void* _Nonnull handle
);
void ffi_proton_core_db_rust_future_free_rust_buffer(void* _Nonnull handle
);
RustBuffer ffi_proton_core_db_rust_future_complete_rust_buffer(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_core_db_rust_future_poll_void(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_core_db_rust_future_cancel_void(void* _Nonnull handle
);
void ffi_proton_core_db_rust_future_free_void(void* _Nonnull handle
);
void ffi_proton_core_db_rust_future_complete_void(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
uint32_t ffi_proton_core_db_uniffi_contract_version(void
);
@@ -0,0 +1,169 @@
// This file was autogenerated by some hot garbage in the `uniffi` crate.
// Trust me, you don't want to mess with it!
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
// The following structs are used to implement the lowest level
// of the FFI, and thus useful to multiple uniffied crates.
// We ensure they are declared exactly once, with a header guard, UNIFFI_SHARED_H.
#ifdef UNIFFI_SHARED_H
// We also try to prevent mixing versions of shared uniffi header structs.
// If you add anything to the #else block, you must increment the version suffix in UNIFFI_SHARED_HEADER_V4
#ifndef UNIFFI_SHARED_HEADER_V4
#error Combining helper code from multiple versions of uniffi is not supported
#endif // ndef UNIFFI_SHARED_HEADER_V4
#else
#define UNIFFI_SHARED_H
#define UNIFFI_SHARED_HEADER_V4
// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️
typedef struct RustBuffer
{
int32_t capacity;
int32_t len;
uint8_t *_Nullable data;
} RustBuffer;
typedef int32_t (*ForeignCallback)(uint64_t, int32_t, const uint8_t *_Nonnull, int32_t, RustBuffer *_Nonnull);
typedef struct ForeignBytes
{
int32_t len;
const uint8_t *_Nullable data;
} ForeignBytes;
// Error definitions
typedef struct RustCallStatus {
int8_t code;
RustBuffer errorBuf;
} RustCallStatus;
// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️
#endif // def UNIFFI_SHARED_H
// Continuation callback for UniFFI Futures
typedef void (*UniFfiRustFutureContinuation)(void * _Nonnull, int8_t);
// Scaffolding functions
RustBuffer ffi_proton_mail_common_rustbuffer_alloc(int32_t size, RustCallStatus *_Nonnull out_status
);
RustBuffer ffi_proton_mail_common_rustbuffer_from_bytes(ForeignBytes bytes, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_common_rustbuffer_free(RustBuffer buf, RustCallStatus *_Nonnull out_status
);
RustBuffer ffi_proton_mail_common_rustbuffer_reserve(RustBuffer buf, int32_t additional, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_common_rust_future_poll_u8(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_common_rust_future_cancel_u8(void* _Nonnull handle
);
void ffi_proton_mail_common_rust_future_free_u8(void* _Nonnull handle
);
uint8_t ffi_proton_mail_common_rust_future_complete_u8(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_common_rust_future_poll_i8(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_common_rust_future_cancel_i8(void* _Nonnull handle
);
void ffi_proton_mail_common_rust_future_free_i8(void* _Nonnull handle
);
int8_t ffi_proton_mail_common_rust_future_complete_i8(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_common_rust_future_poll_u16(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_common_rust_future_cancel_u16(void* _Nonnull handle
);
void ffi_proton_mail_common_rust_future_free_u16(void* _Nonnull handle
);
uint16_t ffi_proton_mail_common_rust_future_complete_u16(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_common_rust_future_poll_i16(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_common_rust_future_cancel_i16(void* _Nonnull handle
);
void ffi_proton_mail_common_rust_future_free_i16(void* _Nonnull handle
);
int16_t ffi_proton_mail_common_rust_future_complete_i16(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_common_rust_future_poll_u32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_common_rust_future_cancel_u32(void* _Nonnull handle
);
void ffi_proton_mail_common_rust_future_free_u32(void* _Nonnull handle
);
uint32_t ffi_proton_mail_common_rust_future_complete_u32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_common_rust_future_poll_i32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_common_rust_future_cancel_i32(void* _Nonnull handle
);
void ffi_proton_mail_common_rust_future_free_i32(void* _Nonnull handle
);
int32_t ffi_proton_mail_common_rust_future_complete_i32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_common_rust_future_poll_u64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_common_rust_future_cancel_u64(void* _Nonnull handle
);
void ffi_proton_mail_common_rust_future_free_u64(void* _Nonnull handle
);
uint64_t ffi_proton_mail_common_rust_future_complete_u64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_common_rust_future_poll_i64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_common_rust_future_cancel_i64(void* _Nonnull handle
);
void ffi_proton_mail_common_rust_future_free_i64(void* _Nonnull handle
);
int64_t ffi_proton_mail_common_rust_future_complete_i64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_common_rust_future_poll_f32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_common_rust_future_cancel_f32(void* _Nonnull handle
);
void ffi_proton_mail_common_rust_future_free_f32(void* _Nonnull handle
);
float ffi_proton_mail_common_rust_future_complete_f32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_common_rust_future_poll_f64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_common_rust_future_cancel_f64(void* _Nonnull handle
);
void ffi_proton_mail_common_rust_future_free_f64(void* _Nonnull handle
);
double ffi_proton_mail_common_rust_future_complete_f64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_common_rust_future_poll_pointer(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_common_rust_future_cancel_pointer(void* _Nonnull handle
);
void ffi_proton_mail_common_rust_future_free_pointer(void* _Nonnull handle
);
void*_Nonnull ffi_proton_mail_common_rust_future_complete_pointer(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_common_rust_future_poll_rust_buffer(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_common_rust_future_cancel_rust_buffer(void* _Nonnull handle
);
void ffi_proton_mail_common_rust_future_free_rust_buffer(void* _Nonnull handle
);
RustBuffer ffi_proton_mail_common_rust_future_complete_rust_buffer(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_common_rust_future_poll_void(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_common_rust_future_cancel_void(void* _Nonnull handle
);
void ffi_proton_mail_common_rust_future_free_void(void* _Nonnull handle
);
void ffi_proton_mail_common_rust_future_complete_void(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
uint32_t ffi_proton_mail_common_uniffi_contract_version(void
);
@@ -0,0 +1,169 @@
// This file was autogenerated by some hot garbage in the `uniffi` crate.
// Trust me, you don't want to mess with it!
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
// The following structs are used to implement the lowest level
// of the FFI, and thus useful to multiple uniffied crates.
// We ensure they are declared exactly once, with a header guard, UNIFFI_SHARED_H.
#ifdef UNIFFI_SHARED_H
// We also try to prevent mixing versions of shared uniffi header structs.
// If you add anything to the #else block, you must increment the version suffix in UNIFFI_SHARED_HEADER_V4
#ifndef UNIFFI_SHARED_HEADER_V4
#error Combining helper code from multiple versions of uniffi is not supported
#endif // ndef UNIFFI_SHARED_HEADER_V4
#else
#define UNIFFI_SHARED_H
#define UNIFFI_SHARED_HEADER_V4
// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️
typedef struct RustBuffer
{
int32_t capacity;
int32_t len;
uint8_t *_Nullable data;
} RustBuffer;
typedef int32_t (*ForeignCallback)(uint64_t, int32_t, const uint8_t *_Nonnull, int32_t, RustBuffer *_Nonnull);
typedef struct ForeignBytes
{
int32_t len;
const uint8_t *_Nullable data;
} ForeignBytes;
// Error definitions
typedef struct RustCallStatus {
int8_t code;
RustBuffer errorBuf;
} RustCallStatus;
// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️
#endif // def UNIFFI_SHARED_H
// Continuation callback for UniFFI Futures
typedef void (*UniFfiRustFutureContinuation)(void * _Nonnull, int8_t);
// Scaffolding functions
RustBuffer ffi_proton_mail_db_rustbuffer_alloc(int32_t size, RustCallStatus *_Nonnull out_status
);
RustBuffer ffi_proton_mail_db_rustbuffer_from_bytes(ForeignBytes bytes, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_db_rustbuffer_free(RustBuffer buf, RustCallStatus *_Nonnull out_status
);
RustBuffer ffi_proton_mail_db_rustbuffer_reserve(RustBuffer buf, int32_t additional, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_db_rust_future_poll_u8(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_db_rust_future_cancel_u8(void* _Nonnull handle
);
void ffi_proton_mail_db_rust_future_free_u8(void* _Nonnull handle
);
uint8_t ffi_proton_mail_db_rust_future_complete_u8(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_db_rust_future_poll_i8(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_db_rust_future_cancel_i8(void* _Nonnull handle
);
void ffi_proton_mail_db_rust_future_free_i8(void* _Nonnull handle
);
int8_t ffi_proton_mail_db_rust_future_complete_i8(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_db_rust_future_poll_u16(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_db_rust_future_cancel_u16(void* _Nonnull handle
);
void ffi_proton_mail_db_rust_future_free_u16(void* _Nonnull handle
);
uint16_t ffi_proton_mail_db_rust_future_complete_u16(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_db_rust_future_poll_i16(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_db_rust_future_cancel_i16(void* _Nonnull handle
);
void ffi_proton_mail_db_rust_future_free_i16(void* _Nonnull handle
);
int16_t ffi_proton_mail_db_rust_future_complete_i16(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_db_rust_future_poll_u32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_db_rust_future_cancel_u32(void* _Nonnull handle
);
void ffi_proton_mail_db_rust_future_free_u32(void* _Nonnull handle
);
uint32_t ffi_proton_mail_db_rust_future_complete_u32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_db_rust_future_poll_i32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_db_rust_future_cancel_i32(void* _Nonnull handle
);
void ffi_proton_mail_db_rust_future_free_i32(void* _Nonnull handle
);
int32_t ffi_proton_mail_db_rust_future_complete_i32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_db_rust_future_poll_u64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_db_rust_future_cancel_u64(void* _Nonnull handle
);
void ffi_proton_mail_db_rust_future_free_u64(void* _Nonnull handle
);
uint64_t ffi_proton_mail_db_rust_future_complete_u64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_db_rust_future_poll_i64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_db_rust_future_cancel_i64(void* _Nonnull handle
);
void ffi_proton_mail_db_rust_future_free_i64(void* _Nonnull handle
);
int64_t ffi_proton_mail_db_rust_future_complete_i64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_db_rust_future_poll_f32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_db_rust_future_cancel_f32(void* _Nonnull handle
);
void ffi_proton_mail_db_rust_future_free_f32(void* _Nonnull handle
);
float ffi_proton_mail_db_rust_future_complete_f32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_db_rust_future_poll_f64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_db_rust_future_cancel_f64(void* _Nonnull handle
);
void ffi_proton_mail_db_rust_future_free_f64(void* _Nonnull handle
);
double ffi_proton_mail_db_rust_future_complete_f64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_db_rust_future_poll_pointer(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_db_rust_future_cancel_pointer(void* _Nonnull handle
);
void ffi_proton_mail_db_rust_future_free_pointer(void* _Nonnull handle
);
void*_Nonnull ffi_proton_mail_db_rust_future_complete_pointer(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_db_rust_future_poll_rust_buffer(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_db_rust_future_cancel_rust_buffer(void* _Nonnull handle
);
void ffi_proton_mail_db_rust_future_free_rust_buffer(void* _Nonnull handle
);
RustBuffer ffi_proton_mail_db_rust_future_complete_rust_buffer(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_db_rust_future_poll_void(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_db_rust_future_cancel_void(void* _Nonnull handle
);
void ffi_proton_mail_db_rust_future_free_void(void* _Nonnull handle
);
void ffi_proton_mail_db_rust_future_complete_void(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
uint32_t ffi_proton_mail_db_uniffi_contract_version(void
);
@@ -0,0 +1,407 @@
// This file was autogenerated by some hot garbage in the `uniffi` crate.
// Trust me, you don't want to mess with it!
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
// The following structs are used to implement the lowest level
// of the FFI, and thus useful to multiple uniffied crates.
// We ensure they are declared exactly once, with a header guard, UNIFFI_SHARED_H.
#ifdef UNIFFI_SHARED_H
// We also try to prevent mixing versions of shared uniffi header structs.
// If you add anything to the #else block, you must increment the version suffix in UNIFFI_SHARED_HEADER_V4
#ifndef UNIFFI_SHARED_HEADER_V4
#error Combining helper code from multiple versions of uniffi is not supported
#endif // ndef UNIFFI_SHARED_HEADER_V4
#else
#define UNIFFI_SHARED_H
#define UNIFFI_SHARED_HEADER_V4
// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️
typedef struct RustBuffer
{
int32_t capacity;
int32_t len;
uint8_t *_Nullable data;
} RustBuffer;
typedef int32_t (*ForeignCallback)(uint64_t, int32_t, const uint8_t *_Nonnull, int32_t, RustBuffer *_Nonnull);
typedef struct ForeignBytes
{
int32_t len;
const uint8_t *_Nullable data;
} ForeignBytes;
// Error definitions
typedef struct RustCallStatus {
int8_t code;
RustBuffer errorBuf;
} RustCallStatus;
// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️
#endif // def UNIFFI_SHARED_H
// Continuation callback for UniFFI Futures
typedef void (*UniFfiRustFutureContinuation)(void * _Nonnull, int8_t);
// Scaffolding functions
void*_Nonnull uniffi_proton_mail_uniffi_fn_clone_loginflow(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void uniffi_proton_mail_uniffi_fn_free_loginflow(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
int8_t uniffi_proton_mail_uniffi_fn_method_loginflow_is_awaiting_2fa(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
int8_t uniffi_proton_mail_uniffi_fn_method_loginflow_is_logged_in(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void* _Nonnull uniffi_proton_mail_uniffi_fn_method_loginflow_login(void*_Nonnull ptr, RustBuffer email, RustBuffer password
);
void* _Nonnull uniffi_proton_mail_uniffi_fn_method_loginflow_submit_totp(void*_Nonnull ptr, RustBuffer code
);
void*_Nonnull uniffi_proton_mail_uniffi_fn_method_loginflow_to_user_context(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void*_Nonnull uniffi_proton_mail_uniffi_fn_clone_mailcontext(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void uniffi_proton_mail_uniffi_fn_free_mailcontext(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void*_Nonnull uniffi_proton_mail_uniffi_fn_constructor_mailcontext_new(RustBuffer session_dir, RustBuffer user_dir, RustBuffer log_dir, int8_t log_debug, uint64_t key_chain, RustBuffer network_callback, RustCallStatus *_Nonnull out_status
);
int8_t uniffi_proton_mail_uniffi_fn_method_mailcontext_is_network_connected(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void*_Nonnull uniffi_proton_mail_uniffi_fn_method_mailcontext_new_login_flow(void*_Nonnull ptr, RustBuffer cb, RustCallStatus *_Nonnull out_status
);
void uniffi_proton_mail_uniffi_fn_method_mailcontext_set_network_connected(void*_Nonnull ptr, int8_t online, RustCallStatus *_Nonnull out_status
);
RustBuffer uniffi_proton_mail_uniffi_fn_method_mailcontext_stored_sessions(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void*_Nonnull uniffi_proton_mail_uniffi_fn_method_mailcontext_user_context_from_session(void*_Nonnull ptr, void*_Nonnull session, RustBuffer cb, RustCallStatus *_Nonnull out_status
);
void*_Nonnull uniffi_proton_mail_uniffi_fn_clone_mailusercontext(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void uniffi_proton_mail_uniffi_fn_free_mailusercontext(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void* _Nonnull uniffi_proton_mail_uniffi_fn_method_mailusercontext_initialize(void*_Nonnull ptr, uint64_t cb
);
void* _Nonnull uniffi_proton_mail_uniffi_fn_method_mailusercontext_logout(void*_Nonnull ptr
);
RustBuffer uniffi_proton_mail_uniffi_fn_method_mailusercontext_mail_settings(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void* _Nonnull uniffi_proton_mail_uniffi_fn_method_mailusercontext_poll_events(void*_Nonnull ptr
);
void*_Nonnull uniffi_proton_mail_uniffi_fn_clone_mailbox(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void uniffi_proton_mail_uniffi_fn_free_mailbox(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void*_Nonnull uniffi_proton_mail_uniffi_fn_constructor_mailbox_new(void*_Nonnull ctx, RustCallStatus *_Nonnull out_status
);
RustBuffer uniffi_proton_mail_uniffi_fn_method_mailbox_active_label(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
RustBuffer uniffi_proton_mail_uniffi_fn_method_mailbox_conversations(void*_Nonnull ptr, int64_t count, RustCallStatus *_Nonnull out_status
);
RustBuffer uniffi_proton_mail_uniffi_fn_method_mailbox_labels_by_type(void*_Nonnull ptr, RustBuffer label_type, RustCallStatus *_Nonnull out_status
);
void*_Nonnull uniffi_proton_mail_uniffi_fn_method_mailbox_new_conversation_observed_query(void*_Nonnull ptr, int64_t limit, uint64_t cb, RustCallStatus *_Nonnull out_status
);
void*_Nonnull uniffi_proton_mail_uniffi_fn_method_mailbox_new_folder_labels_observed_query(void*_Nonnull ptr, uint64_t cb, RustCallStatus *_Nonnull out_status
);
void*_Nonnull uniffi_proton_mail_uniffi_fn_method_mailbox_new_label_labels_observed_query(void*_Nonnull ptr, uint64_t cb, RustCallStatus *_Nonnull out_status
);
void*_Nonnull uniffi_proton_mail_uniffi_fn_method_mailbox_new_system_labels_observed_query(void*_Nonnull ptr, uint64_t cb, RustCallStatus *_Nonnull out_status
);
void uniffi_proton_mail_uniffi_fn_method_mailbox_switch_label(void*_Nonnull ptr, uint64_t label_id, int64_t message_count, RustBuffer cb, RustCallStatus *_Nonnull out_status
);
void*_Nonnull uniffi_proton_mail_uniffi_fn_clone_mailboxconversationlivequery(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void uniffi_proton_mail_uniffi_fn_free_mailboxconversationlivequery(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void uniffi_proton_mail_uniffi_fn_method_mailboxconversationlivequery_disconnect(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
RustBuffer uniffi_proton_mail_uniffi_fn_method_mailboxconversationlivequery_value(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void*_Nonnull uniffi_proton_mail_uniffi_fn_clone_mailboxlabelslivequery(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void uniffi_proton_mail_uniffi_fn_free_mailboxlabelslivequery(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void uniffi_proton_mail_uniffi_fn_method_mailboxlabelslivequery_disconnect(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
RustBuffer uniffi_proton_mail_uniffi_fn_method_mailboxlabelslivequery_value(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void*_Nonnull uniffi_proton_mail_uniffi_fn_clone_storedsession(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void uniffi_proton_mail_uniffi_fn_free_storedsession(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
RustBuffer uniffi_proton_mail_uniffi_fn_method_storedsession_email(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
RustBuffer uniffi_proton_mail_uniffi_fn_method_storedsession_name(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
RustBuffer uniffi_proton_mail_uniffi_fn_method_storedsession_session_id(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
RustBuffer uniffi_proton_mail_uniffi_fn_method_storedsession_user_id(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
);
void uniffi_proton_mail_uniffi_fn_init_callback_mailusercontextinitializationcallback(ForeignCallback _Nonnull handle
);
void uniffi_proton_mail_uniffi_fn_init_callback_mailboxbackgroundresult(ForeignCallback _Nonnull handle
);
void uniffi_proton_mail_uniffi_fn_init_callback_mailboxlivequeryupdatedcallback(ForeignCallback _Nonnull handle
);
void uniffi_proton_mail_uniffi_fn_init_callback_networkstatuschanged(ForeignCallback _Nonnull handle
);
void uniffi_proton_mail_uniffi_fn_init_callback_oskeychain(ForeignCallback _Nonnull handle
);
void uniffi_proton_mail_uniffi_fn_init_callback_sessioncallback(ForeignCallback _Nonnull handle
);
RustBuffer uniffi_proton_mail_uniffi_fn_func_locate_blockquote(RustBuffer input, RustCallStatus *_Nonnull out_status
);
RustBuffer ffi_proton_mail_uniffi_rustbuffer_alloc(int32_t size, RustCallStatus *_Nonnull out_status
);
RustBuffer ffi_proton_mail_uniffi_rustbuffer_from_bytes(ForeignBytes bytes, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_uniffi_rustbuffer_free(RustBuffer buf, RustCallStatus *_Nonnull out_status
);
RustBuffer ffi_proton_mail_uniffi_rustbuffer_reserve(RustBuffer buf, int32_t additional, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_uniffi_rust_future_poll_u8(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_uniffi_rust_future_cancel_u8(void* _Nonnull handle
);
void ffi_proton_mail_uniffi_rust_future_free_u8(void* _Nonnull handle
);
uint8_t ffi_proton_mail_uniffi_rust_future_complete_u8(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_uniffi_rust_future_poll_i8(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_uniffi_rust_future_cancel_i8(void* _Nonnull handle
);
void ffi_proton_mail_uniffi_rust_future_free_i8(void* _Nonnull handle
);
int8_t ffi_proton_mail_uniffi_rust_future_complete_i8(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_uniffi_rust_future_poll_u16(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_uniffi_rust_future_cancel_u16(void* _Nonnull handle
);
void ffi_proton_mail_uniffi_rust_future_free_u16(void* _Nonnull handle
);
uint16_t ffi_proton_mail_uniffi_rust_future_complete_u16(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_uniffi_rust_future_poll_i16(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_uniffi_rust_future_cancel_i16(void* _Nonnull handle
);
void ffi_proton_mail_uniffi_rust_future_free_i16(void* _Nonnull handle
);
int16_t ffi_proton_mail_uniffi_rust_future_complete_i16(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_uniffi_rust_future_poll_u32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_uniffi_rust_future_cancel_u32(void* _Nonnull handle
);
void ffi_proton_mail_uniffi_rust_future_free_u32(void* _Nonnull handle
);
uint32_t ffi_proton_mail_uniffi_rust_future_complete_u32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_uniffi_rust_future_poll_i32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_uniffi_rust_future_cancel_i32(void* _Nonnull handle
);
void ffi_proton_mail_uniffi_rust_future_free_i32(void* _Nonnull handle
);
int32_t ffi_proton_mail_uniffi_rust_future_complete_i32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_uniffi_rust_future_poll_u64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_uniffi_rust_future_cancel_u64(void* _Nonnull handle
);
void ffi_proton_mail_uniffi_rust_future_free_u64(void* _Nonnull handle
);
uint64_t ffi_proton_mail_uniffi_rust_future_complete_u64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_uniffi_rust_future_poll_i64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_uniffi_rust_future_cancel_i64(void* _Nonnull handle
);
void ffi_proton_mail_uniffi_rust_future_free_i64(void* _Nonnull handle
);
int64_t ffi_proton_mail_uniffi_rust_future_complete_i64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_uniffi_rust_future_poll_f32(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_uniffi_rust_future_cancel_f32(void* _Nonnull handle
);
void ffi_proton_mail_uniffi_rust_future_free_f32(void* _Nonnull handle
);
float ffi_proton_mail_uniffi_rust_future_complete_f32(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_uniffi_rust_future_poll_f64(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_uniffi_rust_future_cancel_f64(void* _Nonnull handle
);
void ffi_proton_mail_uniffi_rust_future_free_f64(void* _Nonnull handle
);
double ffi_proton_mail_uniffi_rust_future_complete_f64(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_uniffi_rust_future_poll_pointer(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_uniffi_rust_future_cancel_pointer(void* _Nonnull handle
);
void ffi_proton_mail_uniffi_rust_future_free_pointer(void* _Nonnull handle
);
void*_Nonnull ffi_proton_mail_uniffi_rust_future_complete_pointer(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_uniffi_rust_future_poll_rust_buffer(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_uniffi_rust_future_cancel_rust_buffer(void* _Nonnull handle
);
void ffi_proton_mail_uniffi_rust_future_free_rust_buffer(void* _Nonnull handle
);
RustBuffer ffi_proton_mail_uniffi_rust_future_complete_rust_buffer(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
void ffi_proton_mail_uniffi_rust_future_poll_void(void* _Nonnull handle, UniFfiRustFutureContinuation _Nonnull callback, void* _Nonnull callback_data
);
void ffi_proton_mail_uniffi_rust_future_cancel_void(void* _Nonnull handle
);
void ffi_proton_mail_uniffi_rust_future_free_void(void* _Nonnull handle
);
void ffi_proton_mail_uniffi_rust_future_complete_void(void* _Nonnull handle, RustCallStatus *_Nonnull out_status
);
uint16_t uniffi_proton_mail_uniffi_checksum_func_locate_blockquote(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_loginflow_is_awaiting_2fa(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_loginflow_is_logged_in(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_loginflow_login(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_loginflow_submit_totp(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_loginflow_to_user_context(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailcontext_is_network_connected(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailcontext_new_login_flow(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailcontext_set_network_connected(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailcontext_stored_sessions(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailcontext_user_context_from_session(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailusercontext_initialize(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailusercontext_logout(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailusercontext_mail_settings(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailusercontext_poll_events(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailbox_active_label(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailbox_conversations(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailbox_labels_by_type(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailbox_new_conversation_observed_query(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailbox_new_folder_labels_observed_query(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailbox_new_label_labels_observed_query(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailbox_new_system_labels_observed_query(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailbox_switch_label(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailboxconversationlivequery_disconnect(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailboxconversationlivequery_value(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailboxlabelslivequery_disconnect(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailboxlabelslivequery_value(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_storedsession_email(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_storedsession_name(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_storedsession_session_id(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_storedsession_user_id(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_constructor_mailcontext_new(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_constructor_mailbox_new(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailusercontextinitializationcallback_on_stage(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailboxbackgroundresult_on_background_result(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_mailboxlivequeryupdatedcallback_on_updated(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_networkstatuschanged_on_network_status_changed(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_oskeychain_store(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_oskeychain_delete(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_oskeychain_get(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_sessioncallback_on_session_refresh(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_sessioncallback_on_session_deleted(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_sessioncallback_on_refresh_failed(void
);
uint16_t uniffi_proton_mail_uniffi_checksum_method_sessioncallback_on_error(void
);
uint32_t ffi_proton_mail_uniffi_uniffi_contract_version(void
);
@@ -0,0 +1,10 @@
framework module proton_mail_uniffi_ffi {
header "proton_api_coreFFI.h"
header "proton_api_mailFFI.h"
header "proton_core_commonFFI.h"
header "proton_core_dbFFI.h"
header "proton_mail_commonFFI.h"
header "proton_mail_dbFFI.h"
header "proton_mail_uniffiFFI.h"
export *
}
+3
View File
@@ -18,6 +18,8 @@ packages:
minorVersion: "1.30.0"
DesignSystem:
path: localPackages/DesignSystem
proton_mail_uniffi:
path: localPackages/proton_mail_uniffi
targets:
ProtonMail:
@@ -66,6 +68,7 @@ targets:
- UIInterfaceOrientationLandscapeRight
dependencies:
- package: DesignSystem
- package: proton_mail_uniffi
ProtonMailTest:
type: bundle.unit-test