# `future_form_ffi`
[](https://crates.io/crates/future_form_ffi)
[](https://ci.hel.subduction.keyhive.org/repos/2)
[](https://docs.rs/future_form_ffi)
[](https://codeberg.org/expede/future_form)
FFI support for [`future_form`](https://crates.io/crates/future_form): host-driven polling, opaque handles, and effect slots.
This crate provides the building blocks for FFI bridges that let foreign hosts (Go, Java, Python, C, Swift) drive Rust async state machines without an async runtime.
## Core types
| `PollOnce` | Extension trait: poll a boxed future once with a no-op waker |
| `HostHandle` | Thin-pointer wrapper for passing boxed futures through C ABI |
| `AtomicSlot` | Lock-free, thread-safe slot for a single value |
| `EffectSlot` | Shared-state channel for the sans-IO effect protocol |
| `EffectHandle` | Future handle + stashed effect + context pointer |
## Usage
```rust
use core::task::Poll;
use future_form::Sendable;
use future_form_ffi::host_handle::HostHandle;
let fut = Sendable::from_future(async { 42u64 });
let mut handle = HostHandle::new(fut);
assert_eq!(handle.poll_once(), Poll::Ready(42));
```
See the [design documentation](https://codeberg.org/expede/future_form/src/branch/main/design/host-driven-ffi.md) for the full architecture and effect protocol.
## `no_std` support
This crate is `#![no_std]` (`core` + `alloc`). No feature flags or platform-specific dependencies are required. `EffectSlot` is built on `AtomicSlot`, which uses lock-free atomic swaps for thread safety.
## License
Licensed under either of [Apache License, Version 2.0](../LICENSE-APACHE) or [MIT license](../LICENSE-MIT) at your option.