Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: please add support for Result<T, E> to IntoExcelData #64

Closed
lucatrv opened this issue Dec 31, 2023 · 5 comments
Closed
Assignees

Comments

@lucatrv
Copy link
Contributor

lucatrv commented Dec 31, 2023

Feature Request

Currently IntoExcelData supports Option<T>, which can be used when a value maybe present or not. However often when dealing with tabular data we need to define fallback types, for instance a column could normally contain an f64 but may sometimes contain a String. I think the best way to deal with this very common occurrence is to use Result<f64, String>. Of course also other use cases can be envisioned for a Result<T, E> type.
The rust_xlsxwriter::Worksheet::write* methods should correctly write Result<T, E> if both T and E are supported types.

@jmcnamara jmcnamara self-assigned this Dec 31, 2023
@jmcnamara
Copy link
Owner

I'm not, at first glance, convinced of the general utility of this.

However, I'll consider it and if anyone else thinks this would be useful then a +1 or "me too" comment will help persuade me.

@lucatrv
Copy link
Contributor Author

lucatrv commented Jan 1, 2024

I add references to related discussions for rust-csv and calamine.

jmcnamara added a commit that referenced this issue Jan 2, 2024
Add support for handling Result<T, E> values in the write() method.

Feature request #64
@jmcnamara
Copy link
Owner

jmcnamara commented Jan 2, 2024

Ok. It seems like you have a plan you are working to.

I've added this to main. Let me know how you get on.

It is undocumented for now. I'll add that later. Done.

jmcnamara added a commit that referenced this issue Jan 2, 2024
Add support for handling Result<T, E> values in the write() method.

Feature request #64
@lucatrv
Copy link
Contributor Author

lucatrv commented Jan 2, 2024

Thanks @jmcnamara , yes I will let you know if this feature can be added to rust-csv and calamine, as it will ease management of invalid field formats.

@jmcnamara
Copy link
Owner

This feature has been pushed to crates.io in rust_xlsxwriter v0.60.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants