space-lib

Crates.iospace-lib
lib.rsspace-lib
version0.5.1
sourcesrc
created_at2022-11-26 19:42:14.782152
updated_at2023-03-18 20:32:40.698327
descriptionWebAssembly host functions for Space Operator
homepage
repository
max_upload_size
id723431
size18,650
(enzotar)

documentation

https://docs.rs/space-lib

README

space-lib

cargo add space-lib

This crate provides WebAssembly host functions and other utilities for Space Operator.

Example

use space_lib::{space, Result};
use serde::{Serialize, Deserialize};

#[derive(Deserialize)]
struct Input {
    value: usize,
    name: String,
}

#[derive(Serialize)]
struct Output {
    value: usize,
    name: String,
}

#[space]
fn main(input: Input) -> Result<Output> {
    let output = Output {
        value: input.value * 2,
        name: input.name.chars().rev().collect(),
    };
    Ok(output)
}

HTTP client

use space_lib::Request;

let body = Request::get("https://www.spaceoperator.com")
    .call()?
    .into_string()?;
Commit count: 0

cargo fmt