#![allow(unused)]
fn main() {
// Rust
#[swift_bridge::bridge]
mod ffi {
extern "Rust" {
type SomeRustType;
fn run() -> Result<SomeRustType, String>;
}
}
}
// Swift
func run() throws -> SomeRustType {
// ...
}
#![allow(unused)]
fn main() {
// Rust
#[swift_bridge::bridge]
mod ffi {
extern "Swift" {
fn run(
arg: Box<dyn FnOnce(Result<SomeRustType, String>)>
);
}
extern "Rust" {
type SomeRustType;
}
}
}
// Swift
func run(arg: (RustResult<SomeRustType, String>) -> ()) {
arg(.Err("Something went wrong"))
}