J-F-Liu / lopdf

A Rust library for PDF document manipulation.
MIT License
1.67k stars 176 forks source link

AsyncReader #265

Closed Ech0riginal closed 9 months ago

Ech0riginal commented 9 months ago

This PR's goal is to introduce an AsyncReader via Tokio. There's a lot of code duplication due to my not being familiar with the pattern used here, but it's all feature-gated by "async". The examples are 99% copies, we could throw them in an async folder to separate? Don't mind to make changes re: code duplication, suggestions welcome.

Ech0riginal commented 9 months ago

After spending more than a few minutes with the code I removed the AsyncReader then shoved the async reading into a feature-gated Document implementation. Much cleaner that way and without a ton of code duplication.

There's also an addition of tests/utils to make testing either sync or async smooth, both functions in there are tagged as dead_code to avoid compiler warnings, they are not. Lots of duplication in the examples still.