Add support for Source::Sparse

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
This commit is contained in:
Jiahao XU 2025-06-03 01:11:43 +10:00 committed by GitHub
parent fc32a1ca61
commit 68b9519527
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -30,6 +30,7 @@ impl From<&CrateInfo> for CrateVersionSource {
Git => Source::Git(url),
Path => Source::Path(url),
Registry => Source::Registry(url),
Sparse => Source::Sparse(url),
},
}
}
@ -40,6 +41,7 @@ pub enum Source<'a> {
Git(MaybeOwned<'a, Url>),
Path(MaybeOwned<'a, Url>),
Registry(MaybeOwned<'a, Url>),
Sparse(MaybeOwned<'a, Url>),
}
impl<'a> From<&'a CrateSource> for Source<'a> {
@ -52,6 +54,7 @@ impl<'a> From<&'a CrateSource> for Source<'a> {
Git => Self::Git(url),
Path => Self::Path(url),
Registry => Self::Registry(url),
Sparse => Self::Sparse(url),
}
}
}
@ -125,6 +128,7 @@ impl fmt::Display for Source<'_> {
Source::Git(url) => write!(f, "git+{url}"),
Source::Path(url) => write!(f, "path+{url}"),
Source::Registry(url) => write!(f, "registry+{url}"),
Source::Sparse(url) => write!(f, "sparse+{url}"),
}
}
}