-
-
Notifications
You must be signed in to change notification settings - Fork 12
Description
From #66
[...]
Obviously, to use aGitUrl
as aurl::Url
, the conversion tourl::Url
still has to happen twice (becauseGitUrl::parse()
incurs the conversion viaGitUrl::is_valid()
), but that can be optimized in a separate change, e.g. via a newGitUrl::parse_to_url()
, or by removing the conversion fromGitUrl::is_valid()
altogether, leaving it to the caller to attempt the conversion.
In this scenario, the user wants to use the Url
struct after being parsed by GitUrl::parse()
. And this results in being run twice through Url::parse()
, which is not efficient, not desirable.
Why is this happening? While the url
crate is optional, it currently part of the default-features
. And during GitUrl::parse()
, we call Url::parse()
to catch and throw errors that we miss or report inaccurately.
Ideally, I would like to improve the parser so we can throw accurate errors when we get malformed urls, and then specialize the url
feature towards using the url
crate.
Objectives:
- Remove
url::Url::parse()
step fromGitUrl::is_valid()
- Create an optimized call to parse input into
Url
(i.e.,GitUrl::parse_to_url()
)