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

impl From<RenderError> for RenderErrorReason #644

Merged

Conversation

cmrschwarz
Copy link
Contributor

This just allows one to get the RenderErrorReason out of a RenderError by value.
The current reason() function only gives a reference, and the reason member is not pub (presumably for good reason).

My usecase for this is that I am using render_to_write with known, good data.
So the only possible error is an std::io::Error from the underlying writer, so I want to return that.
Unfortunately, std::io::Error isn't Clone so I can't get it out of the &RenderErrorReason that I'm currently getting.

I figured this was simple enough to not require a huge discussion in an issue first, but I'll gladly implement a different solution for this usecase if this conversion function is not acceptable for some reason.

Cheers and thank you for the awesome library.

@coveralls
Copy link

Coverage Status

coverage: 81.519% (-0.09%) from 81.61%
when pulling 5039170 on cmrschwarz:RenderErrorReason_from_RenderError
into 5efb0b6 on sunng87:master.

@sunng87 sunng87 merged commit 5dda501 into sunng87:master Jun 14, 2024
8 of 9 checks passed
@cmrschwarz cmrschwarz deleted the RenderErrorReason_from_RenderError branch July 13, 2024 20:33
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 this pull request may close these issues.

3 participants