NLnetLabs / domain

A DNS library for Rust.

Home Page:https://nlnetlabs.nl/projects/domain/about/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Seal error types.

partim opened this issue · comments

Plenty of error types are currently public enums. This leads to the necessity of breaking changes any time their content needs to be adjusted. Instead, we should use private enums inside newtypes.

commented

Doesn't using #[non_exhaustive] for the enums cover this?

Yes. I currently think the strategy should differ for error types that convey information that may be useful for the caller (as in: they may want to do different things depending on what went wrong) and those that will essentially only ever lead to cancelling an operation. For the former, the non-exhaustive attribute is probably the right choice.