fschutt / printpdf

An easy-to-use library for writing PDF in Rust
https://docs.rs/printpdf/
MIT License
777 stars 95 forks source link

Use reference instead of copy on converting OffsetDateTime to string #127

Closed derjones closed 1 year ago

derjones commented 1 year ago

Hey, the problem is that js_sys::Date does not implement the copy trait, therefore your OffsetDateTime polyfill for wasm in src/date.rs does not implement the copy trait. Therefore printpdf can't be build for wasm-unknown-unknown. I think the most simple fix is to change the function signatures for to_pdf_time_stamp_metadata and to_pdf_time_stamp_metadata to use a OffsetDateTime reference. A copy is not necessary anyway. Let me know if I'm wrong.

Thank you! Jonas