Closed regismesquita closed 1 year ago
I wonder whether this should be a Result<Option<>>
instead?
@rubdos yeah, using Result<Option<>>
would mean no context for what failed would be lost (or maybe using just Result<>
and making the None
case one of the possible errors). The main issue is that it would be a breaking change for the API, so we decided to avoid it.
If you feel like introducing a breaking change is worth it in this case, then yeah, using a Result<>
would have better semantics.
@gferon opinion? Do we have more breaking changes scheduled? We could introduce it in two steps; merge as-is, and start a breaking version and break a lot of other things in the meantime if there's a demand.
Fixing something like #55 would also introduce a breaking change. I'll make an issue that propagates this as an error, and start pinning such issues to a milestone for a new breaking release. @gferon, if you agree with the provided patch as non-breaking change, please do hit squash-and-merge!
Looks like rustfmt
disagrees here, would you mind still having a look, @regismesquita ?
@rubdos, sorry, I forgot to run it. I have pushed the formatted changes.
@gferon opinion? Do we have more breaking changes scheduled? We could introduce it in two steps; merge as-is, and start a breaking version and break a lot of other things in the meantime if there's a demand.
I think it's a good idea to merge this as-is and prepare a release for later. IIRC, fixing and merging https://github.com/whisperfish/rust-phonenumber/pull/27 will break some of the API (and maybe even is a good occasion to make some methods private).
When trying to parse UIFN toll-free numbers, the lib panicked while retrieving the country id. This PR fixes this issue and returns None instead.
Co-authored-by: Raphael Costa vidal.raphael@gmail.com