Conversation
Added IntoIterator trait implementations for both Mft and &Mft, allowing them to be used directly in for loops and iterator-based APIs. This improves ergonomics when iterating over Mft entries.
The MFT iterator now yields UsnResult<MftEntry> instead of MftEntry, ensuring errors during enumeration are properly surfaced to users rather than being silently ignored. Example code, documentation, and tests have been updated to handle the new result type, providing better error visibility and consistency with the USN journal iterator.
Replaces all instances of format!("...", ...) and related macro calls with the Rust 1.58+ inline format string syntax (e.g., format!("{var}")). This modernizes the code, improves readability, and removes the clippy::uninlined_format_args allowance.
Updated documentation and README examples to clarify that USN journal and MFT iterators yield Result items, allowing individual entry errors to be handled gracefully. Improved code examples to demonstrate error handling for each entry.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This pull request improves error handling for iterator implementations in the usn-journal-rs library by making iterators yield Result types instead of panicking on errors. It also standardizes error handling with a new UsnResult type alias and modernizes string formatting throughout the codebase.
- Updated
UsnJournalIterandMftIterto yieldResult<T, UsnError>items for better error handling - Introduced
UsnResult<T>type alias for consistent error handling patterns - Modernized string formatting from
format!("{}", var)toformat!("{var}")syntax
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/lib.rs | Adds UsnResult type alias and updates documentation examples to handle Result types |
| src/journal.rs | Updates UsnJournalIter to yield Result<UsnEntry, UsnError> and modernizes formatting |
| src/mft.rs | Updates MftIter to yield Result<MftEntry, UsnError> and adds error handling documentation |
| src/volume.rs | Modernizes string formatting in logging and debug statements |
| src/tests.rs | Updates string formatting in test utility functions |
| src/path.rs | Modernizes string formatting in path construction |
| examples/*.rs | Updates examples to handle the new Result-yielding iterators |
| README.md | Updates documentation examples to show proper error handling |
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 enhancements to error handling and type consistency across the
usn-journal-rslibrary. The changes primarily focus on updating iterators to yieldResulttypes, enabling more robust error handling during iteration, and introducing a unifiedUsnResulttype alias for standardizing error handling. Additionally, it improves logging and formatting for error messages.