๐Ÿฆ€๐Ÿš€ Abstract over Send and !Send traits crates.io/crates/future_form
0

Configure Feed

Select the types of activity you want to include in your feed.

future_form_ffi#

CI crates.io 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.