feat(sled): Print a clear error message when attempting to build on wasm

This commit is contained in:
Jonas Platte
2022-08-03 12:58:02 +02:00
committed by Jonas Platte
parent 9714ce9edf
commit 82f4e57a2c

View File

@@ -0,0 +1,17 @@
use std::{env, process};
fn main() {
let target_arch = env::var_os("CARGO_CFG_TARGET_ARCH");
if target_arch.map_or(false, |arch| arch == "wasm32") {
let err = "this crate does not support the target arch 'wasm32'";
eprintln!(
"\n\
┏━━━━━━━━{pad}━┓\n\
┃ error: {err}\n\
┗━━━━━━━━{pad}━┛\n\
",
pad = "".repeat(err.len()),
);
process::exit(1);
}
}