Rust-Kern: WASM-Bindungen je Modul in eigener Datei (web/<modul>.rs), Vorbereitung paralleler Portierungen
Claude-Session: https://claude.ai/code/session_01NTYBZBvLYCtugMJoKXaB67
This commit is contained in:
2 files changed
+20
-14
No files matched your search
@@ -0,0 +1,19 @@
|
||||
//! wasm-bindgen-Fassade (Feature "web"). Je Kern-Modul eine eigene Datei `web/<modul>.rs`
|
||||
//! (parallele Arbeit ohne Konflikte). Eingaben/Ausgaben als flache `f64`-Puffer (s. `flat`).
|
||||
//! Kaputte Eingaben ergeben ein leeres Ergebnis statt eines Panics (ein Panic legt das ganze
|
||||
//! WASM-Modul lahm, [14]).
|
||||
|
||||
mod polygon;
|
||||
|
||||
use wasm_bindgen::prelude::wasm_bindgen;
|
||||
|
||||
#[wasm_bindgen(start)]
|
||||
pub fn start() {
|
||||
console_error_panic_hook::set_once();
|
||||
}
|
||||
|
||||
/// Version des Kern-Moduls (für Diagnose/Startprotokoll).
|
||||
#[wasm_bindgen]
|
||||
pub fn core_version() -> String {
|
||||
env!("CARGO_PKG_VERSION").to_string()
|
||||
}
|
||||
@@ -1,22 +1,9 @@
|
||||
//! wasm-bindgen-Fassade (Feature "web"). Eingaben/Ausgaben als flache `f64`-Puffer (s. `flat`).
|
||||
//! Kaputte Eingaben ergeben ein leeres Ergebnis statt eines Panics (ein Panic legt das ganze
|
||||
//! WASM-Modul lahm, [14]).
|
||||
//! Bindungen der Polygon-Booleans (`crate::polygon_bool`).
|
||||
|
||||
use crate::flat::{decode, encode};
|
||||
use crate::polygon_bool;
|
||||
use wasm_bindgen::prelude::wasm_bindgen;
|
||||
|
||||
#[wasm_bindgen(start)]
|
||||
pub fn start() {
|
||||
console_error_panic_hook::set_once();
|
||||
}
|
||||
|
||||
/// Version des Kern-Moduls (für Diagnose/Startprotokoll).
|
||||
#[wasm_bindgen]
|
||||
pub fn core_version() -> String {
|
||||
env!("CARGO_PKG_VERSION").to_string()
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn poly_union(a: &[f64]) -> Vec<f64> {
|
||||
encode(&polygon_bool::union(&decode(a).unwrap_or_default()))
|
||||
Reference in new issue
Block a user