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

Handling of empty files #51

Closed
mbhall88 opened this issue Oct 22, 2020 · 2 comments · Fixed by #52
Closed

Handling of empty files #51

mbhall88 opened this issue Oct 22, 2020 · 2 comments · Fixed by #52

Comments

@mbhall88
Copy link
Contributor

reader.read_exact(&mut first_two_bytes)?;

This line will cause an error to be returned for an empty file. Is this a feature or a bug?

Effectively, I'm asking if you intentionally return an error for empty files?

I personally don't like failing on empty files. I wonder if you would consider adding a ParseErrorKind variant for an empty file so I can identify and handle these cases accordingly in my project?

I'm happy to implement if you're short on time, but wanted to check first if this is inline with your library.

@Keats
Copy link
Contributor

Keats commented Oct 23, 2020

IIRC it's intended, we consider empty files to be invalid in our codebases. I think a specific ParseErrorKind would be nicer than a IO error though. A PR would be welcome.

@mbhall88
Copy link
Contributor Author

@Keats do you think I might be able to get a review on #52 at some point? I appreciate you probably have lots of other things happening so if you don't have time that is ok.

@Keats Keats closed this as completed in #52 Jan 11, 2021
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

Successfully merging a pull request may close this issue.

2 participants