future_form_ffi 0.1.0

FFI support for future_form: host-driven polling, opaque handles, and effect slots
Documentation
  • Coverage
  • 100%
    28 out of 28 items documented5 out of 25 items with examples
  • Size
  • Source code size: 120.01 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.81 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 22s Average build duration of successful builds.
  • all releases: 22s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • expede

future_form_ffi

crates.io CI docs.rs License

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 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 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.