minus-squareElectricMoose@lemmy.worldtoRust Programming@lemmy.ml•Bash Script to compile a single rust script, execute the binary and delete the binarylinkfedilinkarrow-up0·edit-26 months agoAllow me to retort with an all-in-one self build script, along with pass-through args and exitcode. #!/bin/sh out=$(mktemp) sed -e '0,/^#SELFBUILD$/d' "$0" | rustc --o "$out" - && "$out" "$@" status=$? rm -f "$out" exit "$status" #SELFBUILD fn main() { dbg!(std::env::args()); println!("hello rust"); std::process::exit(2); } P.S. I have no idea why you’d want that, as it’s a terribly inefficient way to ship code, but it’s a fascinating glimpse at how we used to do self-extract archives decades ago. linkfedilink
minus-squareElectricMoose@lemmy.worldtoProgrammer Humor@lemmy.ml•Of courselinkfedilinkarrow-up0·1 year agoAs a bytecode tinkerer, I’d say considering NOP to be global knowledge is a slippery slope. linkfedilink
minus-squareElectricMoose@lemmy.worldtoProgrammer Humor@lemmy.ml•Floating-point arithmeticlinkfedilinkarrow-up0·1 year agoConsider IEEE754 arithmetic as monadic, simple! linkfedilink
Allow me to retort with an all-in-one self build script, along with pass-through args and exitcode.
#!/bin/sh out=$(mktemp) sed -e '0,/^#SELFBUILD$/d' "$0" | rustc --o "$out" - && "$out" "$@" status=$? rm -f "$out" exit "$status" #SELFBUILD fn main() { dbg!(std::env::args()); println!("hello rust"); std::process::exit(2); }
P.S. I have no idea why you’d want that, as it’s a terribly inefficient way to ship code, but it’s a fascinating glimpse at how we used to do self-extract archives decades ago.