wasi-print: : implementation of Rust print macros and similar for no_std WASI
Bart Massey 2023 (version 0.2.2)
This crate contains basic niceties for writing no_std
modules for WASI. wasi-print
provides:
- An
abort()
function that raises a WASI exception. - A
panic_handler
that aborts after trying to print panic information. - A
print_fd()
function that prints an&str
to a WASIfd
. - Printing macros
print!()
,println!()
,!eprint()
and!eprintln()
.
Example
This is a full standalone Rust WASM program using
wasi_print
.
use *;
pub extern "C"
Features
print
: Include printing code. This requires nightly for a variety of reasons.panic_handler
: Provide a panic handler.
Acknowledgments
Figuring out how to write this was made much easier by this excellent blog post by "James [Undefined]".
License
This work is licensed under the "MIT License". Please see the file
LICENSE.txt
in this distribution for license terms.
Further Acknowledgments
Thanks to the cargo-readme
crate for generation of this README
.