Implement async enumerators and enhance related documentation and tests - #37
Merged
Conversation
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #37 +/- ##
==========================================
- Coverage 88.66% 88.45% -0.21%
==========================================
Files 88 88
Lines 5600 5639 +39
Branches 1067 1071 +4
==========================================
+ Hits 4965 4988 +23
- Misses 405 419 +14
- Partials 230 232 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Benchmark ResultsMeasured on ExcelReader.Benchmarks.ColdStartBenchmark
ExcelReader.Benchmarks.CsvParseBenchmark
ExcelReader.Benchmarks.CsvReadBenchmark
ExcelReader.Benchmarks.CsvWriteBenchmark
ExcelReader.Benchmarks.ParseBenchmark
ExcelReader.Benchmarks.ReadBenchmark
ExcelReader.Benchmarks.RealDataReadBenchmark
ExcelReader.Benchmarks.RecordWriteBenchmark
ExcelReader.Benchmarks.WriteBenchmark
ExcelReader.Benchmarks.XlsReadBenchmark
ExcelReader.Benchmarks.XlsWriteBenchmark
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces comprehensive support for async enumeration (
await foreach) of rows and strongly-typed models, including forref structtypes, across all supported Excel formats (XLS, XLSX, XLSB, CSV). The changes unify and modernize both the API surface and documentation, making async consumption of rows and zero-allocation parsing withref structmodels both easier and more idiomatic. The implementation also refactors enumerator types to use reference types where required for async state management, and clarifies usage limitations and patterns in the documentation.Async Enumeration Support and API Changes
CsvReader,XlsReader,XlsbReader) now implement a parameterlessGetAsyncEnumerator()method, enabling direct use withawait foreachfor both row and strongly-typed model enumeration. InterfaceIExcelRowReader<TEnumerator>is updated to include this method. [1] [2] [3] [4]NamedRefRowEnumerable<TModel, TEnumerator>adds bothGetAsyncEnumerator()for pattern-based async enumeration andGetAsyncEnumeratorAsync()for explicit async opening with a cancellation token, supporting advanced scenarios.Enumerator Implementation Changes
NamedRefRowEnumerator<TModel, TEnumerator>is refactored from a struct to a sealed class to correctly manage async state across awaits, ensuring correct behavior for both sync and async enumeration ofref structmodels.MoveNextAsync()implementation toNamedRefRowEnumerator, along with proper async disposal support (DisposeAsync). [1] [2]Documentation Updates
README.mdis updated to document the newawait foreachsupport for all readers and for strongly-typedref structparsing, clarifying usage patterns, limitations, and best practices. This includes code examples and explanations of why certain interfaces (likeIAsyncEnumerable<T>) are not used forref structmodels. [1] [2] [3] [4]Code Quality and Suppression
These changes provide a consistent, modern async API for Excel file reading, support high-performance zero-allocation parsing, and clarify usage for both sync and async consumers.