0.1.0 |
|
---|
#27 in #origin
175KB
3K
SLoC
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:
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.
Dependencies
~10–19MB
~349K SLoC