| Crates.io | grid-rs |
| lib.rs | grid-rs |
| version | 0.1.1 |
| created_at | 2025-09-13 17:25:39.030237+00 |
| updated_at | 2025-09-13 20:55:20.518782+00 |
| description | A library for interacting with host functions in the Slipstream runtime. |
| homepage | |
| repository | https://github.com/s3ndotxyz/grid-rs |
| max_upload_size | |
| id | 1837942 |
| size | 12,597 |
This is a library for using host functions from the Slipstream runtime. It's more or less a wrapper for linked Wasm imports.
We have plans to enable a few other things such as message queues and web-sockets in the near future. Stay tuned!
Here's a simple example of a function that stores a username and a vector of bytes in the key-value store:
use grid_rs::{kvs::Storage};
use serde::{Deserialize, Serialize};
#[grid_rs::main]
fn main(input: &[u8]) -> Result<Vec<u8>, String> {
let input: MyInput = match serde_json::from_slice(input) {
Ok(input) => input,
Err(e) => {
return Err(format!(
"JSON deserialization failed: {e}. Input was: {}",
String::from_utf8_lossy(input)));
}
};
Storage::put(format!("user-{}", input.username).as_str(), &input.username, input.data.as_slice());
let output = MyOutput {
status: "success".to_string(),
result: input.data,
};
Ok(serde_json::to_vec(&output).unwrap())
}
#[derive(Deserialize)]
struct MyInput {
username: String,
data: Vec<u8>,
}
#[derive(Serialize)]
struct MyOutput {
status: String,
result: Vec<u8>,
}