origin-studio

An alternative `std`-like implementation built on origin

Github Actions CI Status zulip chat crates.io page docs.rs docs

origin-stdio is an alternative [`std`]-like implementation built on [`origin`]. At this time, it only works on Linux, requires Rust nightly, lacks full `std` compatibility, and is overall experimental. But it supports threads and stuff. Quick start: In an empty directory, on Linux, with Rust nightly, run these commands: ```sh cargo init cargo add origin_studio cargo add compiler_builtins --features=mem echo 'fn main() { println!("cargo:rustc-link-arg=-nostartfiles"); }' > build.rs sed -i '1s/^/#![no_std]\n#![no_main]\norigin_studio::no_problem!();\n\n/' src/main.rs cargo +nightly run --quiet ``` This will produce a crate and print "Hello, world!". Yes, you might say, I could have already done that, with just the first and last commands. But this version uses `origin` to start and stop the program, and [`rustix`] to do the printing. And beyond that, it uses [`origin`] to start and stop threads, [`rustix-futex-sync`] to do locking for threads, and [`rustix-dlmalloc`] to do memory allocation, so it doesn't use libc at all. [`std`]: https://doc.rust-lang.org/stable/std/ [`origin`]: https://docs.rs/origin/latest/origin/ [`rustix`]: https://docs.rs/rustix/latest/rustix/ [`rustix-futex-sync`]: https://docs.rs/rustix-futex-sync/latest/rustix-futex-sync/ [`rustix-dlmalloc`]: https://docs.rs/rustix-dlmalloc/latest/rustix-dlmalloc/