| Crates.io | origin-stduio |
| lib.rs | origin-stduio |
| version | 0.1.0 |
| created_at | 2023-08-26 15:30:14.46313+00 |
| updated_at | 2023-08-26 15:30:14.46313+00 |
| description | Program startup and thread support written in Rust |
| homepage | |
| repository | https://github.com/sunfishcode/origin |
| max_upload_size | |
| id | 955586 |
| size | 62,208 |
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.