mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
Switch cts_runner to clearer no_main style of wasm compat
This commit is contained in:
parent
267f14632f
commit
65eb10ed5a
@ -1,5 +1,6 @@
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
mod native {
|
||||
#![cfg_attr(target_arch = "wasm32", no_main)]
|
||||
#![cfg(not(target_arch = "wasm32"))]
|
||||
|
||||
use std::sync::Arc;
|
||||
use std::{
|
||||
env, fmt,
|
||||
@ -103,10 +104,7 @@ mod native {
|
||||
}
|
||||
|
||||
#[op2(fast)]
|
||||
fn op_write_file_sync(
|
||||
#[string] path: &str,
|
||||
#[buffer] buf: &[u8],
|
||||
) -> Result<(), std::io::Error> {
|
||||
fn op_write_file_sync(#[string] path: &str, #[buffer] buf: &[u8]) -> Result<(), std::io::Error> {
|
||||
let path = std::path::Path::new(path);
|
||||
let mut file = std::fs::File::create(path)?;
|
||||
file.write_all(buf)?;
|
||||
@ -146,15 +144,8 @@ mod native {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
async fn main() {
|
||||
native::unwrap_or_exit(native::run().await)
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
fn main() {
|
||||
panic!("This is a native only module. It can't be run on the web!");
|
||||
unwrap_or_exit(run().await)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user