Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

mofa-ffi

多语言的外部函数接口绑定。

目的

mofa-ffi 提供:

  • 用于 Python、Java、Go、Swift、Kotlin 的 UniFFI 绑定
  • PyO3 原生 Python 绑定
  • 跨语言类型转换

支持的语言

语言方法状态
PythonUniFFI / PyO3稳定
JavaUniFFI测试版
GoUniFFI测试版
SwiftUniFFI测试版
KotlinUniFFI测试版

用法

构建绑定

# 构建所有绑定
cargo build -p mofa-ffi --features uniffi

# 仅构建 Python
cargo build -p mofa-ffi --features python

生成绑定

# Python
cargo run -p mofa-ffi --features uniffi -- generate python

# Java
cargo run -p mofa-ffi --features uniffi -- generate java

功能标志

标志描述
uniffi启用 UniFFI 绑定
python启用 PyO3 Python 绑定

另见