Files
openchamber-android-native/netcfg/swift/Netcfg.asuka.swift
T

58 lines
2.1 KiB
Swift
Raw Normal View History

// Code generated by asuka native. DO NOT EDIT.
// asuka:native f84252246ecd432c
// What the package's Go declares (package netcfg), as its Swift implements
// it. The Swift writes the functions that make each:
//
// func makeNetcfg() throws -> any Netcfg
import Foundation
import Asuka
/// Netcfg greets in each platform's own code.
public protocol Netcfg: AnyObject {
/// Hello greets name.
func hello(name: String) throws -> String
}
/// The package's native code as the host finds it (by its Objective-C
/// name): what makes, calls and shows what the package declares.
@objc(AsukaModule_github_com_openchamber_openchamber_native_netcfg) public final class AsukaModule_github_com_openchamber_openchamber_native_netcfg: NSObject, AsukaModuleProvider {
public static func make(_ iface: UInt32) throws -> AnyObject {
switch iface {
case 0: return try makeNetcfg()
default: throw AsukaNativeError.unsupported("no interface \(iface)")
}
}
public static func call(_ object: AnyObject, _ iface: UInt32, _ method: UInt32, _ r: inout AsukaNativeReader, _ w: inout AsukaNativeWriter) throws {
switch (iface, method) {
case (0, 1): // Netcfg.Hello
let o = object as! any Netcfg
let name = r.string()
try r.check()
let v = try o.hello(name: name)
w.string(v)
default: throw AsukaNativeError.unsupported("no method \(iface).\(method)")
}
}
public static func start(_ object: AnyObject, _ iface: UInt32, _ method: UInt32, _ input: AsukaNativeReader, _ done: @escaping (Result<AsukaNativeWriter, Error>) -> Void) -> Task<Void, Never>? {
var r = input
switch (iface, method) {
default:
done(.failure(AsukaNativeError.unsupported("no method \(iface).\(method)")))
return nil
}
}
@MainActor public static func makeView(_ name: String, _ ctx: AsukaNativeContext) -> AsukaNativeView? {
switch name {
default: return nil
}
}
}
/// The package's values on the wire (package native's format).
fileprivate enum Wire {
}