mirror of
https://github.com/deps-rs/deps.rs.git
synced 2024-11-25 11:36:30 +00:00
Add Gitlab
to the RepoSite enum
This commit is contained in:
parent
53b7ed3015
commit
194be9c9b5
1 changed files with 7 additions and 3 deletions
|
@ -27,13 +27,15 @@ impl RepoPath {
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)]
|
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)]
|
||||||
pub enum RepoSite {
|
pub enum RepoSite {
|
||||||
Github
|
Github,
|
||||||
|
Gitlab,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RepoSite {
|
impl RepoSite {
|
||||||
pub fn to_base_uri(&self) -> &'static str {
|
pub fn to_base_uri(&self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
&RepoSite::Github => "https://github.com"
|
&RepoSite::Github => "https://github.com",
|
||||||
|
&RepoSite::Gitlab => "https://gitlab.com"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,6 +46,7 @@ impl FromStr for RepoSite {
|
||||||
fn from_str(input: &str) -> Result<RepoSite, Error> {
|
fn from_str(input: &str) -> Result<RepoSite, Error> {
|
||||||
match input {
|
match input {
|
||||||
"github" => Ok(RepoSite::Github),
|
"github" => Ok(RepoSite::Github),
|
||||||
|
"gitlab" => Ok(RepoSite::Gitlab),
|
||||||
_ => Err(format_err!("unknown repo site identifier"))
|
_ => Err(format_err!("unknown repo site identifier"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,7 +55,8 @@ impl FromStr for RepoSite {
|
||||||
impl AsRef<str> for RepoSite {
|
impl AsRef<str> for RepoSite {
|
||||||
fn as_ref(&self) -> &str {
|
fn as_ref(&self) -> &str {
|
||||||
match self {
|
match self {
|
||||||
&RepoSite::Github => "github"
|
&RepoSite::Github => "github",
|
||||||
|
&RepoSite::Gitlab => "gitlab"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue