-
I am a bit confused by https://github.com/rustwasm/team/issues/161
-
What is the "correct" way to have a piece of code that compiles only under the wasm32 target?
https://doc.rust-lang.org/1.30.0/book/first-edition/conditional-compilation.html
#[cfg(target_arch = "wasm32")]
fn hello() {
println!("with wasm")!
}
#[cfg(not(target_arch = "wasm32"))]
fn hello() {
println!("not wasm")!
}
BTW. I can't find where this feature is documented in the second edition of the book.
1 Like
Thanks or the sample code!