-
Notifications
You must be signed in to change notification settings - Fork 267
Closed
Labels
encodingIssues related to support of various encodings of the XML documentsIssues related to support of various encodings of the XML documentsenhancementhelp wanted
Description
A lot of methods are defined twice in the code, once with encoding enabled, and once without it.
Some of these methods have different result types (direct value vs. Result), and this propagate to methods calling them (which must call the former with or without a ?, depending).
(NB: as pointed out in #180, only private method should have a change of signature, but this is orthogonal, I think)
I suggest the following change:
- instead of returning
T, private methods in the non-encodingconfiguration should returnstd::result::Result<T, std::convert::Infallible>, which after compilation is equivalent toT, but is syntactically is still a result. Errorshould implementFrom<Infallible>(again, this is merely to please the compiler during parsing: the‘frommethod will contain anunreachable!()statement, sinceInfalliblehas no value)- that way, all methods calling the private method can use
?, regardless of the presence/absence of theencodingfeature. That way, they don't need two different implementation. The compiler will, however, ignore the?when the underlying error type isInfallible(i.e. whenencodingis disabled).
edited fixed the path of Infallible
Metadata
Metadata
Assignees
Labels
encodingIssues related to support of various encodings of the XML documentsIssues related to support of various encodings of the XML documentsenhancementhelp wanted