future_form_ffi
FFI support for 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
| Type | Purpose |
|---|---|
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
use Poll;
use Sendable;
use HostHandle;
let fut = from_future;
let mut handle = new;
assert_eq!;
See the design documentation 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 or MIT license at your option.