Crates.io | resistation |
lib.rs | resistation |
version | 0.1.0 |
source | src |
created_at | 2024-09-11 11:10:11.374584 |
updated_at | 2024-09-11 11:10:11.374584 |
description | Rust SDK for Resistation, a WASM-powered little computing platform |
homepage | https://resistation.com |
repository | https://sr.ht/~ludo/resistation |
max_upload_size | |
id | 1371846 |
size | 109,960 |
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.
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
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.
The source code for this crate is released under the 3-Clause BSD license.