Productive, performant, robust interop for Rust. Pick three.
With Interoptopus you can write code like this:
#[ffi(service)]
pub struct Hello {}
#[ffi]
impl Hello {
pub fn world() -> Result<Self, Error> { Ok(Self {}) }
}and then call it from your other language like this:
var service = Hello.World();Its key features include:
- Nanosecond fast.
- Supports structs, data-enums, callbacks, services, async, idiomatic error handling, and much more ...
- Bidirectional interop, export your Rust library, or load foreign code into your Rust app.
- Painless workflow, no external tooling required.
- Polyglot core, first-class support for C#, can support any other language.
Read our documentation here.
Gated behind feature flags, these enable:
macros- Proc macros such as#[ffi].serde- Serde attributes on internal types.tokio- Convenience support for async services via Tokio.unstable-plugins- Experimental 'reverse interop' plugins. Not semver stable!
| Language | Backend Crate | Status |
|---|---|---|
| C# | interoptopus_csharp | ✅ |
| C | interoptopus_c | ⏯️ |
| Python | interoptopus_cpython | ⏯️ |
| Other | Write your own backend1 |
✅ Tier 1 target. Active maintenance and production use. Full support of all features.
⏯️ Tier 2 target. Currently suspended, contributors wanted!
1 You can implement basic support for a new language in just a few hours, no pull request needed.
In essence, plain calls are near-zero overhead (1-10ns), as are most structs, enums and services. If serialization is involved it scales with payload size. Using the .NET runtime as a plugin adds ~20 MB overhead.
For more details see our benchmark numbers here.
PRs are very welcome!
- Submit small bug fixes directly. Major changes should be issues first.
- New features or patterns must be materialized in the reference project and accompanied by at least a C# interop test.