Skip to content

impl From<RenderError> for RenderErrorReason#644

Merged
sunng87 merged 1 commit into
sunng87:masterfrom
cmrschwarz:RenderErrorReason_from_RenderError
Jun 14, 2024
Merged

impl From<RenderError> for RenderErrorReason#644
sunng87 merged 1 commit into
sunng87:masterfrom
cmrschwarz:RenderErrorReason_from_RenderError

Conversation

@cmrschwarz

Copy link
Copy Markdown
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
Copy Markdown

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
@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