Files
OneCAD-Draft/src/main.rs
T
Hakan SevenandClaude Opus 4.8 9ca19a9db8 feat(wasm): sequential rayon shim for the web build
wasm32 has no threads, so rayon's global pool would panic at runtime.
Add `crate::par::prelude`: native re-exports `rayon::prelude`, wasm
provides sequential `std`-iterator equivalents (par_iter / into_par_iter
/ flat_map_iter over slices, Vec, HashMap, HashSet). All call sites now
`use crate::par::prelude::*;` instead of rayon directly.

- wire_gpu's rayon `reduce` (2-arg, no std equivalent) is cfg-split to
  a sequential flat_map concat on wasm.
- rayon moves to a non-wasm target dependency.

Native still runs in parallel; all 75 tests pass. wasm bin compiles.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-06-16 17:11:20 +03:00

45 lines
1.3 KiB
Rust

#![allow(non_snake_case)]
// On Windows release builds, hide the console window the OS would
// otherwise spawn alongside the GUI. Debug builds keep stdout/stderr
// attached so eprintln! / panics stay visible while developing.
#![cfg_attr(all(windows, not(debug_assertions)), windows_subsystem = "windows")]
mod app;
mod command;
mod entities;
mod io;
mod linetypes;
mod modules;
mod plugin;
mod patterns;
mod scene;
mod snap;
mod ui;
mod par;
mod sys;
mod update_check;
fn main() -> iced::Result {
// On some Windows hybrid-GPU laptops the AMD OpenGL driver (atio6axx.dll)
// access-violates the moment wgpu enumerates its GL backend at startup,
// killing the app before any window appears — even though DX12 would work
// fine (#55). Restrict wgpu to DX12/Vulkan so the GL ICD is never touched.
// An explicit user-set WGPU_BACKEND still wins.
#[cfg(target_os = "windows")]
if std::env::var_os("WGPU_BACKEND").is_none() {
std::env::set_var("WGPU_BACKEND", "dx12,vulkan");
}
// Web (wasm) uses the single-window entry; native uses the multi-window
// daemon. Trunk calls `main` from its generated JS bootstrap.
#[cfg(target_arch = "wasm32")]
{
console_error_panic_hook::set_once();
app::run_web()
}
#[cfg(not(target_arch = "wasm32"))]
{
app::run()
}
}