| Crates.io | kiss3d-macro |
| lib.rs | kiss3d-macro |
| version | 0.36.0 |
| created_at | 2025-10-18 15:57:17.502047+00 |
| updated_at | 2025-10-18 15:57:17.502047+00 |
| description | Procedural macros for the kiss3d crate |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1889324 |
| size | 6,788 |
Procedural macros for the kiss3d crate.
#[kiss3d::main] macroThis macro simplifies writing cross-platform kiss3d applications that work on both native platforms and WebAssembly.
pollster or wasm_bindgen_futures to your Cargo.toml - they're automatically available through kiss3dWhen writing kiss3d applications that target both native and WASM, you previously had to write boilerplate code like this:
#[cfg(not(target_arch = "wasm32"))]
fn main() {
pollster::block_on(run())
}
#[cfg(target_arch = "wasm32")]
fn main() {
wasm_bindgen_futures::spawn_local(run())
}
async fn run() {
let mut window = Window::new("My App");
while window.render_async().await {
// Your render loop
}
}
With the #[kiss3d::main] macro, you can simplify this to:
#[kiss3d::main]
async fn main() {
let mut window = Window::new("My App");
while window.render_async().await {
// Your render loop
}
}
The macro automatically generates the appropriate platform-specific entry points:
pollster::block_on to run the async functionwasm_bindgen_futures::spawn_local to spawn the async functionmainasyncrender_async(), render_with_camera_async(), etc.)See examples/instancing3d.rs and examples/macro_test.rs for complete examples.