Closed jacobsvante closed 1 year ago
Another API suggestion:
let mut wb = Workbook::new();
wb.use_tempfile_when_larger_than(5_000_000);
In this case temp file would never be created unless data grows to a size of 5 MBytes or more.
Thanks for the feedback.
rust_xlsxwriter currently depends on the tempfile crate, which in turn means that a
/tmp
directory (or equivalent) needs to be available.
There are two items on the roadmap to deal with that:
The Python version supports both of those: https://xlsxwriter.readthedocs.io/workbook.html#constructor
However, I will need to balance this with a 'low/constant memory mode' feature (also supported in the Python version) where tempfile will be required as a backend for worksheets.
However, in the short term I may just remove the tempfile requirement (if there is no performance difference) and re-introduce it later as an optional feature for constant memory mode.
I've pushed a version to main that removes the dependency on the tempfile crate. You can test it if you get a chance.
Thanks for the suggestion.
Fixed in version 0.12.1. Closing.
Great job! Thank you!!
However, I will need to balance this with a 'low/constant memory mode' feature (also supported in the Python version) where tempfile will be required as a backend for worksheets.
Agreed. Having this option will most likely be important for many scenarios, no matter how memory efficient Rust is.
Feature Request
As can be seen here, rust_xlsxwriter currently depends on the tempfile crate, which in turn means that a
/tmp
directory (or equivalent) needs to be available. This isn't the case in Kubernetes environments by default, which is how I noticed this. I guess wasm environments would also have trouble with this.Wouldn't it make more sense to default to in-memory storage, and make
tempfile
an optional feature to the crate? Then with that feature enabled, one could opt in to the file-creating behavior using an associated function, e.g.Workbook::new_tempfile_backed()
.