Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "htmx"
version = "5.0.0-blazingly-fast"
edition = "2024"
description = "htmx, but memory safe"

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

[dependencies]
wasm-bindgen = "0.2"
web-sys = { version = "0.3", features = ["Document", "Element", "Window"] }
19 changes: 19 additions & 0 deletions rust/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//! htmx, rewritten in Rust and WebAssembly.
//!
//! Status: 1 of approximately 4,000 functions ported.

use wasm_bindgen::prelude::*;

/// Ported from `htmx.js`. 0 percent faster, but now it is safe.
#[wasm_bindgen]
pub fn process(elt: &web_sys::Element) -> Result<(), JsValue> {
// TODO: port the rest of htmx
let _ = elt;
unimplemented!("hypermedia is not yet memory safe")
}

/// The JavaScript version was 16kb. This one is 2.4mb before `wasm-opt`.
#[wasm_bindgen(start)]
pub fn main() {
web_sys::console::log_1(&"htmx (rust edition) loaded. please stand by.".into());
}
Loading