axum-wasm-macros

Crates.ioaxum-wasm-macros
lib.rsaxum-wasm-macros
version0.1.2
sourcesrc
created_at2023-07-19 02:13:23.668446
updated_at2023-09-09 01:42:36.425596
descriptionA macro to enable compabatility between Axum and and WASM
homepage
repositoryhttps://github.com/logankeenan/axum-wasm-macros
max_upload_size
id919970
size9,675
Logan Keenan (logankeenan)

documentation

README

axum-wasm-macros

Crates.io

A macro to ensure async axum routes can compile to WASM

Why?

Axum handlers return a Send future. However, JS types do not return a Send future. wasm_compat will provide compatability between the return types.

Example

use axum_wasm_macros::wasm_compat;
use axum::Router;
use axum::routing::get;

#[wasm_compat]
pub async fn index() -> &'static str {
    "Hello World"
}

pub fn main() {
    let router: Router = Router::new().route("/", get(index));
    // rest of the app code goes here.
}
Commit count: 6

cargo fmt