Skip to content

stdweb usage #123

Closed
Closed
@montao

Description

@montao

Related to #17

I have the following deps for my WASM project (it uses easy_reader to read random lines from a text file).

stdweb = "0.4.20"
getopts = "0.2"
rand = {version = "0.7", features = ['stdweb']}
easy_reader = "0.5.0"
yew = { path = "../.." }

I think the line which required the stdweb feature was reader.random_line() but I am not sure if that will work with rand 0.8 and it says that I should change the getrandom crate instead but how can I verify that it works and will it work today already if I tried to remove the rand 0.7 dependency and use getrandom instead?

What I am compiling to WASM is the following:

        let mut c = Cursor::new(Vec::new());
        let str42 = include_str!("spook.lines").as_bytes();            
        // // Write into the "file" and seek to the beginning
        c.write_all(str42).unwrap();
        c.seek(SeekFrom::Start(0)).unwrap();    
        let mut reader = EasyReader::new(c).unwrap();
        let _res = reader.build_index();
        let tmpspooks = reader.random_line().unwrap().unwrap()...

I read that the way I do it might be removed from rand 0.8 if I understand correctly.

"stdweb implies getrandom/stdweb to enable getrandom support on wasm32-unknown-unknown (will be removed in rand 0.8; activate via getrandom crate instead)

wasm-bindgen implies getrandom/wasm-bindgen to enable getrandom support on wasm32-unknown-unknown (will be removed in rand 0.8; activate via getrandom crate instead)"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions