You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Implement TryFrom<GitUrl> for url::Url (#66)
`GitUrl::url_compat_display()` is currently private, but it would be
very useful to have this functionality - in my case, normalizing an SSH
style URL is fine, especially because I do not want to bother with
handling the `'url` lifetime of `GitUrl` in my wrapper enum.
This change implements fallible conversion to `url::Url` for `GitUrl`
and `&GitUrl` via `GitUrl::url_compat_display()`.
Longer term it might be wise to re-visit the use of a lifetime for the
purpose of re-using slices of the input string - the `url::Url` crate
does not bother with such micro-optimizations either, presumably for
good reasons.
Obviously, to use a `GitUrl` as a `url::Url`, the conversion to
`url::Url` still has to happen twice (because `GitUrl::parse()` incurs
the conversion via `GitUrl::is_valid()`), but that can be optimized in a
separate change, e.g. via a new `GitUrl::parse_to_url()`, or by removing
the conversion from `GitUrl::is_valid()` altogether, leaving it to the
caller to attempt the conversion.
0 commit comments