#sdk #platform #little #run-time #environment #programs #wasm-powered

yanked resistation

Rust SDK for Resistation, a WASM-powered little computing platform

1 unstable release

0.1.0 Sep 11, 2024

#105 in #little


Used in resistation-tui

BSD-3-Clause

110KB
2K SLoC

Resistation Rust SDK

This crate provides a library for building programs and games for the Resistation platform.

Resistation is a playful, WASM-powered platform for developing, sharing, and preserving little programs and games. This SDK offers all the necessary APIs to interact with the Resistation runtime environment.

For a complete guide on getting started with Resistation and the SDK, refer to the official guide.

Setup

To use the SDK, ensure that you have the necessary toolchain installed for compiling to WebAssembly (wasm32-unknown-unknown). You can install it with the following command:

rustup target add wasm32-unknown-unknown

Create a new Rust library project using Cargo, and then specify C dynamic library as create type and add the Resistation SDK as a dependency in your Cargo.toml:

[lib]
crate-type = ["cdylib"]

[dependencies]
resistation = "0.1"

To specify wasm32-unknown-unknown as your build target, create a .cargo/cargo.toml in your project's root with this content:

[build]
target = "wasm32-unknown-unknown"

Once set up, you can start building your program by importing the SDK's modules and using its APIs.

To run the program in Resistation on macOS, enter the following command on the terminal from your project's root folder:

> open -a Resistation target/wasm32-unknown-unknown/release/<program name>.wasm

On other Linux or Windows, use the following command instead:

> <path to Resistation AppImage or exe> --program=target/wasm32-unknown-unknown/release/<program name>.wasm

Examples

Here is a simple example to get started with a basic "Hello, World!" program for Resistation:

use resistation::println;

#[no_mangle]
extern "C" fn main() {
    println!("Hello, Resistation!");
}

This program uses the SDK's println! macro to display a message on the screen.

For more comprehensive examples and tutorials, refer to the official guide.

License

The source code for this crate is released under the 3-Clause BSD license.

No runtime deps