-
Notifications
You must be signed in to change notification settings - Fork 208
Delay reading of vba project #574
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
Conversation
|
Not sure what the rules of semantic versioning say about functions that are not callable but manage to be visible. |
+1. It was unnecessarily public. I dropped it completely in my |
|
I have no major comments on this. Overall it looks very good. I'll try do a full review in a few days. In the meantime I'll kick off copilot. Just ignore/resolve any irrelevant comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the VBA project API to simplify error handling and ownership semantics. The main change converts vba_project() from returning Option<Result<Cow<'_, VbaProject>, Error>> to Result<Option<VbaProject>, Error>, eliminating the Cow wrapper and inverting the Option/Result nesting for more idiomatic Rust error handling.
Key changes:
- Changed
vba_project()signature fromOption<Result<Cow<'_, VbaProject>, Error>>toResult<Option<VbaProject>, Error>across all workbook types - Removed redundant
XmlAttributeerror variant inXlsxError, consolidating it with existingXmlAttrvariant - Refactored
Xlsto storeCfband reader internally, enabling lazy VBA loading instead of eager loading - Updated all test cases and examples to use the new API pattern
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib.rs | Updated Reader trait signature for vba_project() and updated documentation example |
| src/vba.rs | Made from_cfb() internal, updated documentation, and added derive traits to VbaProject |
| src/xlsx/mod.rs | Removed duplicate XmlAttribute error variant, simplified error handling, and updated vba_project() implementation |
| src/xlsb/mod.rs | Updated vba_project() implementation and added missing error conversions |
| src/xls.rs | Refactored to store Cfb and reader for lazy VBA loading, updated vba_project() implementation |
| src/ods.rs | Updated vba_project() signature (ODS doesn't support VBA) and fixed error conversion |
| src/cfb.rs | Added derive traits to XlsEncoding and simplified Vec::with_capacity logic |
| src/auto.rs | Updated vba_project() implementation for auto-detected workbook wrapper |
| src/xlsx/cells_reader.rs | Simplified error handling by removing redundant map_err calls |
| tests/test.rs | Updated all test cases to use new VBA API and added VBA reference/module tests |
| examples/search_errors.rs | Updated to use new VBA API pattern |
| fuzz/fuzz_targets/fuzz_all.rs | Updated to use new VBA API pattern |
| README.md | Updated documentation example |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Overall this look good to me. @sftse are you happy to merge? |
|
GTM |
|
Merged. Thanks. |
Supersedes #572