add `From<GlobError> for io::Error` impl
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 595
- Forks
- 93
- PR merge metrics
- No merged PRs in 30d
Description
The conversion I would suggest is:
impl From<GlobError> for io::Error {
fn from(err: GobError) -> io::Error {
io::Error::new(err.error.kind(), err)
}
}
This will keep the "pretty context" so that glob errors keep printing as:
"attempting to read `{}` resulted in an error: {}",
self.path.display(),
self.error
Which is already very ergonomic.
I can do this if you OK it 😄
Benefits / Justification
The glob error is already essentially an io::Error with a bit of additional context. This will allow functions that return io::Error can use glob with ? directly which incurs (basically) no performance issues.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating GlobError and its existing error-formatting implementation, then compare it with the requested io::Error conversion in the issue. Verify that the conversion preserves the existing contextual message and that functions returning io::Error can use glob errors with ?. Confirm the relevant test suite passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100