pdf-rs / pdf

Rust library to read, manipulate and write PDF files.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to use 0.8.0 with wasm-pack

ggodlewski opened this issue · comments

I'm porting my wasm package from 0.7.1 to 0.8.0
Unfortunately I'm getting error due to usage of globalcache which calls unavailable std::time::Instant::now

RuntimeError: unreachable
    at __rust_start_panic (wasm://wasm/0176207e:1:5040215)
    at rust_panic (wasm://wasm/0176207e:1:5027122)
    at std::panicking::rust_panic_with_hook::hd000e9fb43b5781d (wasm://wasm/0176207e:1:4427895)
    at std::panicking::begin_panic_handler::{{closure}}::he16e52e9a7dddeb1 (wasm://wasm/0176207e:1:4593100)
    at std::sys_common::backtrace::__rust_end_short_backtrace::h227361e053771d9e (wasm://wasm/0176207e:1:5021129)
    at rust_begin_unwind (wasm://wasm/0176207e:1:4872135)
    at core::panicking::panic_fmt::h9d972fcdb087ce21 (wasm://wasm/0176207e:1:4995600)
    at std::time::Instant::now::h48900f1b4f732c12 (wasm://wasm/0176207e:1:4953705)
    at globalcache::sync::SyncCache<K,V>::get::h38ca8ac0469be9c3 (wasm://wasm/0176207e:1:2403829)
    at <pdf::file::Storage<B> as pdf::object::Resolve>::get::hb2c01a928274f113 (wasm://wasm/0176207e:1:2752919)

I'd like to be able to disable this caching and provide my own cache implementation.

can you check if 13938b8 solves this?

nevermind. the tests fail due to deadlocks.

I had to add globalcache back as the cache. It is now behind the "cache" feature.

Let me know when it's done. Currently I'm getting:

error[E0432]: unresolved import `globalcache`
  --> /home/gg/workspaces/inceptum/pdf/pdf/src/file.rs:23:5

you have to write
pdf { git = "...", default-features = false }

Exactly what I'm doing. You don't have cfg above line 23:
https://github.com/pdf-rs/pdf/blob/master/pdf/src/file.rs#L22

oops.
I guess doing this in the night was not the best idea.

Thanks, works like a charm.