silvia-odwyer / photon

⚡ Rust/WebAssembly image processing library
https://silvia-odwyer.github.io/photon
Apache License 2.0
2.72k stars 154 forks source link

Use without wasm #147

Closed John0x closed 1 year ago

John0x commented 1 year ago

Hey, is it possible to only use the native mode of Photon in Rust? Would be great to have a feature gate that just excludes all the wasm/js stuff.

bluthen commented 1 year ago

https://silvia-odwyer.github.io/photon/guide/using-photon-natively/

John0x commented 1 year ago

Thanks, but that wasn't really what I meant :) That will still pull all the wasm/js dependencies, which I would like to avoid.

nathanbabcock commented 1 year ago

@silvia-odwyer @John0x what do you think about an optional crate feature disable-wasm that "turns off" all the wasm-bindgen directives (and their dependencies)? Like in this example: https://stackoverflow.com/a/42551386/16517800

It would solve a minor annoyance I have, too. I publish a WASM library using a subset of Photon, but wasm-pack compiles every function (even the ones I'm not using, which is most of them). Instead, I would disable the feature on Photon and manually choose which functions to re-export.

I could prepare a PR if you are open to the idea.

silvia-odwyer commented 1 year ago

@nathanbabcock Hi Nathan! That sounds like an excellent idea, it would be great to have this crate feature added to the library!

If you're interested in creating a PR for this, that would be fantastic. Thanks so much, it's greatly appreciated! 😄