Skip to main content

vthread_stack/
lib.rs

1//! Private, unsupported stack backend for `vthread`; not an independent public API.
2//!
3//! Direct downstream use has no compatibility contract. Cleanup mount callbacks are
4//! runtime integration hooks and must succeed. A persistent mount failure during lexical
5//! scope exit aborts: borrowed executable stacks cannot safely escape their environment.
6
7#![deny(unsafe_op_in_unsafe_fn)]
8
9#[cfg(panic = "abort")]
10const _: () = {
11    compile_error!("vthread-stack requires panic=unwind");
12};
13
14#[cfg(not(any(
15    all(target_os = "linux", target_arch = "x86_64"),
16    all(target_os = "macos", target_arch = "aarch64"),
17)))]
18const _: () = {
19    compile_error!("vthread-stack 0.0.1 supports Linux x86_64 and macOS ARM64");
20};
21
22mod fiber;
23mod lease;
24#[doc(hidden)]
25pub mod panic_payload;
26mod pool;
27mod scoped;
28
29pub use fiber::{Fiber, FiberState, ParkRequest, ParkToken, SuspendError, Suspension, suspend};
30pub use lease::FiberLease;
31pub use pool::{StackPool, StackPoolSnapshot};
32pub use scoped::{FiberScope, fiber_scope};
33
34#[cfg(test)]
35#[path = "lib_test.rs"]
36mod lib_test;