1
0
Fork
You've already forked future_form
0
🦀🚀 Abstract over Send and !Send traits https://crates.io/crates/future_form
  • Rust 79.2%
  • Python 6.4%
  • Java 5.6%
  • Go 5.3%
  • Nix 1.9%
  • Other 1.6%
Brooklyn Zelenka 2819d86fac
All checks were successful
ci/woodpecker/push/doc Pipeline was successful
ci/woodpecker/push/audit Pipeline was successful
ci/woodpecker/push/ffi Pipeline was successful
ci/woodpecker/push/spellcheck Pipeline was successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
Run CI with .#ci flake
2026年03月08日 21:26:24 -07:00
.forgejo Improve docs & tests 2026年01月14日 13:43:37 -08:00
.woodpecker Run CI with .#ci flake 2026年03月08日 21:26:24 -07:00
design Add future_form_ffi 2026年03月08日 11:42:30 -07:00
future_form Disentangle test dependencies 2026年03月08日 11:53:14 -07:00
future_form_ffi Fix license badge 2026年03月08日 13:25:01 -07:00
future_form_macros Add future_form_ffi 2026年03月08日 11:42:30 -07:00
.gitignore Add future_form_ffi 2026年03月08日 11:42:30 -07:00
_typos.toml Improve macro, remove imherent impl ( #6 ) 2026年02月25日 12:34:14 -08:00
Cargo.lock Disentangle test dependencies 2026年03月08日 11:53:14 -07:00
Cargo.toml Add future_form_ffi 2026年03月08日 11:42:30 -07:00
CHANGELOG.md Improve macro, remove imherent impl ( #6 ) 2026年02月25日 12:34:14 -08:00
deny.toml Improve CI 2026年03月08日 13:10:52 -07:00
flake.lock Fix flake 2026年01月23日 19:40:07 -08:00
flake.nix Fix CI 2026年03月08日 15:40:30 -07:00
HACKING.md Rename to future_form and extensivelyrename/refactor ( #2 ) 2026年01月25日 15:42:50 -08:00
LICENSE-APACHE Rename to future_form and extensivelyrename/refactor ( #2 ) 2026年01月25日 15:42:50 -08:00
LICENSE-MIT Rename to future_form and extensivelyrename/refactor ( #2 ) 2026年01月25日 15:42:50 -08:00
README.md Add future_form_ffi 2026年03月08日 11:42:30 -07:00

future_form

crates.io CI docs.rs License

"This isn't even my (削除) final (削除ここまで) future form!"

Abstractions over Send and !Send futures in Rust.

The Problem

Async Rust has a fragmentation problem: some runtimes require Send futures (like tokio), while others work with !Send futures (like Wasm). This forces library authors to either duplicate their async trait implementations or exclude legitimate use cases.

The Solution

future_form lets you write async code once and support both Send and !Send futures:

usefuture_form::{FutureForm,Sendable,Local,future_form};usestd::marker::PhantomData;traitCounter<K: FutureForm>{fn next(&self)-> K::Future<'_,u32>;}struct Memory<K>{val: u32,_marker: PhantomData<K>,}// Generates impl for both Sendable and Local
#[future_form(Sendable, Local)]impl<K: FutureForm>Counter<K>forMemory<K>{fn next(&self)-> K::Future<'_,u32>{letval=self.val;K::from_future(asyncmove{val+1})}}

Packages

Crate Description
future_form Core traits and types (FutureForm, Sendable, Local)
future_form_ffi FFI support: host-driven polling, effect slots, handles
future_form_macros The #[future_form] attribute macro

See the future_form README for full documentation, usage patterns, and comparisons with async-trait and trait-variant.

Examples

Example Description
counter_simple Introductory: basic counter, Go/Java/Python hosts
counter_effects Introductory: sans-IO effect protocol, host-fulfilled timestamps + logging
key_value_store Intermediate: per-future Arc<EffectSlot>, concurrent operations, multi-step futures

Design

Architecture decisions and rationale are documented in design/.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.