MathNya / umya-spreadsheet

A pure rust library for reading and writing spreadsheet files
MIT License
238 stars 41 forks source link

Wasm build getrandom dependency. #183

Closed taylorh140 closed 3 months ago

taylorh140 commented 3 months ago

Im trying to build for wasm and getrandom dependency is making it difficult. I'm curious what its used for or if there is a way to exclude it from the build?

MathNya commented 3 months ago

@taylorh140 Thank you for contacting us. getrandom is used to set passwords for files. If you do not need this feature, you can exclude it.

taylorh140 commented 3 months ago

Ya i figured out that I can use a feature to prevent some issues. particularly:

cargo.toml

getrandom = { version = "0.2.12", features = ["custom"] }

and

use getrandom::register_custom_getrandom;
use getrandom::Error;

// Some application-specific error code
pub fn always_fail(_buf: &mut [u8]) -> Result<(), Error> {
    Ok(())
}

register_custom_getrandom!(always_fail);
taylorh140 commented 3 months ago

@MathNya

@taylorh140 Thank you for contacting us. getrandom is used to set passwords for files. If you do not need this feature, you can exclude it.

Is there a easier way to exclude this?

MathNya commented 3 months ago

getrandom is only used in src.helper.crypt.rs. I think we can remove this class.

I would also like to address the problem with getrandom when building for wasm. I will replace it with an alternative package in the next version.